當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CommonController::checkUser方法代碼示例

本文整理匯總了PHP中CommonController::checkUser方法的典型用法代碼示例。如果您正苦於以下問題:PHP CommonController::checkUser方法的具體用法?PHP CommonController::checkUser怎麽用?PHP CommonController::checkUser使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CommonController的用法示例。


在下文中一共展示了CommonController::checkUser方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: order

 public function order()
 {
     if (isset($_GET['uid']) && isset($_GET['token'])) {
         $_SESSION['uid'] = $_GET['uid'];
         $_SESSION['token'] = $_GET['token'];
     }
     parent::checkUser();
     if (IS_AJAX) {
         parent::checkUser();
         $goods = M('goods')->where('id=' . $_POST['id'])->select();
         $order_details['gid'] = $_POST['id'];
         $order_details['gonum'] = $_POST['num'];
         M('gorder_details')->startTrans();
         $order['uid'] = $_SESSION['uid'];
         $time = explode('-', date('Y-m-d', time()));
         $order['gordernumber'] = $order_details['oid'] = $time[0] . $time[1] . $time[2] . $_SESSION['uid'] . rand(100000, 999999);
         $order['create_time'] = time();
         $order['gostatus'] = 0;
         $order['name'] = $_POST['name'];
         $order['telephone'] = $_POST['telephone'];
         $order['address'] = $_POST['address'];
         $order_details['gdprice'] = $goods[0]['gprice'];
         $order['gototal'] = $_POST['num'] * $goods[0]['gprice'];
         // 生成訂單
         if (M('orders')->data($order)->add() && M('gorder_details')->data($order_details)->add()) {
             M('gorder_details')->commit();
             echo json_encode(1);
             exit;
         } else {
             M('gorder_details')->rollback();
             echo json_encode(0);
             exit;
         }
     }
     if (isset($_GET['uid'])) {
         $_SESSION['uid'] = $_GET['uid'];
     }
     if (isset($_SESSION['uid'])) {
         //分配手機號
         $telephone = M('users')->field('telephone')->where('id=' . $_SESSION['uid'])->select();
         //代付款
         $not_paying = M()->field('orders.id as orders_id,orders.gordernumber,orders.create_time,orders.gototal,goods.gname,goods.gprice,goods.gsize,goods.gcolor,goods.gnum as gnum,goods.id as goods_id,order_details.gonum,order_details.gdprice,goods_face.location_status,goods_face.g_faceurl,goods_face.g_face')->table('kxw_goods as goods,kxw_orders as orders,kxw_gorder_details as order_details,kxw_goods_face as goods_face')->where("orders.gostatus=0 and orders.uid=" . $_SESSION['uid'] . " and orders.gordernumber=order_details.oid and order_details.gid=goods.id and order_details.gid=goods_face.gid and goods_face.status=2")->order('orders.create_time desc')->select();
         //已付款代發貨
         $not_send = M()->field('orders.id as orders_id,orders.gordernumber,orders.create_time,orders.gototal,goods.gname,goods.gprice,goods.gsize,goods.gcolor,goods.id as goods_id,order_details.gonum,order_details.gdprice,goods_face.location_status,goods_face.g_faceurl,goods_face.g_face')->table('kxw_goods as goods,kxw_orders as orders,kxw_gorder_details as order_details,kxw_goods_face as goods_face')->where("orders.gostatus=1 and orders.uid=" . $_SESSION['uid'] . " and orders.gordernumber=order_details.oid and order_details.gid=goods.id and order_details.gid=goods_face.gid and goods_face.status=2")->order('orders.create_time desc')->select();
         //待收貨
         $success_paying = M()->field('orders.create_time,orders.gordernumber,orders.Logistics_code,orders.logistics_number,orders.gototal,goods.gname,goods.gprice,orders.id,goods.gsize,goods.gcolor,order_details.gonum,order_details.gdprice,goods_face.location_status,goods_face.g_faceurl,goods_face.g_face,goods.id as goods_id,orders.Logistics_code as Logistics_code,orders.logistics_number as logistics_number')->table('kxw_goods as goods,kxw_orders as orders,kxw_gorder_details as order_details,kxw_goods_face as goods_face')->where("orders.gostatus=2 and orders.uid=" . $_SESSION['uid'] . " and orders.gordernumber=order_details.oid and order_details.gid=goods.id and order_details.gid=goods_face.gid and goods_face.status=2")->order('orders.create_time desc')->select();
         //已完成訂單
         $complete_paying = M()->field('orders.create_time,orders.logistics_number,orders.Logistics_code,orders.gordernumber,goods.id,goods.gname,goods.gprice,goods.gsize,goods.id,gcolor,order_details.gonum,order_details.gdprice,goods_face.location_status,goods_face.g_faceurl,goods_face.g_face')->table('kxw_goods as goods,kxw_orders as orders,kxw_gorder_details as order_details,kxw_goods_face as goods_face')->where("orders.gostatus=5 and orders.uid=" . $_SESSION['uid'] . " and orders.gordernumber=order_details.oid and order_details.gid=goods.id and order_details.gid=goods_face.gid and goods_face.status=2")->order('orders.pay_time desc')->select();
         if (!$telephone[0]['telephone']) {
             $telephone[0]['telephone'] = '';
         }
         //$tel_q3=substr($telephone[0]['telephone'],0,3);
         //$tel_h4=substr($telephone[0]['telephone'],7);
         $this->assign('tel', $telephone[0]['telephone']);
         $this->assign('telephone', $telephone);
         $this->assign('uid', $_SESSION['uid']);
         $this->assign('not_paying', $not_paying);
         $this->assign('not_send', $not_send);
         $this->assign('success_paying', $success_paying);
         $this->assign('complete_paying', $complete_paying);
         $this->display();
     }
 }
開發者ID:283541486,項目名稱:kaixinwa2.0,代碼行數:63,代碼來源:IndexController.class.php


注:本文中的CommonController::checkUser方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。