|
|
|
@ -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 ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 支付页面
|
|
|
|
|
*
|
|
|
|
|