commit | author | age
|
2207d6
|
1 |
<?php |
W |
2 |
|
|
3 |
namespace app\models; |
|
4 |
|
|
5 |
use Yii; |
|
6 |
|
|
7 |
/** |
|
8 |
* This is the model class for table "{{%coupon_auto_send}}". |
|
9 |
* |
|
10 |
* @property int $id |
|
11 |
* @property int $mall_id |
|
12 |
* @property int $coupon_id 优惠券 |
|
13 |
* @property int $event 触发事件:1=分享,2=购买并付款 3=新人领券 |
|
14 |
* @property int $send_count 最多发放次数,0表示不限制 |
|
15 |
* @property int $is_delete 删除 |
|
16 |
* @property string $deleted_at |
|
17 |
* @property string $created_at |
|
18 |
* @property string $updated_at |
|
19 |
* @property int $type 领取人 0--所有人 1--指定用户 |
|
20 |
* @property string $user_list 指定用户id列表 |
|
21 |
* @property Coupon $coupon |
|
22 |
*/ |
|
23 |
class CouponAutoSend extends ModelActiveRecord |
|
24 |
{ |
|
25 |
/** |
|
26 |
* {@inheritdoc} |
|
27 |
*/ |
|
28 |
public static function tableName() |
|
29 |
{ |
|
30 |
return '{{%coupon_auto_send}}'; |
|
31 |
} |
|
32 |
|
|
33 |
/** |
|
34 |
* {@inheritdoc} |
|
35 |
*/ |
|
36 |
public function rules() |
|
37 |
{ |
|
38 |
return [ |
|
39 |
[['mall_id', 'coupon_id', 'deleted_at', 'created_at', 'updated_at'], 'required'], |
|
40 |
[['mall_id', 'coupon_id', 'event', 'send_count', 'is_delete', 'type'], 'integer'], |
|
41 |
[['deleted_at', 'created_at', 'updated_at'], 'safe'], |
|
42 |
[['user_list'], 'string'], |
|
43 |
]; |
|
44 |
} |
|
45 |
|
|
46 |
/** |
|
47 |
* {@inheritdoc} |
|
48 |
*/ |
|
49 |
public function attributeLabels() |
|
50 |
{ |
|
51 |
return [ |
|
52 |
'id' => 'ID', |
|
53 |
'mall_id' => 'mall ID', |
|
54 |
'coupon_id' => '优惠券', |
|
55 |
'event' => '触发事件:1=分享,2=购买并付款', |
|
56 |
'send_count' => '最多发放次数,0表示不限制', |
|
57 |
'is_delete' => '删除', |
|
58 |
'deleted_at' => 'Deleted At', |
|
59 |
'created_at' => 'Created At', |
|
60 |
'updated_at' => 'Updated At', |
|
61 |
'type' => '领取人 0--所有人 1--指定用户', |
|
62 |
'user_list' => '指定用户id列表', |
|
63 |
]; |
|
64 |
} |
|
65 |
|
|
66 |
// 触发事件 |
|
67 |
const SHARE = 1; |
|
68 |
const PAY = 2; |
|
69 |
|
|
70 |
public function getCoupon() |
|
71 |
{ |
|
72 |
return $this->hasOne(Coupon::className(), ['id' => 'coupon_id']); |
|
73 |
} |
|
74 |
} |