| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- <?php
- namespace addons\LuckyGroup\common\models;
- use common\models\base\BaseActiveRecord;
- use common\models\user\User;
- use Yii;
- /**
- * This is the model class for table "qimall_addons_lucky_group_lottery_period".
- *
- * @property int $id
- * @property int $mall_id 商城ID
- * @property int $open_reward_log_id 开团日志id
- * @property int $activity_id 活动D
- * @property int $goods_id 商品ID
- * @property int $user_id 会员ID
- * @property int $order_id 订单id
- * @property int $number 期数
- * @property string|null $win_order_ids 拼中订单集
- * @property string|null $loss_order_ids 拼不中订单集
- * @property int $status 状态[-1:删除;0:禁用;1启用]
- * @property int $created_at
- * @property int $updated_at 更新时间
- */
- class LuckyGroupLotteryPeriod extends BaseActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return '{{%addons_lucky_group_lottery_period}}';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['mall_id','open_reward_log_id', 'activity_id', 'goods_id', 'user_id', 'order_id', 'number', 'status', 'created_at', 'updated_at'], 'integer'],
- [['win_order_ids', 'loss_order_ids'], 'string', 'max' => 1000],
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'mall_id' => '商城ID',
- 'open_reward_log_id' => '开团日志id',
- 'activity_id' => '活动D',
- 'goods_id' => '商品ID',
- 'user_id' => '会员ID',
- 'order_id' => '订单id',
- 'number' => '期数',
- 'win_order_ids' => '拼中订单集',
- 'loss_order_ids' => '拼不中订单集',
- 'status' => '状态[-1:删除;0:禁用;1启用]',
- 'created_at' => 'Created At',
- 'updated_at' => '更新时间',
- ];
- }
- public function getUser()
- {
- return $this->hasOne(User::class, ['id' => 'user_id'])->select('id,avatar_url');
- }
- public static function setData($params)
- {
- $field = ['mall_id','open_reward_log_id', 'activity_id','goods_id','user_id','order_id','number','win_order_ids','loss_order_ids','status','created_at','updated_at'];
- // 批量插入数据
- Yii::$app->db->createCommand()->batchInsert(self::tableName(), $field, $params)->execute();
- }
- }
|