文件
mashangyoujiu/Application/Retail/Controller/PaysetController.class.php

373 行
10 KiB
PHP
可执行文件

此文件含有模棱两可的 Unicode 字符

此文件含有可能会与其他字符混淆的 Unicode 字符。 如果您是想特意这样的,可以安全地忽略该警告。 使用 Escape 按钮显示他们。

<?php
namespace Retail\Controller;
use Api\Controller\RetailPaySetController;
use Common\Business\Plug;
use Common\Model\MerchantPayAuthModel;
use Common\Model\MerRemitModel;
use Common\Model\PayPatternModel;
use Think\Controller;
//[1.9.8]
/**
* 商户支付设置
* Class PaysetController
* @package Retail\Controller
*/
class PaysetController extends BaseController
{
private $RetailPaySet;
public function _initialize()
{
parent::_initialize(); // TODO: Change the autogenerated stub
if (!session('merchant_userinfo')) {
if (IS_POST) {
$this->ajaxReturn(array(
'status' => 0,
'msg' => '登录超时,请重新登录'
));
} else {
$this->error("登录超时,请重新登录");
exit;
}
}
$this->RetailPaySet = new RetailPaySetController();
}
/**
* 支付页面
*/
public function paySet()
{
// 查询商户设置
$result = $this->RetailPaySet->getPaySet($this->merchant_id, $this->store_id);
$this->assign('entry_status', $result['entry_status']);
$this->assign("merchantInfo", json_encode($result['merchantInfo']));
$this->assign('entry', json_encode($result['entry']));
$this->assign('pay', json_encode($result['paySet']));
$this->assign('open_user', 1);
$this->assign('merchant_id', $this->merchant_id);
// 节点
$arr = array(
'doSetPaySet' => '/index.php/Retail/Payset/doSetPaySet',
);
$authArr = checkFunction($arr);
$this->assign('authArr', $authArr);
$this->display();
}
/**
* 获取商户支付权限
*/
public function get_pay_pattern()
{
$user = session('merchant_userinfo');
/* 获取代理商支付配置权限 */
$PayPatternModel = new PayPatternModel();
$find_agent = $PayPatternModel->getFind(['agent_id' => $user['agentid']]);
if (!$find_agent) {
$find_merchant['general_pay'] = 0;
$find_merchant['service_pay'] = 0;
$find_merchant['new_continent_pay'] = 0;
$find_merchant['close_pay_type'] = 0;
$find_merchant['cloud_pay'] = 0;
$find_merchant['happy_pay'] = 0;
$find_merchant['lakala_pay'] = 0;
$find_merchant['qian_ke_pay'] = 0;
return $find_merchant;
}
/* 获取商户支付配置权限 */
$MerchantPayAuthModel = new MerchantPayAuthModel();
$find_merchant = $MerchantPayAuthModel->getFind(['merchant_id' => $this->merchant_id]);
if (!$find_merchant) {
$find_merchant['general_pay'] = 0;
$find_merchant['service_pay'] = 0;
$find_merchant['new_continent_pay'] = 0;
$find_merchant['close_pay_type'] = 0;
$find_merchant['cloud_pay'] = 0;
$find_merchant['happy_pay'] = 0;
$find_merchant['lakala_pay'] = 0;
$find_merchant['qian_ke_pay'] = 0;
} else {
$Plug = new Plug();
$merPlug = $Plug->merPlugState([
'merchant_id' => $this->merchant_id,
'identification_arr' => ['moneyguestpay', 'lakalapay', 'happypay']
]);
$find_merchant['general_pay'] = $find_agent['general_pay'] == 1 ? $find_merchant['general_pay'] : 0;
$find_merchant['service_pay'] = $find_agent['service_pay'] == 1 ? $find_merchant['service_pay'] : 0;
$find_merchant['new_continent_pay'] = $find_agent['new_continent_pay'] == 1 ? $find_merchant['new_continent_pay'] : 0;
$find_merchant['cloud_pay'] = $find_agent['cloud_pay'] == 1 ? $find_merchant['cloud_pay'] : 0;
$find_merchant['happy_pay'] = $find_agent['happy_pay'] == 1 && $merPlug['happypay'] ? $find_merchant['happy_pay'] : 0;
$find_merchant['lakala_pay'] = $find_agent['lakala_pay'] == 1 && $merPlug['lakalapay'] ? $find_merchant['lakala_pay'] : 0;
$find_merchant['qian_ke_pay'] = $find_agent['qian_ke_pay'] == 1 && $merPlug['moneyguestpay'] ? $find_merchant['qian_ke_pay'] : 0;
}
$this->ajaxReturn($find_merchant);
}
/**
* 上传证书
*/
public function upload()
{
$res = $this->RetailPaySet->upload();
$this->ajaxReturn($res);
}
/**
* 保存支付设置
*/
public function doSetPaySet()
{
if (IS_POST) {
$res = $this->RetailPaySet->doSetPaySet($this->merchant_id, $this->store_id);
$this->ajaxReturn($res);
}
}
/**
* 已有新大陆商户,直接配置 Configurexdl
*/
public function customSettings()
{
$result = $this->RetailPaySet->customSettings($this->merchant_id);
$this->ajaxReturn($result);
}
/***************************************** 新大陆新版进件 ***************************************/
//进件页面
public function merchantEntry()
{
$open_type = I('get.open_type');
$this->assign('open_type', $open_type);
$this->display();
}
/**
* 获取初始新大陆进件信息
*/
public function initialNewPaySet()
{
// 判断登录
$res = $this->RetailPaySet->initialNewPaySet($this->merchant_id);
$this->ajaxReturn($res);
}
/**
* 获取经营类目
*/
public function getMccArr()
{
$res = $this->RetailPaySet->getMccArr();
$this->ajaxReturn($res);
}
/**
* 获取省列表
*/
public function getProvince()
{
$res = $this->RetailPaySet->getProvince();
$this->ajaxReturn($res);
}
/**
* 获取市列表
*/
public function getSubordinate()
{
// 接收参数
$p_id = I('post.p_id');
if (!$p_id) {
$res = array('status' => 0, 'msg' => '参数缺失');
$this->ajaxReturn($res);
}
$res = $this->RetailPaySet->getSubordinate($p_id);
$this->ajaxReturn($res);
}
/**
* 获取区列表
*/
public function getArea()
{
// 接收参数
$province = I('post.province');
$city = I('post.city');
if (!$province || !$city) {
$res = array(
'status' => 0,
'msg' => '参数缺失'
);
$this->ajaxReturn($res);
}
$res = $this->RetailPaySet->getArea();
$this->ajaxReturn($res);
}
/**
* 获取银行信息
*/
public function getBank()
{
$res = $this->RetailPaySet->getBank();
$this->ajaxReturn($res);
}
/**
* 上传图片
*/
public function uploads()
{
$res = $this->RetailPaySet->uploads($this->merchant_id);
$this->ajaxReturn($res);
}
/**
* 保存新大陆进件信息
*/
public function updateNewPaySet()
{
// 接收参数
$data = I('post.data');
$step = I('post.step');
$res = $this->RetailPaySet->updateNewPaySet($data, $step, $this->merchant_id);
$this->ajaxReturn($res);
}
/**
* 获取联行信息
*/
public function getWcLbnkNo()
{
$keyword = I('post.keyword');
$res = $this->RetailPaySet->getWcLbnkNo($keyword);
$this->ajaxReturn($res);
}
/**
* 第一次提交进件信息
*/
public function toIncomingParts()
{
$res = $this->RetailPaySet->toIncomingParts($this->merchant_id);
$this->ajaxReturn($res);
}
/**
* 提交信息
*/
public function submitApply()
{
$res = $this->RetailPaySet->submitApply($this->merchant_id);
$this->ajaxReturn($res);
}
/**
* 商户提交查询状态
*/
public function searchEntryApply()
{
$res = $this->RetailPaySet->searchEntryApply($this->merchant_id);
$this->ajaxReturn($res);
}
/**
* 商户申请修改 商户通过时才能申请
*/
public function applyChange()
{
$res = $this->RetailPaySet->applyChange($this->merchant_id);
$this->ajaxReturn($res);
}
/**
* 删除商户新大陆支付配置
*/
public function deleteEntry()
{
$res = $this->RetailPaySet->deleteEntry($this->merchant_id);
$this->ajaxReturn($res);
}
/*******************打款设置***************************/
/**
* 打款设置设置页面
*/
public function remit()
{
$this->display();
}
/**
* 获取打款设置
*/
public function getRemitData()
{
$MerRemitModel = new MerRemitModel();
$map = array(
'merchant_id' => $this->merchant_id,
);
$fields = array(
'mch_appid',
'mch_id',
'apiclient_cert',
'apiclient_key',
'wx_secret_key',
'wx_state',
);
$data = $MerRemitModel->getFind($map, $fields);
$this->ajaxReturn(array(
'status' => 1,
'msg' => '获取成功',
'data' => $data,
));
}
/**
* 保存打款设置
*/
public function saveRemitData()
{
$data = I('post.');
$MerRemitModel = new MerRemitModel();
$map = array(
'merchant_id' => $this->merchant_id,
);
$old = $MerRemitModel->getFind($map);
if ($old) {
$res = $MerRemitModel->updateOrder($map, $data);
} else {
$data['merchant_id'] = $this->merchant_id;
$res = $MerRemitModel->addOrder($data);
}
if ($res) {
$source = 0; //请求来源: 0pc系统 1小助手
$type = 3; //平台:1合伙人端 2代理商端 3商户端 4门店端
$request_data = json_encode($data); //请求参数 json数据
$desc = '商户设置-支付设置-打款设置'; //操作行为描述
action_log($source, $type, $request_data, $desc);
$result = array(
'status' => 1,
'msg' => '保存成功',
'data' => $data,
);
} else {
$result = array(
'status' => 0,
'msg' => '保存失败',
'data' => $data,
);
}
$this->ajaxReturn($result);
}
}