request->isAjax) { return $this->render('/setting/index'); } if (\Yii::$app->request->isGet) { $basic = \Yii::$app->services->setting->addons->get($this->mall_id, HappinessEnum::ADDONS_NAME, 'basic'); if(empty($basic['localtion_limit'])) $basic['localtion_limit'] = 10; //资产设置 $default_withdraw_way = HappinessWithdrawWayEnum::getDefaultWithDrawWayMap(HappinessWithdrawWayEnum::WITHDRAW_TYPE_2); $extension_withdraw_way = GlobalInvoke::exec(GlobalInvoke::INVOKE_GET_WITHDRAW_EXTENSION_WAY,$this->mall_id); $all_withdraw = array_merge($default_withdraw_way,$extension_withdraw_way); if (!empty($all_withdraw['alipay_tax'])) { $all_withdraw['alipay_tax'] = $all_withdraw['alipay_tax']['name']; } if (!empty($all_withdraw['bank_tax'])) unset($all_withdraw['bank_tax']); if (!empty($all_withdraw['alipay_tax'])) unset($all_withdraw['alipay_tax']); if (!empty($all_withdraw['auto'])) unset($all_withdraw['auto']); $basic['balance_withdraw_way'] = $all_withdraw; if(!empty($basic['balance_cash_type'])){ $basic['balance_cash_type'] = json_decode($basic['balance_cash_type'],true); }else{ //默认银行卡/余额提现 $basic['balance_cash_type'] = ['balance','bank']; } $basic['name_rule'] = !empty($basic['name_rule'])?json_decode($basic['name_rule'],true):['no'];//命名规则 $basic['name_rule_copy'] = !empty($basic['name_rule_copy'])?json_decode($basic['name_rule_copy'],true):[];//副命名规则 $basic['recharge_list'] = !empty($basic['recharge_list'])?json_decode($basic['recharge_list'],true):[];//充值设置 $basic['goods_label'] = !empty($basic['goods_label'])?json_decode($basic['goods_label'],true):[];//商品标签 $basic['pay_type_list'] = !empty($basic['pay_type_list'])? json_decode($basic['pay_type_list'],true):[];//支付方式 $basic['business_list'] = !empty($basic['business_list'])? json_decode($basic['business_list'],true):[];//身份收益设置 $basic['agent_list'] = !empty($basic['agent_list'])? json_decode($basic['agent_list'],true):[];//身份收益设置 $basic['boss_list'] = !empty($basic['boss_list'])? json_decode($basic['boss_list'],true):[];//身份收益设置 $basic['pay_after_link'] = !empty($basic['pay_after_link'])? json_decode($basic['pay_after_link'],true) :'';//支付后跳转设置 $basic['compute_period'] = $basic['compute_period'] ?? 0; //支付方式 $pay_type_list = \Yii::$app->services->pay->getEnablePaymentType($this->mall_id); $settings = [ 'basic' => $basic, 'pay_type_list' => $pay_type_list ]; $group = \Yii::$app->request->get('group'); if (!empty($group)) { $settings = $settings[$group] ?? []; } return $this->success('success', $settings); } else { $post = \Yii::$app->request->post(); $group = $post['group'] ?? ''; unset($post['_csrf'], $post['group']); if (empty($group)) { return $this->error('参数错误'); } $rules = [ 'basic' => [ [['is_enable','store_audit', 'delivery_fee', 'service_fee', 'settle_type', 'start_limit', 'start_amount', 'add_limit', 'add_amount', 'delivery_amount','settlement_method'], 'integer'], [['is_location_limit', 'delivery_fee', 'platform_ratio', 'balance_cash_service_fee', 'localtion_limit'], 'number'], [['balance_cash_type', 'balance_withdraw_way','recruit_content','recharge_list','goods_label','pay_type_list','business_list','name_rule','name_rule_copy','boss_list','agent_list','pay_after_link'], 'safe'], [['name_rule_no','name_rule_copy_no','recruit_title'], 'string'], [['store_share_scale','share_scale','lock_scale','pension_scale','pv_scale','commission_day'], 'number'], [['compute_period'], 'integer'] ], ]; $res = \Yii::$app->services->validate->validate($post[$group], $rules[$group]); if ($res === false) return $this->error(\Yii::$app->services->validate->getErrorMessage()); $localtion_limit = $post[$group]['localtion_limit'] ? $post[$group]['localtion_limit']: 100000; if ($post[$group]['is_location_limit'] == 0) $localtion_limit = 100000; $post[$group]['name_rule']=!empty($post[$group]['name_rule'])?json_encode($post[$group]['name_rule']): '';//命名规则 $post[$group]['name_rule_copy']=!empty($post[$group]['name_rule_copy'])?json_encode($post[$group]['name_rule_copy']): '';//副命名规则 $post[$group]['recharge_list']=!empty($post[$group]['recharge_list'])?json_encode($post[$group]['recharge_list']): '';//充值设置 $post[$group]['goods_label']=!empty($post[$group]['goods_label'])?json_encode($post[$group]['goods_label']): '';//商品标签 $post[$group]['pay_type_list']=!empty($post[$group]['pay_type_list'])?json_encode($post[$group]['pay_type_list']): '';//支付设置 $post[$group]['business_list']=!empty($post[$group]['business_list'])?json_encode($post[$group]['business_list']): '';//身份收益设置 $post[$group]['agent_list']=!empty($post[$group]['agent_list'])?json_encode($post[$group]['agent_list']): '';//身份收益设置 $post[$group]['boss_list']=!empty($post[$group]['boss_list'])?json_encode($post[$group]['boss_list']): '';//身份收益设置 $post[$group]['pay_after_link']=!empty($post[$group]['pay_after_link'])?json_encode($post[$group]['pay_after_link']): ''; \Yii::$app->services->setting->addons->set($this->mall_id, HappinessEnum::ADDONS_NAME, $post); HappinessStore::updateAll(['distribution_scope' => $localtion_limit], ['mall_id' => $this->mall_id, 'is_alone' => 0]); return $this->success('保存成功'); } } // public function actionTest() // { // $data = [ // 'id' => 60752 // ]; // $res = (new OrderCloseListener())->asyncHandle($data); // print_r($res);exit; // } }