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


PHP Order::getCountByStoreId方法代碼示例

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


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

示例1: 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

示例2:

        </div>
        <div class="row">
            <div class="col-lg-12">
                <?php 
echo Alert::widget();
?>
            </div>
        </div>
        <?php 
echo $content;
?>
    </div>
    <!-- /#page-wrapper -->

</div>
<!-- /#wrapper -->
<audio class="audio-order hidden" controls="controls" data-count="<?php 
echo Order::getCountByStoreId(Yii::$app->user->identity->store_id);
?>
">
    <source src="<?php 
echo Url::base();
?>
/audio/alert.ogg" type="audio/ogg">
    <source src="<?php 
echo Url::base();
?>
/audio/alert.mp3" type="audio/mpeg">
</audio>
<?php 
$this->endContent();
開發者ID:daixianceng,項目名稱:xiaoego.com,代碼行數:31,代碼來源:main.php

示例3: actionCount

 public function actionCount()
 {
     Yii::$app->response->format = Response::FORMAT_JSON;
     $count = Order::getCountByStoreId(Yii::$app->user->identity->store_id);
     return ['count' => $count];
 }
開發者ID:daixianceng,項目名稱:xiaoego.com,代碼行數:6,代碼來源:OrderController.php


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