|
|
@@ -4,7 +4,6 @@ namespace console\controllers;
|
|
|
|
|
|
use common\components\noticeUtil;
|
|
|
use common\components\util;
|
|
|
-use Yii;
|
|
|
use yii\console\Controller;
|
|
|
use biz\shop\classes\ShopClass;
|
|
|
use biz\shop\classes\ShopExtClass;
|
|
|
@@ -15,7 +14,6 @@ use common\components\httpUtil;
|
|
|
use common\components\mtUtil;
|
|
|
use Shishaoqi\MeituanFlashPurchase\Application;
|
|
|
|
|
|
-
|
|
|
class MtController extends Controller
|
|
|
{
|
|
|
|
|
|
@@ -27,14 +25,17 @@ class MtController extends Controller
|
|
|
ini_set('memory_limit', '2045M');
|
|
|
set_time_limit(0);
|
|
|
|
|
|
- $shopId = $argv[2];
|
|
|
+ $shopId = $argv[2] ?? 0;
|
|
|
+ if (empty($shopId)) {
|
|
|
+ util::stop('请填写门店id');
|
|
|
+ }
|
|
|
$ext = ShopExtClass::getByCondition(['shopId' => $shopId], true);
|
|
|
if (empty($ext)) {
|
|
|
- util::fail('没有找到门店相信息');
|
|
|
+ util::stop('没有找到门店相信息');
|
|
|
}
|
|
|
$shop = ShopClass::getById($shopId, true);
|
|
|
if (empty($shop)) {
|
|
|
- util::fail('没有找到门店');
|
|
|
+ util::stop('没有找到门店');
|
|
|
}
|
|
|
$mainId = $shop->mainId ?? 0;
|
|
|
$sjId = $shop->sjId ?? 0;
|
|
|
@@ -45,7 +46,7 @@ class MtController extends Controller
|
|
|
$json = $app->retail->retailList($params);
|
|
|
$arr = json_decode($json, true);
|
|
|
if (isset($arr['data']) == false || empty($arr['data'])) {
|
|
|
- util::fail('没有商品');
|
|
|
+ util::stop('没有商品');
|
|
|
}
|
|
|
|
|
|
$mtCategory = CategoryClass::getByCondition(['mainId' => $mainId, 'style' => 1], true);
|
|
|
@@ -54,7 +55,7 @@ class MtController extends Controller
|
|
|
}
|
|
|
$catId = $mtCategory->id ?? 0;
|
|
|
if (empty($catId)) {
|
|
|
- util::fail('没有找到美团的商品分类');
|
|
|
+ util::stop('没有找到美团的商品分类');
|
|
|
}
|
|
|
|
|
|
$goodsList = $arr['data'];
|