当前位置: 首页>>代码示例>>PHP>>正文


PHP Orders::add方法代码示例

本文整理汇总了PHP中Orders::add方法的典型用法代码示例。如果您正苦于以下问题:PHP Orders::add方法的具体用法?PHP Orders::add怎么用?PHP Orders::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Orders的用法示例。


在下文中一共展示了Orders::add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionCreate

 public function actionCreate()
 {
     $model = new Orders();
     if (isset($_POST['test'])) {
         $add = $model->add($_POST['test']);
         $this->redirect('orders');
     }
 }
开发者ID:aramharutyunyan1234,项目名称:YiiFramework,代码行数:8,代码来源:OrdersController.php

示例2: order_create

 /**
  * 功能号:12080
  * 订单接口
  * */
 public function order_create()
 {
     COMFilter::$_jump = false;
     $clientmac = $_COOKIE['CLIENTMAC'];
     if (!$clientmac) {
         $boxmac = new COMGetmac();
         // print 'getmac';
         $clientmac = 'M' . $boxmac->getmac();
         setcookie("CLIENTMAC", $clientmac);
     }
     // print $clientmac;
     $clientboxid = intval($_COOKIE['CLIENTBOXID']);
     if (!$clientboxid) {
         $clientbox = new Boxs();
         $one = $clientbox->getOne("mac=?", $clientmac);
         if ($one) {
             $clientboxid = $one->id;
             setcookie("CLIENTMAC", $clientmac);
         }
     }
     $phone = Core::$_dataFilter->valueCheck(Core::get("phone"), "Require,Limit", "手机号不能为空,手机号最多11个字符", false, 11);
     $goodsid = 10001;
     if ($phone) {
         //统计
         Statistics::hitscounter(intval($clientboxid), "logined", "logined");
         $user = new Users();
         $addate = COMCommon::sysTime();
         $one = $user->getOne('user_name=?', $phone);
         if (empty($one)) {
             $id = $user->add($phone, $addate);
         } else {
             $id = $one->id;
         }
         setcookie("CLIENTPHONE", $phone);
         $token = new Users_token();
         //$host = '115.28.92.216';
         $host = $this->_host;
         $network = Core::connect_check($host);
         if ($network) {
             $param = array("m" => 12080, "phone" => $phone, "goods" => $goodsid);
             if (!$clientboxid) {
                 $param['mac'] = $clientmac;
             } else {
                 $param['box'] = $clientboxid;
             }
             $param['at'] = $_SERVER['REQUEST_TIME'];
             $one = $token->getOne("id = ? and end_time - UNIX_TIMESTAMP() > 0", $id);
             if (empty($one)) {
                 $param['pal'] = 1;
             }
             $sign = Core::get_signature($param);
             $param["sign"] = $sign;
             $url = "http://{$host}/tvmv/?m=12080";
             $temp = Core::request_url($url, $param, 1);
             $return = json_decode($temp);
             if ($return->status === 1) {
                 $data = $return->data;
                 if ($data->token) {
                     if (!$data->status) {
                         $order = new Orders();
                         $one = $order->getOne("order_sn=?", $data->ordersn, "pay_time desc");
                         if ($one) {
                             $one->status = 1;
                             $one->pay_time = date("Y-m-d H:i:s", $data->start_time);
                             $flag = $one->save();
                             if ($flag) {
                                 $one = $token->getOne("id = ?", $id);
                                 if ($one) {
                                     $flag = $token->edit(1, $data->ordersn, $data->token, $data->start_time, $data->end_time, 1, $data->code, $id);
                                 } else {
                                     $flag = $token->add($id, 1, $data->ordersn, $data->token, $data->start_time, $data->end_time, 1, $data->code);
                                 }
                                 if ($flag) {
                                     $this->notify_server($one, $data->token);
                                 }
                             }
                         }
                     }
                     setcookie("CLIENTTOKEN", $data->token);
                     $retval['token'] = $data->token;
                     Core::json_result($retval, '已支付');
                 } elseif ($data->ordersn) {
                     $order = new Orders();
                     $one = $order->getOne("order_sn=?", $data->ordersn, "pay_time desc");
                     if (empty($one)) {
                         $orderid = $order->add($data->ordersn, $id, 0, $clientboxid, 0, "", $goodsid, 0, 0, "", 1);
                         if ($orderid) {
                             $ordersn = $data->ordersn;
                         }
                     } else {
                         $ordersn = $one->order_sn;
                     }
                     setcookie("CLIENTORDERSN", $ordersn);
                     $retval['ordersn'] = $ordersn;
                     Core::json_result($retval, '订单生成');
                 }
//.........这里部分代码省略.........
开发者ID:infi000,项目名称:geek,代码行数:101,代码来源:order.class.php


注:本文中的Orders::add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。