From bdb8e34cdde03e65263c6eb13e340c9a03d82f54 Mon Sep 17 00:00:00 2001 From: tpingzhang <635929049@qq.com> Date: Tue, 12 Nov 2019 16:28:34 +0800 Subject: [PATCH] =?UTF-8?q?ios=20=E5=85=BC=E5=AE=B9=E6=97=A7=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sdk/Controller/SpendController.class.php | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/Application/Sdk/Controller/SpendController.class.php b/Application/Sdk/Controller/SpendController.class.php index e5bfe836..f9f45fcc 100644 --- a/Application/Sdk/Controller/SpendController.class.php +++ b/Application/Sdk/Controller/SpendController.class.php @@ -112,6 +112,44 @@ class SpendController extends Controller { } + public function pay_way_v1() { + $user_id = I ('user_id'); + $game_id = I ('game_id'); + + $file = file_get_contents ( "./Application/Sdk/OrderNo/" . $user_id . "-" . $game_id . ".txt" ); + $request = json_decode ( think_decrypt ( $file ), true ); + + $data = array( + 'coin' => $request ['body'], + 'price' => $request ['price'], + 'game_name' => $request ['game_name'], + 'code' => $request ['code'] + ); + $balance = M ( 'user', 'tab_' )->where ( array ( + 'id' => $user_id + ) )->getField ( 'balance' ); + $bind_balance = M ( 'user_play', 'tab_' )->where ( array ( + 'user_id' => $user_id, + 'game_id' => $game_id + ) )->getField ( 'bind_balance' ); + // $data['price'] = 1; + + $this->assign ( 'balance', $balance ); + $this->assign ( 'bind_balance', $bind_balance ); + $this->assign ( 'data', $data ); + $this->assign ( 'btncolor', $request ['btncolor'] ); + if ($balance + $bind_balance > $data['price']) { + $this->assign ('pay_price', 0); // 是否第三方支付 + } else { + $payPrice = $data['price'] - $balance - $bind_balance; + $this->assign ('pay_price', $payPrice ? $payPrice : 0); + } + + /* $this->assign ( 'alipayurl', $ret[0]['payURL']); + header("Access-Control-Allow-Origin: *"); */ + $this->display (); + } + /** * 支付页面 *