Exemplo n.º 1
0
 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');
     $account = $validator->required()->validate('account');
     if (!$this->validate($validator)) {
         goto out_display;
     }
     // 保存设置
     AlipayPlugin::saveOptionValue('partner_id', $partner_id);
     AlipayPlugin::saveOptionValue('partner_key', $partner_key);
     AlipayPlugin::saveOptionValue('account', $account);
     $this->addFlashMessage('保存设置成功');
     out_display:
     $smarty->display('alipay_configure.tpl', 'post');
 }
Exemplo n.º 2
0
 public function init(array $paramArray = null)
 {
     // 参数验证
     $this->partnerId = AlipayPlugin::getOptionValue('partner_id');
     $this->partnerKey = AlipayPlugin::getOptionValue('partner_key');
     $this->account = AlipayPlugin::getOptionValue('account');
     $this->payId = AlipayPlugin::getOptionValue('pay_id');
     $alipayConfig = array();
     $alipayConfig['partner'] = $this->partnerId;
     $alipayConfig['key'] = $this->partnerKey;
     //签名方式 不需修改
     $alipayConfig['sign_type'] = 'MD5';
     //字符编码格式 目前支持 gbk 或 utf-8
     $alipayConfig['input_charset'] = 'utf-8';
     //ca证书路径地址,用于curl中ssl校验
     //请保证cacert.pem文件在当前文件夹目录中
     $alipayConfig['cacert'] = dirname(__FILE__) . '/cacert.pem';
     //访问模式,根据自己的服务器是否支持ssl访问,若支持请选择https;若不支持请选择http
     $alipayConfig['transport'] = 'https';
     $this->alipayConfig = $alipayConfig;
     return true;
 }