diff --git a/Application/Mobile/Controller/SsgController.class.php b/Application/Mobile/Controller/SsgController.class.php index 9432f4630..421996bc4 100644 --- a/Application/Mobile/Controller/SsgController.class.php +++ b/Application/Mobile/Controller/SsgController.class.php @@ -20,10 +20,10 @@ class SsgController extends BaseController { public function login(){ - $user = session("user_auth"); - if ($user) { - redirect(U("ssg/index")); - } + $user = session("user_auth"); + if ($user) { + redirect(U("ssg/index")); + } $this->display(); } @@ -87,32 +87,42 @@ class SsgController extends BaseController { //首页 public function index(){ - $user = session("user_auth"); - if (!$user) { + $user = session("user_auth"); + if (!$user) { redirect(U("ssg/login")); - //$this->error("请登入", U('ssg/login')); - } + //$this->error("请登入", U('ssg/login')); + } $map['a.user_id']= $user['user_id']; $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->display(); } public function order(){ - //.echo md5(sha1('123456') . 'UmtW6-Z(S^8xvwDn;B:J{X7FG9z2+Np.|C#~QRY"');exit(); - $user = session("user_auth"); - if (!$user) { + //.echo md5(sha1('123456') . 'UmtW6-Z(S^8xvwDn;B:J{X7FG9z2+Np.|C#~QRY"');exit(); + $user = session("user_auth"); + if (!$user) { redirect(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")->join("left join tab_game b on a.game_id=b.id")->where(array( - 'a.user_id' => $user['user_id'], + //$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( + 'a.user_id' => $user['user_id'], ))->order("a.id")->select(); // 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("nowtime", time()); $this->display(); } @@ -135,12 +145,36 @@ class SsgController extends BaseController { public function rule(){ $this->display(); } - + // 支付页面 public function alipay($data) { - $this->assign("url", $data['url']); - $this->assign("price", $data['price']); - - $this->display(); + $this->assign("url", $data['url']); + $this->assign("price", $data['price']); + + $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; } } diff --git a/Application/Mobile/View/Ssg/home.html b/Application/Mobile/View/Ssg/home.html index d8167fd66..cecb8ff94 100644 --- a/Application/Mobile/View/Ssg/home.html +++ b/Application/Mobile/View/Ssg/home.html @@ -29,6 +29,12 @@ background-repeat: no-repeat; 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); + } diff --git a/Application/Mobile/View/Ssg/index.html b/Application/Mobile/View/Ssg/index.html index 686c98db7..e6d81a1df 100644 --- a/Application/Mobile/View/Ssg/index.html +++ b/Application/Mobile/View/Ssg/index.html @@ -11,7 +11,7 @@