public function replaceShortcodes($message, $kogortDate)
{
$bonusActivity = $this->getBonusAction();
- $validDate = date('d-m-Y', strtotime("+$bonusActivity days", strtotime($kogortDate)));
+ $validDate = date('d.m.Y', strtotime("+$bonusActivity days", strtotime($kogortDate)));
$message = str_replace('[NumberOfBonuses]', $this->bonus, $message);
return str_replace('[ValidityOfBonuses]', $validDate, $message);
}
[['kogort_date', 'target_date', 'created_at'], 'safe'],
[['type'], 'default', 'value' => null],
[['type'], 'integer'],
- [['chat_id', 'phone', 'message'], 'string', 'max' => 255],
+ [['message'], 'string'],
+ [['chat_id', 'phone'], 'string', 'max' => 255],
];
}
return !str_contains($currentUrl, self::TARGET_PROD_URL);
}
+ public static function isDevEnv(): bool
+ {
+ return getenv('DB_HOST') === 'db-yii_erp24';
+ }
+
+ public static function isDevEnvironment(): bool
+ {
+ return getenv('XDEBUG_MODE') === 'debug';
+ }
+
public static function sendErrorToTelegramMessage($message, $disableNotification, $isDev)
{
$botToken = self::TELEGRAM_BOT_DEV;
$botToken = self::TELEGRAM_BOT_PROD;
}
+ $botToken = self::TELEGRAM_BOT_PROD;
+
$apiURL = "https://api.telegram.org/bot{$botToken}/sendMessage";
+ $message = self::escapeMarkdown($message);
+
$client = new Client();
try {
$response = $client->post($apiURL, [