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


PHP Order::find方法代码示例

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


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

示例1: actionIndex

 public function actionIndex()
 {
     $dataProvider = new ActiveDataProvider(['query' => Order::find()->limit(10)->where(['status' => Order::STATUS_NEW])]);
     $productModel = new Product(['scenario' => 'create']);
     $productModel->date = date('Y-m-d H:i');
     return $this->render('index', ['dataProvider' => $dataProvider, 'categoryModel' => new Category(), 'productModel' => $productModel]);
 }
开发者ID:cyanofresh,项目名称:yii2shop,代码行数:7,代码来源:SiteController.php

示例2: actionIndex

 public function actionIndex()
 {
     $last15days = [];
     $last6Month = [];
     $numDataOrder = [];
     // 订单生成数据
     $numDataVolume = [];
     // 营业额数据
     $numDataCompleted = [];
     // 订单完成数据
     $numDataVolumeMonth = [];
     // 每月营业额
     $today = strtotime("00:00:00");
     $todayEnd = strtotime("23:59:59");
     for ($i = 0; $i < 15; $i++) {
         $timestrap = strtotime('-' . $i . ' days', $today);
         $timestrapEnd = strtotime('-' . $i . ' days', $todayEnd);
         $where = ['and', ['store_id' => Yii::$app->user->identity->store_id], ['>=', 'created_at', $timestrap], ['<=', 'created_at', $timestrapEnd]];
         array_unshift($last15days, date('m/d', $timestrap));
         array_unshift($numDataOrder, Order::find()->where($where)->count());
         $data = OrderVolume::find()->select(['sum(volume) AS volume', 'count(*) AS count'])->where($where)->asArray()->one();
         array_unshift($numDataVolume, $data['volume']);
         array_unshift($numDataCompleted, $data['count']);
     }
     for ($i = 0; $i < 6; $i++) {
         $timestrap = strtotime("first day of -{$i} month", $today);
         $timestrapEnd = strtotime("last day of -{$i} month", $todayEnd);
         $where = ['and', ['store_id' => Yii::$app->user->identity->store_id], ['>=', 'created_at', $timestrap], ['<=', 'created_at', $timestrapEnd]];
         array_unshift($last6Month, date('Y/m', $timestrap));
         array_unshift($numDataVolumeMonth, OrderVolume::find()->where($where)->sum('volume'));
     }
     $data2 = OrderVolume::find()->select(['sum(volume) AS volume', 'count(*) AS count'])->where(['store_id' => Yii::$app->user->identity->store_id])->asArray()->one();
     return $this->render('index', ['model' => Yii::$app->user->identity->store, 'last15days' => $last15days, 'last6Month' => $last6Month, 'numDataOrder' => $numDataOrder, 'numDataVolume' => $numDataVolume, 'numDataCompleted' => $numDataCompleted, 'numDataVolumeMonth' => $numDataVolumeMonth, 'countOrder' => Order::getCountByStoreId(Yii::$app->user->identity->store_id), 'countCompleted' => $data2['count'], 'sumVolume' => $data2['volume']]);
 }
开发者ID:daixianceng,项目名称:xiaoego.com,代码行数:34,代码来源:SiteController.php

示例3: actionComplete

 /**
  * 完成超过2小时未收货的订单,每小时执行一次
  * 
  * @return string
  */
 public function actionComplete()
 {
     $transaction = Yii::$app->db->beginTransaction();
     try {
         $twelveHoursAgo = time() - 3600 * 2;
         $orders = Order::find()->where(['and', ['status' => Order::STATUS_SHIPPED], ['<=', 'created_at', $twelveHoursAgo]])->all();
         $count1 = 0;
         $count2 = 0;
         foreach ($orders as $key => $order) {
             if ($order->complete()) {
                 $count1++;
             } else {
                 $count2++;
             }
             unset($orders[$key]);
         }
         $transaction->commit();
         echo "{$count1} of orders affected by the execution, {$count2} fails.\n";
         return static::EXIT_CODE_NORMAL;
     } catch (\Exception $e) {
         $transaction->rollBack();
         echo $e->getMessage();
         return static::EXIT_CODE_ERROR;
     }
 }
开发者ID:daixianceng,项目名称:xiaoego.com,代码行数:30,代码来源:OrderController.php

示例4: __construct

 /**
  * Creates a form model given an 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 order id is not valid
  */
 public function __construct($id, $config = [])
 {
     $this->_order = Order::find()->where(['and', ['id' => $id], ['user_id' => Yii::$app->user->id], ['<>', 'status', Order::STATUS_DELETED]])->one();
     if (!$this->_order) {
         throw new InvalidParamException('您没有该订单!');
     }
     parent::__construct($config);
 }
开发者ID:shunzi250,项目名称:xiaoego.com,代码行数:15,代码来源:PayOrderForm.php

示例5: actionSelect

 public function actionSelect($id, $hallid)
 {
     $res = Order::find()->select('session_id')->where(['session_id' => $id])->one();
     if (!empty($res)) {
         \Yii::$app->db->createCommand("UPDATE `order` SET `seats`=:status WHERE `session_id`=:id")->bindValue(':id', $id)->bindValue(':status', $hallid)->execute();
     } else {
         \Yii::$app->db->createCommand()->insert('order', ['session_id' => $id, 'seats' => $hallid])->execute();
     }
 }
开发者ID:saqbest,项目名称:advanced,代码行数:9,代码来源:SessionController.php

