1.本地生活二维码支付测试
This commit is contained in:
parent
0cb7ee695b
commit
5ecdfd8fbd
@ -658,6 +658,7 @@ class PayLogic extends Logic
|
||||
}
|
||||
//本地商家支付
|
||||
public static function localWxPay($user_id,$post,$client){
|
||||
$post['lid'] = 10;
|
||||
$res = WeChatPayServer::localserverWxPay($user_id,$post, $client);
|
||||
if (false === $res) {
|
||||
return JsonServer::error(WeChatPayServer::getError());
|
||||
@ -665,7 +666,63 @@ class PayLogic extends Logic
|
||||
if ((is_object($res) || is_string($res)) && $client != Client_::pc) {
|
||||
$res = (array)($res);
|
||||
}
|
||||
$data['order_sn'] = createSn('order_trade', 't_sn');
|
||||
$data['order_source'] = 1;
|
||||
$data['pay_way'] = 1;
|
||||
$data['pay_status'] = 0;
|
||||
$data['user_id'] = $user_id;
|
||||
$data['order_amount'] = $post['money'];
|
||||
$data['create_time'] = time();
|
||||
$r = Db::name("recharge_order")->save($data);
|
||||
|
||||
$company = Db::name("local_store")->where("lstore_id",$post['lid'])->where("is_delete",0)->find();
|
||||
$dt['lstore_id'] = $post['lid'];
|
||||
$dt['payment_type'] = $company['bankType'];
|
||||
$dt['total_amount'] = $post['money'];
|
||||
$dt['account_name'] = $company['store_nickname'];
|
||||
$dt['bank_name'] = $company['bankName'];
|
||||
$dt['bank_card'] = $company['bankCard'];
|
||||
$dt['large_number'] = $company['largeNumber'];
|
||||
$dt['separate_account'] = round($post['money']*0.6,2);
|
||||
$dt['create_time'] = date("Y-m-d H:i:s");
|
||||
$dt['user_id'] = $user_id;
|
||||
$r = Db::name("local_store_order")->save($dt);
|
||||
// 基本户 5%
|
||||
$dt1['lstore_id'] = $post['lid'];
|
||||
$dt1['payment_type'] = 1;
|
||||
$dt1['account_name'] = "东龙汇";
|
||||
$dt1['bank_name'] = "中国工商银行";
|
||||
$dt1['bank_card'] = "1204068809100138961";
|
||||
$dt1['large_number'] = "102335006882";
|
||||
$dt1['separate_account'] = round($post['money']*0.08,2);
|
||||
$dt1['create_time'] = date("Y-m-d H:i:s");
|
||||
$dt1['user_id'] = $user_id;
|
||||
$dt1['local_our_company'] = 1;
|
||||
$r1 = Db::name("local_store_order")->save($dt1);
|
||||
// 22% 一般户
|
||||
$dt2['lstore_id'] = $post['lid'];
|
||||
$dt2['payment_type'] = 1;
|
||||
$dt2['account_name'] = "东龙汇";
|
||||
$dt2['bank_name'] = "中国工商银行";
|
||||
$dt2['bank_card'] = "1204064019200152507";
|
||||
$dt2['large_number'] = "102335006405";
|
||||
$dt2['separate_account'] = round($post['money']*0.22,2);
|
||||
$dt2['create_time'] = date("Y-m-d H:i:s");
|
||||
$dt2['user_id'] = $user_id;
|
||||
$dt2['local_our_company'] = 1;
|
||||
$r2 = Db::name("local_store_order")->save($dt2);
|
||||
// 10% 一般户
|
||||
$dt3['lstore_id'] = $post['lid'];
|
||||
$dt3['payment_type'] = 1;
|
||||
$dt3['account_name'] = "东龙汇";
|
||||
$dt3['bank_name'] = "中国工商银行";
|
||||
$dt3['bank_card'] = "1204064419000115357";
|
||||
$dt3['large_number'] = "102335006448";
|
||||
$dt3['separate_account'] = round($post['money']*0.1,2);
|
||||
$dt3['create_time'] = date("Y-m-d H:i:s");
|
||||
$dt3['user_id'] = $user_id;
|
||||
$dt3['local_our_company'] = 1;
|
||||
$r3 = Db::name("local_store_order")->save($dt3);
|
||||
if (is_string($res)) {
|
||||
$data = [
|
||||
'code' => 1,
|
||||
@ -678,6 +735,7 @@ class PayLogic extends Logic
|
||||
|
||||
return JsonServer::success('微信支付发起成功', $res, 1);
|
||||
}
|
||||
|
||||
// 本地生活余额支付
|
||||
public static function localBalance($user_id,$post){
|
||||
$user_balance = User::where(['id' => $user_id])->value('user_money');
|
||||
@ -703,6 +761,7 @@ class PayLogic extends Logic
|
||||
$dt['account_name'] = $company['store_nickname'];
|
||||
$dt['bank_name'] = $company['bankName'];
|
||||
$dt['bank_card'] = $company['bankCard'];
|
||||
$dt['total_amount'] = $post['money'];
|
||||
$dt['large_number'] = $company['largeNumber'];
|
||||
$dt['separate_account'] = round($post['money']*0.6,2);
|
||||
$dt['create_time'] = date("Y-m-d H:i:s");
|
||||
@ -725,6 +784,7 @@ class PayLogic extends Logic
|
||||
$dt1['create_time'] = date("Y-m-d H:i:s");
|
||||
$dt1['user_id'] = $user_id;
|
||||
$dt1['state'] = 1;
|
||||
$dt1['local_our_company'] = 1;
|
||||
$r1 = Db::name("local_store_order")->save($dt1);
|
||||
if (!$r1) {
|
||||
Db::rollback();
|
||||
@ -741,6 +801,7 @@ class PayLogic extends Logic
|
||||
$dt2['create_time'] = date("Y-m-d H:i:s");
|
||||
$dt2['user_id'] = $user_id;
|
||||
$dt2['state'] = 1;
|
||||
$dt2['local_our_company'] = 1;
|
||||
$r2 = Db::name("local_store_order")->save($dt2);
|
||||
if (!$r2) {
|
||||
Db::rollback();
|
||||
@ -757,6 +818,7 @@ class PayLogic extends Logic
|
||||
$dt3['create_time'] = date("Y-m-d H:i:s");
|
||||
$dt3['user_id'] = $user_id;
|
||||
$dt3['state'] = 1;
|
||||
$dt3['local_our_company'] = 1;
|
||||
$r3 = Db::name("local_store_order")->save($dt3);
|
||||
if (!$r3) {
|
||||
Db::rollback();
|
||||
|
||||
@ -164,6 +164,8 @@ class WeChatPayServer
|
||||
'openid' => $auth['openid'] ?? '',
|
||||
'attach' => 'trade'
|
||||
];
|
||||
print_r("<pre>");
|
||||
var_dump($attributes);
|
||||
$attributes['out_trade_no'] = "dlh".time().$user_id. $attributes['trade_type'] . $client;
|
||||
$result = $app->order->unify($attributes);
|
||||
// var_dump($result);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user