228 行
9.2 KiB
PHP
可执行文件
228 行
9.2 KiB
PHP
可执行文件
<?php
|
|
namespace Admin\Controller;
|
|
use Think\Controller;
|
|
/*
|
|
* 系统代理商信息配置 控制器
|
|
* @author ocean <1635179657@qq.com> 2.24 10:53
|
|
* @version v1.0
|
|
*/
|
|
//[1.1.7]
|
|
class SystemConfController extends BaseController
|
|
{
|
|
/**
|
|
* 系统代理商信息配置
|
|
*/
|
|
public function index(){
|
|
//获取微信和支付宝的基本配置
|
|
$userinfo = session('admin_userinfo');
|
|
$map['partnerid'] = $userinfo['id'];
|
|
$entrys = M('retail_admin')->where(array('id'=>$map['partnerid']))->getField('entry');
|
|
$cache = M('systemconfig')->where($map)->find();
|
|
$pays = M('pay_api')->where(array('id'=>2))->find();
|
|
$this->assign('pays',$pays);
|
|
$this->assign('cache',$cache);
|
|
$this->assign('entrys',$entrys); //判断合伙人是否有添加新大陆商户权限
|
|
// print_r($cache);
|
|
$continent = M('continent_config')->where($map)->find();
|
|
$continent['continent_domain'] = json_decode($continent['continent_domain'],true);
|
|
$this->assign('continent',$continent);
|
|
$this->display();
|
|
}
|
|
/**
|
|
* 微信配置信息
|
|
*/
|
|
public function wx_agentconf(){
|
|
//微信配置
|
|
$userinfo = session('admin_userinfo');
|
|
$uid = $userinfo['id'];
|
|
if(IS_POST){
|
|
//判断没有没这个配置
|
|
$map['uid'] = $uid;
|
|
$re = M('systemconfig')->where(array('partnerid'=>$uid))->count();
|
|
if($re==0){
|
|
//添加流程
|
|
$item['wx_appid'] = I('post.wx_appid');
|
|
$item['wx_key'] = I('post.wx_key');
|
|
$item['wx_apiclient_cert'] = I('post.wx_apiclient_cert');
|
|
$item['wx_apiclient_key'] = I('post.wx_apiclient_key');
|
|
$item['mch_id'] = I('post.mch_id');
|
|
$item['partnerid'] = $uid;
|
|
$item['addtime'] = time();
|
|
$item['status'] = 1;
|
|
$res = M('systemconfig')->add($item);
|
|
if($res){
|
|
$data['status'] = 1;
|
|
$data['msg'] = "微信服务商配置参数成功";
|
|
}else{
|
|
$data['status'] = 0;
|
|
$data['msg'] = "微信服务商配置参数失败";
|
|
}
|
|
}else{
|
|
//修改流程
|
|
$item['wx_appid'] = I('post.wx_appid');
|
|
$item['wx_key'] = I('post.wx_key');
|
|
$item['wx_apiclient_cert'] = I('post.wx_apiclient_cert');
|
|
$item['wx_apiclient_key'] = I('post.wx_apiclient_key');
|
|
$item['mch_id'] = I('post.mch_id');
|
|
$item['addtime'] = time();
|
|
$item['status'] = 1;
|
|
$res = M('systemconfig')->where(array('partnerid'=>$uid))->save($item);
|
|
|
|
if($res){
|
|
$data['status'] = 1;
|
|
$data['msg'] = "微信服务商配置参数成功";
|
|
}else{
|
|
$data['status'] = 0;
|
|
$data['msg'] = "微信服务商配置参数失败";
|
|
}
|
|
}
|
|
}else{
|
|
$data['status'] = 0;
|
|
$data['msg'] = "配置错误,暂无信息";
|
|
}
|
|
$this->ajaxReturn($data);
|
|
}
|
|
/**
|
|
* 支付宝参数信息配置
|
|
*/
|
|
public function ali_agentconf(){
|
|
//支付宝配置
|
|
$userinfo = session('admin_userinfo');
|
|
$uid = $userinfo['id'];
|
|
|
|
if(IS_POST){
|
|
//判断没有没这个配置
|
|
$map['uid'] = $uid;
|
|
$re = M('systemconfig')->where(array('partnerid'=>$uid))->count();
|
|
if($re==0){
|
|
//添加流程
|
|
$item['alipay_appid'] = I('post.alipay_appid');
|
|
$item['alipay_pid'] = I('post.alipay_pid');
|
|
$item['alipay_public_key'] = I('post.alipay_public_key');
|
|
$item['alipay_private_key'] = I('post.alipay_private_key');
|
|
$item['partnerid'] = $uid;
|
|
$item['addtime'] = time();
|
|
$item['status'] = 1;
|
|
$res = M('systemconfig')->add($item);
|
|
if($res){
|
|
$data['status'] = 1;
|
|
$data['msg'] = "支付宝服务商配置参数成功";
|
|
}else{
|
|
$data['status'] = 0;
|
|
$data['msg'] = "支付宝服务商配置参数失败";
|
|
}
|
|
}else{
|
|
$item['alipay_appid'] = I('post.alipay_appid');
|
|
$item['alipay_pid'] = I('post.alipay_pid');
|
|
$item['alipay_public_key'] = I('post.alipay_public_key');
|
|
$item['alipay_private_key'] = I('post.alipay_private_key');
|
|
$item['addtime'] = time();
|
|
$item['status'] = 1;
|
|
$res = M('systemconfig')->where(array('partnerid'=>$uid))->save($item);
|
|
|
|
if($res){
|
|
$data['status'] = 1;
|
|
$data['msg'] = "支付宝服务商配置参数成功";
|
|
}else{
|
|
$data['status'] = 0;
|
|
$data['msg'] = "支付宝服务商配置参数失败";
|
|
}
|
|
}
|
|
}else{
|
|
$data['status'] = 0;
|
|
$data['msg'] = "配置错误,暂无信息";
|
|
}
|
|
$this->ajaxReturn($data);
|
|
}
|
|
|
|
//新大陆支付配置
|
|
public function continent_conf(){
|
|
//新大陆配置
|
|
$userinfo = session('admin_userinfo');
|
|
$uid = $userinfo['id'];
|
|
if(IS_POST){
|
|
//判断没有没这个配置
|
|
$map['uid'] = $uid;
|
|
$re = M('continent_config')->where(array('partnerid'=>$uid))->count();
|
|
if($re==0){
|
|
//添加流程
|
|
$item['continent_number'] = I('post.continent_number');
|
|
$item['continent_pay_secret_key'] = I('post.continent_pay_secret_key');
|
|
$item['continent_callback_secret_key'] = I('post.continent_callback_secret_key');
|
|
$item['continent_credential'] = I('post.continent_credential');
|
|
$item['continent_domain_secret'] = I('post.continent_domain_secret');
|
|
$arr = I('post.continent_domain');
|
|
$arr = $arr?$arr:array();
|
|
|
|
$item['partnerid'] = $uid;
|
|
$item['continent_domain'] = json_encode($arr);
|
|
$res = M('continent_config')->add($item);
|
|
if($res){
|
|
$data['status'] = 1;
|
|
$data['msg'] = "新大陆配置参数成功";
|
|
}else{
|
|
$data['status'] = 0;
|
|
$data['msg'] = "新大陆配置参数失败";
|
|
}
|
|
}else{
|
|
//修改流程
|
|
$item['continent_number'] = I('post.continent_number');
|
|
$item['continent_pay_secret_key'] = I('post.continent_pay_secret_key');
|
|
$item['continent_callback_secret_key'] = I('post.continent_callback_secret_key');
|
|
$item['continent_credential'] = I('post.continent_credential');
|
|
$item['continent_domain_secret'] = I('post.continent_domain_secret');
|
|
$arr = I('post.continent_domain');
|
|
if($arr){
|
|
foreach ($arr as $k=>$v){
|
|
if(!$v){
|
|
unset($arr[$k]);
|
|
}
|
|
}
|
|
}
|
|
$arr = $arr?$arr:array();
|
|
$item['continent_domain'] = json_encode($arr);
|
|
$res = M('continent_config')->where(array('partnerid'=>$uid))->save($item);
|
|
if($res){
|
|
$data['status'] = 1;
|
|
$data['msg'] = "新大陆配置参数修改成功";
|
|
}else{
|
|
$data['status'] = 0;
|
|
$data['msg'] = "新大陆配置参数修改失败";
|
|
}
|
|
}
|
|
}else{
|
|
$data['status'] = 0;
|
|
$data['msg'] = "配置错误,暂无信息";
|
|
}
|
|
$this->ajaxReturn($data);
|
|
}
|
|
|
|
|
|
public function upload()
|
|
{
|
|
$upload = new \Think\Upload (); // 实例化上传类
|
|
$upload->maxSize = 5242880 / 2; // 设置附件上传大小5M/5
|
|
$upload->exts = array(
|
|
'pkcs12',
|
|
'pem'
|
|
); // 设置附件上传类型
|
|
$upload->rootPath = 'Uploads'; // 设置附件上传根目录
|
|
$upload->savePath = '/cache/'; // 设置附件上传(子)目录
|
|
$upload->saveName = array(
|
|
'uniqid',
|
|
array('', true)
|
|
);
|
|
// 上传文件
|
|
$info = $upload->upload();
|
|
if (!empty($info['file']['savename'])) {
|
|
$path = "/" . $upload->rootPath . $info['file']['savepath'] . $info['file']['savename'];
|
|
$rt['status'] = 1;
|
|
$rt['path'] = $_SERVER['DOCUMENT_ROOT'].$path;
|
|
$rt['msg'] = '文件上传成功';
|
|
}else{
|
|
$rt['status'] = 0;
|
|
$rt['msg'] = '文件上传失败';
|
|
}
|
|
$this->ajaxReturn($rt);
|
|
}
|
|
} |