| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <?php
- namespace addons\LuckyGroup\common\models;
- use common\models\base\BaseActiveRecord;
- use Yii;
- /**
- * This is the model class for table "qimall_addons_lucky_group_attend_times_log".
- *
- * @property int $id id
- * @property int|null $mall_id 商城ID
- * @property int|null $user_id 用户id
- * @property int|null $num 拼团次数(支持负数)
- * @property int $before_num 变动前次数
- * @property string $desc 描述
- * @property int $type 0系统赠送 1每日赠送
- * @property int $status 状态[-1:删除;0:禁用;1启用]
- * @property int $created_at 创建时间
- * @property int $updated_at 更新时间
- */
- class LuckyGroupAttendTimesLog extends BaseActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return '{{%addons_lucky_group_attend_times_log}}';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['mall_id', 'user_id', 'num', 'before_num', 'type', 'status', 'created_at', 'updated_at'], 'integer'],
- [['desc'], 'required'],
- [['desc'], 'string', 'max' => 255],
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'id',
- 'mall_id' => '商城ID',
- 'user_id' => '用户id',
- 'num' => '拼团次数(支持负数)',
- 'before_num' => '变动前次数',
- 'desc' => '描述',
- 'type' => '0系统赠送 1每日赠送',
- 'status' => '状态[-1:删除;0:禁用;1启用]',
- 'created_at' => '创建时间',
- 'updated_at' => '更新时间',
- ];
- }
- /**
- * 新增记录
- * @Author pin
- * @DateTime 2021-04-13 14:43:43
- * @param [type] $params
- * @return void
- * @copyright: Copyright (c) 2020 广东七件事集团
- */
- public function saveLog($params)
- {
- try {
- $model = new self();
- $model->attributes = $params;
- if (!$model->save()) throw new \Exception($model->getErrorMessage());
- return true;
- } catch (\Exception $e) {
- $this->addError('', $e->getMessage());
- return false;
- }
- }
- }
|