超级签H5订单优化

master
zhengchanglong 5 years ago
parent 13a4a48c1d
commit 7388a4bbc0

@ -20,10 +20,10 @@ class SsgController extends BaseController {
public function login(){ public function login(){
$user = session("user_auth"); $user = session("user_auth");
if ($user) { if ($user) {
redirect(U("ssg/index")); redirect(U("ssg/index"));
} }
$this->display(); $this->display();
} }
@ -87,32 +87,42 @@ class SsgController extends BaseController {
//首页 //首页
public function index(){ public function index(){
$user = session("user_auth"); $user = session("user_auth");
if (!$user) { if (!$user) {
redirect(U("ssg/login")); redirect(U("ssg/login"));
//$this->error("请登入", U('ssg/login')); //$this->error("请登入", U('ssg/login'));
} }
$map['a.user_id']= $user['user_id']; $map['a.user_id']= $user['user_id'];
$map['a.sdk_version'] = 2; $map['a.sdk_version'] = 2;
$game_list = M("user_play a","tab_")->field("b.*,b.id as game_id")->join("tab_game b on a.game_id=b.id")->where($map)->select(); $game_list = M("user_play a","tab_")->field("b.*,b.id as game_id,od.pay_status")->join("inner join tab_game b on a.game_id=b.id left join tab_game_supersign od on od.user_id=a.user_id and od.game_id=b.id and od.pay_status=1")->where($map)->select();
$this->assign("data_list",$game_list); $this->assign("data_list",$game_list);
$this->display(); $this->display();
} }
public function order(){ public function order(){
//.echo md5(sha1('123456') . 'UmtW6-Z(S^8xvwDn;B:J{X7FG9z2+Np.|C#~QRY"');exit(); //.echo md5(sha1('123456') . 'UmtW6-Z(S^8xvwDn;B:J{X7FG9z2+Np.|C#~QRY"');exit();
$user = session("user_auth"); $user = session("user_auth");
if (!$user) { if (!$user) {
redirect(U("ssg/login")); redirect(U("ssg/login"));
//$this->error("请登入", U('ssg/login')); //$this->error("请登入", U('ssg/login'));
} }
$order_list = M("game_supersign a","tab_")->field("a.order_id, b.game_name, b.icon, b.id as game_id, a.pay_status, a.user_id, a.create_time")->join("left join tab_game b on a.game_id=b.id")->where(array(
$order_list = M("game_supersign a","tab_")->field("a.order_id, b.game_name, b.icon, b.id as game_id, a.pay_status, a.user_id")->join("left join tab_game b on a.game_id=b.id")->where(array( 'a.user_id' => $user['user_id'],
'a.user_id' => $user['user_id'],
))->order("a.id")->select(); ))->order("a.id")->select();
// pp($order_list); // pp($order_list);
foreach ($order_list as $key => $value){
$deff = $this->timediffs(time(),$value['create_time']);
//计算分钟数
if(($deff['day']+ $deff['hour'])>=1 || $deff['min']>30){
$order_list[$key]['invalid']=1;
}else{
$order_list[$key]['invalid']=0;
}
}
$this->assign("data_list", $order_list); $this->assign("data_list", $order_list);
$this->assign("nowtime", time());
$this->display(); $this->display();
} }
@ -135,12 +145,36 @@ class SsgController extends BaseController {
public function rule(){ public function rule(){
$this->display(); $this->display();
} }
// 支付页面 // 支付页面
public function alipay($data) { public function alipay($data) {
$this->assign("url", $data['url']); $this->assign("url", $data['url']);
$this->assign("price", $data['price']); $this->assign("price", $data['price']);
$this->display(); $this->display();
}
public function timediffs($begin_time, $end_time) {
if ($begin_time < $end_time) {
$starttime = $begin_time;
$endtime = $end_time;
} else {
$starttime = $end_time;
$endtime = $begin_time;
}
//计算天数
$timediff = $endtime - $starttime;
$days = intval($timediff / 86400);
//计算小时数
$remain = $timediff % 86400;
$hours = intval($remain / 3600);
//计算分钟数
$remain = $remain % 3600;
$mins = intval($remain / 60);
//计算秒数
$secs = $remain % 60;
$res = array("day" => $days, "hour" => $hours, "min" => $mins, "sec" => $secs);
return $res;
} }
} }

@ -29,6 +29,12 @@
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: 100%; background-size: 100%;
} }
.protect-box .inner{
background-image: url(__IMG__/ssg/box-bg.png);
}
.install-box .inner{
background-image: url(__IMG__/ssg/box-bg2.png);
}
</style> </style>
</head> </head>

