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


PHP Order::findOne方法代码示例

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


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

示例1: findModel

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

示例2: __construct

 /**
  * Creates a form model given a order id.
  *
  * @param  string                          $id
  * @param  array                           $config name-value pairs that will be used to initialize the object properties
  * @throws \yii\base\InvalidParamException if waybill sn is empty or not valid
  */
 public function __construct($id, $config = [])
 {
     if (empty($id) || !is_numeric($id)) {
         throw new InvalidParamException('参数错误!');
     }
     $this->_order = Order::findOne(['id' => $id, 'store_id' => Yii::$app->user->identity->store_id]);
     if (!$this->_order) {
         throw new InvalidParamException('您没有该订单!');
     }
     parent::__construct($config);
 }
开发者ID:daixianceng,项目名称:xiaoego.com,代码行数:18,代码来源:CancelOrderForm.php

示例3: __construct

 /**
  * Creates a form model given a order id.
  *
  * @param  string                          $id
  * @param  array                           $config name-value pairs that will be used to initialize the object properties
  * @throws \yii\base\InvalidParamException if waybill sn is empty or not valid
  */
 public function __construct($id, $config = [])
 {
     if (empty($id) || !is_numeric($id)) {
         throw new InvalidParamException('参数错误!');
     }
     $this->_order = Order::findOne($id);
     if (!$this->_order) {
         throw new InvalidParamException('未找到该订单!');
     }
     parent::__construct($config);
 }
开发者ID:daixianceng,项目名称:xiaoego.com,代码行数:18,代码来源:CancelOrderForm.php

示例4: actionShip

 public function actionShip($id)
 {
     $model = Order::findOne(['id' => $id, 'store_id' => Yii::$app->user->identity->store_id]);
     if (!$model) {
         throw new NotFoundHttpException('未找到该订单!');
     }
     if ($model->ship()) {
         Yii::$app->session->setFlash('success', '设置配送成功!');
     } else {
         Yii::$app->session->setFlash('danger', '配送请求失败!');
     }
     return $this->redirect(['view', 'id' => $id]);
 }
开发者ID:daixianceng,项目名称:xiaoego.com,代码行数:13,代码来源:OrderController.php

示例5: actionSuccesspay

 public function actionSuccesspay()
 {
     //      vd(['get' => Yii::$app->request->getQueryParams() ,
     //          'post' => Yii::$app->request->getBodyParams()],1);
     $r = new Request();
     //Yii::info(\yii\helpers\Json::encode($requestData), 'apiRequest');
     \Yii::info('[DEBUG_ME]' . print_r(['get' => $r->getQueryParams(), 'post' => $r->getBodyParams()], true), 'appDebug');
     if ($r->post('action')) {
         vd(['get' => $r->getQueryParams(), 'post' => $r->getBodyParams()], 1);
     }
     $order = Order::findOne($r->post('orderNumber'));
     if ($order) {
     } else {
         vd($order);
     }
     $project = $order->project;
     return $this->render('successpay', ['project' => $project]);
 }
开发者ID:pjoger,项目名称:pon4ik,代码行数:18,代码来源:OrderController.php

示例6: NotifyProcess

 public function NotifyProcess($data, &$msg)
 {
     if (!array_key_exists("transaction_id", $data)) {
         $msg = "输入参数不正确";
         return false;
     }
     //查询订单,判断订单真实性
     //if(!$this->Queryorder($data["transaction_id"])){
     //    $msg = "订单查询失败";
     //    return false;
     //}
     $model = Order::findOne(['order_sn' => $data['out_trade_no'], 'status' => [Order::STATUS_UNPAID, Order::STATUS_CANCELLED]]);
     if ($model) {
         if ($model->pay()) {
             Yii::info("订单支付成功!订单号:{$model->order_sn}");
             return true;
         } else {
             Yii::error("订单支付失败!订单号:{$model->order_sn}");
         }
     }
     return false;
 }
开发者ID:daixianceng,项目名称:xiaoego.com,代码行数:22,代码来源:PayNotifyCallBack.php

示例7: actionTimeout

 public function actionTimeout($order)
 {
     $model = Order::findOne(['user_id' => Yii::$app->user->id, 'order_sn' => $order, 'status' => Order::STATUS_UNPAID]);
     if ($model && $model->cancel('支付超时。')) {
         Yii::$app->session->setFlash('warning', '订单取消,支付超时!');
     }
     return $this->redirect(['/order/detail', 'order' => $order]);
 }
开发者ID:daixianceng,项目名称:xiaoego.com,代码行数:8,代码来源:OrderController.php

示例8: actionWebhooks

 public function actionWebhooks()
 {
     Yii::$app->response->format = Response::FORMAT_RAW;
     $data = file_get_contents("php://input");
     $signature = Yii::$app->request->headers->get('x-pingplusplus-signature');
     $pubKey = file_get_contents(Yii::getAlias(Yii::$app->params['pingpp.publicKeyPath']));
     // Verify signature
     $result = openssl_verify($data, base64_decode($signature), $pubKey, 'sha256');
     if ($result !== 1) {
         Yii::$app->response->statusCode = 403;
         return;
     }
     $event = json_decode($data);
     if (!isset($event->type)) {
         Yii::$app->response->statusCode = 400;
         return;
     }
     switch ($event->type) {
         case "charge.succeeded":
             $charge = $event->data->object;
             $model = Order::findOne(['order_sn' => $charge->order_no]);
             if ($model) {
                 if ($charge->paid && $model->pay()) {
                     $this->_sendMsg($model);
                     Yii::info("订单支付成功!订单号:{$charge->order_no}");
                     return;
                 } else {
                     Yii::error("订单支付失败!订单号:{$charge->order_no}");
                 }
             }
             break;
         default:
             break;
     }
     Yii::$app->response->statusCode = 400;
     return;
 }
开发者ID:daixianceng,项目名称:xiaoego.com,代码行数:37,代码来源:PaymentController.php

示例9: actionCancel

 public function actionCancel($id)
 {
     $order = Order::findOne($id);
     $order->status = -1;
     $order->update();
     return $this->redirect('orders');
 }
开发者ID:md-nurul-islam,项目名称:simple-ecom,代码行数:7,代码来源:MemberController.php

示例10: actionTimeout

 public function actionTimeout($id)
 {
     $model = Order::findOne(['user_id' => Yii::$app->user->id, 'id' => $id, 'status' => Order::STATUS_UNPAID]);
     if ($model && $model->cancel('支付超时。')) {
         return ['status' => 'success', 'data' => ['status' => $model->status, 'statusMsg' => $model->statusMsg]];
     } else {
         return ['status' => 'fail', 'data' => []];
     }
 }
开发者ID:daixianceng,项目名称:xiaoego.com,代码行数:9,代码来源:OrderController.php


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