林琦海 5 лет назад
Родитель
Сommit
e82b9f6470

+ 2 - 2
app-ghs/controllers/ApplyController.php

@@ -46,7 +46,7 @@ class ApplyController extends BaseController
         $post['long'] = isset($post['longitude']) ? $post['longitude'] : '';
         $post['lat'] = isset($post['latitude']) ? $post['latitude'] : '';
         $post['from'] = ApplyClass::FROM_GHS;
-        $name = $get['name'] ?? '';
+        $name = $post['name'] ?? '';
         if (empty($name)) {
             util::fail('名称不能为空');
         }
@@ -92,4 +92,4 @@ class ApplyController extends BaseController
         util::success(['code' => rand(1111, 9999)]);
     }
 
-}
+}

+ 25 - 20
app-ghs/controllers/BaseController.php

@@ -65,27 +65,32 @@ class BaseController extends PublicController
         } else {
             //后台
             $currentShopId = $admin['currentShopId'] ?? 0;
-            if (empty($currentShopId) && in_array($action->id, $this->guestAccess) == false) {
-                util::fail('您没有权限访问哦!');
+            if(empty($currentShopId)){
+                if( in_array($action->id, $this->guestAccess) == false){
+                    util::fail('您没有权限访问哦!');
+                }
+            }else{
+                $this->shopId = $currentShopId;
+                $shop = ShopClass::getShopInfo($currentShopId);
+                $this->shop = $shop;
+                if (empty($shop)) {
+                    util::fail('没有找到您管理的门店');
+                }
+                $shopAdmin = ShopAdminClass::getByCondition(['shopId' => $currentShopId, 'adminId' => $adminId, 'delStatus' => 0]);
+                if (empty($shopAdmin)) {
+                    util::fail('没有找到员工信息');
+                }
+                $this->shopAdmin = $shopAdmin;
+                $this->shopAdminId = $shopAdmin['id'] ?? 0;
+                $sjId = $shop['merchantId'];
+                $this->sjId = $sjId;
+                $sj = MerchantService::getMerchantById($sjId);
+                $this->sj = $sj;
+                $sjExtend = MerchantExtendService::getByMerchantId($sjId);
+                $this->sjExtend = $sjExtend;
             }
-            $this->shopId = $currentShopId;
-            $shop = ShopClass::getShopInfo($currentShopId);
-            $this->shop = $shop;
-            if (empty($shop)) {
-                util::fail('没有找到您管理的门店');
-            }
-            $shopAdmin = ShopAdminClass::getByCondition(['shopId' => $currentShopId, 'adminId' => $adminId, 'delStatus' => 0]);
-            if (empty($shopAdmin)) {
-                util::fail('没有找到员工信息');
-            }
-            $this->shopAdmin = $shopAdmin;
-            $this->shopAdminId = $shopAdmin['id'] ?? 0;
-            $sjId = $shop['merchantId'];
-            $this->sjId = $sjId;
-            $sj = MerchantService::getMerchantById($sjId);
-            $this->sj = $sj;
-            $sjExtend = MerchantExtendService::getByMerchantId($sjId);
-            $this->sjExtend = $sjExtend;
+
+
         }
         return parent::beforeAction($action);
     }

+ 2 - 1
app-ghs/controllers/MapController.php

@@ -9,6 +9,7 @@ use Yii;
 class MapController extends BaseController
 {
 
+    public $guestAccess = ['suggestion'];
     //腾讯地图关键词输入提醒 ssh 2020.1.21
     public function actionSuggestion()
     {
@@ -18,4 +19,4 @@ class MapController extends BaseController
         util::success($result);
     }
 
-}
+}

+ 10 - 9
app-ghs/controllers/UploadController.php

@@ -11,12 +11,12 @@ use common\components\stringUtil;
 use Yii;
 use common\components\util;
 use yii\imagine\Image;
-
+use common\components\oss;
 class UploadController extends BaseController
 {
-	
-	public $guestAccess = [];
-	
+
+	public $guestAccess = ['save-img'];
+
 	//上传图片接口
 	public function actionSaveImg()
 	{
@@ -33,7 +33,7 @@ class UploadController extends BaseController
 				}
 			}
 		}
