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