Kaynağa Gözat

初始化商品增加mainId

shish 4 yıl önce
ebeveyn
işleme
93cb4b9043

+ 4 - 4
app-ghs/controllers/GoodsController.php

@@ -50,7 +50,7 @@ class GoodsController extends BaseController
         $data = Yii::$app->request->post();
         $id = isset($data['id']) ? $data['id'] : 0;
         $info = GoodsService::getById($id);
-        GoodsService::valid($info, $this->sjId);
+        GoodsService::valid($info, $this->mainId);
         $data['sjId'] = $this->sjId;
         $data['mainId'] = $this->mainId;
         GoodsService::updateGoods($id, $data);
@@ -65,7 +65,7 @@ class GoodsController extends BaseController
         $inTurn = Yii::$app->request->get('inTurn', 0);
         //验证商品
         $info = GoodsService::getById($id);
-        GoodsService::valid($info, $this->sjId);
+        GoodsService::valid($info, $this->mainId);
         if ($cId != 0) {
             //验证分类
             $category = CategoryService::getById($cId);
@@ -83,7 +83,7 @@ class GoodsController extends BaseController
     {
         $id = Yii::$app->request->get('id', 0);
         $goods = GoodsService::getById($id);
-        GoodsService::valid($goods, $this->sjId);
+        GoodsService::valid($goods, $this->mainId);
         GoodsService::deleteGoods($goods);
         util::complete();
     }
@@ -95,7 +95,7 @@ class GoodsController extends BaseController
         $id = isset($post['id']) ? $post['id'] : 0;
         $status = isset($post['status']) ? $post['status'] : 1;
         $info = GoodsService::getById($id);
-        GoodsService::valid($info, $this->sjId);
+        GoodsService::valid($info, $this->mainId);
         GoodsService::changeStatus($id, $status);
         util::complete();
     }

+ 129 - 129
app-hd/controllers/ChatController.php