-		
+
 		//匹配出图片的格式
 		if (preg_match('/^(data:\s*image\/(\w+);base64,)/', $base64_image_content, $result)) {
 			$type = $result[2];
@@ -55,7 +55,7 @@ class UploadController extends BaseController
 			$imgInfo = getimagesize($fullPathFile);
 			$width = $imgInfo[0];
 			$height = $imgInfo[1];
-			
+
 			//如果图片太大,进行压缩,并删除原图
 			if ($width > 800) {
 				$newWidth = 800;
@@ -71,6 +71,7 @@ class UploadController extends BaseController
 				$fullPathFile = $newFullPathFile;
 			}
 
+            oss::uploadImage($img,$fullPathFile);
 			//生成小图 200px
 			$smallWidth = 200;
 			$smallHeight = ceil((200 * $height) / $width);
@@ -96,7 +97,7 @@ class UploadController extends BaseController
 		}
 		util::fail('上传失败!');
 	}
-	
+
 	//保存图片 ssh 2019.12.20
 	public function actionSave()
 	{
@@ -125,5 +126,5 @@ class UploadController extends BaseController
 			util::success($data);
 		}
 	}
-	
-}
+
+}

+ 1 - 1
app-hd/controllers/UploadController.php

@@ -16,7 +16,7 @@ use yii\imagine\Image;
 class UploadController extends BaseController
 {
 
-	public $guestAccess = [];
+	public $guestAccess = ['save-img'];
 
 	//上传图片接口
 	public function actionSaveImg()

+ 71 - 0
console/controllers/GhsInitController.php

@@ -0,0 +1,71 @@
+<?php
+/**
+ * User: admin
+ * Date Time: 2021/4/7 21:29
+ */
+
+namespace console\controllers;
+
+use biz\item\classes\PtItemClass;
+use bizGhs\item\classes\ItemClass;
+use bizGhs\item\classes\ItemClassClass;
+use bizGhs\product\classes\ProductClass;
+use common\services\xhItemService;
+use yii\console\Controller;
+class GhsInitController extends Controller
+{
+
+    //初始化
+    public function actionInit()
+    {
+
+        $itemIds = [1002,1003,1004,1005,1007];
+        foreach ($itemIds as $v){
+            $itemInfo = PtItemClass::getById($v);
+            $data = [
+                'name'=>$itemInfo['name'],
+                'alias'=>$itemInfo['alias'],
+                'py'=>$itemInfo['py'],
+                'ratio'=>$itemInfo['ratio'],
+                'weight'=>$itemInfo['weight'],
+                'stockWarning'=>$itemInfo['stockWarning'],
+                'cost'=>$itemInfo['cost'],
+                'addPrice'=>$itemInfo['addPrice'],
+                'bigUnit'=>$itemInfo['bigUnit'],
+                'smallUnit'=>$itemInfo['smallUnit'],
+            ];
+            //ProductClass::updateByCondition(['itemId'=>$v],$data);
+            ItemClass::updateByCondition(['itemId'=>$v],$data);
+
+        }
+        echo "done";
+    }
+
+    //清空某个商户的product
+    public function actionClearItem($sjId)
+    {
+        //ProductClass::deleteByCondition(['merchantId'=>$sjId]);
+        //ItemClass::deleteByCondition(['merchantId'=>$sjId]);
+        //ItemClassClass::deleteByCondition(['merchantId'=>$sjId]);
+    }
+
+    public function actionPtUnit()
+    {
+        $res = ProductClass::getAllList("*","");
+        foreach ($res as $v){
+            $id = $v['id'];
+            $obigU = $v['bigUnit'];
+            $oSmallU = $v['smallUnit'];
+            $bigUname = xhItemService::getUnitName($obigU);
+            $smallUName = xhItemService::getUnitName($oSmallU);
+            $data = [
+                'bigUnitId'=>$obigU,
+                'smallUnitId'=>$oSmallU,
+                'bigUnit'=>$bigUname,
+                'smallUnit'=>$smallUName,
+            ];
+            ProductClass::updateById($id,$data);
+        }
+        echo "done";
+    }
+}