255], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'mall_id' => '商城ID', 'level_id' => '对应qimall_addons_double_copy_level.id', 'level' => '等级', 'commission_type' => '分佣类型:积分score;佣金:commission', 'from_type' => '分佣类型:二二复制', 'first_prize_type' => '直推奖类型 0百分比 1 固定金额', 'first_prize' => '直推奖励', 'indirect_prize_type' => '间推奖类型 0百分比 1 固定金额', 'indirect_prize' => '间推奖励', 'second_prize_type' => '平台补贴类型 0 百分比 1 固定金额', 'second_prize' => '平台补贴', 'equal_prize_type' => '培育奖类型 0百分比 1 固定金额', 'equal_prize' => '培育奖', 'freeze_fund_prize' => '冻结基金每单比例', 'freeze_fund_num' => '解冻达标团队人数', 'status' => '状态[-1:删除;0:禁用;1启用]', 'created_at' => 'Created At', 'updated_at' => 'Updated At', ]; } public function getLevelInfo() { return $this->hasOne(DoubleCopyLevel::class, ['id' => 'level_id']); } /** * 保存数据 * @Author: lun * @DateTime: 2022/5/14 0014 10:07 * @Copyright: copyright (c) 2021 广东七件事集团 * @param $params * @return bool */ public static function setData($params) { try{ $model = self::findOne([ 'mall_id' => $params['mall_id'], 'level_id' => $params['level_id'], 'commission_type' => $params['commission_type'] ]); if (empty($model)) { $model = new self(); $model->mall_id = $params['mall_id']; $model->level_id = $params['level_id']; $model->commission_type = $params['commission_type']; $model->loadDefaultValues(); } if(!$model->load($params,'') || !$model->save()){ throw new \Exception($model->getErrorMessage()); } return true; }catch(\Exception $e){ self::$static_error = $e->getMessage(); return false; } } }