|
|
|
@ -4,9 +4,9 @@ namespace App\Providers; |
|
|
|
|
|
|
|
use App\Common\AgentType; |
|
|
|
use App\Common\ProductStatus; |
|
|
|
use App\Common\UserStatus; |
|
|
|
use App\Models\AgentProduct; |
|
|
|
use App\Models\AgentProductItem; |
|
|
|
use App\Models\AgentProductSpec; |
|
|
|
use App\Models\AgentSetting; |
|
|
|
use App\Models\Category; |
|
|
|
use App\Models\Agent; |
|
|
|
@ -14,7 +14,6 @@ use App\Models\Product; |
|
|
|
use App\Models\ProductSpec; |
|
|
|
use App\Service\SmsService; |
|
|
|
use App\Traits\SmsTraits; |
|
|
|
use Illuminate\Database\Eloquent\Model; |
|
|
|
use Illuminate\Support\Facades\DB; |
|
|
|
use Illuminate\Support\Facades\Log; |
|
|
|
use Illuminate\Support\ServiceProvider; |
|
|
|
@ -52,14 +51,12 @@ class ProductServiceProvider extends ServiceProvider |
|
|
|
/** 同步信息到代理商产品 END */ |
|
|
|
|
|
|
|
/** 自动上架 START */ |
|
|
|
$agentIds = AgentProductItem::query() |
|
|
|
->withoutGlobalScope('orderById') |
|
|
|
->where('supplier_id', $product->supplier_id) |
|
|
|
->whereHas('agent',function($query) { |
|
|
|
$query->where('type','!=',AgentType::OPERATOR); |
|
|
|
}) |
|
|
|
->distinct() |
|
|
|
->pluck('agent_id'); |
|
|
|
$agentIds = Agent::query()->where([ |
|
|
|
['id', '>', 1], //1是总管理员,不处理
|
|
|
|
['type', '<>', AgentType::OPERATOR], |
|
|
|
['status', '=', UserStatus::NORMAL] |
|
|
|
])->pluck('id'); |
|
|
|
|
|
|
|
foreach ($agentIds as $v) { |
|
|
|
//如果没开启自动上架 滚蛋
|
|
|
|
if (empty(AgentSetting::val($v, 'auto_shelves'))) { |
|
|
|
|