| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- namespace pt\controllers;
- use biz\shop\classes\ShopClass;
- use bizHd\merchant\services\ShopService;
- use common\components\stringUtil;
- use common\components\util;
- use Yii;
- class ShopController extends BaseController
- {
- //调整仅采购功能,允许零售使用所有功能 ssh 20220919
- public function actionChangeOnlyCg()
- {
- $get = Yii::$app->request->get();
- $id = $get['id'] ?? 0;
- $shop = ShopClass::getById($id, true);
- if (empty($shop)) {
- util::fail('没有找到门店');
- }
- if ($shop->ptStyle != 1) {
- util::fail('只能给零售店操作');
- }
- $shop->onlyCg = $shop->onlyCg == 0 ? 1 : 0;
- $shop->save();
- util::complete();
- }
- //门店列表 ssh 20210730
- public function actionList()
- {
- $where = [];
- $name = Yii::$app->request->get('name', '');
- if (!empty($name)) {
- if (stringUtil::isLetter($name)) {
- $where['py'] = ['like', $name];
- } else {
- $where['merchantName'] = ['like', $name];
- }
- }
- $list = ShopService::getShopList($where);
- util::success($list);
- }
- }
|