From 3f7f3e9b70f1e54a254a22726069e634d1d17776 Mon Sep 17 00:00:00 2001 From: tping Date: Thu, 23 Jul 2020 15:14:46 +0800 Subject: [PATCH 1/3] test --- Application/Sdk/View/default/Spend/pay_way.html | 1 + 1 file changed, 1 insertion(+) diff --git a/Application/Sdk/View/default/Spend/pay_way.html b/Application/Sdk/View/default/Spend/pay_way.html index 3fa8297b..ba53dec3 100644 --- a/Application/Sdk/View/default/Spend/pay_way.html +++ b/Application/Sdk/View/default/Spend/pay_way.html @@ -38,6 +38,7 @@
当前支付渠道: {$payname3}
+
From 95bb9f9897a09383df7de0921ca0eb491b77a24d Mon Sep 17 00:00:00 2001 From: tping Date: Thu, 23 Jul 2020 15:18:19 +0800 Subject: [PATCH 2/3] payment_rule --- ThinkPHP/Library/Think/Pay.class.php | 53 ++++++++++++++++------------ 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/ThinkPHP/Library/Think/Pay.class.php b/ThinkPHP/Library/Think/Pay.class.php index 92f291ab..5c9214b5 100644 --- a/ThinkPHP/Library/Think/Pay.class.php +++ b/ThinkPHP/Library/Think/Pay.class.php @@ -67,25 +67,25 @@ class Pay return false; } - public function buildRequestForm(Pay\PayVo $vo, $uc = 0, $param=array(), $payConf=array()) + public function buildRequestForm(Pay\PayVo $vo, $uc = 0, $param=array()) { - /* $promoteId = 0; + $promoteId = 0; if ($vo->getPromoteId()) { $promoteId = $vo->getPromoteId(); } elseif (isset($param['promote_id']) && $param['promote_id']) { $promoteId = $param['promote_id']; } - $isKBCPartner = $this->isKBCPartner($promoteId); */ + $isKBCPartner = $this->isKBCPartner($promoteId); $this->payer->check(); $result = false; if ($uc == 0) { switch ($vo->getTable()) { case 'spend': - $result = $this->add_spend($vo, $param); + $result = $this->add_spend($vo, $param, $isKBCPartner); break; case 'deposit': - $result = $this->add_deposit($vo, $param); + $result = $this->add_deposit($vo, $isKBCPartner); break; case 'agent': $result = $this->add_agent($vo); @@ -115,7 +115,7 @@ class Pay if ($result !== false) {//$check !== false if ($this->apitype == "alipay" && C('alipay.usenew')) { if (C('alipay.appid')) { - return $this->newbuildRequestForm($vo, $payConf); + return $this->newbuildRequestForm($vo, $isKBCPartner); } else { E("appid未设置"); exit('新版appid未填写'); @@ -135,17 +135,26 @@ class Pay /** * 新版支付宝接口调用 * */ - public function newbuildRequestForm(Pay\PayVo $vo, $payConf=array()) + public function newbuildRequestForm(Pay\PayVo $vo, $isKBCPartner = false) { - if (!$payConf) return false; Vendor('Alipay.AopSdk'); $aop = new \AopClient(); - - $aop->appId = $payConf['app_id']; + $aop->appId = $isKBCPartner ? C('ALIPAY_KBC_APPID') : C('alipay.appid'); $aop->signType = 'RSA2'; - $aop->rsaPrivateKey = $payConf['private_key']; - $aop->alipayrsaPublicKey = $payConf['public_key']; - + $aop->rsaPrivateKey = $isKBCPartner ? C('ALIPAY_KBC_PRI') : C('alipay.pri_secret'); + if (!$aop->rsaPrivateKey) { + $aop->rsaPrivateKey = file_get_contents("./Application/Sdk/SecretKey/alipay/rsa2_private_key.txt"); + } + $aop->alipayrsaPublicKey = $isKBCPartner ? C('ALIPAY_KBC_PUB') : C('alipay.pub_secret'); + if (!$aop->alipayrsaPublicKey) { + $aop->alipayrsaPublicKey = file_get_contents("./Application/Sdk/SecretKey/alipay/alipay2_public_key.txt"); + } + $gameId = $vo->getGameId(); + if ($gameId == 219 || $gameId == 220) { + $aop->appId = '2021001165628090'; + $aop->rsaPrivateKey = 'MIIEowIBAAKCAQEAkiDKuAqNxdXIjxFuPoyQzOyyt1E3einQ2coy/CaxC0vgX3QCisha5DOElkNZgiKoqlgp7bGW/UZip04+5DM6VlrSHatuK5xIS/UAezxqVWWDsaHhSY4QVfeyOs6P0DUWm7K3COcpsLNVQjwK5gq2O8WJeBHdWRLDmFtr60xF1hVlSnp++8alNgqzVS5AoAeLN7+cqTDfxJCQlYW18HOBDh7i5lQExWtQohTH1tFLVbcKF9TnvcmpnOYQha56OsqqHytmtLFyhQqzBYpfy/3ebwSV3eFpjz+dmlhrf+V+4Z4BVU6bYiDoqoaR3TIZetIVRGqsdceU3+xrQOAXBE5meQIDAQABAoIBACI+aQMkBgE8jhlo3kruKei7902aTMPmFLlU9wm8D3U0PMphp07akOI1aHbGJa2nbZstufWnzlhgLDJE1dwoXR1rfx3Q1KqHnzGdopU+nTSR64CvDNpt3konF69MRMtoBXpLMTV25oAwJmS1KWCrVfU/320x0otTKF8F3Y5we1UlpxO9ZuY8Ile9q/yTs4S8pXk5T0Mfa3jVFMV5dJ3PV1O/z631uUdQqTptshJtlUu3QgJfZvplNX9qP3wUPRg1BQ2oFiQaMv3XQrlbdsUuOdF5FugSAc1/GwyfqRZ4d9oWsnBIJO/cLgpUOP7NGpXGC6RtkkpslgCOYkD3tYn2XQECgYEA2vMPs9Lmc1vtr+CApeIveC4Sx1zaWSxo9IyUdidr7aWs+3c5teqH3pdpYJp8hPDv7FMFIbUzWNQe/gc523mz+F+RDDfyBIA3X5/SHNxNCbQg/gHYxtUNSPmTqYjne2T5t6l9B0lFRz+AIAi9TMS13wiJ85HkejZnZidydKeKMEkCgYEAqtsXzjMPUxd83SWKKjg5UR1dWRuv3F40YmsNJrpC/3h2HTYjfRO67l9/n1/O5T4hVSYZy0Vbz0pVAlHatr/8keZSg59yVbcLY+wq39AJZHyy+wUOo3gSppOWn4ZaBS2FtVXl09ayht9vmln407siOO0luB+dFoJf71c0Hkiy5LECgYA1tfy7I1iPIhUL2SoWB4eXls3ahEe4KnHQ1A+zcHZEhSkLQzMwEkmkbEZYgW1ce3KP6cnPfBENkHPN413pHlDs9Byz/6FqQz3SQnWbyNtJLxwM080m8arhpP/5TfFjTuEHkhduyyWolcZLlXlCtNrczM5ypu6CoIf7AmBMh7EZqQKBgQCZDXMh0DOmJ6A/KuW+NGeD9l4s+NRtACbFE0jQrIJgADUurdTUstv9tabJyjW4vhN2B4+LvDImW1wTm+flVc6XlE/OgQMXLcYSWPl/TQlc7ygWHc2jOmjat9NyTBRQFxtz+eLMBcQfdgCvsHFqmnRpsmbbrdY218vAx8l0Z4N5wQKBgFUk9nJ0FVafmw0BgQLi3f7XRW9F5ECfVlG+P7MyNx7/VTSjkF7tvVZAjRSzw2xVgI1PpTP4VI4NoWAdTXTSylJoiivDdHfUgHZbCf3kS0LfwXpA2EQrSsJX0MgYGUvc0shv869dZix0o1NAff/0erxrg4Eu+5JbqpOyHi1z+oQW'; + $aop->alipayrsaPublicKey = 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApGA73xiJnGXsrIPCqTSgq9C/4uNArsX3/xBE1qSl6n4X2NR+oejR9fVzM3+rlo4npJPUDh5sq3udfUNWkC5Gb4MzHyNExNWD97pV+xNjwwKIV95ysll44qNFhSIeeiHg3duPV9ZJ3GxUS2lAE0Mw3+6eU5QFAjYHmBsozCXz3RKk9UxVNBR3VkjLzkUh7kyg00kv/pIFM03i4l804FQ3ssbzE5FSL9maucibwRibAnStR778bM9r9PLNZ48v9XeAGThfk9WFoOfbJB8UQMgO05QmT77iWMuOJZqP6Q1w1LF1W8eM1jz4MzjgTyauYndZBqvXnyPBKnUYoIBNI/6bGwIDAQAB'; + } $type = $vo->getPayMethod(); //file_put_contents(dirname(__FILE__) . '/newbuildRequestForm.txt',json_encode($vo->getOrderNo())); switch ($type) { @@ -178,13 +187,16 @@ class Pay $request->setReturnUrl('http://' . $_SERVER ['HTTP_HOST'] . "/mobile.php/Trade/success"); break; case 'mobile': + $aop->alipayrsaPublicKey = file_get_contents("./Application/Sdk/SecretKey/alipay/alipay2_public_key.txt"); $productcode = 'QUICK_MSECURITY_PAY'; $request = new \AlipayTradeAppPayRequest(); break; case 'refund': + $aop->alipayrsaPublicKey = file_get_contents("./Application/Sdk/SecretKey/alipay/alipay2_public_key.txt"); $request = new \AlipayTradeRefundRequest(); break; case 'transfer': + $aop->alipayrsaPublicKey = file_get_contents("./Application/Sdk/SecretKey/alipay/alipay2_public_key.txt"); $request = new \AlipayFundTransToaccountTransferRequest (); break; default: @@ -339,7 +351,7 @@ class Pay /** *消费表添加数据 */ - private function add_spend(Pay\PayVo $vo, $param=array(), $payConf = array()) + private function add_spend(Pay\PayVo $vo, $param=array(), $isKBCPartner = false) { $spend = M("spend", "tab_"); $spend_data['user_id'] = $vo->getUserId(); @@ -372,9 +384,9 @@ class Pay $spend_data['spend_ip'] = get_client_ip(); $spend_data['sdk_version'] = $vo->getSdkVersion(); $spend_data['market_admin_id'] = $this->getMarketAdminId($vo->getPromoteId()); - /* if ($isKBCPartner) { + if ($isKBCPartner) { $spend_data['partner_type'] = 1; - } */ + } if($vo->getSmallId() != $vo->getUserId()) { $spend_data['small_id'] = $vo->getSmallId(); $spend_data['small_account'] = $vo->getSmallAccount(); @@ -383,7 +395,6 @@ class Pay $spend_data['deduction_amount'] = $param['deduction_amount']; $spend_data['discount_amount'] = $param['discount_amount']; } - $spend_data['merchant_id'] = isset($payConf) ? $payConf['id'] : 0; $result = $spend->add($spend_data); return $result; } @@ -391,7 +402,7 @@ class Pay /** *平台币充值记录 */ - private function add_deposit(Pay\PayVo $vo, $payConf=array()) + private function add_deposit(Pay\PayVo $vo, $isKBCPartner = false) { if (!empty($vo->getUc())) { $uc = new Ucservice(); @@ -418,11 +429,9 @@ class Pay $deposit_data['create_time'] = NOW_TIME; $deposit_data['sdk_version'] = $vo->getSdkVersion(); $deposit_data['market_admin_id'] = $this->getMarketAdminId($vo->getPromoteId()); - /* if ($isKBCPartner) { + if ($isKBCPartner) { $deposit_data['partner_type'] = 1; - } */ - $spend_data['merchant_id'] = isset($payConf) ? $payConf['id'] : 0; - + } $result = $deposit->add($deposit_data); return $result; } From c2a6f80e92be255f8922dbca8a96aa99981efb21 Mon Sep 17 00:00:00 2001 From: tping Date: Thu, 23 Jul 2020 15:26:59 +0800 Subject: [PATCH 3/3] payment_rule test --- .../Controller/BaseController.class.php | 63 ------ .../Controller/Notify2Controller.class.php | 25 +-- .../Controller/NotifyController.class.php | 35 +-- Application/Common/Common/extend.php | 210 +----------------- .../Sdk/View/default/Spend/pay_way.html | 13 -- .../Library/Org/WeixinSDK/Weixin.class.php | 5 +- 6 files changed, 16 insertions(+), 335 deletions(-) diff --git a/Application/Callback/Controller/BaseController.class.php b/Application/Callback/Controller/BaseController.class.php index d1c5597f..a4fba5f6 100644 --- a/Application/Callback/Controller/BaseController.class.php +++ b/Application/Callback/Controller/BaseController.class.php @@ -835,67 +835,4 @@ class BaseController extends Controller { return false; } } */ - - // 根据订单号 获取支付配置 - protected function getPayConfByOrderId($orderNo) { - $order = array(); - if (substr($orderNo, 0, 2) == "SP") { - $order = M('spend', 'tab_')->where([ - 'pay_order_number' => $orderNo - ])->find(); - } else { - $order = M('despo', 'tab_')->where([ - 'pay_order_number' => $orderNo - ])->find(); - } - if (!$order) { - return array( - 'code' => 1, - 'msg' => "订单号不存在pay_order_number:".$orderNo, - 'data' => array() - ); - } - $payConf = M('payment_merchant', 'tab_')->where([ - 'id' => $order['merchant_id'] - ])->find(); - if (!$payConf) { - return array( - 'code' => 1, - 'msg' => "找不到支付配置merchant_id:".$order['merchant_id'], - 'data' => array() - ); - } - - $payConf = json_decode($payConf['config'], true); - - return array( - 'code' => 0, - 'msg' => '', - 'data' => $payConf, - ); - } - - // 根据商户号 获取支付配置 - protected function getPayConfByIdentifier($identifier) { - - $payConf = M('payment_merchant', 'tab_')->where([ - 'identifier' => $identifier - ])->find(); - if (!$payConf) { - return array( - 'code' => 1, - 'msg' => "找不到支付配置identifier:".$identifier, - 'data' => array() - ); - } - - $payConf = json_decode($payConf['config'], true); - - return array( - 'code' => 0, - 'msg' => '', - 'data' => $payConf, - ); - } - } \ No newline at end of file diff --git a/Application/Callback/Controller/Notify2Controller.class.php b/Application/Callback/Controller/Notify2Controller.class.php index 4ef2dd59..9a697ca9 100644 --- a/Application/Callback/Controller/Notify2Controller.class.php +++ b/Application/Callback/Controller/Notify2Controller.class.php @@ -41,21 +41,14 @@ class Notify2Controller extends BaseController Vendor('Alipay.AopSdk'); $aop = new \AopClient(); - if (!$notify['auth_app_id']) { - $this->record_logs("auth_app_id不存在!"); - echo 'fail'; - exit(); + $aop->alipayrsaPublicKey = C('alipay.pub_secret'); + if (isset($notify['auth_app_id']) && $notify['auth_app_id'] == C('ALIPAY_KBC_APPID')) { + $aop->alipayrsaPublicKey = C('ALIPAY_KBC_PUB'); } - $merchant = M('payment_merchant', 'tab_')->where([ - 'identifier' => $notify['auth_app_id'] - ])->find(); - if (!$merchant) { - $this->record_logs("找不到商户!".$notify['auth_app_id']); - echo 'fail'; - exit(); + + if (!$aop->alipayrsaPublicKey) { + $aop->alipayrsaPublicKey = file_get_contents("./Application/Sdk/SecretKey/alipay/alipay2_public_key.txt"); } - $payConf = json_decode($merchant['config'], true); - $aop->alipayrsaPublicKey = $payConf['public_key']; $result = $aop->rsaCheckV1($notify,'','RSA2'); if ($result) { @@ -81,9 +74,9 @@ class Notify2Controller extends BaseController case 'TB': $result = $this->set_balance($order_info); break; - case 'SI': - $result = $this->set_order($order_info); - break; + case 'SI': + $result = $this->set_order($order_info); + break; default: exit('accident order data'); break; diff --git a/Application/Callback/Controller/NotifyController.class.php b/Application/Callback/Controller/NotifyController.class.php index 64885bae..151b910e 100644 --- a/Application/Callback/Controller/NotifyController.class.php +++ b/Application/Callback/Controller/NotifyController.class.php @@ -283,27 +283,16 @@ class NotifyController extends BaseController $weixin = A("WeiXin", "Event"); $request = file_get_contents("php://input"); $reqdata = $weixin->xmlstr_to_array($request); - - Log::write(serialize($reqdata), Log::DEBUG); - if ($reqdata['return_code'] != 'SUCCESS') { $this->record_logs("return_code返回数据错误"); exit(); } else { - $payData = $this->getPayConfByOrderId($reqdata['out_trade_no']); - if ($payData['code'] != 0) { - $this->record_logs($payData['msg']); - exit(); - } - $payConf = $payData['data']; - if ($_REQUEST['method'] == "notify2") {//sdk $Common_util_pub = new \Common_util_pub(C('wei_xin_app.email'), C('wei_xin_app.partner'), C('wei_xin_app.key')); } elseif ($_REQUEST['method'] == "notify3") { //app $Common_util_pub = new \Common_util_pub(C('wei_xin_apps.email'), C('wei_xin_apps.partner'), C('wei_xin_apps.key')); } elseif ($_REQUEST['method'] == "notify") {//扫码 -// $Common_util_pub = new \Common_util_pub(C('wei_xin.email'), C('wei_xin.partner'), C('wei_xin.key')); - $Common_util_pub = new \Common_util_pub($payConf['appid'], $payConf['partner'], $payConf['key']); + $Common_util_pub = new \Common_util_pub(C('wei_xin.email'), C('wei_xin.partner'), C('wei_xin.key')); } if ($Common_util_pub->getSign($reqdata) == $reqdata['sign']) { $pay_where = substr($reqdata['out_trade_no'], 0, 2); @@ -471,15 +460,8 @@ class NotifyController extends BaseController Log::write(serialize($_REQUEST), Log::DEBUG); - $payData = $this->getPayConfByIdentifier($merNo); - if ($payData['code'] != 0) { - $this->record_logs($payData['msg']); - exit(); - } - $payConf = $payData['data']; - $secret = $payConf['secret']; // pp(C('sqpay.key')); -// $secret = strtoupper(md5(C('sqpay.key')));//支付秘钥 + $secret = strtoupper(md5(C('sqpay.key')));//支付秘钥 // 参与校验 $sign = strtoupper(md5("Amount={$amount}&BillNo={$billNo}&MerNo={$merNo}&Succeed={$succed}&{$secret}")); @@ -883,19 +865,6 @@ class NotifyController extends BaseController $private_key = C('yeepay.private_key'); $source = $_REQUEST['response']; - $identifier = $source['customerIdentification']; - if (substr($identifier, 0, 4) == "OPR:") { - $identifier = substr($identifier, 4); - } - $payData = $this->getPayConfByIdentifier($identifier); - if ($payData['code'] != 0) { - $this->record_logs($payData['msg']); - exit(); - } - $payConf = $payData['data']; - $private_key = $payConf['private_key']; - $yop_public_key = $payConf['public_key']; - $sourceData = \YopSignUtils::decrypt($source, $private_key, $yop_public_key); $sourceData = json_decode($sourceData, true); if ($sourceData['status'] != 'SUCCESS') { diff --git a/Application/Common/Common/extend.php b/Application/Common/Common/extend.php index 889f7ec5..2c4963de 100644 --- a/Application/Common/Common/extend.php +++ b/Application/Common/Common/extend.php @@ -65,7 +65,7 @@ function is_idcard( $idcard ) { $arr_ch = array('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'); $sign = 0; for ( $i = 0; $i < 17; $i++ ) { - $b = (int) $id[$i]; + $b = (int) $id{$i}; $w = $arr_int[$i]; $sign += $b * $w; } @@ -1968,215 +1968,11 @@ function get_shortcut_pay_type(){ } } -function get_promote_company($user_id) { - if (!$user_id) return 0; - $promote_id = M('user', 'tab_')->where(['id' => $user_id])->getField('promote_id'); - if (!$promote_id) return 0; - - $promote = M('promote', 'tab_')->field(['company_id', 'id'])->where(['id' => $promote_id])->find(); - if (!$promote) return 0; - - $company = M('promote_company', 'tab_')->field(['company_belong', 'id'])->where(['id' => $promote['company_id']])->find(); - if (!$company) return 0; - - return $company; -} - - - -// 0 默认 -^Euo2fM -function get_default_payment_config($way=1) { - $merchant = M('payment_merchant', 'tab_')->where(['_string' => 'ways&' . $way . '=' . $way . ' and is_default&' . $way . '=' . $way])->find(); - if (is_null($merchant)) { - return -1; -// $merchant = M('payment_merchant', 'tab_')->where(['_string' => 'ways&' . $way . '=' . $way])->find(); - } - - return $merchant; -} - -// 获取支付配置 way 1 支付宝 2微信 3快捷 -function get_payment_config($way=1, $game=0, $user_id=0) { - $time = time(); - $company = get_promote_company($user_id); - - $where = []; - $map = []; - $where['start_time'] = array('lt', $time); - $where['end_time'] = array('gt', $time); - $where['_logic'] = 'and'; - $map['_complex'] = $where; - $map['end_time'] = 0; - $map['_logic'] = 'or'; - - $baseGameId = M('base_game', 'tab_')->where([ - 'android_game_id|ios_game_id' => $game['id'] - ])->getField('id'); - if (!$baseGameId) { - return ['code' => -3, 'msg' => '找不到游戏ID', 'data' => []]; - } - - $payment_rule = M('payment_rule', 'tab_')->where($map)->select(); - $find_rule = false; - $rule = array(); - - if (!$company['id']) { - foreach ($payment_rule as $v) { - if ($v['game_id'] == $baseGameId) { - $rule = $v; - $find_rule = true; - break; - } - } - - if (!$find_rule) { - foreach ($payment_rule as $v) { - if ($v['game_type_id'] == $game['game_type_id'] && $v['game_id'] == 0) { - $rule = $v; - $find_rule = true; - break; - } - } - } - if ($find_rule) { - $merchant_id = $rule['alipay_merchant_id']; - if ($way == 2) - $merchant_id = $rule['weixin_merchant_id']; - if ($way == 3) - $merchant_id = $rule['express_merchant_id']; - - $pay_conf = M('payment_merchant', 'tab_')->where([ - 'id' => $merchant_id - ])->find(); - if (!$pay_conf) { - return ['code' => -2, 'msg' => '找不到对应的支付配置'.$merchant_id, 'data' => []]; - } - return $pay_conf; - } - - return get_default_payment_config($way); - - } else { - // 最优先推广公司 游戏 - foreach ($payment_rule as $v) { - if ($v['company_id'] == $company['id'] && $v['game_id'] == $baseGameId) { - $rule = $v; - $find_rule = true; -// echo '1'; - break; - } - } - // 2 推广公司 所有游戏 - if (!$find_rule) { - foreach ($payment_rule as $v) { - if ($v['company_id'] == $company['id'] && $v['game_id'] == 0) { - $rule = $v; - $find_rule = true; -// echo '2'; - break; - } - } - } - // 3 0-内团;1-外团 2-分发联盟 3 无 === 游戏 - if (!$find_rule) { - foreach ($payment_rule as $v) { - if ($v['company_id'] == 0 && $v['company_belong'] == $company['company_belong'] && $v['game_id'] == $baseGameId) { - $rule = $v; - $find_rule = true; -// echo '3'; - break; - } - } - } - - // 3.1 内外团 游戏类型 所有游戏 - if (!$find_rule) { - foreach ($payment_rule as $v) { - if ($v['company_id'] == 0 && $v['company_belong'] == $company['company_belong'] && $v['game_id'] == 0 && $game['game_type_id'] == $v['game_type_id']) { - $rule = $v; - $find_rule = true; -// echo '4'; - break; - } - } - } - - // 4 内外团 所有游戏 - if (!$find_rule) { - foreach ($payment_rule as $v) { - - if ($v['company_id'] == 0 && $v['company_belong'] == $company['company_belong'] && $v['game_id'] == 0) { - $rule = $v; - $find_rule = true; -// echo '5'; - break; - } - } - } - - // 5 游戏 - if (!$find_rule) { - foreach ($payment_rule as $v) { - if ($v['company_id'] == 0 && $v['company_belong'] == -1 && $v['game_id'] == $baseGameId) { - $rule = $v; - $find_rule = true; -// echo '6'; - break; - } - } - } - - // 6 游戏类型 - if (!$find_rule) { - foreach ($payment_rule as $v) { - if ($v['company_id'] == 0 && $v['company_belong'] == -1 && $v['game_id'] == 0 && $v['game_type_id'] == $game['game_type_id']) { - $rule = $v; - $find_rule = true; -// echo '7'; - break; - } - } - } - - // 7 默认 - if (!$find_rule) { - foreach ($payment_rule as $v) { - if ($v['company_id'] == 0 && $v['company_belong'] == -1 && $v['game_id'] == 0 && $v['game_type_id'] == $game['game_type_id']) { - $rule = $v; - $find_rule = true; -// echo '8'; - break; - } - } - } - - if ($find_rule) { -// var_dump($rule); - $merchant_id = $rule['alipay_merchant_id']; - if ($way == 2) - $merchant_id = $rule['weixin_merchant_id']; - if ($way == 3) - $merchant_id = $rule['express_merchant_id']; - - $pay_conf = M('payment_merchant', 'tab_')->where([ - 'id' => $merchant_id - ])->find(); - if (!$pay_conf) { - return ['code' => -2, 'msg' => '找不到对应的支付配置'.$merchant_id, 'data' => []]; - } - return $pay_conf; - } - - return get_default_payment_config($way); - - } - -} //获取微信支付类型 0官方 1金猪wap 2双乾 function get_zfb_type($game_id=0, $user_id=0){ - /* if ($game_id) { + if ($game_id) { $game = M('game', 'tab_')->where(['id' => $game_id])->find(); if ($game && $game['pay_config']) { $payConf = json_decode($game['pay_config'], true); @@ -2198,7 +1994,7 @@ function get_zfb_type($game_id=0, $user_id=0){ return -1; } } - } */ // 取消按游戏区分商户20200716 + } if(C('alipay.status') == 1) {return 0;} $map['name']='goldpig'; diff --git a/Application/Sdk/View/default/Spend/pay_way.html b/Application/Sdk/View/default/Spend/pay_way.html index ba53dec3..234aba5e 100644 --- a/Application/Sdk/View/default/Spend/pay_way.html +++ b/Application/Sdk/View/default/Spend/pay_way.html @@ -30,17 +30,6 @@
- -
-
-
当前支付渠道: {$payname1}
-
当前支付渠道: {$payname2}
-
当前支付渠道: {$payname3}
-
-
- - -
订单金额: ¥{$data['price']}元
@@ -153,9 +142,7 @@
-
-
订单金额: ¥{$data['price']}元
您的账户余额: {$balance+$bind_balance}平台币
diff --git a/ThinkPHP/Library/Org/WeixinSDK/Weixin.class.php b/ThinkPHP/Library/Org/WeixinSDK/Weixin.class.php index 6eb33ad0..4cb406c9 100644 --- a/ThinkPHP/Library/Org/WeixinSDK/Weixin.class.php +++ b/ThinkPHP/Library/Org/WeixinSDK/Weixin.class.php @@ -9,7 +9,7 @@ class Weixin { - public function weixin_pay($title, $order_no, $pay_amount, $trade_type = "NATIVE", $tt = 1, $payConf=array()) + public function weixin_pay($title, $order_no, $pay_amount, $trade_type = "NATIVE", $tt = 1) { //官方 @@ -23,8 +23,7 @@ class Weixin //使用统一支付接口 if ($tt == 1 || $tt == 4) { //扫码 || 超级签h5 $notifyy="notify"; -// $unifiedOrder = new \UnifiedOrder_pub(C('wei_xin.email'), C('wei_xin.partner'), C('wei_xin.key')); - $unifiedOrder = new \UnifiedOrder_pub($payConf['appid'], $payConf['partner'], $payConf['key']); + $unifiedOrder = new \UnifiedOrder_pub(C('wei_xin.email'), C('wei_xin.partner'), C('wei_xin.key')); } else if($tt==2) { //sdk,公众号 $notifyy="notify2";