* @date 2025/6/8 9:29 */ public static function synchronizeGoods($goods_id, $platform_id, $params = []) { try { $result = false; // 判断平台配置 是否同步商品库 is_synchronize 是否同步外部 is_synchronize_external $is_synchronize = ExternalPlatform::getPlatformConfig($platform_id,'is_synchronize'); if($is_synchronize){ $externalPlatformGoods = ExternalPlatformGoods::where('goods_id',$goods_id)->where('external_platform_id',$platform_id)->findOrEmpty(); if($externalPlatformGoods->isEmpty()){ $result = ExternalPlatformGoodsLogic::add([ 'service_fee' => $params['service_fee']??0, 'goods_status' => 1, 'goods_id' => $goods_id, 'external_goods_sn' => '', 'external_platform_id' => $platform_id, ]); }else{ $externalPlatformGoods->service_fee = $params['service_fee']??0; $externalPlatformGoods->save(); $result = true; } } $is_synchronize_external = ExternalPlatform::getPlatformConfig($platform_id,'is_synchronize_external'); if($is_synchronize && $is_synchronize_external){ // tmp固定 - goods_category_id goods_id external_platform_id // TODO: tmp固定platform_id $platform_id == 6 && DouYinService::addProduct(['goods_category_id'=>$params['goods_category_id']??0,'goods_id'=>$goods_id,'external_platform_id'=>$platform_id]); } return true; } catch (\Exception $e) { Log::info('synchronizeGoods:'.$e->getMessage()); return false; } } }