CouponAutoSend.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <?php
  2. /**
  3. * 厦门云联储网络科技有限公司
  4. * https://www.baokuaiyun.com
  5. * Copyright (c) 2023 爆块云 All rights reserved.
  6. */
  7. namespace app\models;
  8. use Yii;
  9. use yii\db\ActiveRecord;
  10. use yii\behaviors\TimestampBehavior;
  11. /**
  12. * This is the model class for table "{{%coupon_auto_send}}".
  13. *
  14. * @property int $id Id
  15. * @property int $store_id 商城
  16. * @property int $coupon_id 优惠券id
  17. * @property int $event 触发事件:1=分享,2=购买并付款
  18. * @property int|null $send_times 最多发放次数,0表示不限制
  19. * @property int|null $created_at 添加时间
  20. * @property int $is_delete 是否删除
  21. * @property int|null $mch_id 入驻商id
  22. * @property int|null $updated_at 更新时间
  23. * @property int|null $amount 现金
  24. * @property int|null $day_num 单人单日获取数量
  25. * @property int|null $day_count 单人总获取数量
  26. * @property int|null $status 状态
  27. */
  28. class CouponAutoSend extends \yii\db\ActiveRecord
  29. {
  30. /**
  31. * {@inheritdoc}
  32. */
  33. public static function tableName()
  34. {
  35. return '{{%coupon_auto_send}}';
  36. }
  37. const IS_DELETE_YES = 1;//已删除
  38. const IS_DELETE_NO = 0;//未删除
  39. const EVENT_SHARE = 1; // 分享
  40. const EVENT_RECHARGE = 2; // 充值赠送
  41. const EVENT_PAY = 3; // 现金积分购买
  42. const EVENT_QRCODE = 4; // 二维码领取
  43. const EVENT_NEWUSER = 5; // 新人专享
  44. const EVENT_ORDER = 6; // 下单赠送
  45. const EXT_REG = 1; // 注册
  46. const EXT_FIRST_ORDER = 2; // 首单
  47. const EXT_SECOND_ORDER = 3; // 次单
  48. public function behaviors()
  49. {
  50. return [
  51. [
  52. 'class' => TimestampBehavior::class,
  53. 'attributes' => [
  54. ActiveRecord::EVENT_BEFORE_INSERT => ['updated_at', 'created_at'],
  55. ActiveRecord::EVENT_BEFORE_UPDATE => 'updated_at'
  56. ]
  57. ]
  58. ];
  59. }
  60. /**
  61. * {@inheritdoc}
  62. */
  63. public function rules()
  64. {
  65. return [
  66. [['store_id', 'coupon_id'], 'required'],
  67. [['store_id', 'event', 'send_times', 'created_at', 'is_delete', 'mch_id', 'updated_at', 'day_num', 'day_count', 'status'], 'integer'],
  68. [['coupon_id'],'string'],
  69. [['amount', 'money'], 'number'],
  70. [['ext_type'], 'safe'],
  71. ];
  72. }
  73. /**
  74. * {@inheritdoc}
  75. */
  76. public function attributeLabels()
  77. {
  78. return [
  79. 'id' => 'Id',
  80. 'store_id' => '商城',
  81. 'coupon_id' => '优惠券id',
  82. 'event' => '触发事件:1=分享,2=购买并付款',
  83. 'ext_type' => '附加条款:1=注册,',
  84. 'send_times' => '最多发放次数,0表示不限制',
  85. 'created_at' => '添加时间',
  86. 'is_delete' => '是否删除',
  87. 'mch_id' => '入驻商id',
  88. 'updated_at' => '更新时间',
  89. 'amount' => '现金',
  90. 'day_num' => '单人单日获取数量',
  91. 'day_count' => '单人总获取量',
  92. 'money' => '需要现金',
  93. ];
  94. }
  95. }