@ -11,7 +11,7 @@
<body> <body>
<div class="page-container "> <div class="page-container ">
<div class="top"> <div class="top">
<a href="{:U('order')}" class="link">订单查询</a> <a href="javascript:history.go(-1);"></a><a href="{:U('order')}" class="link">订单查询</a>
</div> </div>
<style> <style>
.interval { .interval {
@ -43,7 +43,7 @@
<div class="product-list"> <div class="product-list">
<ul> <ul>
<volist name="data_list" id="data"> <volist name="data_list" id="data">
<li onclick="handleGameID('{$data.game_id}','{$data.game_name}')"> <li onclick="handleGameID('{$data.game_id}','{$data.game_name}','{$data.pay_status}')">
<dl> <dl>
<dt><img src="{$data['icon']|get_cover='path'}"></dt> <dt><img src="{$data['icon']|get_cover='path'}"></dt>
<dd class="product-title">{$data.game_name}-超级签&nbsp;<i></i></dd> <dd class="product-title">{$data.game_name}-超级签&nbsp;<i></i></dd>
@ -57,6 +57,7 @@
</ul> </ul>
<input type="hidden" id="hdGameID" value="{$data_list[0]['game_id']}"> <input type="hidden" id="hdGameID" value="{$data_list[0]['game_id']}">
<input type="hidden" id="orderStatus" value="{$data_list[0]['pay_status']}">
<script> <script>
</script> </script>
@ -86,16 +87,21 @@
//联系客服 //联系客服
window.location.href = decodeURIComponent("https://www.sobot.com/chat/h5/index.html?sysNum=823d139047674564bfc040e60c4a1a18&color=fa8932&customerFields={'customField8':'" + userID + "'}"); window.location.href = decodeURIComponent("https://www.sobot.com/chat/h5/index.html?sysNum=823d139047674564bfc040e60c4a1a18&color=fa8932&customerFields={'customField8':'" + userID + "'}");
}*/ }*/
function handleGameID(gameID, gameName) { function handleGameID(gameID, gameName,orderStatus) {
var hdGameID = $("#hdGameID").val(); var hdGameID = $("#hdGameID").val();
$("#hdGameID").val(hdGameID == gameID ? 0 : gameID); $("#hdGameID").val(hdGameID == gameID ? 0 : gameID);
$("#orderStatus").val(orderStatus);
$("#txtgamename").text(gameName + "-超级签"); $("#txtgamename").text(gameName + "-超级签");
} }
function handlePay() { function handlePay() {
var hdGameID = $("#hdGameID").val(); var hdGameID = $("#hdGameID").val();
var orderStatus = $("#orderStatus").val();
if (!hdGameID || hdGameID == 0) { if (!hdGameID || hdGameID == 0) {
alert("请选择游戏"); alert("请选择游戏");
} else { } else if(orderStatus==1){
alert("亲~您已购买过了~请到【订单查询】查看订单信息哟~");
}else {
location.href = "/sdk.php/Ipa365/pay/game_id/"+hdGameID; location.href = "/sdk.php/Ipa365/pay/game_id/"+hdGameID;
} }
} }

@ -33,9 +33,12 @@
<dd class="order-title">{$data['game_name']}</dd> <dd class="order-title">{$data['game_name']}</dd>
<if condition="$data['pay_status'] eq '1'"> <if condition="$data['pay_status'] eq '1'">
<dd class="order-status"></dd> <dd class="order-status"></dd>
</if> <else />
<if condition="$data['pay_status'] eq '0'"> <if condition="$data['pay_status'] eq '0' and $data['invalid'] eq 0">
<a href="/sdk.php/Ipa365/pay/game_id/{$data['game_id']}"><dd class="order-pay">立即支付</dd></a> <a href="/sdk.php/Ipa365/pay/game_id/{$data['game_id']}"><dd class="order-pay">立即支付</dd></a>
<else />
<dd class="order-pay" style="color:gray">已失效</dd>
</if>
</if> </if>
<!-- <!--
<dd class="order-pay" style="color:gray">已失效</dd> <dd class="order-pay" style="color:gray">已失效</dd>
@ -45,7 +48,9 @@
</volist> </volist>
</ul> </ul>
<else /> <else />
<div class="no-order"></div> <div class="no-order">
您还没有订单哟~快去下单吧~
</div>
</if> </if>
</div> </div>
<script> <script>

Loading…
Cancel
Save