shish 3 rokov pred
rodič
commit
8bcca2e40a
1 zmenil súbory, kde vykonal 13 pridanie a 2 odobranie
  1. 13 2
      app-hd/controllers/MtController.php

+ 13 - 2
app-hd/controllers/MtController.php

@@ -246,6 +246,7 @@ class MtController extends PublicController
                 noticeUtil::push("美团修改商品,通知我们时,没有发现这个商品,mainId:{$mainId} spu:{$appSpuCode}", '15280215347');
                 return Json::encode(['data' => 'ok']);
             }
+            $hasGoodsId = $hasGoods->id ?? 0;
 
             $params = ['app_poi_code' => $shopId, 'app_spu_code' => $appSpuCode, 'access_token' => $accessToken];
             $goodsInfo = $app->retail->getDetail($params);
@@ -263,13 +264,23 @@ class MtController extends PublicController
                 return Json::encode(['data' => 'ok']);
             }
 
-            noticeUtil::push("美团修改商品,通知我们,商品图片:" . $imgString, '15280215347');
-
             $goodsName = $goodsInfo['data']['name'] ?? '';
             $goodsPrice = $goodsInfo['data']['price'] ?? '';
             $description = $goodsInfo['data']['description'] ?? '';
             $sh = strstr($description, '【鲜花】') !== false ? 1 : 0;
 
+            $currentStr = md5($goodsName . '_' . $goodsPrice . '_' . $description . '_' . $sh . '_' . $imgString);
+            $cacheKey = 'mt_goods_id_' . $hasGoodsId;
+            $cacheStr = Yii::$app->redis->executeCommand('GET', [$cacheKey]);
+            if ($cacheStr == $currentStr) {
+                noticeUtil::push("美团修改商品,通知我们时发现商品没有更新哦", '15280215347');
+                return Json::encode(['data' => 'ok']);
+            } else {
+                Yii::$app->redis->executeCommand('SET', [$cacheKey, $currentStr]);
+            }
+
+            noticeUtil::push("美团修改商品,通知我们,商品图片:" . $imgString, '15280215347');
+
             $shopImg = [];
             $cover = '';
             $imgArr = explode(',', $imgString);