public function init(array $paramArray = null) { $this->partnerId = TenpayPlugin::getOptionValue('partner_id'); $this->partnerKey = TenpayPlugin::getOptionValue('partner_key'); $this->tradeMode = TenpayPlugin::getOptionValue('trade_mode'); $this->payId = TenpayPlugin::getOptionValue('pay_id'); // 如果是网银直连,设置网银参数 $this->bankType = $paramArray && isset($paramArray[1]) ? $paramArray[1] : 'DEFAULT'; return true; }
public function post($f3) { // 权限检查 $this->requirePrivilege('manage_plugin_plugin_configure'); global $smarty; // 参数验证 $validator = new Validator($f3->get('POST')); $partner_id = $validator->required()->validate('partner_id'); $partner_key = $validator->required()->validate('partner_key'); if (!$this->validate($validator)) { goto out_display; } // 保存设置 TenpayPlugin::saveOptionValue('partner_id', $partner_id); TenpayPlugin::saveOptionValue('partner_key', $partner_key); $this->addFlashMessage('保存设置成功'); out_display: $smarty->display('tenpay_configure.tpl', 'post'); }