| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?php
- namespace App\Models;
- use Illuminate\Database\Eloquent\Model;
- use Illuminate\Support\Facades\DB;
- use Illuminate\Support\Facades\Log;
- class RouteMailSendLog extends Model
- {
- const TABLE = 'QPAccountsDB.dbo.RouteMailSendLog';
- protected $table = self::TABLE;
- public $timestamps = false;
- protected $fillable = [
- 'UserID',
- 'MailMark',
- 'CreatedAt',
- ];
- public static function markSent($userId, $mark)
- {
- try {
- return DB::connection('write')->table(self::TABLE)->insert([
- 'UserID' => (int) $userId,
- 'MailMark' => (string) $mark,
- 'CreatedAt' => date('Y-m-d H:i:s'),
- ]);
- } catch (\Throwable $exception) {
- Log::info('route_mail_already_sent', [
- 'UserID' => $userId,
- 'MailMark' => $mark,
- 'message' => $exception->getMessage(),
- ]);
- return false;
- }
- }
- }
|