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


PHP Order::findOne方法代码示例

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


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

示例1: findModel

 protected function findModel($id)
 {
     if (($model = Order::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
开发者ID:royutoan,项目名称:pianodanang,代码行数:8,代码来源:OrderController.php

示例2: actionOrder

 public function actionOrder($id)
 {
     /** @var Order $model */
     $model = Order::findOne($id);
     if (!is_null($model)) {
         if (!is_null($model->orderShipping)) {
             if ($model->orderShipping->shipping_email != $this->getDestinationAccount()->email) {
                 $model = null;
             }
         } else {
             $model = null;
         }
     }
     if (isset($_REQUEST['output']) && $_REQUEST['output'] == 'print') {
         $this->layout = 'print';
         return $this->render('order_print', ['model' => $model]);
     } else {
         return $this->render('order', ['model' => $model]);
     }
 }
开发者ID:rcjusto,项目名称:simplestore,代码行数:20,代码来源:DefaultController.php

示例3: actionReOrder

 public function actionReOrder($id)
 {
     if (!is_null($user = $this->getLoggedUser())) {
         /** @var Order $model */
         $model = Order::findOne($id);
         if (!is_null($model) && $model->user_id == $user->id) {
             $shopCart = $this->getShoppingCart();
             foreach ($model->orderProducts as $item) {
                 if (!is_null($product = $item->product)) {
                     $shopCart->addProduct($product, $item->quantity, '');
                 }
             }
             return $this->redirect(['shopcart/index']);
         } else {
             return $this->redirect(['user/orders']);
         }
     } else {
         return $this->redirect(['site/register']);
     }
 }
开发者ID:rcjusto,项目名称:simplestore,代码行数:20,代码来源:UserController.php

示例4: actionUpdate

 /**
  * Updating order
  * User have to give order_id to program know which record is to update
  * Other attributes is optional and will update it value
  */
 public function actionUpdate()
 {
     $role = UserRoleDetector::getUserRole();
     Yii::$app->response->format = Response::FORMAT_JSON;
     if ($role != 3 && $role != 4) {
         echo json_encode(array('error_code' => Codes::$UNAUTHORIZED, 'errors' => StatusCodeMessage::$UNAUTHORIZED), JSON_PRETTY_PRINT);
     } else {
         $params = $_REQUEST;
         if (!isset($params['order_id'])) {
             $this->setHeader(CODES::$BAD_REQUEST);
             echo json_encode(array('status_code' => CODES::$BAD_REQUEST, 'message' => StatusCodeMessage::$BAD_REQUEST), JSON_PRETTY_PRINT);
             exit;
         } else {
             if (($order = Order::findOne(['order_id' => $params['order_id']])) != null) {
                 if (isset($params['user_id'])) {
                     $order->user_id = $params['user_id'];
                 }
                 if (isset($params['user_info'])) {
                     $order->user_info = $params['user_info'];
                 }
                 if (isset($params['restaurant_id'])) {
                     $order->restaurant_id = $params['restaurant_id'];
                 }
                 if (isset($params['order_info'])) {
                     $order->order_info = $params['order_info'];
                 }
                 if (isset($params['status'])) {
                     $order->status = $params['status'];
                 }
                 $order->save();
                 echo json_encode(array('status_code' => CODES::$OK, 'message' => StatusCodeMessage::$OK), JSON_PRETTY_PRINT);
             } else {
                 echo json_encode(array('status_code' => CODES::$NOT_FOUND, 'message' => StatusCodeMessage::$NOT_FOUND), JSON_PRETTY_PRINT);
                 exit;
             }
         }
     }
 }
开发者ID:vodas,项目名称:praktykigda,代码行数:43,代码来源:OrderController.php

示例5: actionGetTicketInfo

 public function actionGetTicketInfo()
 {
     $type_user = $this->get["type_user"];
     if ($type_user == 1) {
         $name_table = new Customs();
     } elseif ($type_user == 2) {
         $name_table = new Bankir();
     }
     $controller = $name_table::findOne(["token" => $this->get["token"]]);
     if (!$controller) {
         $r = $this->setError(205);
     } else {
         $RelOrderPeople = RelOrderPeople::findOne(["qr" => $this->get["qr"]]);
         if (!$RelOrderPeople) {
             $r = $this->setError(501);
         } else {
             $r["status"] = "ok";
             if ($RelOrderPeople->type_people == 1) {
                 $type_people = new Parents();
                 $r["type_people"] = "Adult";
             } elseif ($RelOrderPeople->type_people == 2) {
                 $type_people = new Kids();
                 $r["type_people"] = "Kids";
             }
             $order = Order::findOne($RelOrderPeople->id_order);
             $people = $type_people::findOne($RelOrderPeople->id_people);
             $r["name"] = $people->name;
             $r["surname"] = $people->surname;
             $r["father_name"] = $people->father_name;
             $dt_txt = date("Y-m-d", $people->birthday);
             $datetime1 = date_create($dt_txt);
             $datetime2 = date_create();
             $interval = date_diff($datetime1, $datetime2);
             $r["birthday"] = $interval->format('%y') . " лет (" . date("d.m.Y", $people->birthday) . ")";
             $r["phone"] = $people->phone;
             $r["summ"] = $RelOrderPeople->summ / 100;
             $r["pitanie"] = $RelOrderPeople->pitanie;
             $r["status_enter"] = $RelOrderPeople->status;
             $r["status_money"] = $RelOrderPeople->status_money;
             $r["count_hours"] = $order->count_hours;
             if ($RelOrderPeople->type_people == 2) {
                 $r["money"] = 50;
             } else {
                 $r["money"] = 0;
             }
             $type_tiket = TypeTicket::findOne($RelOrderPeople->type_tiket);
             $r["type_tiket"] = $type_tiket->name;
             $d = $order->date;
             $date1 = date("d.m.Y", $d);
             $date2 = date("d.m.Y", mktime(0, 0, 0, date("m", $d) + 6, date("d", $d), date("Y", $d)));
             $r["date1"] = $date1;
             $r["date2"] = $date2;
         }
     }
     return json_encode($r);
 }
开发者ID:kidskazan,项目名称:masterslavl,代码行数:56,代码来源:ApiController.php

示例6: actionTestResult

 public function actionTestResult($id)
 {
     $order = Order::findOne($id);
     return $this->render('order_result', ['model' => $order]);
 }
开发者ID:rcjusto,项目名称:simplestore,代码行数:5,代码来源:ShopcartController.php

示例7: findModel

 /**
  * Finds the Order model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $id
  * @return Order the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     $model = new Order();
     $model->scenario = Order::SCENARIO_READ;
     if (($model = Order::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
开发者ID:vodas,项目名称:praktykigda,代码行数:17,代码来源:OrderController.php

示例8: actionFinishorder

 /**
  *完成一个订单 (厨师用)
  */
 public function actionFinishorder()
 {
     $o_id = $_POST['o_id'];
     $order = Order::findOne($o_id);
     $order->e_time = date('y-m-d h:i:s', time());
     if ($order === null) {
         throw new NotFoundHttpException();
     }
     if ($order->save()) {
         echo 'success';
         // 获取用户输入的数据,验证并保存
     }
 }
开发者ID:trieyouth,项目名称:basic,代码行数:16,代码来源:OrderController.php

示例9: actionUpdateAuditStatu

 public function actionUpdateAuditStatu()
 {
     $id = Yii::$app->request->post('pk');
     //$name = Yii::$app->request->post('name');
     $value = Yii::$app->request->post('value');
     $order = Order::findOne($id);
     if ($order->statu != Order::$_AUDIT_PEND) {
         $result = ['status' => 'error', 'msg' => '该商品已审核!'];
         echo json_encode($result);
         return;
     }
     $order->statu = $value;
     if ($order->save()) {
         $total_num = Order::find()->where('shop = :shop and commodity = :commodity and statu = :statu', [':shop' => $order->shop, ':commodity' => $order->commodity, ':statu' => Order::$_AUDIT_ACCESS])->count();
         $fact_fee = Order::find()->where('shop = :shop and commodity = :commodity and statu = :statu', [':shop' => $order->shop, ':commodity' => $order->commodity, ':statu' => Order::$_AUDIT_ACCESS])->sum('fee');
         $total_income = Order::find()->where('shop = :shop and commodity = :commodity and statu = :statu', [':shop' => $order->shop, ':commodity' => $order->commodity, ':statu' => Order::$_AUDIT_ACCESS])->sum('money');
         $statistics = Statistics::find()->where('shop = :shop and commodity = :commodity', [':shop' => $order->shop, ':commodity' => $order->commodity])->one();
         if (!empty($statistics)) {
             $statistics->total_num = $total_num;
             $statistics->fact_fee = $fact_fee;
             //intval($order->fee);
             $statistics->total_income = $total_income;
             //floatval($order->money);
             $statistics->save();
         }
     }
     $result = ['status' => 'sucess'];
     echo json_encode($result);
 }
开发者ID:vilison,项目名称:yii2-order,代码行数:29,代码来源:OrderController.php

示例10: actionSertificat

 public function actionSertificat()
 {
     $model = new Order();
     $city = City::find()->All();
     $arrCity = array();
     $error = array();
     $msg = array();
     $price_kids = PriceSertificate::findOne(["name" => "kids"]);
     $price_adult = PriceSertificate::findOne(["name" => "adult"]);
     if (count($city)) {
         foreach ($city as $val) {
             $arrCity[$val->id] = $val->name;
         }
     }
     $post = Yii::$app->request->post();
     if (isset($post["Order"])) {
         $post = $post["Order"];
         foreach ($post as $key => $value) {
             $model->{$key} = $value;
         }
         if ($post["id_city"] == "") {
             $error["id_city"] = 1;
         }
         if ($post["count_kids"] == "") {
             $error["count_kids"] = 1;
         }
         if ($post["count_adult"] == "") {
             $error["count_adult"] = 1;
         }
         if (count($error) == 0) {
             $session = Yii::$app->session;
             $model->date = time();
             $model->type_ticket = $_REQUEST["type_ticket"];
             $model->id_user = Yii::$app->user->id;
             $model->save();
             $model_id = $model->id;
             $session["order_id"] = $model_id;
             $order = Order::findOne($model_id);
             if (isset($_REQUEST["pay"])) {
                 if ($ch = @curl_init()) {
                     $url = Url::base("http") . "/index.php?r=online-pay/finish&orderId=" . $order->id;
                     $id_order = $order->id;
                     $amount = (int) $_REQUEST["Order"]["summ"] * 100;
                     @curl_setopt($ch, CURLOPT_URL, 'https://securepayments.sberbank.ru/payment/rest/register.do?userName=masterslavl-api&password=shrjkisi&orderNumber=' . $id_order . '&amount=' . $amount . '&returnUrl=' . $url);
                     @curl_setopt($ch, CURLOPT_HEADER, false);
                     @curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
                     @curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
                     @curl_setopt($ch, CURLOPT_USERAGENT, 'Masterslavl');
                     $data = @curl_exec($ch);
                     $dt = json_decode($data);
                     @curl_close($ch);
                     if (isset($dt->orderId)) {
                         if (isset($_REQUEST["date_enter"])) {
                             $order->date = strtotime($_REQUEST["date_enter"]);
                             $order->save();
                         }
                         $order->summ = $amount;
                         $order->bankOrderId = $dt->orderId;
                         $order->bankFormUrl = $dt->formUrl;
                         $order->save();
                         $this->redirect($dt->formUrl);
                     } elseif ($order->bankFormUrl != "") {
                         $this->redirect($order->bankFormUrl);
                     }
                 }
             }
         }
     }
     $options_tiket = GeneralOptions::findOne(["name" => "gen_options_tikets"]);
     $opt_val = $options_tiket->value;
     $TypeHours = TypeHours::find()->where(["options" => $opt_val])->all();
     foreach ($TypeHours as $val) {
         $type_hours[$val->id] = $val->value;
     }
     return $this->render('sertificat', ['model' => $model, 'p_kids' => $price_kids, 'p_adult' => $price_adult]);
 }
开发者ID:kidskazan,项目名称:masterslavl,代码行数:76,代码来源:OnlinePayController.php


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