request->isAjax) { if (\Yii::$app->request->isGet) { $group = \Yii::$app->request->get('group', ''); $group = $group ?: 'basic'; $configs = \Yii::$app->services->setting->addons->get($this->mall_id, UnionPayEnum::ADDONS_NAME, $group); if(isset($configs['is_enable'])) $configs['is_enable'] = intval($configs['is_enable']); if(isset($configs['mp_wx_open'])) $configs['mp_wx_open'] = intval($configs['mp_wx_open']); if(isset($configs['mp_wx_cashier_open'])) $configs['mp_wx_cashier_open'] = intval($configs['mp_wx_cashier_open']); if(isset($configs['wechat_h5_cashier_open'])) $configs['wechat_h5_cashier_open'] = intval($configs['wechat_h5_cashier_open']); if(isset($configs['wechat_open'])) $configs['wechat_open'] = intval($configs['wechat_open']); if(isset($configs['wechat_h5_open'])) $configs['wechat_h5_open'] = intval($configs['wechat_h5_open']); if(isset($configs['wechat_app_open'])) $configs['wechat_app_open'] = intval($configs['wechat_app_open']); if(isset($configs['alipay_h5_open'])) $configs['alipay_h5_open'] = intval($configs['alipay_h5_open']); if(isset($configs['alipay_app_open'])) $configs['alipay_app_open'] = intval($configs['alipay_app_open']); if(isset($configs['fastpay_js_open'])) $configs['fastpay_js_open'] = intval($configs['fastpay_js_open']); $list['list'] = $configs; return $this->success('操作成功', $list,ApiStatusEnum::CODE_SUCCESS, 0); } else { $postData = \Yii::$app->request->post(); $res = Yii::$app->services->validate->validate($postData, [ [['is_enable', 'orgid', 'cusid', 'appid','private_key','public_key','union_pay_public_key', 'wechat_trade_name','mp_wx_open','mp_wx_cashier_open','wechat_h5_cashier_open','wechat_open','wechat_h5_open','wechat_app_open','alipay_trade_name','alipay_h5_open','alipay_app_open', 'fastpay_trade_name', 'fastpay_js_open' ], 'safe'], ]); if ($res === false) return $this->error(Yii::$app->services->validate->getErrorMessage()); $postData['mall_id'] = $this->mall_id; \Yii::$app->services->setting->addons->set($this->mall_id, UnionPayEnum::ADDONS_NAME, ['basic' => $postData]); return $this->success('操作成功'); } } return $this->render('setting'); } }