| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- namespace platform\controllers;
- use Yii;
- use yii\helpers\Json;
- use common\services\xhGoodsSettingService;
- use common\components\configDict;
- use common\services\xhRecommendService;
- use common\components\util;
- use common\components\qrCodeUtil;
- use common\models\xhGoods;
- use common\services\xhGoodsService;
- use common\services\xhGoodsPriceService;
- use common\services\xhTMessageService;
- use common\services\xhCategoryService;
- use common\components\page;
- use common\services\xhAdminToMerchantService;
- use common\services\xhWxOpenService;
- class GoodsController extends PlatformController
- {
- /**
- * 商品列表
- */
- public function actionList()
- {
- $get = Yii::$app->request->get();
- $query = xhGoods::find();
- $status = isset($get['status']) ? $get['status'] : -1;
- if(isset($get['status']) && $get['status'] != -1){
- $query->andWhere(['status' => $get['status']]);
- }
- $query->andWhere(['delStatus' => 0]);
- if(isset($get['goodsName']) && !empty($get['goodsName'])){
- $query->andWhere(['like', 'goodsName', $get['goodsName']]);
- }
- $query->orderBy('id desc');
- $countQuery = clone $query;
- $count = $countQuery->count();
- $page = isset($get['page']) ? $get['page'] : 1;
- $pageSize = 20;
- $offset = ($page - 1) * $pageSize;
- $models = $query->offset($offset)->limit($pageSize)->asArray()->all();
- $page = new page($count,$page,$pageSize);
- $paging = $page->fpage();
- return $this->render('list', ['models' => $models,'paging' => $paging,'status' => $status,]);
- }
- }
|