|
|
@@ -14,6 +14,33 @@ class CpClass extends BaseClass
|
|
|
|
|
|
public static $baseFile = '\bizGhs\cp\models\Cp';
|
|
|
|
|
|
+ //恢复产品 ssh 20240222
|
|
|
+ public static function recoverCp($cp, $masterShop)
|
|
|
+ {
|
|
|
+ $ptCpId = $cp->ptCpId ?? 0;
|
|
|
+ $cp->delStatus = 0;
|
|
|
+ $cp->save();
|
|
|
+ if (isset($masterShop->default) && $masterShop->default == 1) {
|
|
|
+ $sjId = $masterShop->sjId ?? 0;
|
|
|
+ $shopList = ShopClass::getAllByCondition(['sjId' => $sjId], null, '*', null, true);
|
|
|
+ if (!empty($shopList)) {
|
|
|
+ foreach ($shopList as $shop) {
|
|
|
+ if ($shop->id == $masterShop->id) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ $shopName = $shop->shopName ?? '';
|
|
|
+ $chainMainId = $shop->mainId ?? 0;
|
|
|
+ $has = self::getByCondition(['mainId' => $chainMainId, 'ptCpId' => $ptCpId, 'delStatus' => 0], true);
|
|
|
+ if (empty($has)) {
|
|
|
+ util::fail($shopName . '的产品没有找到');
|
|
|
+ }
|
|
|
+ $has->delStatus = 0;
|
|
|
+ $has->save();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
//删除产品 ssh 20240221
|
|
|
public static function delCp($cp, $masterShop)
|
|
|
{
|