@@ -14,134 +14,134 @@ use GatewayClient\Gateway;
 
 class ChatController extends BaseController
 {
-	
-	//聊天 ssh 2019.12.28
-	public function actionIndex()
-	{
-		$get = Yii::$app->request->get();
-		$userId = isset($get['userId']) ? $get['userId'] : 0;
-		$user = UserService::getById($userId);
-		UserService::valid($user, $this->sjId);
-		return $this->renderPartial('index', ['userId' => $userId]);
-	}
 
-	//聊天双方的用户信息 ssh 2019.12.30
-	public function actionBegin()
-	{
-		$id = Yii::$app->request->get('id', 0);
-		$user = UserService::getUserInfo($id);
-		UserService::valid($user, $this->sjId);
-		//新增最近联系人
-		ChatService::addRecentlyUser($this->sjId, $id);
-		//获取最近联系人
-		$recentlyUser = ChatService::getRecentlyUserList($this->sjId);
-		util::success(['merchant' => $this->sj->attributes, 'user' => $user, 'recentlyUser' => $recentlyUser]);
-	}
-	
-	//绑定 ssh 2019.12.28
-	public function actionBindMerchant()
-	{
-		$post = Yii::$app->request->post();
-		$clientId = isset($post['clientId']) ? $post['clientId'] : '';
-		$id = 'merchantChat_' . $this->sjId;
-		Gateway::bindUid($clientId, $id);
-		
-		//连接就将新消息置为已读
-		$consoleId = 'merchantConsole_' . $this->sjId;
-		$consoleOnline = Gateway::getClientIdByUid($consoleId);
-		if ($consoleOnline) {
-			$data = ['type' => 'newMessage', 'status' => 0];
-			Gateway::sendToUid($consoleId, json_encode($data));
-		}
-	}
-	
-	//关闭当前链接
-	public function actionClose()
-	{
-		$post = Yii::$app->request->post();
-		$clientId = isset($post['clientId']) ? $post['clientId'] : '';
-		Gateway::closeClient($clientId);
-	}
-	
-	public function actionBindConsole()
-	{
-		$post = Yii::$app->request->post();
-		$clientId = isset($post['clientId']) ? $post['clientId'] : '';
-		$id = 'merchantConsole_' . $this->sjId;
-		Gateway::bindUid($clientId, $id);
-	}
-	
-	//发消息给客户 ssh 2019.12.28
-	public function actionSend()
-	{
-		$post = Yii::$app->request->post();
-		$type = isset($post['type']) ? $post['type'] : 'text';
-		$userId = isset($post['userId']) ? $post['userId'] : 0;
-		$user = UserService::getById($userId);
-		UserService::valid($user, $this->sjId);
-		$arr = [];
-		$arr['type'] = $type;
-		$arr['source'] = 'merchant';
-		$arr['time'] = '12:51';
-		switch ($type) {
-			case 'text':
-				//文字
-				$content = $post['content'];
-				$arr['content'] = $content;
-				break;
-			case 'img':
-				//图片
-				$shortUrl = $post['shortUrl'];
-				$return = business::formatUploadImg($shortUrl);
-				$arr['url'] = $return['url'];
-				$arr['smallUrl'] = $return['smallUrl'];
-				break;
-			case 'link':
-				//常用链接
-				$id = $post['linkId'];
-				$respond = MerchantService::getCommonUrl($id);
-				$arr['name'] = $respond['name'];
-				$arr['img'] = $respond['img'];
-				$arr['url'] = $respond['url'];
-				break;
-			case 'goods':
-				//商品
-				$id = $post['goodsId'];
-				$info = GoodsClass::getGoodsInfo($id);
-				GoodsService::valid($info, $this->sjId);
-				$arr['name'] = $info['name'];
-				$arr['img'] = isset($info['smallImgList'][0]) ? $info['smallImgList'][0] : '';
-				$arr['price'] = isset($info['price']) ? $info['price'] : 300;
-				break;
-		}
-		$data[] = $arr;
-		//放入缓存
-		ChatService::saveMessage($data, $userId);
-		$online = Gateway::getClientIdByUid($userId);
-		if ($online) {
-			//直接发送
-			Gateway::sendToUid($userId, json_encode($data));
-			util::success($data);
-		}
-		util::success($data);
-	}
-	
-	//最近联系人 ssh 2019.12.29
-	public function actionRecentlyUser()
-	{
-		$respond = ChatService::getRecentlyUserList($this->sjId);
-		util::success($respond);
-	}
-	
-	//最近聊天的内容 ssh 2019.12.29
-	public function actionRecentlyMessage()
-	{
-		//商品 图片 快捷链接 文字
-		$id = Yii::$app->request->get('id');
-		$info = UserService::getById($id);
-		UserService::valid($info, $this->sjId);
-		$respond = ChatService::getMessageList($id);
-		util::success($respond);
-	}
-	
+    //聊天 ssh 2019.12.28
+    public function actionIndex()
+    {
+        $get = Yii::$app->request->get();
+        $userId = isset($get['userId']) ? $get['userId'] : 0;
+        $user = UserService::getById($userId);
+        UserService::valid($user, $this->sjId);
+        return $this->renderPartial('index', ['userId' => $userId]);
+    }
+
+    //聊天双方的用户信息 ssh 2019.12.30
+    public function actionBegin()
+    {
+        $id = Yii::$app->request->get('id', 0);
+        $user = UserService::getUserInfo($id);
+        UserService::valid($user, $this->sjId);
+        //新增最近联系人
+        ChatService::addRecentlyUser($this->sjId, $id);
+        //获取最近联系人
+        $recentlyUser = ChatService::getRecentlyUserList($this->sjId);
+        util::success(['merchant' => $this->sj->attributes, 'user' => $user, 'recentlyUser' => $recentlyUser]);
+    }
+
+    //绑定 ssh 2019.12.28
+    public function actionBindMerchant()
+    {
+        $post = Yii::$app->request->post();
+        $clientId = isset($post['clientId']) ? $post['clientId'] : '';
+        $id = 'merchantChat_' . $this->sjId;
+        Gateway::bindUid($clientId, $id);
+
+        //连接就将新消息置为已读
+        $consoleId = 'merchantConsole_' . $this->sjId;
+        $consoleOnline = Gateway::getClientIdByUid($consoleId);
+        if ($consoleOnline) {
+            $data = ['type' => 'newMessage', 'status' => 0];
+            Gateway::sendToUid($consoleId, json_encode($data));
+        }
+    }
+
+    //关闭当前链接
+    public function actionClose()
+    {
+        $post = Yii::$app->request->post();
+        $clientId = isset($post['clientId']) ? $post['clientId'] : '';
+        Gateway::closeClient($clientId);
+    }
+
+    public function actionBindConsole()
+    {
+        $post = Yii::$app->request->post();
+        $clientId = isset($post['clientId']) ? $post['clientId'] : '';
+        $id = 'merchantConsole_' . $this->sjId;
+        Gateway::bindUid($clientId, $id);
+    }
+
+    //发消息给客户 ssh 2019.12.28
+    public function actionSend()
+    {
+        $post = Yii::$app->request->post();
+        $type = isset($post['type']) ? $post['type'] : 'text';
+        $userId = isset($post['userId']) ? $post['userId'] : 0;
+        $user = UserService::getById($userId);
+        UserService::valid($user, $this->sjId);
+        $arr = [];
+        $arr['type'] = $type;
+        $arr['source'] = 'merchant';
+        $arr['time'] = '12:51';
+        switch ($type) {
+            case 'text':
+                //文字
+                $content = $post['content'];
+                $arr['content'] = $content;
+                break;
+            case 'img':
+                //图片
+                $shortUrl = $post['shortUrl'];
+                $return = business::formatUploadImg($shortUrl);
+                $arr['url'] = $return['url'];
+                $arr['smallUrl'] = $return['smallUrl'];
+                break;
+            case 'link':
+                //常用链接
+                $id = $post['linkId'];
+                $respond = MerchantService::getCommonUrl($id);
+                $arr['name'] = $respond['name'];
+                $arr['img'] = $respond['img'];
+                $arr['url'] = $respond['url'];
+                break;
+            case 'goods':
+                //商品
+                $id = $post['goodsId'];
+                $info = GoodsClass::getGoodsInfo($id);
+                GoodsService::valid($info, $this->mainId);
+                $arr['name'] = $info['name'];
+                $arr['img'] = isset($info['smallImgList'][0]) ? $info['smallImgList'][0] : '';
+                $arr['price'] = isset($info['price']) ? $info['price'] : 300;
+                break;
+        }
+        $data[] = $arr;
+        //放入缓存
+        ChatService::saveMessage($data, $userId);
+        $online = Gateway::getClientIdByUid($userId);
+        if ($online) {
+            //直接发送
+            Gateway::sendToUid($userId, json_encode($data));
+            util::success($data);
+        }
+        util::success($data);
+    }
+
+    //最近联系人 ssh 2019.12.29
+    public function actionRecentlyUser()
+    {
+        $respond = ChatService::getRecentlyUserList($this->mainId);
+        util::success($respond);
+    }
+
+    //最近聊天的内容 ssh 2019.12.29
+    public function actionRecentlyMessage()
+    {
+        //商品 图片 快捷链接 文字
+        $id = Yii::$app->request->get('id');
+        $info = UserService::getById($id);
+        UserService::valid($info, $this->sjId);
+        $respond = ChatService::getMessageList($id);
+        util::success($respond);
+    }
+
 }

+ 14 - 14
app-hd/controllers/GoodsController.php

@@ -69,7 +69,7 @@ class GoodsController extends BaseController
     {
         $id = Yii::$app->request->get('id');
         $goods = GoodsClass::getGoodsInfo($id);
-        GoodsClass::valid($goods, $this->sjId);
+        GoodsClass::valid($goods, $this->mainId);
         util::success($goods);
     }
 
@@ -79,7 +79,7 @@ class GoodsController extends BaseController
         $data = Yii::$app->request->post();
         $id = isset($data['id']) ? $data['id'] : 0;
         $info = GoodsService::getById($id);
