diff --git a/Application/Sdk/Controller/BaseController.class.php b/Application/Sdk/Controller/BaseController.class.php index b3d3a391..d04caafc 100644 --- a/Application/Sdk/Controller/BaseController.class.php +++ b/Application/Sdk/Controller/BaseController.class.php @@ -319,13 +319,13 @@ class BaseController extends RestController{ } else { switch ($result['code']) { case 1021:{ - $this->set_message(1010,"fail","验证码已失效,请重新获取"); + $this->new_set_message(1010,"验证码已失效,请重新获取"); };break; case 1022:{ - $this->set_message(1022,"fail","验证码不正确,请重新输入"); + $this->new_set_message(1022,"验证码不正确,请重新输入"); };break; default: - $this->set_message($result['code'],"fail",$result['msg']); + $this->new_set_message($result['code'],$result['msg']); } } diff --git a/Application/Sdk/Controller/ExchangeController.class.php b/Application/Sdk/Controller/ExchangeController.class.php index 502392d4..e8c5bb03 100644 --- a/Application/Sdk/Controller/ExchangeController.class.php +++ b/Application/Sdk/Controller/ExchangeController.class.php @@ -83,8 +83,10 @@ class ExchangeController extends BaseController{ // $url = C('PAY_DOMAIN') . '/sdk.php?s=/Spend/'.$payPage.'&user_id='.$request['user_id'].'&game_id='.$request['game_id'].'&type=1'.'&user_token='.$userToken.'&action=pay'; file_put_contents("./Application/Sdk/OrderNo/".$request['user_id']."-".$request['game_id'].".txt",think_encrypt(json_encode($request))); - $url = C('PAY_DOMAIN') . '/sdk.php?s=/userH/platform_pay/account/'.$request['account'].'&user_token='.$userToken.'&game_id='.$request['game_id'].'&money='.$request['price'].'&action=pay1&api_ver=1'; - echo base64_encode(json_encode(array('status'=>200,'out_trade_no'=>$out_trade_no,'img'=>$url))); +// $url = C('PAY_DOMAIN') . '/sdk.php?s=/userH/platform_pay/account/'.$request['account'].'&user_token='.$userToken.'&game_id='.$request['game_id'].'&money='.$request['price'].'&action=pay1&api_ver=1'; +// echo base64_encode(json_encode(array('status'=>200,'out_trade_no'=>$out_trade_no,'img'=>$url))); + echo base64_encode(json_encode(array('status'=>200,'out_trade_no'=>$out_trade_no,'img'=>C('PAY_DOMAIN').'/sdk.php?s=/Spend/pay_way_v1&user_id='.$request['user_id'].'&game_id='.$request['game_id'].'&type=1'.'&user_token='.$userToken)));exit; + exit; } else { diff --git a/Application/Sdk/Controller/NoticeController.class.php b/Application/Sdk/Controller/NoticeController.class.php index f07cd487..fde269fc 100644 --- a/Application/Sdk/Controller/NoticeController.class.php +++ b/Application/Sdk/Controller/NoticeController.class.php @@ -46,7 +46,7 @@ class NoticeController extends BaseController{ $notice_list = $notice ->field('id as notice_id,title,start_time as create_time,1 as type') ->where($map) - ->order('level desc') + ->order('level desc,create_time desc') ->select(); $notice_read_model = M('notice_read', 'tab_'); $notice_read = M('notice_read', 'tab_') diff --git a/Application/Sdk/Controller/PayH5Controller.class.php b/Application/Sdk/Controller/PayH5Controller.class.php index 94f9b122..3d8ffaff 100644 --- a/Application/Sdk/Controller/PayH5Controller.class.php +++ b/Application/Sdk/Controller/PayH5Controller.class.php @@ -622,7 +622,7 @@ ADD COLUMN `pay_url` text NULL AFTER `check_sign`; $is_pay = json_decode($weixn->weixin_pay("充值", $request['pay_order_number'], $pay_amount, 'MWEB'), true); if($is_pay['status']==1){ - $json_data['url'] = $is_pay['mweb_url'].'&redirect_url='.C('PAY_DOMAIN')."sdk.php/Spend/paycallback/orderno/{$request['pay_order_number']}/user_token/".$this->userToken."/paytype/weixinpay"; + $json_data['url'] = $is_pay['mweb_url'].'&redirect_url='.C('PAY_DOMAIN')."sdk.php/Spend/paycallback/orderno/{$request['pay_order_number']}/user_token/".$this->userToken."/paytype/weixinpay/game_id/{$game_id}"; $request['pay_url'] = $json_data['url']; $this->add_deposit($request, 1); // .(is_ssl()?'https%3A%2F%2F':'http%3A%2F%2F'). $_SERVER ['HTTP_HOST'] . "%2Fsdk.php%2FSpend%2Fpay_success%2Forderno%2F".$request['pay_order_number'].'%2Fgame_id%2F'.$request['game_id'] ; 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 (); + } + /** * 支付页面 * diff --git a/Application/Sdk/View/default/Spend/pay_way_v1.html b/Application/Sdk/View/default/Spend/pay_way_v1.html new file mode 100644 index 00000000..eea05953 --- /dev/null +++ b/Application/Sdk/View/default/Spend/pay_way_v1.html @@ -0,0 +1,249 @@ + + + +
+ + +