200], [['redpack_remark', 'score_remark', 'balance_remark'], 'string', 'max' => 300], [['remark'], 'string', 'max' => 255], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'mall_id' => '商城id', 'name' => '规则名称', 'grant_object' => '发放对象:1:全部会员 2:会员等级 3:会员标签 4:会员id 5:指定区域', 'grant_object_content' => '对象内容', 'timing_time' => '定时发送时间', 'grant_time' => '上一次发放券的时间', 'grant_type' => '发放类型:1:手动发放 2:自动发放 3:失效', 'grant_status' => '发放状态:1:未发放 2:已发放 3:发放中', 'is_grant' => '是否发放:0:未发放 1:已发放', 'redpack_remark' => '红包备注', 'score_remark' => '积分备注', 'balance_remark' => '余额备注', 'admin_id' => '管理员id', 'remark' => '备注', 'created_at' => 'Created At', 'updated_at' => 'Updated At', 'status' => '状态[-1:删除;0:禁用;1启用]', 'e_coupon' => '电子券数量', 'coupon' => '优惠卷数量', 'redpack' => '红包统计', 'balance' => '金额统计', 'score' => '积分统计', ]; } /** * 保存数据 * @Author: ltm * @DateTime: 2022/6/28 0015 9:26 * @Copyright: copyright (c) 2021 广东七件事集团 * @param $mall_id * @param array $params * @return Rebate|bool */ public static function setData(array $params){ try{ $mall_id = $params['mall_id']; $model = self::findOne(['id'=>$params['id'],'mall_id' => $mall_id]); if(empty($model)){ $model = new self(); $model->loadDefaultValues(); $model->mall_id = $mall_id; } // 将内容转为json字符串 if(!$model->load($params,'') || !$model->save()) throw new Exception($model->getErrorMessage()); return $model; }catch(\Exception $e){ self::setStaticError($e->getMessage()); return false; } } }