Jelajahi Sumber

Merge branch 'master' into dev

shish 11 bulan lalu
induk
melakukan
3dad781d04

+ 5 - 8
app-hd/controllers/ProductController.php

@@ -843,22 +843,19 @@ class ProductController extends BaseController
     public function actionGhsProductDetail()
     {
         $get = Yii::$app->request->get();
-        $id = isset($get['id']) ? intval($get['id']) : 0;
-        $ghsId = isset($get['ghsId']) ? intval($get['ghsId']) : 0;
-        if ($id == 0 || $ghsId == 0) {
-            util::fail('请求参数出错');
-        }
-
+        $id = $get['id'] ?? 0;
+        $ghsId = $get['ghsId'] ?? 0;
         $product = ProductClass::getById($id);
         if (empty($product)) {
             util::fail('没有花材信息');
         }
-        $ghsInfo = GhsClass::getById($ghsId, true, 'giveLevel, mainId');
+        $ghsInfo = GhsClass::getById($ghsId, true, 'giveLevel');
         $level = isset($ghsInfo->giveLevel) ? $ghsInfo->giveLevel : 1;
         $list = ProductClass::groupProductInfo([$product], $level);
         $product = current($list);
 
-        $pixTextGoods = PicTextGhsItemClass::getByCondition(['mainId' => $ghsInfo->mainId, 'ghsItemId' => $id], true);
+        $mainId = $product['mainId']??0;
+        $pixTextGoods = PicTextGhsItemClass::getByCondition(['mainId' => $mainId, 'ghsItemId' => $id], true);
         $product['picTextGoods'] = $pixTextGoods;
         // 封面图与多花材图片的兼容处理
         if ($product['images'] == '' && $product['shortCover'] != '') {

+ 5 - 1
app-mall/controllers/ChatController.php

@@ -74,7 +74,11 @@ class ChatController extends BaseController
     //客户的未读消息总数
     public function actionUnReadMsgCount()
     {
-        $c = ChatService::getUnReadMsgCount(intval($this->userId), 'message');
+        $c = 0;
+        //未登录也会访问这个接口
+        if ($this->userId > 0) {
+            $c = ChatService::getUnReadMsgCount($this->userId, 'message');
+        }
         util::success(['msg_count' => $c]);
     }