示例6: actionIndex

 public function actionIndex()
 {
     $orders = Order::find()->where(['user_id' => Yii::$app->user->id])->limit(2)->all();
     $productIds = ArrayHelper::map(Favorite::find()->where(['user_id' => Yii::$app->user->id])->orderBy(['id' => SORT_DESC])->asArray()->all(), 'product_id', 'product_id');
     if (count($productIds)) {
         $favorites = Product::find()->where(['id' => $productIds])->limit(5)->all();
     }
     $coupons = Coupon::find()->where(['and', 'user_id = ' . Yii::$app->user->id, 'used_at = 0', 'ended_at >= ' . time()])->all();
     return $this->render('index', ['orders' => $orders, 'favorites' => isset($favorites) ? $favorites : null, 'coupons' => $coupons]);
 }
开发者ID:liangdabiao,项目名称:funshop,代码行数:10,代码来源:UserController.php

示例7: search

 public function search($params)
 {
     $query = Order::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'user_id' => $this->user_id, 'summ' => $this->summ, 'status_index' => $this->status_index, 'created_datetime' => $this->created_datetime, 'finished_datetime' => $this->finished_datetime]);
     return $dataProvider;
 }
开发者ID:kibercoder,项目名称:bilious-octo-fibula,代码行数:10,代码来源:OrderSearch.php

示例8: __construct

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

示例9: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Order::find()->orderBy('id DESC');
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', 'phone', $this->phone])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'notes', $this->notes])->andFilterWhere(['like', 'status', $this->status]);
     return $dataProvider;
 }
开发者ID:ibrarturi,项目名称:yii2-shop,代码行数:18,代码来源:OrderSearch.php

示例10: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Order::find();
     $query->orderBy(['created_at' => SORT_DESC]);
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if ($this->load($params) && !$this->validate()) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'user_id' => $this->user_id, 'country' => $this->country, 'province' => $this->province, 'city' => $this->city, 'district' => $this->district, 'payment_method' => $this->payment_method, 'payment_status' => $this->payment_status, 'payment_id' => $this->payment_id, 'payment_fee' => $this->payment_fee, 'shipment_status' => $this->shipment_status, 'shipment_id' => $this->shipment_id, 'shipment_fee' => $this->shipment_fee, 'amount' => $this->amount, 'tax' => $this->tax, 'status' => $this->status, 'paid_at' => $this->paid_at, 'shipped_at' => $this->shipped_at, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, 'created_by' => $this->created_by, 'updated_by' => $this->updated_by]);
     $query->andFilterWhere(['like', 'sn', $this->sn])->andFilterWhere(['like', 'consignee', $this->consignee])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'zipcode', $this->zipcode])->andFilterWhere(['like', 'phone', $this->phone])->andFilterWhere(['like', 'mobile', $this->mobile])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'remark', $this->remark])->andFilterWhere(['like', 'payment_name', $this->payment_name])->andFilterWhere(['like', 'shipment_name', $this->shipment_name])->andFilterWhere(['like', 'invoice', $this->invoice]);
     return $dataProvider;
 }
开发者ID:liangdabiao,项目名称:funshop,代码行数:19,代码来源:OrderSearch.php

示例11: actionMy

 public function actionMy()
 {
     if (\Yii::$app->user->isGuest) {
         throw new NotFoundHttpException();
     } else {
         $query = Order::find()->where(['and', ['user_id' => \Yii::$app->user->getId()], ['not', ['closed_at' => null]]]);
         $pagination = new Pagination(['defaultPageSize' => 5, 'totalCount' => $query->count()]);
         $orders = $query->with('project')->orderBy('closed_at DESC')->offset($pagination->offset)->limit($pagination->limit)->all();
         //        vd($orders);
         return $this->render('my', ['orders' => $orders, 'pagination' => $pagination]);
     }
 }
开发者ID:pjoger,项目名称:pon4ik,代码行数:12,代码来源:OrderController.php

示例12: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Order::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'goods_id' => $this->goods_id, 'user_id' => $this->user_id, 'active' => $this->active, 'datetime' => $this->datetime]);
     return $dataProvider;
 }
开发者ID:RStuffGit,项目名称:mebel,代码行数:20,代码来源:OrderSearch.php

示例13: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Order::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'orderId' => $this->orderId, 'totalPrice' => $this->totalPrice, 'dateTime' => $this->dateTime]);
     $query->andFilterWhere(['like', 'firstName', $this->firstName])->andFilterWhere(['like', 'lastName', $this->lastName])->andFilterWhere(['like', 'package', $this->package]);
     return $dataProvider;
 }
开发者ID:fnoorman,项目名称:dev,代码行数:21,代码来源:OrderSearch.php

示例14: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Order::find()->orderBy('status');
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'status' => $this->status, 'total_cost' => $this->total_cost, 'date' => $this->date]);
     $query->andFilterWhere(['like', 'data', $this->data])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'phone', $this->phone])->andFilterWhere(['like', 'message', $this->message]);
     return $dataProvider;
 }
开发者ID:cyanofresh,项目名称:yii2shop,代码行数:21,代码来源:OrderSearch.php

示例15: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Order::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'price' => $this->price, 'datetime' => $this->datetime]);
     $query->andFilterWhere(['like', 'fio', $this->fio])->andFilterWhere(['like', 'phone', $this->phone])->andFilterWhere(['like', 'email', $this->email]);
     return $dataProvider;
 }
开发者ID:RStuffGit,项目名称:furniture,代码行数:21,代码来源:OrderSearch.php


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