Browse Source

初始化和更新产品

shish 2 years ago
parent
commit
407499112d
2 changed files with 5 additions and 1 deletions
  1. 3 0
      biz-ghs/apply/services/ApplyService.php
  2. 2 1
      biz/cp/serices/PtCpService.php

+ 3 - 0
biz-ghs/apply/services/ApplyService.php

@@ -2,6 +2,7 @@
 
 namespace bizGhs\apply\services;
 
+use biz\cp\services\PtCpService;
 use biz\shop\classes\ShopClass;
 use bizGhs\apply\classes\ApplyClass;
 use bizGhs\merchant\services\MerchantService;
@@ -47,6 +48,8 @@ class ApplyService extends BaseService
         $apply['name'] = isset($apply['name']) ? $apply['name'] : '';
         //初始化或更新花材
         MainClass::addMainInitItem($main, $live);
+        //初始化或更新产品
+        PtCpService::initMainCp($main);
         $respond = MerchantService::initGhsBaseInfo($apply, $main, true);
         $pfShop = $respond['shop'] ?? [];
 

+ 2 - 1
biz/cp/serices/PtCpService.php

@@ -22,8 +22,9 @@ class PtCpService extends BaseService
     public static $baseFile = '\biz\cp\classes\PtCpClass';
 
     //初始化商家的产品 ssh 20240216
-    public function initMainCp($mainId)
+    public static function initMainCp($main)
     {
+        $mainId = $main->id ?? 0;
         $ptClassList = PtCpClassClass::getAllByCondition(['delStatus' => 0], null, '*');
         foreach ($ptClassList as $ptClass) {
             $ptClassId = $ptClass['id'] ?? 0;