AlipayAcitvityVoucherCoupon.php 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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. use app\models\WechatConfig;
  12. use app\models\Option;
  13. /**
  14. * This is the model class for table "{{%coupon}}".
  15. *
  16. * @property int $id
  17. * @property int $mini_id
  18. * @property int $status
  19. * @property string $alipay_activity_id
  20. * @property datetime $publish_start_time
  21. * @property datetime $publish_end_time
  22. * @property int $store_id
  23. * @property string $name 优惠券名称
  24. * @property string $desc 优惠券描述
  25. * @property string|null $pic_url 缩略图
  26. * @property int $discount_type 优惠券类型:1=折扣,2=满减
  27. * @property float $min_price 最低消费金额
  28. * @property float $sub_price 优惠金额
  29. * @property float $discount 折扣率
  30. * @property int $expire_type 到期类型:1=领取后N天过期,2=指定有效期
  31. * @property int $expire_day 有效天数,expire_type=1时
  32. * @property int $begin_time 有效期开始时间
  33. * @property int $end_time 有效期结束时间
  34. * @property int $created_at 添加时间
  35. * @property int $is_delete 是否删除
  36. * @property int $total_count 发放总数量
  37. * @property int $is_join 是否加入领券中心 1--不加入领券中心 2--加入领券中心
  38. * @property int $is_alipay_voucher
  39. * @property int|null $sort 排序按升序排列
  40. * @property string|null $cat_id_list
  41. * @property int|null $appoint_type
  42. * @property int $is_integral 是否加入积分商城 1--不加入 2--加入
  43. * @property int $integral 兑换需要积分数量
  44. * @property float $price 售价
  45. * @property int $total_num 积分商城发放总数
  46. * @property int $user_num 每人限制兑换数量
  47. * @property string|null $rule 使用说明
  48. * @property string|null $goods_id_list
  49. * @property int|null $mch_id 入驻商id
  50. * @property int|null $updated_at
  51. * @property int $is_join_welfare 是否加入到福利中心
  52. * @property int $is_give
  53. */
  54. class AlipayAcitvityVoucherCoupon extends \yii\db\ActiveRecord
  55. {
  56. /**
  57. * {@inheritdoc}
  58. */
  59. public static function tableName()
  60. {
  61. return '{{%alipay_activity_voucher_coupon}}';
  62. }
  63. const IS_DELETE_YES = 1;//已删除
  64. const IS_DELETE_NO = 0;//未删除
  65. const IS_JOIN_YES = 2; //加入领券中心
  66. const IS_JOIN_NO = 1;//不加入领券中心
  67. const DISCOUNT_TYPE_ONE = 1;//折扣类型
  68. const DISCOUNT_TYPE_TWO = 2; //满减类型
  69. const EXPIRE_TYPE_DAY = 1;//领取后n天过期
  70. const EXPIRE_TYPE_DATE = 2;//指定有效期
  71. const IS_INTEGRAL_YES = 2;//加入积分商城
  72. const IS_INTEGRAL_NO = 1;//不加入积分商城
  73. const APPOINT_TYPE_CAT = 1;//商品分类
  74. const APPOINT_TYPE_GOODS = 2;//商品
  75. const APPOINT_TYPE_FACE = 3;//当面付
  76. /**
  77. * saas 加入福利中心
  78. */
  79. const IS_JOIN_WELFARE_YES = 1;
  80. /**
  81. * saas 不加入福利中心
  82. */
  83. const IS_JOIN_WELFARE_NO = 0;
  84. public function behaviors()
  85. {
  86. return [
  87. [
  88. 'class' => TimestampBehavior::class,
  89. 'attributes' => [
  90. ActiveRecord::EVENT_BEFORE_INSERT => ['updated_at', 'created_at'],
  91. ActiveRecord::EVENT_BEFORE_UPDATE => 'updated_at'
  92. ]
  93. ]
  94. ];
  95. }
  96. /**
  97. * {@inheritdoc}
  98. */
  99. public function rules()
  100. {
  101. return [
  102. [['store_id', 'name'], 'required'],
  103. [['store_id', 'discount_type', 'updated_at', 'expire_type', 'expire_day', 'begin_time', 'end_time', 'created_at', 'is_delete', 'total_count', 'is_join', 'sort', 'appoint_type', 'is_integral', 'integral', 'total_num', 'user_num', 'mch_id', 'is_join_welfare', 'is_give','is_business','business_type','is_alipay_voucher'], 'integer'],
  104. [['min_price', 'sub_price', 'discount', 'price'], 'number'],
  105. [['name', 'cat_id_list', 'goods_id_list'], 'string', 'max' => 255],
  106. [['desc'], 'string', 'max' => 2000],
  107. [['pic_url'], 'string', 'max' => 2048],
  108. [['rule'], 'string', 'max' => 1000],
  109. ['discount', 'default', 'value' => 10],
  110. ['is_integral', 'default', 'value' => 1],
  111. ['integral', 'default', 'value' => 0],
  112. ['price', 'default', 'value' => 0],
  113. ['total_num', 'default', 'value' => 0],
  114. ['expire_day', 'default', 'value' => 0],
  115. ['user_num', 'default', 'value' => 0],
  116. ['sub_price', 'default', 'value' => 0],
  117. ['total_count', 'default', 'value' => -1],
  118. [['begin_time', 'end_time'], 'default', 'value' => 0],
  119. [['is_alipay_voucher', 'mini_id', 'publish_start_time', 'publish_end_time', 'alipay_activity_id', 'status'], 'safe']
  120. ];
  121. }
  122. /**
  123. * {@inheritdoc}
  124. */
  125. public function attributeLabels()
  126. {
  127. return [
  128. 'id' => 'ID',
  129. 'store_id' => 'Store ID',
  130. 'name' => '优惠券名称',
  131. 'desc' => '优惠券描述',
  132. 'pic_url' => '缩略图',
  133. 'discount_type' => '优惠券类型:1=折扣,2=满减',
  134. 'min_price' => '最低消费金额',
  135. 'sub_price' => '优惠金额',
  136. 'discount' => '折扣率',
  137. 'expire_type' => '到期类型:1=领取后N天过期,2=指定有效期',
  138. 'expire_day' => '有效天数,expire_type=1时',
  139. 'begin_time' => '有效期开始时间',
  140. 'end_time' => '有效期结束时间',
  141. 'created_at' => '添加时间',
  142. 'is_delete' => '是否删除',
  143. 'total_count' => '发放总数量',
  144. 'is_join' => '是否加入领券中心 1--不加入领券中心 2--加入领券中心',
  145. 'sort' => '排序按降序排列',
  146. 'cat_id_list' => 'Cat Id List',
  147. 'appoint_type' => 'Appoint Type',
  148. 'is_integral' => '是否加入积分商城 1--不加入 2--加入',
  149. 'integral' => '兑换需要积分数量',
  150. 'price' => '售价',
  151. 'total_num' => '积分商城发放总数',
  152. 'user_num' => '每人限制兑换数量',
  153. 'rule' => '使用说明',
  154. 'goods_id_list' => 'Goods Id List',
  155. 'mch_id' => '入驻商id',
  156. 'updated_at' => 'Update Time',
  157. 'is_join_welfare' => '是否加入福利中心 1--不加入福利中心 2--加入福利中心',
  158. 'is_give' => '是否可转增',
  159. 'is_business' => '是否是商盟',
  160. 'business_type' => '展示位置',
  161. ];
  162. }
  163. }