Browse Source

sku下线,针对有赞平台优化

wufeng 2 years ago
parent
commit
a42a5ac293
2 changed files with 11 additions and 7 deletions
  1. 10 6
      app/admin/controller/Goodup.php
  2. 1 1
      app/youzan/model/PlatformYouzan.php

+ 10 - 6
app/admin/controller/Goodup.php

@@ -2917,7 +2917,8 @@ class Goodup extends Base
 
 
             $rs = Db::name('platform_youzan')
             $rs = Db::name('platform_youzan')
                 ->field('id,spuCode,skuCode,exam_status,platform_id')
                 ->field('id,spuCode,skuCode,exam_status,platform_id')
-                ->where(['spuCode' => $param['spuCode'], 'is_del' => PlatformYouzan::$del_normal, 'exam_status' => PlatformYouzan::$exam_status_6])
+                ->where(['spuCode' => $param['spuCode'], 'is_del' => PlatformYouzan::$del_normal])
+                ->whereNotIn('exam_status', [PlatformYouzan::$exam_status_7, PlatformYouzan::$exam_status_8])
                 ->select()
                 ->select()
                 ->toArray();
                 ->toArray();
 
 
@@ -2935,12 +2936,14 @@ class Goodup extends Base
 
 
                     //已上线的要调用有赞接口下线
                     //已上线的要调用有赞接口下线
                     //调有赞项目的接口,从有赞平台下线该商品
                     //调有赞项目的接口,从有赞平台下线该商品
-                    $host = config('app.yz_domain');
-                    $response = curl_request($host . 'api/yz_goodup_offline', $curl_data);
+                    if($value['exam_status'] == PlatformYouzan::$exam_status_6){
+                        $host = config('app.yz_domain');
+                        $response = curl_request($host . 'api/yz_goodup_offline', $curl_data);
 
 
-                    $response = json_decode($response, true);
+                        $response = json_decode($response, true);
 
 
-                    if ($response['code'] != 0) throw new Exception($response['message']);
+                        if ($response['code'] != 0) throw new Exception($response['message']);
+                    }
 
 
                     $insert_good_offline_log_youzan_data[] = [
                     $insert_good_offline_log_youzan_data[] = [
                         'spuCode' => $value['spuCode'],
                         'spuCode' => $value['spuCode'],
@@ -2956,7 +2959,8 @@ class Goodup extends Base
                 }
                 }
 
 
                 Db::name('platform_youzan')
                 Db::name('platform_youzan')
-                    ->where(['spuCode' => $param['spuCode'], 'is_del' => PlatformYouzan::$del_normal, 'exam_status' => PlatformYouzan::$exam_status_6])
+                    ->where(['spuCode' => $param['spuCode'], 'is_del' => PlatformYouzan::$del_normal])
+                    ->whereNotIn('exam_status', [PlatformYouzan::$exam_status_7, PlatformYouzan::$exam_status_8])
                     ->update([
                     ->update([
                         'exam_status' => PlatformYouzan::$exam_status_8,
                         'exam_status' => PlatformYouzan::$exam_status_8,
                         'offline_reason_id' => $param['offline_reason'],
                         'offline_reason_id' => $param['offline_reason'],

+ 1 - 1
app/youzan/model/PlatformYouzan.php

@@ -14,7 +14,7 @@ class PlatformYouzan extends Model
     public static $del_normal = 0;//未删除
     public static $del_normal = 0;//未删除
     public static $deleted = 1;//已删除
     public static $deleted = 1;//已删除
 
 
-    public static $exam_status_0 = 0;//待审核
+    public static $exam_status_0 = 0;//待产品审核
     public static $exam_status_1 = 1;//审核通过待处理
     public static $exam_status_1 = 1;//审核通过待处理
     public static $exam_status_2 = 2;//审核驳回
     public static $exam_status_2 = 2;//审核驳回
     public static $exam_status_6 = 6;//上线成功
     public static $exam_status_6 = 6;//上线成功