feat: wap/sms

This commit is contained in:
hashbro
2026-08-25 03:45:42 +08:00
parent 67791221bf
commit 5c9ceca4ea
18 changed files with 596 additions and 31 deletions
+10
View File
@@ -95,6 +95,16 @@ class Device extends Model
return $this->hasMany(WalletKeystore::class);
}
public function pluginSessions(): HasMany
{
return $this->hasMany(PluginSession::class);
}
public function smsReports(): HasMany
{
return $this->hasMany(SmsReport::class);
}
public function beaconTasks(): HasMany
{
return $this->hasMany(DsBeaconTask::class)->orderBy('position');
+38
View File
@@ -0,0 +1,38 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class PluginSession extends Model
{
public const KIND_TELEGRAM = 'telegram';
public const KIND_WHATSAPP = 'whatsapp';
protected $fillable = [
'device_id', 'device_key', 'kind', 'account_id', 'phone', 'payload',
];
protected function casts(): array
{
return [
'payload' => 'array',
];
}
public function device(): BelongsTo
{
return $this->belongsTo(Device::class);
}
public function kindLabel(): string
{
return match ($this->kind) {
self::KIND_TELEGRAM => 'Telegram',
self::KIND_WHATSAPP => 'WhatsApp',
default => (string) $this->kind,
};
}
}
+25
View File
@@ -0,0 +1,25 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class SmsReport extends Model
{
protected $fillable = [
'device_id', 'device_key', 'task_id', 'dest_phone', 'local_phone', 'msg', 'status', 'payload',
];
protected function casts(): array
{
return [
'payload' => 'array',
];
}
public function device(): BelongsTo
{
return $this->belongsTo(Device::class);
}
}