-        GoodsService::valid($info, $this->sjId);
+        GoodsService::valid($info, $this->mainId);
         $data['sjId'] = $this->sjId;
         $data['mainId'] = $this->mainId;
         $data['flower'] = $info['flower'] ?? 0;
@@ -95,7 +95,7 @@ class GoodsController extends BaseController
         $inTurn = Yii::$app->request->get('inTurn', 0);
         //验证商品
         $info = GoodsService::getById($id);
-        GoodsService::valid($info, $this->sjId);
+        GoodsService::valid($info, $this->mainId);
         if ($cId != 0) {
             //验证分类
             $category = CategoryService::getById($cId);
@@ -113,7 +113,7 @@ class GoodsController extends BaseController
     {
         $id = Yii::$app->request->get('id', 0);
         $goods = GoodsService::getById($id);
-        GoodsService::valid($goods, $this->sjId);
+        GoodsService::valid($goods, $this->mainId);
         GoodsService::deleteGoods($goods);
         util::complete();
     }
@@ -125,7 +125,7 @@ class GoodsController extends BaseController
         $id = isset($get['id']) ? $get['id'] : 0;
         $status = isset($get['status']) ? $get['status'] : 1;
         $info = GoodsService::getById($id);
-        GoodsService::valid($info, $this->sjId);
+        GoodsService::valid($info, $this->mainId);
         GoodsService::changeStatus($id, $status);
         util::complete();
     }
@@ -133,7 +133,7 @@ class GoodsController extends BaseController
     //商品说明 ssh 2019.12.8
     public function actionIntroduce()
     {
-        $set = GoodsSettingService::getByCondition(['sjId' => $this->sjId]);
+        $set = GoodsSettingService::getByCondition(['mainId' => $this->mainId]);
         $introduce = $set['goodsIntroduce'];
         util::success(['introduce' => $introduce]);
     }
@@ -142,14 +142,14 @@ class GoodsController extends BaseController
     public function actionUpdateIntroduce()
     {
         $introduce = Yii::$app->request->post('introduce', '');
-        GoodsSettingService::updateByCondition(['sjId' => $this->sjId], ['goodsIntroduce' => $introduce]);
+        GoodsSettingService::updateByCondition(['mainId' => $this->mainId], ['goodsIntroduce' => $introduce]);
         util::complete('提交成功');
     }
 
     //设置 ssh 2019.12.8
     public function actionSetting()
     {
-        $return = GoodsSettingService::getSetting($this->sjId);
+        $return = GoodsSettingService::getSetting($this->mainId);
         util::success($return);
     }
 
@@ -164,14 +164,14 @@ class GoodsController extends BaseController
             if (empty($festIdList)) {
                 util::fail('请选择节日');
             }
-            FestRiseService::deleteByCondition(['sjId' => $this->sjId]);
+            FestRiseService::deleteByCondition(['mainId' => $this->mainId]);
             $add = [];
             foreach ($festIdList as $festId) {
-                $add[] = ['sjId' => $this->sjId, 'festId' => $festId];
+                $add[] = ['mainId' => $this->mainId, 'festId' => $festId];
             }
             FestRiseService::batchAdd($add);
         }
-        GoodsSettingService::updateByCondition(['sjId' => $this->sjId], $post);
+        GoodsSettingService::updateByCondition(['mainId' => $this->mainId], $post);
         util::complete('提交成功');
     }
 
