// 'export-catalog' => \app\actions\cron\ExportCatalogAction::class,
// 'cloudpayments-region' => \app\actions\cron\CloudpaymentsRegionAction::class,
// 'bonus-users-sale-update' => \app\actions\cron\BonusUsersSaleUpdateAction::class,
- // '1c-check-1day' => \app\actions\cron\OneCCheckOneDayAction::class,
+ // '1c-check-1day' => \app\actions\cron\OneCCheckOneDayAction::class,
];
}
//cron/one-c
- public function actionOneC() {
+ public function actionOneC()
+ {
$req_id = time();
$json_post = '{"request_id": "' . $req_id . '" ,"incomings":{"start_time":"' . date("Y-m-d", time() - 86400) . ' 00:00:00","end_time":"' . date("Y-m-d", time()) . ' 23:59:59"},"checks":{"start_time":"' . date("Y-m-d", time() - 24400) . ' 00:00:00","end_time":"' . date("Y-m-d", time()) . ' 23:59:59"},
"write_offs":{"start_time":"' . date("Y-m-d", time() - 86400 * 7) . ' 00:00:00","end_time":"' . date("Y-m-d", time()) . ' 23:59:59"}}';
}
//cron/one-c-check-one-day
- public function actionOneCCheckOneDay() {
- $req_id=time();
- $json_post='{"request_id": "'.$req_id.'" ,"checks":{"start_time":"'.date("Y-m-d",time()-86400).' 00:00:00","end_time":"'.date("Y-m-d H:i:s",time()).'"}}';
+ public function actionOneCCheckOneDay()
+ {
+ $req_id = time();
+ $json_post = '{"request_id": "' . $req_id . '" ,"checks":{"start_time":"' . date("Y-m-d", time() - 86400) . ' 00:00:00","end_time":"' . date("Y-m-d H:i:s", time()) . '"}}';
$this->setApiCron($req_id, $json_post);
}
//cron/one-c-sellers
- public function actionOneCSellers() {
- $req_id=time();
- $json_post='{"request_id": "'.$req_id.'","nomenclature":true,"sellers":true, "prices":{"type_price":"Розничная цена"}, "balances":true, "payment_types":true}';
+ public function actionOneCSellers()
+ {
+ $req_id = time();
+ $json_post = '{"request_id": "' . $req_id . '","nomenclature":true,"sellers":true, "prices":{"type_price":"Розничная цена"}, "balances":true, "payment_types":true}';
$this->setApiCron($req_id, $json_post);
}
//cron/one-c-price-msk
- public function actionOneCPriceMsk() {
- $req_id=time();
- $json_post='{"request_id": "'.$req_id.'","nomenclature":true,"sellers":true, "prices":{"type_price":"Розничная Маг на Московск"}, "balances":true, "payment_types":true}';
+ public function actionOneCPriceMsk()
+ {
+ $req_id = time();
+ $json_post = '{"request_id": "' . $req_id . '","nomenclature":true,"sellers":true, "prices":{"type_price":"Розничная Маг на Московск"}, "balances":true, "payment_types":true}';
$this->setApiCron($req_id, $json_post);
}
//cron/custom-one-c-cron
- public function actionCustomOneCCron() {
- $req_id=time();
+ public function actionCustomOneCCron()
+ {
+ $req_id = time();
//чеки за 7 дней назад прогружаем
- $json_post='{"request_id": "'.$req_id.'", "checks":{"start_time":"'.date("Y-m-d",time()-86400*7).' 00:00:00","end_time":"'.date("Y-m-d",time()).' 23:59:59"}}';
+ $json_post = '{"request_id": "' . $req_id . '", "checks":{"start_time":"' . date("Y-m-d", time() - 86400 * 7) . ' 00:00:00","end_time":"' . date("Y-m-d", time()) . ' 23:59:59"}}';
$this->setApiCron($req_id, $json_post);
}
//cron/one-c-cron-self-cost-day
- public function actionOneCCronSelfCostDay() {
- $req_id=time();
+ public function actionOneCCronSelfCostDay()
+ {
+ $req_id = time();
//себестоимость за текущий день
- $json_post='{"request_id": "'.$req_id.'", "self_cost":{"start_time":"'.date("Y-m-d",time()).' 00:00:00","end_time":"'.date("Y-m-d",time()).' 23:59:59"}}';
+ $json_post = '{"request_id": "' . $req_id . '", "self_cost":{"start_time":"' . date("Y-m-d", time()) . ' 00:00:00","end_time":"' . date("Y-m-d", time()) . ' 23:59:59"}}';
$this->setApiCron($req_id, $json_post);
// }
- public function actionBalanceHistory() {
+ public function actionBalanceHistory()
+ {
$data = Yii::$app->db->createCommand("SELECT * FROM balances")->queryAll();
$command = Yii::$app->db->createCommand()->batchInsert('balances_history',
$command->execute();
}
- private function setApiCron($req_id, $json_post) {
+ private function setApiCron($req_id, $json_post)
+ {
Yii::$app->db->createCommand()->insert('api_cron', [
'date' => new Expression('NOW()'),
'date_up' => new Expression('NOW()'),
],
[
- 'kogort_date' => $kogortDate,
- 'target_date' => $targetDate,
+ 'kogort_date' => $kogortDate,
+ 'target_date' => $targetDate,
'kogort_number' => SentKogort::KOGORT_NUMBERS['target'],
- 'phone' => $phonesArray,
+ 'phone' => $phonesArray,
]
);
$ip = "tst";
$tip_sale = "target";
$name = "Начисление бонусов на дату {$kogortDate}";
- $daysToEnd = $step1 + 1;
+ $daysToEnd = $step1 + 1;
$userBonusExist = UsersBonus::find()
->select(['phone'])
->where(['phone' => $kogortPhones])
);
if (!empty($telegramUsers)) {
- $messageText = $messagesSettings
- ->replaceShortcodes($messagesSettings->offer_2, $targetDate);
+ $messageText = $messagesSettings
+ ->replaceShortcodes($messagesSettings->offer_2, $targetDate);
foreach ($telegramUsers as $telegramUser) {
if (!in_array($telegramUser['phone'], $sentStatusKogort)) {
$messageData = [];
$this->stdout("Некорректный формат времени\n", BaseConsole::FG_RED);
return ExitCode::DATAERR;
}
- $currentDate = $this->time ? date('Y-m-d', (int)$this->time) : date('Y-m-d');
+ $currentDate = $this->time ? date('Y-m-d', (int)$this->time) : date('Y-m-d');
$stepsBack = $this->stepsBack ?? 0;
$step3 = $messagesSettings ? $messagesSettings->day_before_step3 : 2;
]
]
],
+ 'custom' => [
+ [
+ 'id' => 125,
+ 'name' => 'Шаг воронки',
+ 'type' => 'funnel',
+ 'value' => 'На прозвон'
+
+ ]
+ ],
//признак того что звонок должен поступать сразу после загрузки лида
//поставить true при согласовании с маркетингом
//также добавить признак повод звонка при необходимости
$batchSize = 500;
$offset = 0;
- // $csvFilePath = Yii::getAlias('@data/missing_users.csv');
- // $fileHandle = fopen($csvFilePath, 'w');
- // fputcsv($fileHandle, ['phone', 'username', 'chat_id', 'is-blocked', 'is_registered', 'reason'], ';');
+ // $csvFilePath = Yii::getAlias('@data/missing_users.csv');
+ // $fileHandle = fopen($csvFilePath, 'w');
+ // fputcsv($fileHandle, ['phone', 'username', 'chat_id', 'is-blocked', 'is_registered', 'reason'], ';');
while (true) {
$chatbotUsers = $remoteDb
->createCommand('SELECT * FROM chatbot_telegram_users LIMIT :limit OFFSET :offset', [
- ':limit' => $batchSize,
- ':offset' => $offset,
- ])->queryAll();
+ ':limit' => $batchSize,
+ ':offset' => $offset,
+ ])->queryAll();
if (empty($chatbotUsers)) {
break;