|
|
@ -4,6 +4,7 @@ namespace Admin\Controller;
|
|
|
|
|
|
|
|
|
|
|
|
use User\Api\UserApi as UserApi;
|
|
|
|
use User\Api\UserApi as UserApi;
|
|
|
|
use Base\Service\PaymentMerchantService;
|
|
|
|
use Base\Service\PaymentMerchantService;
|
|
|
|
|
|
|
|
use Base\Service\MerchantMainService;
|
|
|
|
use Base\Service\PaymentRuleService;
|
|
|
|
use Base\Service\PaymentRuleService;
|
|
|
|
use Base\Service\PromoteCompanyService;
|
|
|
|
use Base\Service\PromoteCompanyService;
|
|
|
|
use Base\Service\GameService;
|
|
|
|
use Base\Service\GameService;
|
|
|
@ -19,7 +20,8 @@ class PaymentMerchantController extends ThinkController
|
|
|
|
$page = I('p', 1);
|
|
|
|
$page = I('p', 1);
|
|
|
|
$row = I('row', 10);
|
|
|
|
$row = I('row', 10);
|
|
|
|
$name = I('name', '');
|
|
|
|
$name = I('name', '');
|
|
|
|
$mainName = I('main_name', '');
|
|
|
|
// $mainName = I('main_name', '');
|
|
|
|
|
|
|
|
$mainId = I('main_id', 0);
|
|
|
|
$adminId = I('admin_id', 0);
|
|
|
|
$adminId = I('admin_id', 0);
|
|
|
|
$channel = I('channel', 0);
|
|
|
|
$channel = I('channel', 0);
|
|
|
|
$account = I('account', '');
|
|
|
|
$account = I('account', '');
|
|
|
@ -32,8 +34,8 @@ class PaymentMerchantController extends ThinkController
|
|
|
|
if ($name != '') {
|
|
|
|
if ($name != '') {
|
|
|
|
$conditions['name'] = ['like', '%' . $name . '%'];
|
|
|
|
$conditions['name'] = ['like', '%' . $name . '%'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($mainName != '') {
|
|
|
|
if ($mainId != 0) {
|
|
|
|
$conditions['main_name'] = ['like', '%' . $mainName . '%'];
|
|
|
|
$conditions['main_id'] = $mainId;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($account != '') {
|
|
|
|
if ($account != '') {
|
|
|
|
$conditions['account'] = ['like', '%' . $account . '%'];
|
|
|
|
$conditions['account'] = ['like', '%' . $account . '%'];
|
|
|
@ -98,6 +100,8 @@ class PaymentMerchantController extends ThinkController
|
|
|
|
$this->assign('ways', PaymentMerchantService::$ways);
|
|
|
|
$this->assign('ways', PaymentMerchantService::$ways);
|
|
|
|
$this->assign('statusList', PaymentMerchantService::$statusList);
|
|
|
|
$this->assign('statusList', PaymentMerchantService::$statusList);
|
|
|
|
$this->assign('channels', PaymentMerchantService::$channels);
|
|
|
|
$this->assign('channels', PaymentMerchantService::$channels);
|
|
|
|
|
|
|
|
$MerchantMainService = new MerchantMainService();
|
|
|
|
|
|
|
|
$this->assign('merchantMain', $MerchantMainService->getSelectList());
|
|
|
|
$this->display();
|
|
|
|
$this->display();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -105,6 +109,8 @@ class PaymentMerchantController extends ThinkController
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$this->meta_title = '添加收款商户';
|
|
|
|
$this->meta_title = '添加收款商户';
|
|
|
|
$this->assign('channels', PaymentMerchantService::$channels);
|
|
|
|
$this->assign('channels', PaymentMerchantService::$channels);
|
|
|
|
|
|
|
|
$MerchantMainService = new MerchantMainService();
|
|
|
|
|
|
|
|
$this->assign('merchantMain', $MerchantMainService->getSelectList());
|
|
|
|
$this->display('form');
|
|
|
|
$this->display('form');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -158,6 +164,8 @@ class PaymentMerchantController extends ThinkController
|
|
|
|
$this->assign('record', $merchant);
|
|
|
|
$this->assign('record', $merchant);
|
|
|
|
$this->assign('config', $config);
|
|
|
|
$this->assign('config', $config);
|
|
|
|
$this->assign('ways', $ways);
|
|
|
|
$this->assign('ways', $ways);
|
|
|
|
|
|
|
|
$MerchantMainService = new MerchantMainService();
|
|
|
|
|
|
|
|
$this->assign('merchantMain', $MerchantMainService->getSelectList());
|
|
|
|
$this->display('form');
|
|
|
|
$this->display('form');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -171,7 +179,7 @@ class PaymentMerchantController extends ThinkController
|
|
|
|
$account = I('account', '');
|
|
|
|
$account = I('account', '');
|
|
|
|
$config = I('config', []);
|
|
|
|
$config = I('config', []);
|
|
|
|
$ways = I('ways', []);
|
|
|
|
$ways = I('ways', []);
|
|
|
|
$mainName = I('main_name', '');
|
|
|
|
$mainId = I('main_id', 0);
|
|
|
|
|
|
|
|
|
|
|
|
if ($name == '') {
|
|
|
|
if ($name == '') {
|
|
|
|
$this->ajaxReturn([
|
|
|
|
$this->ajaxReturn([
|
|
|
@ -179,10 +187,10 @@ class PaymentMerchantController extends ThinkController
|
|
|
|
'message' => '请输入支付配置名称',
|
|
|
|
'message' => '请输入支付配置名称',
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($mainName == '') {
|
|
|
|
if ($mainId === 0) {
|
|
|
|
$this->ajaxReturn([
|
|
|
|
$this->ajaxReturn([
|
|
|
|
'status' => 0,
|
|
|
|
'status' => 0,
|
|
|
|
'message' => '请输入商户商户主体',
|
|
|
|
'message' => '请选择商户商户主体',
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($account == '') {
|
|
|
|
if ($account == '') {
|
|
|
@ -205,6 +213,9 @@ class PaymentMerchantController extends ThinkController
|
|
|
|
$paymentMerchantService = new PaymentMerchantService();
|
|
|
|
$paymentMerchantService = new PaymentMerchantService();
|
|
|
|
$waysValue = $paymentMerchantService->getWaysValue($ways);
|
|
|
|
$waysValue = $paymentMerchantService->getWaysValue($ways);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$MerchantMainService = new MerchantMainService();
|
|
|
|
|
|
|
|
$mainName = $MerchantMainService->getNameById($mainId);
|
|
|
|
|
|
|
|
|
|
|
|
$userAuth = session('user_auth');
|
|
|
|
$userAuth = session('user_auth');
|
|
|
|
|
|
|
|
|
|
|
|
$data = [];
|
|
|
|
$data = [];
|
|
|
@ -217,6 +228,7 @@ class PaymentMerchantController extends ThinkController
|
|
|
|
$data['config'] = json_encode($config);
|
|
|
|
$data['config'] = json_encode($config);
|
|
|
|
$data['update_time'] = time();
|
|
|
|
$data['update_time'] = time();
|
|
|
|
$data['main_name'] = $mainName;
|
|
|
|
$data['main_name'] = $mainName;
|
|
|
|
|
|
|
|
$data['main_id'] = $mainId;
|
|
|
|
if ($id == 0) {
|
|
|
|
if ($id == 0) {
|
|
|
|
$data['create_time'] = time();
|
|
|
|
$data['create_time'] = time();
|
|
|
|
$data['channel'] = $channel;
|
|
|
|
$data['channel'] = $channel;
|
|
|
@ -233,6 +245,7 @@ class PaymentMerchantController extends ThinkController
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$this->changeSpendPartnerType($mainId,$id);
|
|
|
|
$data['identifier'] = $paymentMerchantService->getIdentifierByConfig($config, $merchant['channel']);
|
|
|
|
$data['identifier'] = $paymentMerchantService->getIdentifierByConfig($config, $merchant['channel']);
|
|
|
|
M('payment_merchant', 'tab_')->where(['id' => $id])->save($data);
|
|
|
|
M('payment_merchant', 'tab_')->where(['id' => $id])->save($data);
|
|
|
|
|
|
|
|
|
|
|
@ -252,6 +265,18 @@ class PaymentMerchantController extends ThinkController
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private function changeSpendPartnerType($mainId,$merchantId)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
$oldMainId = M('payment_merchant', 'tab_')->where(['id' => $merchantId])->getField("main_id");
|
|
|
|
|
|
|
|
if($oldMainId != $mainId){
|
|
|
|
|
|
|
|
//更改支付表
|
|
|
|
|
|
|
|
$save = [
|
|
|
|
|
|
|
|
'partner_type'=>$mainId
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
M("Spend","tab_")->where("merchant_id = '{$merchantId}'")->save($save);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function delete()
|
|
|
|
public function delete()
|
|
|
|