| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <?php
- /**
- * Created by PhpStorm.
- * User: 阿源
- * Date: 2020/8/31
- * Time: 11:21
- */
- namespace addons\ShortVideo\backend\controllers;
- use addons\ShortVideo\common\models\ShortVideoConfig;
- use common\enums\StatusEnum;
- use common\models\goods\Goods;
- class ConfigController extends BaseController
- {
- /**
- * 指定商品可用时搜索商品
- * @return mixed|void
- */
- public function actionGoodsList()
- {
- if (!\Yii::$app->request->isGet) {
- return $this->error('请求方式错误');
- }
- $page = \Yii::$app->request->get('page', 1);
- $limit = \Yii::$app->request->get('limit', $this->pageSize);
- $keyword = \Yii::$app->request->get('keyword');
- $where[] = [
- 'mall_id' => $this->mall_id,
- 'mch_id' => $this->admin->mch_id,
- 'status' => StatusEnum::ENABLED,
- 'is_on_sale' => 1,
- ];
- if (!empty($keyword)) {
- $where[] = ['like', 'goods_name', $keyword];
- }
- $params = [
- 'select' => 'id as goods_id,goods_name,cover_pic,sort',
- 'where' => $where,
- 'order' => 'sort asc,id desc',
- 'page' => $page,
- 'limit' => $limit,
- ];
- $list = Goods::listPage($params);
- return $this->success('success', $list);
- }
- }
|