255], [['basic_config', 'relation_ship'], 'string',], [['level_config', 'goods_config'], 'string',], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'mall_id' => '商城ID', 'source_table' => '来源表', 'source_table_id' => '来源表id', 'type' => '奖励类型', 'from_type' => '来源类型', 'basic_config' => '基础配置', 'level_config' => '等级配置', 'goods_config' => '商品独立配置', 'relation_ship' => '关系链等级', 'status' => '状态[-1:删除;0:禁用;1启用]', 'created_at' => '创建时间', 'updated_at' => '修改时间', ]; } /** * @desc:保存数据 * @Author: hua * @Date: 2021/11/18 * @Time: 10:54 * @Copyright: copyright (c) 2021 广东七件事集团 * @param array $params * @return AgentCommissionBasisLog|false|null */ public static function setData(array $params) { try { $model = self::findOne(['mall_id' => $params['mall_id'], 'source_table_id' => $params['source_table_id'], 'source_table' => $params['source_table'], 'type' => $params['type'], 'from_type' => $params['from_type'], 'status' => [StatusEnum::ENABLED, StatusEnum::DISABLED]]); if(!empty($model)) return $model; $model = new self(); $model->loadDefaultValues(); if (!$model->load($params, '')) throw new \Exception($model->getErrorMessage()); if (!$model->save()) throw new \Exception($model->getErrorMessage()); return $model; } catch (\Exception $e) { self::$static_error = $e->getMessage(); return false; } } }