Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Письменов Дмитрий Иванович
/
yourroomads
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 7be069a6
authored
Jul 06, 2021
by
Vladislav
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#20414 Загрузка и синхронизация VCards
1 parent
8036cb5a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
18 deletions
app/Console/Kernel.php
app/Models/Pivots/GoalVCard.php
app/Service/Requests/Direct/AddVCards.php
app/Console/Kernel.php
View file @
7be069a
...
@@ -25,6 +25,8 @@ use App\Console\Commands\KeywordsAdd;
...
@@ -25,6 +25,8 @@ use App\Console\Commands\KeywordsAdd;
use
App\Console\Commands\KeywordsDelete
;
use
App\Console\Commands\KeywordsDelete
;
use
App\Console\Commands\KeywordsUpdate
;
use
App\Console\Commands\KeywordsUpdate
;
use
App\Console\Commands\RefreshLimits
;
use
App\Console\Commands\RefreshLimits
;
use
App\Console\Commands\VCardsAdd
;
use
App\Console\Commands\VCardsLoad
;
use
Illuminate\Console\Scheduling\Schedule
;
use
Illuminate\Console\Scheduling\Schedule
;
use
Illuminate\Foundation\Console\Kernel
as
ConsoleKernel
;
use
Illuminate\Foundation\Console\Kernel
as
ConsoleKernel
;
...
@@ -51,6 +53,7 @@ class Kernel extends ConsoleKernel
...
@@ -51,6 +53,7 @@ class Kernel extends ConsoleKernel
$schedule
->
command
(
RefreshLimits
::
class
)
->
hourly
();
$schedule
->
command
(
RefreshLimits
::
class
)
->
hourly
();
$schedule
->
command
(
DictionariesLoad
::
class
)
->
saturdays
()
->
at
(
'05:00'
);
$schedule
->
command
(
DictionariesLoad
::
class
)
->
saturdays
()
->
at
(
'05:00'
);
$schedule
->
command
(
VCardsLoad
::
class
)
->
at
(
'00:00'
);
$schedule
->
command
(
CampaignsCheckChange
::
class
)
->
hourlyAt
(
5
);
$schedule
->
command
(
CampaignsCheckChange
::
class
)
->
hourlyAt
(
5
);
$schedule
->
command
(
CampaignsLoadUpdated
::
class
)
->
hourlyAt
(
10
);
$schedule
->
command
(
CampaignsLoadUpdated
::
class
)
->
hourlyAt
(
10
);
$schedule
->
command
(
CampaignsCheckUpdatedChildren
::
class
)
->
hourlyAt
(
10
);
$schedule
->
command
(
CampaignsCheckUpdatedChildren
::
class
)
->
hourlyAt
(
10
);
...
@@ -64,6 +67,7 @@ class Kernel extends ConsoleKernel
...
@@ -64,6 +67,7 @@ class Kernel extends ConsoleKernel
$schedule
->
command
(
AdGroupsLoadUpdated
::
class
)
->
hourlyAt
(
20
);
$schedule
->
command
(
AdGroupsLoadUpdated
::
class
)
->
hourlyAt
(
20
);
$schedule
->
command
(
AdGroupsLoadKeywords
::
class
)
->
hourlyAt
(
30
);
$schedule
->
command
(
AdGroupsLoadKeywords
::
class
)
->
hourlyAt
(
30
);
$schedule
->
command
(
VCardsAdd
::
class
)
->
hourlyAt
(
25
);
$schedule
->
command
(
AdExtensionsLoad
::
class
)
->
hourlyAt
(
25
);
$schedule
->
command
(
AdExtensionsLoad
::
class
)
->
hourlyAt
(
25
);
$schedule
->
command
(
AdExtensionsAdd
::
class
)
->
hourlyAt
(
30
);
$schedule
->
command
(
AdExtensionsAdd
::
class
)
->
hourlyAt
(
30
);
...
...
app/Models/Pivots/GoalVCard.php
View file @
7be069a
...
@@ -13,7 +13,7 @@ class GoalVCard extends Pivot
...
@@ -13,7 +13,7 @@ class GoalVCard extends Pivot
{
{
use
SoftDeletes
;
use
SoftDeletes
;
protected
$table
=
'goal_v_card'
;
protected
$table
=
'goal_v_card
s
'
;
protected
$fillable
=
[
protected
$fillable
=
[
'external_id'
,
'external_id'
,
...
...
app/Service/Requests/Direct/AddVCards.php
View file @
7be069a
...
@@ -121,31 +121,69 @@ class AddVCards extends DirectRequest
...
@@ -121,31 +121,69 @@ class AddVCards extends DirectRequest
$list
=
$lists
[
$goalVCard
->
dictionary_campaign_id
];
$list
=
$lists
[
$goalVCard
->
dictionary_campaign_id
];
}
}
return
[
$data
=
[
'CampaignId'
=>
$goalVCard
->
dictionary_campaign_external_id
,
'CampaignId'
=>
$goalVCard
->
dictionary_campaign_external_id
,
'Country'
=>
StrReplaceByVariables
::
getInstance
(
$goalVCard
->
vCard
->
country
,
$list
)
->
get
(),
'Country'
=>
StrReplaceByVariables
::
getInstance
(
$goalVCard
->
vCard
->
country
,
$list
)
->
get
(),
'City'
=>
StrReplaceByVariables
::
getInstance
(
$goalVCard
->
vCard
->
city
,
$list
)
->
get
(),
'City'
=>
StrReplaceByVariables
::
getInstance
(
$goalVCard
->
vCard
->
city
,
$list
)
->
get
(),
'CompanyName'
=>
StrReplaceByVariables
::
getInstance
(
$goalVCard
->
vCard
->
company_name
,
$list
)
->
get
(),
'CompanyName'
=>
StrReplaceByVariables
::
getInstance
(
$goalVCard
->
vCard
->
company_name
,
$list
)
->
get
(),
'WorkTime'
=>
StrReplaceByVariables
::
getInstance
(
$goalVCard
->
vCard
->
work_time
,
$list
)
->
get
(),
'WorkTime'
=>
StrReplaceByVariables
::
getInstance
(
$goalVCard
->
vCard
->
work_time
,
$list
)
->
get
(),
'Phone'
=>
array_map
(
function
(
$phone
)
use
(
$list
)
{
];
if
(
$goalVCard
->
vCard
->
street
)
{
$data
[
'Street'
]
=
StrReplaceByVariables
::
getInstance
(
$goalVCard
->
vCard
->
street
,
$list
)
->
get
();
}
if
(
$goalVCard
->
vCard
->
house
)
{
$data
[
'House'
]
=
StrReplaceByVariables
::
getInstance
(
$goalVCard
->
vCard
->
house
,
$list
)
->
get
();
}
if
(
$goalVCard
->
vCard
->
building
)
{
$data
[
'Building'
]
=
StrReplaceByVariables
::
getInstance
(
$goalVCard
->
vCard
->
building
,
$list
)
->
get
();
}
if
(
$goalVCard
->
vCard
->
apartment
)
{
$data
[
'Apartment'
]
=
StrReplaceByVariables
::
getInstance
(
$goalVCard
->
vCard
->
apartment
,
$list
)
->
get
();
}
if
(
$goalVCard
->
vCard
->
extra_message
)
{
$data
[
'ExtraMessage'
]
=
StrReplaceByVariables
::
getInstance
(
$goalVCard
->
vCard
->
extra_message
,
$list
)
->
get
();
}
if
(
$goalVCard
->
vCard
->
contact_email
)
{
$data
[
'ContactEmail'
]
=
StrReplaceByVariables
::
getInstance
(
$goalVCard
->
vCard
->
contact_email
,
$list
)
->
get
();
}
if
(
$goalVCard
->
vCard
->
ogrn
)
{
$data
[
'Ogrn'
]
=
StrReplaceByVariables
::
getInstance
(
$goalVCard
->
vCard
->
ogrn
,
$list
)
->
get
();
}
if
(
$goalVCard
->
vCard
->
metro_station_id
)
{
$data
[
'MetroStationId'
]
=
StrReplaceByVariables
::
getInstance
(
$goalVCard
->
vCard
->
metro_station_id
,
$list
)
->
get
();
}
if
(
$goalVCard
->
vCard
->
contact_person
)
{
$data
[
'ContactPerson'
]
=
StrReplaceByVariables
::
getInstance
(
$goalVCard
->
vCard
->
contact_person
,
$list
)
->
get
();
}
if
(
$goalVCard
->
vCard
->
phone
&&
count
(
$goalVCard
->
vCard
->
phone
))
{
$data
[
'Phone'
]
=
array_map
(
function
(
$phone
)
use
(
$list
)
{
return
StrReplaceByVariables
::
getInstance
(
$phone
,
$list
)
->
get
();
return
StrReplaceByVariables
::
getInstance
(
$phone
,
$list
)
->
get
();
},
$goalVCard
->
vCard
->
phone
),
},
$goalVCard
->
vCard
->
phone
);
'Street'
=>
StrReplaceByVariables
::
getInstance
(
$goalVCard
->
vCard
->
street
,
$list
)
->
get
(),
}
'House'
=>
StrReplaceByVariables
::
getInstance
(
$goalVCard
->
vCard
->
house
,
$list
)
->
get
(),
'Building'
=>
StrReplaceByVariables
::
getInstance
(
$goalVCard
->
vCard
->
building
,
$list
)
->
get
(),
if
(
$goalVCard
->
vCard
->
instant_messenger
&&
count
(
$goalVCard
->
vCard
->
instant_messenger
))
{
'Apartment'
=>
StrReplaceByVariables
::
getInstance
(
$goalVCard
->
vCard
->
apartment
,
$list
)
->
get
(),
$data
[
'InstantMessenger'
]
=
array_map
(
function
(
$instant_messenger
)
use
(
$list
)
{
'InstantMessenger'
=>
array_map
(
function
(
$instant_messenger
)
use
(
$list
)
{
return
StrReplaceByVariables
::
getInstance
(
$instant_messenger
,
$list
)
->
get
();
return
StrReplaceByVariables
::
getInstance
(
$instant_messenger
,
$list
)
->
get
();
},
$goalVCard
->
vCard
->
instant_messenger
),
},
$goalVCard
->
vCard
->
instant_messenger
);
'ExtraMessage'
=>
StrReplaceByVariables
::
getInstance
(
$goalVCard
->
vCard
->
extra_message
,
$list
)
->
get
(),
}
'ContactEmail'
=>
StrReplaceByVariables
::
getInstance
(
$goalVCard
->
vCard
->
contact_email
,
$list
)
->
get
(),
'Ogrn'
=>
StrReplaceByVariables
::
getInstance
(
$goalVCard
->
vCard
->
ogrn
,
$list
)
->
get
(),
if
(
$goalVCard
->
vCard
->
point_on_map
&&
count
(
$goalVCard
->
vCard
->
point_on_map
))
{
'MetroStationId'
=>
StrReplaceByVariables
::
getInstance
(
$goalVCard
->
vCard
->
metro_station_id
,
$list
)
->
get
(),
$data
[
'PointOnMap'
]
=
array_map
(
function
(
$point_on_map
)
use
(
$list
)
{
'PointOnMap'
=>
array_map
(
function
(
$point_on_map
)
use
(
$list
)
{
return
StrReplaceByVariables
::
getInstance
(
$point_on_map
,
$list
)
->
get
();
return
StrReplaceByVariables
::
getInstance
(
$point_on_map
,
$list
)
->
get
();
},
$goalVCard
->
vCard
->
point_on_map
),
},
$goalVCard
->
vCard
->
point_on_map
);
'ContactPerson'
=>
StrReplaceByVariables
::
getInstance
(
$goalVCard
->
vCard
->
contact_person
,
$list
)
->
get
(),
}
];
return
$data
;
})
->
toArray
(),
})
->
toArray
(),
]);
]);
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment