shish 6 лет назад
Родитель
Сommit
8f193a08fc
2 измененных файлов с 21 добавлено и 3 удалено
  1. 11 1
      biz/goods/services/GoodsStyleService.php
  2. 10 2
      console/controllers/InitController.php

+ 11 - 1
biz/goods/services/GoodsStyleService.php

@@ -3,6 +3,7 @@
 namespace biz\goods\services;
 
 use biz\base\services\BaseService;
+use biz\goods\classes\GoodsClass;
 use biz\goods\classes\GoodsStyleClass;
 use common\components\business;
 use Yii;
@@ -10,7 +11,16 @@ use linslin\yii2\curl;
 
 class GoodsStyleService extends BaseService
 {
-
+	
 	public static $baseFile = '\biz\goods\classes\GoodsStyleClass';
 
+	public static function updateGlhsGoods()
+	{
+		$styleList = GoodsStyleClass::getAllByCondition([], null, '*');
+		foreach ($styleList as $style) {
+			$goodsId = $style['goodsId'];
+			GoodsClass::updateById($goodsId, ['goodsStyle' => 1]);
+		}
+	}
+
 }

+ 10 - 2
console/controllers/InitController.php

@@ -2,6 +2,8 @@
 
 namespace console\controllers;
 
+use biz\goods\services\GoodsService;
+use biz\goods\services\GoodsStyleService;
 use biz\merchant\services\MerchantService;
 use biz\user\services\UserService;
 use biz\wx\services\WxOpenService;
@@ -86,13 +88,13 @@ class InitController extends Controller
 		$redisPubSub = \Yii::$app->redisPubSub;
 		$redisPubSub->publish($name, $time);
 	}
-
+	
 	public function actionPullUser()
 	{
 		//拉取用户
 		$this->actionPullUser();
 	}
-
+	
 	// 拉取微信用户 shish 2019.9.9
 	public function actionPullUser2()
 	{
@@ -101,5 +103,11 @@ class InitController extends Controller
 		$total = isset($return['data']['total']) ? $return['data']['total'] : 0;
 		xhMerchantAssetService::updateByMerchantId($merchantId, ['totalFans' => $total]);
 	}
+
+	//商品多款式 shish 2020.6.4
+	public function actionUpdateGoods()
+	{
+		GoodsStyleService::updateGlhsGoods();
+	}
 	
 }