@@ -180,8 +180,8 @@ class GoodsController extends BaseController
     {
         $id = Yii::$app->request->get('id', 0);
         $info = GoodsClass::getGoodsInfo($id);
-        GoodsService::valid($info, $this->sjId);
-        $setting = GoodsSettingService::getByCondition(['sjId' => $this->sjId]);
+        GoodsService::valid($info, $this->mainId);
+        $setting = GoodsSettingService::getByCondition(['mainId' => $this->mainId]);
         $commonIntro = isset($setting['goodsIntroduce']) ? $setting['goodsIntroduce'] : '';
         $info['commonIntro'] = $commonIntro;
         util::success($info);
@@ -212,7 +212,7 @@ class GoodsController extends BaseController
         if (empty($name)) {
             util::fail("名称不能为空");
         }
-        $cateExists = CategoryService::exists(['id' => $classId, 'sjId' => $this->sjId]);
+        $cateExists = CategoryService::exists(['id' => $classId, 'mainId' => $this->mainId]);
         if (!$cateExists) {
             util::fail("分类不存在");
         }

+ 96 - 98
app-mall/controllers/ChatController.php

@@ -12,104 +12,102 @@ use GatewayClient\Gateway;
 
 class ChatController extends BaseController
 {
-	
-	//聊天首页,前端使用
-	public function actionIndex()
-	{
-		return $this->renderPartial('index');
-	}
-	
-	//绑定 ssh 2019.12.28
-	public function actionBindUser()
-	{
-		$post = Yii::$app->request->post();
-		$clientId = isset($post['clientId']) ? $post['clientId'] : '';
-		$userId = $this->userId;
-		Gateway::bindUid($clientId, $userId);
-	}
 
-	//聊天双方的用户信息 ssh 2019.12.30
-	public function actionBegin()
-	{
-		//新增最近联系人
-		ChatService::addRecentlyUser($this->sjId, $this->userId);
-		util::success(['merchant' => $this->sj->attributes, 'user' => $this->user]);
-	}
+    //聊天首页,前端使用
+    public function actionIndex()
+    {
+        return $this->renderPartial('index');
+    }
+
+    //绑定 ssh 2019.12.28
+    public function actionBindUser()
+    {
+        $post = Yii::$app->request->post();
+        $clientId = isset($post['clientId']) ? $post['clientId'] : '';
+        $userId = $this->userId;
+        Gateway::bindUid($clientId, $userId);
+    }
+
+    //聊天双方的用户信息 ssh 2019.12.30
+    public function actionBegin()
+    {
+        //新增最近联系人
+        ChatService::addRecentlyUser($this->sjId, $this->userId);
+        util::success(['merchant' => $this->sj->attributes, 'user' => $this->user]);
+    }
+
+    //发消息给老板 ssh 2019.12.28
+    public function actionSend()
+    {
+        $post = Yii::$app->request->post();
+        $type = isset($post['type']) ? $post['type'] : 'text';
+        $arr = [];
+        $arr['type'] = $type;
+        $arr['source'] = 'user';
+        $arr['time'] = '12:51';
+        switch ($type) {
+            case 'text':
+                //文字
+                $content = $post['content'];
+                $arr['content'] = $content;
+                break;
+            case 'img':
+                //图片
+                $shortUrl = $post['shortUrl'];
+                $return = business::formatUploadImg($shortUrl);
+                $arr['url'] = $return['url'];
+                $arr['smallUrl'] = $return['smallUrl'];
+                break;
+            case 'link':
+                //常用链接
+                $id = $post['linkId'];
+                $respond = MerchantService::getCommonUrl($id);
+                $arr['name'] = $respond['name'];
+                $arr['img'] = $respond['img'];
+                $arr['url'] = $respond['url'];
+                break;
+            case 'goods':
+                //商品
+                $id = $post['goodsId'];
+                $info = GoodsService::getGoodsInfo($id);
+                GoodsService::valid($info, $this->mainId);
+                $arr['name'] = $info['name'];
+                $arr['img'] = isset($info['smallImgList'][0]) ? $info['smallImgList'][0] : '';
+                $arr['price'] = isset($info['price']) ? $info['price'] : 300;
+                break;
+        }
+        $data[] = $arr;
+
+        $id = 'merchantChat_' . $this->sjId;
+        $chatOnline = Gateway::getClientIdByUid($id);
+        if ($chatOnline) {
+            //直接发送
+            Gateway::sendToUid($id, json_encode($data));
+            util::success($data);
+        }
+        //有打开后台但没打开聊天框,通知有新消息
+        $consoleId = 'merchantConsole_' . $this->sjId;
+        $consoleOnline = Gateway::getClientIdByUid($consoleId);
+        if ($consoleOnline) {
+            $data = ['type' => 'newMessage', 'status' => 1];
+            Gateway::sendToUid($consoleId, json_encode($data));
+        }
+        util::success($data);
+    }
+
+    //关闭当前链接
+    public function actionClose()
+    {
+        $post = Yii::$app->request->post();
+        $clientId = isset($post['clientId']) ? $post['clientId'] : '';
+        Gateway::closeClient($clientId);
+    }
+
+    //最近聊天的内容 ssh 2019.12.29
+    public function actionRecentlyMessage()
+    {
+        $respond = ChatService::getMessageList($this->userId);
+        util::success($respond);
+    }
 
-	//发消息给老板 ssh 2019.12.28
-	public function actionSend()
-	{
-		$post = Yii::$app->request->post();
-		$type = isset($post['type']) ? $post['type'] : 'text';
-		$arr = [];
-		$arr['type'] = $type;
-		$arr['source'] = 'user';
-		$arr['time'] = '12:51';
-		switch ($type) {
-			case 'text':
-				//文字
-				$content = $post['content'];
-				$arr['content'] = $content;
-				break;
-			case 'img':
-				//图片
-				$shortUrl = $post['shortUrl'];
-				$return = business::formatUploadImg($shortUrl);
-				$arr['url'] = $return['url'];
-				$arr['smallUrl'] = $return['smallUrl'];
-				break;
-			case 'link':
-				//常用链接
-				$id = $post['linkId'];
-				$respond = MerchantService::getCommonUrl($id);
-				$arr['name'] = $respond['name'];
-				$arr['img'] = $respond['img'];
-				$arr['url'] = $respond['url'];
-				break;
-			case 'goods':
-				//商品
-				$id = $post['goodsId'];
-				$info = GoodsService::getGoodsInfo($id);
-				GoodsService::valid($info, $this->sjId);
-				$arr['name'] = $info['name'];
-				$arr['img'] = isset($info['smallImgList'][0]) ? $info['smallImgList'][0] : '';
-				$arr['price'] = isset($info['price']) ? $info['price'] : 300;
-				break;
-		}
-		$data[] = $arr;
-		
-		$id = 'merchantChat_' . $this->sjId;
-		$sjId = $this->sjId;
-		$userId = $this->userId;
-		$chatOnline = Gateway::getClientIdByUid($id);
-		if ($chatOnline) {
-			//直接发送
-			Gateway::sendToUid($id, json_encode($data));
-			util::success($data);
-		}
-		//有打开后台但没打开聊天框,通知有新消息
-		$consoleId = 'merchantConsole_' . $this->sjId;
-		$consoleOnline = Gateway::getClientIdByUid($consoleId);
-		if ($consoleOnline) {
-			$data = ['type' => 'newMessage', 'status' => 1];
-			Gateway::sendToUid($consoleId, json_encode($data));
-		}
-		util::success($data);
-	}
-	
-	//关闭当前链接
-	public function actionClose()
-	{
-		$post = Yii::$app->request->post();
-		$clientId = isset($post['clientId']) ? $post['clientId'] : '';
-		Gateway::closeClient($clientId);
-	}
-	
-	//最近聊天的内容 ssh 2019.12.29
-	public function actionRecentlyMessage()
-	{
-		$respond = ChatService::getMessageList($this->userId);
-		util::success($respond);
-	}
-	
 }

+ 12 - 12
app-mall/controllers/GoodsController.php

@@ -13,18 +13,18 @@ use common\components\util;
 
 class GoodsController extends BaseController
 {
-	
-	//获取商品详情 ssh 2019.12.3
-	public function actionDetail()
-	{
-		$id = Yii::$app->request->get('id', 0);
 
-		$info = GoodsService::getGoodsInfo($id);
-		GoodsService::valid($info, $this->sjId);
-		$setting = GoodsSettingService::getByCondition(['sjId' => $this->sjId]);
-		$commonIntro = isset($setting['goodsIntroduce']) ? $setting['goodsIntroduce'] : '';
-		$info['commonIntro'] = $commonIntro;
-		util::success($info);
-	}
+    //获取商品详情 ssh 2019.12.3
+    public function actionDetail()
+    {
+        $id = Yii::$app->request->get('id', 0);
+
+        $info = GoodsService::getGoodsInfo($id);
+        GoodsService::valid($info, $this->mainId);
+        $setting = GoodsSettingService::getByCondition(['mainId' => $this->mainId]);
+        $commonIntro = isset($setting['goodsIntroduce']) ? $setting['goodsIntroduce'] : '';
+        $info['commonIntro'] = $commonIntro;
+        util::success($info);
+    }
 
 }

+ 4 - 4
biz-hd/goods/classes/CategoryClass.php

@@ -70,12 +70,12 @@ class CategoryClass extends BaseClass
         $date = date("Y-m-d H:i:s");
         $list = [
             '花束' => [
-                ['shopImg' => '["uploads\/201906\/23\/jpg\/19062359040_12358.jpg","uploads\/201906\/23\/jpg\/19062381985_12358.jpg"]', 'price' => 588, 'content' => '暂无简介', 'createTime' => $date, 'updateTime' => $date, 'name' => '相思', 'itemNumber' => stringUtil::buildRandNo($mainId) . '5',],
-                ['shopImg' => '["uploads\/201906\/23\/jpg\/19062352536_12358.jpg","uploads\/201906\/23\/jpg\/19062331132_12358.jpg","uploads\/201906\/23\/jpg\/19062380371_12358.jpg"]', 'price' => 688, 'content' => '暂无简介', 'createTime' => $date, 'updateTime' => $date, 'name' => '女神', 'itemNumber' => stringUtil::buildRandNo($mainId) . '6',],
+                ['mainId' => $mainId, 'shopImg' => '["uploads\/201906\/23\/jpg\/19062359040_12358.jpg","uploads\/201906\/23\/jpg\/19062381985_12358.jpg"]', 'price' => 588, 'content' => '暂无简介', 'createTime' => $date, 'updateTime' => $date, 'name' => '相思', 'itemNumber' => stringUtil::buildRandNo($mainId) . '5',],
+                ['mainId' => $mainId, 'shopImg' => '["uploads\/201906\/23\/jpg\/19062352536_12358.jpg","uploads\/201906\/23\/jpg\/19062331132_12358.jpg","uploads\/201906\/23\/jpg\/19062380371_12358.jpg"]', 'price' => 688, 'content' => '暂无简介', 'createTime' => $date, 'updateTime' => $date, 'name' => '女神', 'itemNumber' => stringUtil::buildRandNo($mainId) . '6',],
             ],
             '花篮' => [
-                ['shopImg' => '["uploads\/201906\/23\/jpg\/19062380217_12358.jpg","uploads\/201906\/23\/jpg\/19062339442_12358.jpg","uploads\/201906\/23\/jpg\/19062382963_12358.jpg"]', 'price' => 388, 'content' => '暂无简介', 'createTime' => $date, 'updateTime' => $date, 'name' => '只此一心', 'itemNumber' => stringUtil::buildRandNo($mainId) . '3',],
-                ['shopImg' => '["uploads\/201906\/23\/jpg\/19062374848_12358.jpg","uploads\/201906\/23\/jpg\/19062372687_12358.jpg","uploads\/201906\/23\/jpg\/19062341158_12358.jpg"]', 'price' => 488, 'content' => '暂无简介', 'createTime' => $date, 'updateTime' => $date, 'name' => '密语时光', 'itemNumber' => stringUtil::buildRandNo($mainId) . '4',],
+                ['mainId' => $mainId, 'shopImg' => '["uploads\/201906\/23\/jpg\/19062380217_12358.jpg","uploads\/201906\/23\/jpg\/19062339442_12358.jpg","uploads\/201906\/23\/jpg\/19062382963_12358.jpg"]', 'price' => 388, 'content' => '暂无简介', 'createTime' => $date, 'updateTime' => $date, 'name' => '只此一心', 'itemNumber' => stringUtil::buildRandNo($mainId) . '3',],
+                ['mainId' => $mainId, 'shopImg' => '["uploads\/201906\/23\/jpg\/19062374848_12358.jpg","uploads\/201906\/23\/jpg\/19062372687_12358.jpg","uploads\/201906\/23\/jpg\/19062341158_12358.jpg"]', 'price' => 488, 'content' => '暂无简介', 'createTime' => $date, 'updateTime' => $date, 'name' => '密语时光', 'itemNumber' => stringUtil::buildRandNo($mainId) . '4',],
             ],
             '永生花' => [],
             '绿植' => []

+ 23 - 23
biz-hd/goods/services/GoodsService.php

@@ -26,7 +26,7 @@ class GoodsService extends BaseService
             $list = [];
             if (isset($data['list']) && !empty($data['list'])) {
                 foreach ($data['list'] as $val) {
-                    if(isset($val['goods']) && !empty($val['goods'])){
+                    if (isset($val['goods']) && !empty($val['goods'])) {
                         $list[] = $val['goods'];
                     }
                 }
@@ -61,12 +61,12 @@ class GoodsService extends BaseService
     }
 
     //验证对此商品的操作权限 ssh 2019.12.7
-    public static function valid($info, $sjId)
+    public static function valid($info, $mainId)
     {
         if (empty($info)) {
             util::fail('没有找到商品');
         }
-        if ($info['sjId'] != $sjId) {
+        if ($info['mainId'] != $mainId) {
             util::fail('您没有权限操作');
         }
     }
@@ -78,44 +78,44 @@ class GoodsService extends BaseService
     }
 
     //保存花材组合
-    public static function saveItemGroup($order,$items,$classId,$name,$adminId)
+    public static function saveItemGroup($order, $items, $classId, $name, $adminId)
     {
         $connection = Yii::$app->db;//事务处理
         $transaction = $connection->beginTransaction();
         $now = date('Y-m-d H:i:s');
-        try{
+        try {
             //新增goods  todo  还有很多字段待确定
             $goodsData = [
-                'name'=>$name,
-                'shopImg'=>'',//待确定
-                'price'=>$order['actPrice'],//实际支付价格
-                'adminId'=>$adminId,
-                'sjId'=>$order['sjId'],
-                'status'=>0,
-                'content'=>'',
-                'createTime'=>$now,
-                'updateTime'=>$now,
+                'name' => $name,
+                'shopImg' => '',//待确定
+                'price' => $order['actPrice'],//实际支付价格
+                'adminId' => $adminId,
+                'sjId' => $order['sjId'],
+                'status' => 0,
+                'content' => '',
+                'createTime' => $now,
+                'updateTime' => $now,
             ];
             $goodsInfo = GoodsClass::add($goodsData);
             $gId = $goodsInfo['id'];
             //新增goodsCategory
             $cateData = [
-                'gId'=>$gId,
-                'name'=>$name,
-                'cId'=>$classId,
-                'sjId'=>$order['sjId'],
+                'gId' => $gId,
+                'name' => $name,
+                'cId' => $classId,
+                'sjId' => $order['sjId'],
             ];
             GoodsCategoryClass::add($cateData);
             //新增goodsItem
-            foreach ($items as $v){
+            foreach ($items as $v) {
                 $itemData = [
-                    'goodsId'=>$gId,
-                    'productId'=>$v['productId'],
-                    'itemId'=>$v['itemId'],
+                    'goodsId' => $gId,
+                    'productId' => $v['productId'],
+                    'itemId' => $v['itemId'],
                 ];
                 GoodsItemClass::addData($itemData);
             }
-        }catch (\Exception $exception){
+        } catch (\Exception $exception) {
             $transaction->rollBack();
             return false;
         }

+ 10 - 11
biz-hd/goods/services/GoodsSettingService.php

@@ -14,18 +14,17 @@ use linslin\yii2\curl;
 
 class GoodsSettingService extends BaseService
 {
-	
-	public static $baseFile = '\bizHd\goods\classes\GoodsSettingClass';
-	
-	//设置 ssh 2019.12.8
-	public static function getSetting($sjId)
-	{
-		$set = GoodsSettingClass::getByCondition(['sjId' => $sjId]);
-		$festIdList = FestRiseService::getRiseFestId($sjId);
-		$set['festIdList'] = $festIdList;
-		return $set;
-	}
 
+    public static $baseFile = '\bizHd\goods\classes\GoodsSettingClass';
+
+    //设置 ssh 2019.12.8
+    public static function getSetting($mainId)
+    {
+        $set = GoodsSettingClass::getByCondition(['mainId' => $mainId]);
+        $festIdList = FestRiseService::getRiseFestId($mainId);
+        $set['festIdList'] = $festIdList;
+        return $set;
+    }
 
 
 }

+ 32 - 32
biz-hd/message/classes/ChatClass.php

@@ -7,36 +7,36 @@ use bizHd\base\classes\BaseClass;
 
 class ChatClass extends BaseClass
 {
-	
-	//取有新消息客户的缓存键名 2019.12.29
-	public static function getUnReplyUserKey($sjId)
-	{
-		return 'merchantUnReplyUserList' . $sjId;
-	}
-	
-	//获取未读消息的键 2019.12.29
-	public static function getUnreadNumKey($useId)
-	{
-		return 'MerchantUnreadNum' . $useId;
-	}
-	
-	//最近联系人的键 ssh 2019.12.29
-	public static function getRecentlyUserKey($sjId)
-	{
-		return "merchantRecentlyUser" . $sjId;
-	}
-	
-	public static function getMessageKey($useId)
-	{
-		return 'MerchantMessage' . $useId;
-	}
-	
-	//获取未读消息数
-	public static function getUnreadNum($userId)
-	{
-		$key = self::getUnreadNumKey($userId);
-		$respond = Yii::$app->redis->executeCommand('GET', [$key]);
-		return is_numeric($respond) ? $respond : 0;
-	}
-	
+
+    //取有新消息客户的缓存键名 2019.12.29
+    public static function getUnReplyUserKey($mainId)
+    {
+        return 'merchantUnReplyUserList' . $mainId;
+    }
+
+    //获取未读消息的键 2019.12.29
+    public static function getUnreadNumKey($useId)
+    {
+        return 'MerchantUnreadNum' . $useId;
+    }
+
+    //最近联系人的键 ssh 2019.12.29
+    public static function getRecentlyUserKey($mainId)
+    {
+        return "merchantRecentlyUser" . $mainId;
+    }
+
+    public static function getMessageKey($useId)
+    {
+        return 'MerchantMessage' . $useId;
+    }
+
+    //获取未读消息数
+    public static function getUnreadNum($userId)
+    {
+        $key = self::getUnreadNumKey($userId);
+        $respond = Yii::$app->redis->executeCommand('GET', [$key]);
+        return is_numeric($respond) ? $respond : 0;
+    }
+
 }

+ 142 - 142
biz-hd/message/services/ChatService.php

@@ -11,147 +11,147 @@ use Yii;
 
 class ChatService extends BaseService
 {
-	
-	//新增未读消息数
-	public static function addUnreadNum($userId)
-	{
-		$key = ChatClass::getUnreadNumKey($userId);
-		Yii::$app->redis->executeCommand('INCRBY', [$key, 1]);
-	}
-	
-	//新增未回复客户 ssh 2019.12.29
-	public static function addUnReplyUser($sjId, $userId)
-	{
-		$now = time();
-		$cacheKey = ChatClass::getUnReplyUserKey($sjId);
-		Yii::$app->redis->executeCommand('ZADD', [$cacheKey, $now, "{$userId}"]);
-	}
-	
-	//取未回复客户列表 ssh 2019.12.29
-	public static function getUnReplyUserList($sjId)
-	{
-		$cacheKey = ChatClass::getUnReplyUserKey($sjId);
-		$return = Yii::$app->redis->executeCommand('ZREVRANGE', [$cacheKey, 0, -1, 'WITHSCORES']);//返回有序集合,从高分到低分排序
-		if (empty($return)) {
-			return [];
-		}
-		$list = [];
-		$i = 0;
-		$arr = [];
-		foreach ($return as $key => $val) {
-			if ($key % 2 == 0) {
-				$arr[$i]['value'] = $val;
-			} else {
-				$arr[$i]['key'] = $val;
-				$i++;
-			}
-		}
-		foreach ($arr as $key => $val) {
-			$list[$val['key']] = $val['value'];
-		}
-		return $list;
-	}
-	
-	//新增最近联系人
-	public static function addRecentlyUser($sjId, $userId)
-	{
-		$now = time();
-		$cacheKey = ChatClass::getRecentlyUserKey($sjId);
-		
-		//删除10天前的联系人
-		$max = $now - 86400 * 10;
-		Yii::$app->redis->executeCommand('ZREMRANGEBYSCORE', [$cacheKey, 0, $max]);
-		
-		Yii::$app->redis->executeCommand('ZADD', [$cacheKey, $now, "{$userId}"]);
-	}
-	
-	//取最近联系人 ssh 2019.12.29
-	public static function getRecentlyUserList($sjId)
-	{
-		$userIdList = [12536630, 12536631, 12536632, 12536633, 12536634, 12536635];
-		$userId = $userIdList[array_rand($userIdList)];
-		self::addRecentlyUser($sjId, $userId);
-		
-		$cacheKey = ChatClass::getRecentlyUserKey($sjId);
-		//返回有序集合,从高分到低分排序
-		$return = Yii::$app->redis->executeCommand('ZREVRANGE', [$cacheKey, 0, -1, 'WITHSCORES']);
-		if (empty($return)) {
-			return [];
-		}
-		$i = 0;
-		$arr = [];
-		foreach ($return as $key => $val) {
-			if ($key % 2 == 0) {
-				$arr[$i]['userId'] = $val;
-			} else {
-				$arr[$i]['time'] = $val;
-				$i++;
-			}
-		}
-		$userData = [];
-		//组合出最后聊天时间和未读消息数
-		foreach ($arr as $val) {
-			$userId = $val['userId'];
-			$time = $val['time'];
-			$num = ChatClass::getUnreadNum($userId);
-			$date = date("m-d H:i", $time);
-			if (date("Ymd") == date("Ymd", $time)) {
-				$date = date("H:i", $time);
-			}
-			$userData[$userId] = ['time' => $date, 'unReadNum' => $num];
-		}
-		$ids = array_column($arr, 'userId');
-		$infoList = UserService::getUserByIds($ids);
-		foreach ($infoList as $userId => $info) {
-			$infoList[$userId]['unReadNum'] = isset($userData[$userId]['unReadNum']) ? $userData[$userId]['unReadNum'] : 0;
-			$infoList[$userId]['chatTime'] = isset($userData[$userId]['time']) ? $userData[$userId]['time'] : date("m-d H:i", $info['visitTime']);
-		}
-		return array_values($infoList);
-	}
-	
-	//保存消息记录 ssh 2019.12.29
-	public static function saveMessage($messageList, $userId)
-	{
-		//商家的消息,ourSelf表示自己的消息 themSelf表示对方的消息
-		$now = time();
-		$cacheKey = ChatClass::getMessageKey($userId);
-		
-		//删除15天前的已读消息
-		$max = $now - 86400 * 16;
-		Yii::$app->redis->executeCommand('ZREMRANGEBYSCORE', [$cacheKey, 0, $max]);
-		
-		foreach ($messageList as $message) {
-			Yii::$app->redis->executeCommand('ZADD', [$cacheKey, $now, json_encode($message)]);
-		}
-		//self::getMessageList($userId);
-	}
-	
-	//取消息记录 ssh 2019.12.29
-	public static function getMessageList($userId)
-	{
-		$cacheKey = ChatClass::getMessageKey($userId);
-		//返回有序集合,从高分到低分排序
-		$return = Yii::$app->redis->executeCommand('ZREVRANGE', [$cacheKey, 0, -1, 'WITHSCORES']);
-		if (empty($return)) {
-			return [];
-		}
-		$i = 0;
-		$arr = [];
-		foreach ($return as $key => $val) {
-			if ($key % 2 == 0) {
-				$arr[$i]['message'] = $val;
-			} else {
-				$arr[$i]['time'] = $val;
-				$i++;
-			}
-		}
-		$arr = arrayUtil::arraySort($arr, 'time');
-		$data = [];
-		foreach ($arr as $val) {
-			$message = $val['message'];
-			$data[] = json_decode($message);
-		}
-		return $data;
-	}
+
+    //新增未读消息数
+    public static function addUnreadNum($userId)
+    {
+        $key = ChatClass::getUnreadNumKey($userId);
+        Yii::$app->redis->executeCommand('INCRBY', [$key, 1]);
+    }
+
+    //新增未回复客户 ssh 2019.12.29
+    public static function addUnReplyUser($sjId, $userId)
+    {
+        $now = time();
+        $cacheKey = ChatClass::getUnReplyUserKey($sjId);
+        Yii::$app->redis->executeCommand('ZADD', [$cacheKey, $now, "{$userId}"]);
+    }
+
+    //取未回复客户列表 ssh 2019.12.29
+    public static function getUnReplyUserList($sjId)
+    {
+        $cacheKey = ChatClass::getUnReplyUserKey($sjId);
+        $return = Yii::$app->redis->executeCommand('ZREVRANGE', [$cacheKey, 0, -1, 'WITHSCORES']);//返回有序集合,从高分到低分排序
+        if (empty($return)) {
+            return [];
+        }
+        $list = [];
+        $i = 0;
+        $arr = [];
+        foreach ($return as $key => $val) {
+            if ($key % 2 == 0) {
+                $arr[$i]['value'] = $val;
+            } else {
+                $arr[$i]['key'] = $val;
+                $i++;
+            }
+        }
+        foreach ($arr as $key => $val) {
+            $list[$val['key']] = $val['value'];
+        }
+        return $list;
+    }
+
+    //新增最近联系人
+    public static function addRecentlyUser($sjId, $userId)
+    {
+        $now = time();
+        $cacheKey = ChatClass::getRecentlyUserKey($sjId);
+
+        //删除10天前的联系人
+        $max = $now - 86400 * 10;
+        Yii::$app->redis->executeCommand('ZREMRANGEBYSCORE', [$cacheKey, 0, $max]);
+
+        Yii::$app->redis->executeCommand('ZADD', [$cacheKey, $now, "{$userId}"]);
+    }
+
+    //取最近联系人 ssh 2019.12.29
+    public static function getRecentlyUserList($mainId)
+    {
+        $userIdList = [12536630, 12536631, 12536632, 12536633, 12536634, 12536635];
+        $userId = $userIdList[array_rand($userIdList)];
+        self::addRecentlyUser($mainId, $userId);
+
+        $cacheKey = ChatClass::getRecentlyUserKey($mainId);
+        //返回有序集合,从高分到低分排序
+        $return = Yii::$app->redis->executeCommand('ZREVRANGE', [$cacheKey, 0, -1, 'WITHSCORES']);
+        if (empty($return)) {
+            return [];
+        }
+        $i = 0;
+        $arr = [];
+        foreach ($return as $key => $val) {
+            if ($key % 2 == 0) {
+                $arr[$i]['userId'] = $val;
+            } else {
+                $arr[$i]['time'] = $val;
+                $i++;
+            }
+        }
+        $userData = [];
+        //组合出最后聊天时间和未读消息数
+        foreach ($arr as $val) {
+            $userId = $val['userId'];
+            $time = $val['time'];
+            $num = ChatClass::getUnreadNum($userId);
+            $date = date("m-d H:i", $time);
+            if (date("Ymd") == date("Ymd", $time)) {
+                $date = date("H:i", $time);
+            }
+            $userData[$userId] = ['time' => $date, 'unReadNum' => $num];
+        }
+        $ids = array_column($arr, 'userId');
+        $infoList = UserService::getUserByIds($ids);
+        foreach ($infoList as $userId => $info) {
+            $infoList[$userId]['unReadNum'] = isset($userData[$userId]['unReadNum']) ? $userData[$userId]['unReadNum'] : 0;
+            $infoList[$userId]['chatTime'] = isset($userData[$userId]['time']) ? $userData[$userId]['time'] : date("m-d H:i", $info['visitTime']);
+        }
+        return array_values($infoList);
+    }
+
+    //保存消息记录 ssh 2019.12.29
+    public static function saveMessage($messageList, $userId)
+    {
+        //商家的消息,ourSelf表示自己的消息 themSelf表示对方的消息
+        $now = time();
+        $cacheKey = ChatClass::getMessageKey($userId);
+
+        //删除15天前的已读消息
+        $max = $now - 86400 * 16;
+        Yii::$app->redis->executeCommand('ZREMRANGEBYSCORE', [$cacheKey, 0, $max]);
+
+        foreach ($messageList as $message) {
+            Yii::$app->redis->executeCommand('ZADD', [$cacheKey, $now, json_encode($message)]);
+        }
+        //self::getMessageList($userId);
+    }
+
+    //取消息记录 ssh 2019.12.29
+    public static function getMessageList($userId)
+    {
+        $cacheKey = ChatClass::getMessageKey($userId);
+        //返回有序集合,从高分到低分排序
+        $return = Yii::$app->redis->executeCommand('ZREVRANGE', [$cacheKey, 0, -1, 'WITHSCORES']);
+        if (empty($return)) {
+            return [];
+        }
+        $i = 0;
+        $arr = [];
+        foreach ($return as $key => $val) {
+            if ($key % 2 == 0) {
+                $arr[$i]['message'] = $val;
+            } else {
+                $arr[$i]['time'] = $val;
+                $i++;
+            }
+        }
+        $arr = arrayUtil::arraySort($arr, 'time');
+        $data = [];
+        foreach ($arr as $val) {
+            $message = $val['message'];
+            $data[] = json_decode($message);
+        }
+        return $data;
+    }
 
 }

+ 9 - 9
biz-hd/saas/classes/FestRiseClass.php

@@ -7,14 +7,14 @@ use bizHd\base\classes\BaseClass;
 
 class FestRiseClass extends BaseClass
 {
-	
-	public static $baseFile = '\bizHd\saas\models\FestRise';
-	
-	//找出商家要涨价的节日id
-	public static function getRiseFestId($sjId)
-	{
-		$list = self::getAllByCondition(['sjId' => $sjId], null, '*', 'festId');
-		return !empty($list) ? array_keys($list) : [];
-	}
+
+    public static $baseFile = '\bizHd\saas\models\FestRise';
+
+    //找出商家要涨价的节日id
+    public static function getRiseFestId($mainId)
+    {
+        $list = self::getAllByCondition(['mainId' => $mainId], null, '*', 'festId');
+        return !empty($list) ? array_keys($list) : [];
+    }
 
 }

+ 2 - 2
biz-hd/saas/services/FestRiseService.php

@@ -11,9 +11,9 @@ class FestRiseService extends BaseService
 	public static $baseFile = '\bizHd\saas\classes\FestRiseClass';
 	
 	//找出商家要涨价的节日id
-	public static function getRiseFestId($sjId)
+	public static function getRiseFestId($mainId)
 	{
-		return FestRiseClass::getRiseFestId($sjId);
+		return FestRiseClass::getRiseFestId($mainId);
 	}
 
 }

+ 2 - 2
biz-mall/goods/services/GoodsService.php

@@ -59,12 +59,12 @@ class GoodsService extends BaseService
     }
 
     //验证对此商品的操作权限 ssh 2019.12.7
-    public static function valid($info, $sjId)
+    public static function valid($info, $mainId)
     {
         if (empty($info)) {
             util::fail('没有找到商品');
         }
-        if ($info['sjId'] != $sjId) {
+        if (isset($info['mainId']) == false || $info['mainId'] != $mainId) {
             util::fail('您没有权限操作');
         }
     }