Commit 8fd54f7a by Vladislav

Исправления

1 parent 295f4037
......@@ -41,14 +41,14 @@ class CampaignsAdd extends Command
*/
public function handle()
{
$tokens = Tokens::whereHas('dictionaryCampaignsEnabledForNotExternalForNotReserveCreate')
->with('dictionaryCampaignsEnabledForNotExternalForNotReserveCreate.campaign')
$tokens = Tokens::whereHas('dictionaryCampaignsEnabledForNotExternalForNotReserveCreateSynchronized')
->with('dictionaryCampaignsEnabledForNotExternalForNotReserveCreateSynchronized.campaign')
->where('type', '!=', Tokens::MAIN)
->get();
foreach ($tokens as $token) {
foreach (array_chunk($token->dictionaryCampaignsEnabledForNotExternalForNotReserveCreate->pluck('id')->toArray(), 100) as $items) {
foreach (array_chunk($token->dictionaryCampaignsEnabledForNotExternalForNotReserveCreateSynchronized->pluck('id')->toArray(), 100) as $items) {
DictionaryCampaign::whereIn('id', $items)
->update([
'reserve_create_at' => Carbon::now(),
......@@ -58,7 +58,7 @@ class CampaignsAdd extends Command
$request = new AddCampaigns();
$request->setToken($token)
->call([
'dictionaryCampaigns' => $token->dictionaryCampaignsEnabledForNotExternalForNotReserveCreate,
'dictionaryCampaigns' => $token->dictionaryCampaignsEnabledForNotExternalForNotReserveCreateSynchronized,
]);
}
......
......@@ -216,11 +216,11 @@ class CampaignVariablesController extends Controller
})->update([
'updated_need' => Carbon::now(),
]);
// $dictionary_campaign->goalGoalSitelink()->forExternal()->where(function ($query) {
// $query->getModel()->timestamps = false;
// })->update([
// 'updated_need' => Carbon::now(),
// ]);
$dictionary_campaign->goalGoalSitelink()->forExternal()->where(function ($query) {
$query->getModel()->timestamps = false;
})->update([
'updated_need' => Carbon::now(),
]);
$dictionary_campaign->goalVCards()->forExternal()->where(function ($query) {
$query->getModel()->timestamps = false;
})->update([
......
......@@ -233,6 +233,8 @@ class DictionaryCampaign extends Pivot
array_merge(
$data,
[
'updated' => false,
'synced' => false,
'dictionary_id' => $dictionary->getKey(),
'campaign_id' => $campaign->getKey(),
]
......
......@@ -234,9 +234,9 @@ class Tokens extends Model
return $this->dictionaryCampaigns()->enabled()->forExternal()->forUpdated()->needUpdated()->forNotReserveUpdate();
}
public function dictionaryCampaignsEnabledForNotExternalForNotReserveCreate()
public function dictionaryCampaignsEnabledForNotExternalForNotReserveCreateSynchronized()
{
return $this->dictionaryCampaigns()->enabled()->forNotExternal()->forNotReserveCreate();
return $this->dictionaryCampaigns()->enabled()->forNotExternal()->forNotReserveCreate()->synchronized();
}
public function dictionaryCampaignsNotEnabledForExternalNotDisabledForNotReserveSuspend()
......
......@@ -97,10 +97,12 @@ class AddAdExtensions extends DirectRequest
public function failed()
{
GoalAdExtension::whereIn('id', $this->goalAdExtensions->pluck('id')->toArray())
->update([
'reserve_create_at' => null,
]);
foreach (array_chunk($this->goalAdExtensions->pluck('id')->toArray(), 100) as $items) {
GoalAdExtension::whereIn('id', $items)
->update([
'reserve_create_at' => null,
]);
}
}
public function putParams($params)
......
......@@ -113,10 +113,12 @@ class AddAdGroups extends DirectRequest
public function failed()
{
GoalAdGroup::whereIn('id', $this->goalAdGroups->pluck('id')->toArray())
->update([
'reserve_create_at' => null,
]);
foreach (array_chunk($this->goalAdGroups->pluck('id')->toArray(), 100) as $items) {
GoalAdGroup::whereIn('id', $items)
->update([
'reserve_create_at' => null,
]);
}
}
public function putParams($params)
......
......@@ -146,10 +146,12 @@ class AddAds extends DirectRequest
public function failed()
{
GoalAdvertisement::whereIn('id', $this->goalAds->pluck('id')->toArray())
->update([
'reserve_create_at' => null,
]);
foreach (array_chunk($this->goalAds->pluck('id')->toArray(), 100) as $items) {
GoalAdvertisement::whereIn('id', $items)
->update([
'reserve_create_at' => null,
]);
}
}
public function putParams($params)
......
......@@ -105,12 +105,14 @@ class AddBidModifiers extends DirectRequest
public function failed()
{
GoalBidModifier::whereIn('id', $this->goalBidModifiers->pluck('ids')->map(function ($ids) {
foreach (array_chunk($this->goalBidModifiers->pluck('ids')->map(function ($ids) {
return json_decode($ids);
})->collapse()->toArray())
->update([
'reserve_create_at' => null,
]);
})->collapse()->toArray(), 100) as $items) {
GoalBidModifier::whereIn('id', $items)
->update([
'reserve_create_at' => null,
]);
}
}
public function putParams($params)
......
......@@ -122,10 +122,12 @@ class AddKeywords extends DirectRequest
public function failed()
{
GoalKeyword::whereIn('id', $this->goalKeywords->pluck('id')->toArray())
->update([
'reserve_create_at' => null,
]);
foreach (array_chunk($this->goalKeywords->pluck('id')->toArray(), 100) as $items) {
GoalKeyword::whereIn('id', $items)
->update([
'reserve_create_at' => null,
]);
}
}
private function requestPrepare($params)
......
......@@ -101,10 +101,12 @@ class AddRetargetinglists extends DirectRequest
public function failed()
{
GoalRetargetinglist::whereIn('id', $this->goalRetargetinglists->pluck('id')->toArray())
->update([
'reserve_create_at' => null,
]);
foreach (array_chunk($this->goalRetargetinglists->pluck('id')->toArray(), 100) as $items) {
GoalRetargetinglist::whereIn('id', $items)
->update([
'reserve_create_at' => null,
]);
}
}
public function putParams($params)
......
......@@ -101,10 +101,12 @@ class AddSitelinks extends DirectRequest
public function failed()
{
GoalSitelink::whereIn('id', $this->goalSitelinks->pluck('id')->toArray())
->update([
'reserve_create_at' => null,
]);
foreach (array_chunk($this->goalSitelinks->pluck('id')->toArray(), 100) as $items) {
GoalSitelink::whereIn('id', $items)
->update([
'reserve_create_at' => null,
]);
}
}
public function putParams($params)
......
......@@ -132,15 +132,19 @@ class ArchiveAds extends DirectRequest
public function failed()
{
if ($this->getToken()->isMain()) {
Advertisement::whereIn('external_id', $this->getParams()['SelectionCriteria']['Ids'])
->update([
'reserve_archive_at' => null,
]);
foreach (array_chunk($this->getParams()['SelectionCriteria']['Ids'], 100) as $items) {
Advertisement::whereIn('external_id', $items)
->update([
'reserve_archive_at' => null,
]);
}
} else {
GoalAdvertisement::whereIn('external_id', $this->getParams()['SelectionCriteria']['Ids'])
->update([
'reserve_archive_at' => null,
]);
foreach (array_chunk($this->getParams()['SelectionCriteria']['Ids'], 100) as $items) {
GoalAdvertisement::whereIn('external_id', $items)
->update([
'reserve_archive_at' => null,
]);
}
}
}
......
......@@ -82,10 +82,12 @@ class DeleteAdGroups extends DirectRequest
public function failed()
{
GoalAdGroup::whereIn('external_id', $this->getParams()['SelectionCriteria']['Ids'])
->update([
'reserve_delete_at' => null,
]);
foreach (array_chunk($this->getParams()['SelectionCriteria']['Ids'], 100) as $items) {
GoalAdGroup::whereIn('external_id', $items)
->update([
'reserve_delete_at' => null,
]);
}
}
private function requestPrepare($params)
......
......@@ -114,15 +114,19 @@ class DeleteAds extends DirectRequest
public function failed()
{
if ($this->getToken()->isMain()) {
Advertisement::whereIn('external_id', $this->getParams()['SelectionCriteria']['Ids'])
->update([
'reserve_delete_at' => null,
]);
foreach (array_chunk($this->getParams()['SelectionCriteria']['Ids'], 100) as $items) {
Advertisement::whereIn('external_id', $items)
->update([
'reserve_delete_at' => null,
]);
}
} else {
GoalAdvertisement::whereIn('external_id', $this->getParams()['SelectionCriteria']['Ids'])
->update([
'reserve_delete_at' => null,
]);
foreach (array_chunk($this->getParams()['SelectionCriteria']['Ids'], 100) as $items) {
GoalAdvertisement::whereIn('external_id', $items)
->update([
'reserve_delete_at' => null,
]);
}
}
}
......
......@@ -99,15 +99,19 @@ class DeleteAudienceTarget extends DirectRequest
public function failed()
{
if ($this->getToken()->isMain()) {
AudienceTarget::whereIn('external_id', $this->getParams()['SelectionCriteria']['Ids'])
->update([
'reserve_delete_at' => null,
]);
foreach (array_chunk($this->getParams()['SelectionCriteria']['Ids'], 100) as $items) {
AudienceTarget::whereIn('external_id', $items)
->update([
'reserve_delete_at' => null,
]);
}
} else {
GoalAudienceTarget::whereIn('external_id', $this->getParams()['SelectionCriteria']['Ids'])
->update([
'reserve_delete_at' => null,
]);
foreach (array_chunk($this->getParams()['SelectionCriteria']['Ids'], 100) as $items) {
GoalAudienceTarget::whereIn('external_id', $items)
->update([
'reserve_delete_at' => null,
]);
}
}
}
......
......@@ -80,10 +80,12 @@ class DeleteKeywords extends DirectRequest
public function failed()
{
GoalKeyword::whereIn('external_id', $this->getParams()['SelectionCriteria']['Ids'])
->update([
'reserve_delete_at' => null,
]);
foreach (array_chunk($this->getParams()['SelectionCriteria']['Ids'], 100) as $items) {
GoalKeyword::whereIn('external_id', $items)
->update([
'reserve_delete_at' => null,
]);
}
}
private function requestPrepare($params)
......
......@@ -99,15 +99,19 @@ class DeleteRetargetinglists extends DirectRequest
public function failed()
{
if ($this->getToken()->isMain()) {
Retargetinglist::whereIn('external_id', $this->getParams()['SelectionCriteria']['Ids'])
->update([
'reserve_delete_at' => null,
]);
foreach (array_chunk($this->getParams()['SelectionCriteria']['Ids'], 100) as $items) {
Retargetinglist::whereIn('external_id', $items)
->update([
'reserve_delete_at' => null,
]);
}
} else {
GoalRetargetinglist::whereIn('external_id', $this->getParams()['SelectionCriteria']['Ids'])
->update([
'reserve_delete_at' => null,
]);
foreach (array_chunk($this->getParams()['SelectionCriteria']['Ids'], 100) as $items) {
GoalRetargetinglist::whereIn('external_id', $items)
->update([
'reserve_delete_at' => null,
]);
}
}
}
......
......@@ -111,15 +111,19 @@ class DeleteVCards extends DirectRequest
public function failed()
{
if ($this->getToken()->isMain()) {
VCard::whereIn('external_id', $this->getParams()['SelectionCriteria']['Ids'])
->update([
'reserve_delete_at' => null,
]);
foreach (array_chunk($this->getParams()['SelectionCriteria']['Ids'], 100) as $items) {
VCard::whereIn('external_id', $items)
->update([
'reserve_delete_at' => null,
]);
}
} else {
GoalVCard::whereIn('external_id', $this->getParams()['SelectionCriteria']['Ids'])
->update([
'reserve_delete_at' => null,
]);
foreach (array_chunk($this->getParams()['SelectionCriteria']['Ids'], 100) as $items) {
GoalVCard::whereIn('external_id', $items)
->update([
'reserve_delete_at' => null,
]);
}
}
}
......
......@@ -76,10 +76,12 @@ class ResumeCampaigns extends DirectRequest
public function failed()
{
DictionaryCampaign::whereIn('external_id', array_column($this->getParams()['SelectionCriteria']['Ids'], 'Id'))
->update([
'reserve_resume_at' => null,
]);
foreach (array_chunk(array_column($this->getParams()['SelectionCriteria']['Ids'], 'Id'), 100) as $items) {
DictionaryCampaign::whereIn('external_id', $items)
->update([
'reserve_resume_at' => null,
]);
}
}
private function requestPrepare($filter)
......
......@@ -91,10 +91,12 @@ class SetBidModifiers extends DirectRequest
public function failed()
{
GoalBidModifier::whereIn('external_id', array_column($this->getParams()['BidModifiers'], 'Id'))
->update([
'reserve_update_at' => null,
]);
foreach (array_chunk(array_column($this->getParams()['BidModifiers'], 'Id'), 100) as $items) {
GoalBidModifier::whereIn('external_id', $items)
->update([
'reserve_update_at' => null,
]);
}
}
private function requestPrepare($params)
......
......@@ -76,10 +76,12 @@ class SuspendCampaigns extends DirectRequest
public function failed()
{
DictionaryCampaign::whereIn('external_id', array_column($this->getParams()['SelectionCriteria']['Ids'], 'Id'))
->update([
'reserve_suspend_at' => null,
]);
foreach (array_chunk(array_column($this->getParams()['SelectionCriteria']['Ids'], 'Id'), 100) as $items) {
DictionaryCampaign::whereIn('external_id', $items)
->update([
'reserve_suspend_at' => null,
]);
}
}
private function requestPrepare($filter)
......
......@@ -91,10 +91,12 @@ class UpdateAdGroups extends DirectRequest
public function failed()
{
GoalAdGroup::whereIn('external_id', array_column($this->getParams()['AdGroups'], 'Id'))
->update([
'reserve_update_at' => null,
]);
foreach (array_chunk(array_column($this->getParams()['AdGroups'], 'Id'), 100) as $items) {
GoalAdGroup::whereIn('external_id', $items)
->update([
'reserve_update_at' => null,
]);
}
}
private function requestPrepare($params)
......
......@@ -112,10 +112,12 @@ class UpdateAds extends DirectRequest
public function failed()
{
GoalAdvertisement::whereIn('external_id', array_column($this->getParams()['Ads'], 'Id'))
->update([
'reserve_update_at' => null,
]);
foreach (array_chunk(array_column($this->getParams()['Ads'], 'Id'), 100) as $items) {
GoalAdvertisement::whereIn('external_id', $items)
->update([
'reserve_update_at' => null,
]);
}
}
private function requestPrepare($params)
......
......@@ -93,10 +93,12 @@ class UpdateKeywords extends DirectRequest
public function failed()
{
GoalKeyword::whereIn('external_id', array_column($this->getParams()['Keywords'], 'Id'))
->update([
'reserve_update_at' => null,
]);
foreach (array_chunk(array_column($this->getParams()['Keywords'], 'Id'), 100) as $items) {
GoalKeyword::whereIn('external_id', $items)
->update([
'reserve_update_at' => null,
]);
}
}
private function requestPrepare($params)
......
......@@ -88,10 +88,12 @@ class UpdateRetargetinglists extends DirectRequest
public function failed()
{
GoalRetargetinglist::whereIn('external_id', array_column($this->getParams()['RetargetingLists'], 'Id'))
->update([
'reserve_update_at' => null,
]);
foreach (array_chunk(array_column($this->getParams()['RetargetingLists'], 'Id'), 100) as $items) {
GoalRetargetinglist::whereIn('external_id', $items)
->update([
'reserve_update_at' => null,
]);
}
}
private function requestPrepare($params)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!