Commit cb6bae98 by Vladislav

Исправление типов аргументов

1 parent a0692877
Showing with 20 additions and 19 deletions
......@@ -9,13 +9,14 @@ use App\Service\Requests\DirectRequest;
use App\Service\StrReplaceByVariables;
use Carbon\Carbon;
use Illuminate\Support\Facades\Log;
use Ramsey\Collection\Collection;
class AddKeywords extends DirectRequest
{
protected $max_count = 1000;
protected $timestamp;
/* @var array */
/* @var Collection */
protected $goalKeywords;
public function call($params = null)
......@@ -35,11 +36,11 @@ class AddKeywords extends DirectRequest
$splinter = $this->sliceByKey($maxObjects, 'Keywords');
$splinter->putParams([
'goalKeywords' => array_values(array_slice($this->goalKeywords, $maxObjects)),
'goalKeywords' => $this->goalKeywords->slice($maxObjects)->values(),
]);
$this->putParams([
'goalKeywords' => array_values(array_slice($this->goalKeywords, 0, $maxObjects)),
'goalKeywords' => $this->goalKeywords->slice(0, $maxObjects)
]);
return $splinter;
......@@ -98,38 +99,38 @@ class AddKeywords extends DirectRequest
$lists = [];
$this->setParams([
'Keywords' => array_map(function (array $goalKeyword) use ($variables, $lists) {
'Keywords' => $this->goalKeywords->map(function ($goalKeyword) use ($variables, $lists) {
if (!isset($lists[$goalKeyword['dictionary_campaign_id']])) {
$list = Variable::getListVariablesByDictionaryCampaign($goalKeyword['dictionary_campaign_id'], $variables);
$lists[$goalKeyword['dictionary_campaign_id']] = $list;
if (!isset($lists[$goalKeyword->dictionary_campaign_id])) {
$list = Variable::getListVariablesByDictionaryCampaign($goalKeyword->dictionary_campaign_id, $variables);
$lists[$goalKeyword->dictionary_campaign_id] = $list;
} else {
$list = $lists[$goalKeyword['dictionary_campaign_id']];
$list = $lists[$goalKeyword->dictionary_campaign_id];
}
$data = [
'Keyword' => StrReplaceByVariables::getInstance($goalKeyword['keyword'], $list)->get(),
'AdGroupId' => $goalKeyword['goal_ad_group_external_id'],
'Keyword' => StrReplaceByVariables::getInstance($goalKeyword->keyword, $list)->get(),
'AdGroupId' => $goalKeyword->goal_ad_group_external_id,
];
if ($goalKeyword['bid']) {
$data['Bid'] = $goalKeyword['bid'];
if ($goalKeyword->bid) {
$data['Bid'] = $goalKeyword->bid;
}
if ($goalKeyword['context_bid']) {
$data['ContextBid'] = $goalKeyword['context_bid'];
if ($goalKeyword->context_bid) {
$data['ContextBid'] = $goalKeyword->context_bid;
}
if ($goalKeyword['user_param_1']) {
$data['UserParam1'] = $goalKeyword['user_param_1'];
if ($goalKeyword->user_param_1) {
$data['UserParam1'] = $goalKeyword->user_param_1;
}
if ($goalKeyword['user_param_2']) {
$data['UserParam2'] = $goalKeyword['user_param_2'];
if ($goalKeyword->user_param_2) {
$data['UserParam2'] = $goalKeyword->user_param_2;
}
return $data;
}, $this->goalKeywords),
}),
]);
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!