RechargeModel.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: king
  5. * Date: 2018/10/22
  6. * Time: 上午11:58
  7. */
  8. namespace app\common\models\point;
  9. use app\common\models\BaseModel;
  10. use app\common\observers\point\RechargeObserver;
  11. use app\common\traits\CreateOrderSnTrait;
  12. /**
  13. * Class RechargeModel
  14. * @package app\common\models\point
  15. */
  16. class RechargeModel extends BaseModel
  17. {
  18. use CreateOrderSnTrait;
  19. protected $table = 'yz_point_recharge';
  20. protected $guarded = [''];
  21. /**
  22. * Recharge state error.
  23. */
  24. const STATUS_ERROR = -1;
  25. /**
  26. * Recharge state success.
  27. */
  28. const STATUS_SUCCESS = 1;
  29. public function member()
  30. {
  31. return $this->hasOne('app\common\models\Member', 'uid', 'member_id');
  32. }
  33. public static function boot()
  34. {
  35. parent::boot();
  36. self::observe(new RechargeObserver());
  37. }
  38. /**
  39. * 定义字段名
  40. *
  41. * @return array
  42. */
  43. public function atributeNames() {
  44. return [
  45. 'uniacid' => "公众号ID",
  46. 'member_id' => "会员ID",
  47. 'money' => '充值金额',
  48. 'type' => '充值类型',
  49. 'order_sn' => '充值订单号',
  50. 'status' => '状态',
  51. 'remark' => '备注信息'
  52. ];
  53. }
  54. }