| 1234567891011121314151617181920212223242526272829303132 |
- <?php
- namespace bizGhs\cp\services;
- use bizGhs\base\services\BaseService;
- use bizGhs\cp\classes\CpClass;
- use bizGhs\shop\classes\ShopClass;
- class CpService extends BaseService
- {
- public static $baseFile = '\bizGhs\cp\classes\CpClass';
- //从平台导入产品 ssh 20240227
- public static function addPtCp($ptCp, $currentShop)
- {
- $shopCp = CpClass::importPtCp($ptCp, $currentShop);
- if (isset($currentShop->default) && $currentShop->default == 1) {
- $sjId = $currentShop->sjId ?? 0;
- $shopList = ShopClass::getAllByCondition(['sjId' => $sjId], null, '*', null, true);
- foreach ($shopList as $shop) {
- $shopId = $shop->id ?? 0;
- if ($shopId == $currentShop->id) {
- continue;
- }
- CpClass::importPtCp($ptCp, $shop);
- }
- }
- return $shopCp;
- }
- }
|