| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- <?php
- namespace hd\controllers;
- use biz\ghs\classes\GhsClass;
- use biz\product\classes\XjClass;
- use biz\shop\classes\ShopExtClass;
- use common\components\imgUtil;
- use common\components\util;
- use biz\admin\classes\AdminRoleClass;
- use common\components\printUtil;
- use Yii;
- class ShopExtController extends BaseController
- {
- public $guestAccess = [];
- //取出供应商的小菊颜色 ssh 20210907
- public function actionGetGhsXj()
- {
- $id = Yii::$app->request->get('ghsId', 0);
- $ghs = GhsClass::getById($id, true);
- GhsClass::valid($ghs, $this->shopId);
- $shopId = $ghs->shopId ?? 0;
- $list = XjClass::getAllByCondition(['shopId' => $shopId, 'delStatus' => 0, 'status' => 1], null, '*');
- if (!empty($list)) {
- foreach ($list as $key => $val) {
- $shortCover = $val['cover'] ?? '';
- $cover = imgUtil::groupImg($shortCover) . "?x-oss-process=image/resize,m_fill,h_130,w_130";
- $bigCover = imgUtil::groupImg($shortCover) . "?x-oss-process=image/resize,m_fill,h_700,w_700";
- $list[$key]['cover'] = $cover;
- $list[$key]['bigCover'] = $bigCover;
- $list[$key]['shortCover'] = $shortCover;
- }
- }
- util::success(['list' => $list]);
- }
- //添加打印机 ssh 20210712
- public function actionAddPrint()
- {
- $shopAdmin = $this->shopAdmin;
- $roleId = $shopAdmin['roleId'] ?? 0;
- $role = AdminRoleClass::getById($roleId);
- $roleName = $role['roleName'] ?? '';
- if ($roleName == '员工') {
- util::fail('没有权限操作哦');
- }
- $shopId = $this->shopId;
- $ext = ShopExtClass::getByCondition(['shopId' => $shopId], true);
- $get = Yii::$app->request->get();
- $printSn = $get['printSn'] ?? '';
- $printKey = $get['printKey'] ?? '';
- $print = new printUtil($printSn);
- $shop = $this->shop;
- $default = $shop->default ?? 0;
- $shopName = $shop->shopName ?? '';
- $sj = $this->sj;
- $sjName = $sj->name ?? '';
- $name = $default == 1 ? $sjName : $sjName . ' ' . $shopName;
- if (!empty($printSn) && !empty($printKey)) {
- $return = $print->addPrint($printKey, $name);
- if ($return) {
- $ext->printSn = $printSn;
- $ext->printKey = $printKey;
- $ext->save();
- util::complete('添加成功');
- }
- }
- if (empty($printSn) && empty($printKey)) {
- $ext->printSn = '';
- $ext->printKey = '';
- $ext->save();
- util::complete('修改成功');
- }
- util::fail('添加失败');
- }
- //获取打印机信息
- public function actionGetPrint()
- {
- $shopId = $this->shopId;
- $ext = ShopExtClass::getByCondition(['shopId' => $shopId]);
- util::success($ext);
- }
- //获取云喇叭信息 ssh 20220105
- public function actionGetLb()
- {
- $shopId = $this->shopId;
- $ext = ShopExtClass::getByCondition(['shopId' => $shopId]);
- util::success($ext);
- }
- //添加喇叭 ssh 20220105
- public function actionAddLb()
- {
- $shopAdmin = $this->shopAdmin;
- if (isset($shopAdmin->super) == false || $shopAdmin->super != 1) {
- util::fail('超管才能修改');
- }
- $shopId = $this->shopId;
- $ext = ShopExtClass::getByCondition(['shopId' => $shopId], true);
- $get = Yii::$app->request->get();
- $lbSn = $get['lbSn'] ?? '';
- $ext->lbSn = $lbSn;
- $ext->save();
- util::complete('设置成功');
- }
- }
|