255], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'mall_id' => '商城ID', 'is_join' => '是否参与业绩奖励:0:否;1是', 'is_enable' => '是否独立设置:0:否;1是', 'item_id' => '项目id', 'item_type' => '项目类型:商品goods', 'commission_type' => '分佣类型:积分score;佣金:commission', 'is_percent' => '奖励类型 0百分比 1 固定金额', 'price' => '商品参与业绩奖励额度', 'status' => '状态[-1:删除;0:禁用;1启用]', 'created_at' => 'Created At', 'updated_at' => 'Updated At', ]; } public static function setData($params, $data) { try{ foreach ($data as $item) { $model = self::findOne([ 'mall_id' => $params['mall_id'], 'item_type' => $item['item_type'], 'commission_type' => $item['commission_type'], 'item_id' => $params['item_id'], 'status' => [StatusEnum::ENABLED] ]); if (empty($model)) { $model = new self(); $model->mall_id = $params['mall_id']; $model->item_id = $params['item_id']; $model->loadDefaultValues(); } if(!$model->load($item,'') || !$model->save()){ throw new \Exception($model->getErrorMessage()); } } return true; }catch(\Exception $e){ self::$static_error = $e->getMessage(); return false; } } public static function getAddons(array $params){ $is_install = MallAddons::isInstall($params['mall_id'], AchievementEnum::ADDONS_NAME); if($is_install){ $detail = Addons::getOne([['name' => AchievementEnum::ADDONS_NAME], ['is_online' => 1]], true); return [ 'addons_name'=>AchievementEnum::ADDONS_NAME, 'title'=>$detail['title'], ]; } return []; } }