mirror of
https://github.com/kuaifan/dootask.git
synced 2026-10-30 14:30:49 +00:00
- 新增 app_push_devices 表与 api/push/device 接口(新版 App 上报/删除 DooPush 设备) - app/Module/AppPush 统一分发友盟与 DooPush,业务字段经 payload.data 下发 - 系统设置「App 推送」新增 DooPush 配置;点击通知打开对应会话 - 更新 Expo 壳子模块(接入 DooPush)、语言包与 ai-kb
33 lines
922 B
PHP
33 lines
922 B
PHP
<?php
|
|
|
|
namespace App\Module\AppPush;
|
|
|
|
use App\Models\UmengAlias;
|
|
use App\Module\Base;
|
|
|
|
class AppPush
|
|
{
|
|
public static function enabled(): bool
|
|
{
|
|
$setting = Base::setting('appPushSetting');
|
|
return ($setting['push'] ?? 'close') === 'open' || ($setting['doopush'] ?? 'close') === 'open';
|
|
}
|
|
|
|
/**
|
|
* @param array|int $userids
|
|
* @param array $msg [title, subtitle, body, description, extra, seconds, badge]
|
|
*/
|
|
public static function pushToUsers(array|int $userids, array $msg): void
|
|
{
|
|
$setting = Base::setting('appPushSetting');
|
|
if (($setting['push'] ?? 'close') === 'open') {
|
|
try {
|
|
UmengAlias::pushMsgToUserid($userids, $msg);
|
|
} catch (\Throwable $e) {
|
|
info('[AppPush] Umeng failed: ' . $e->getMessage());
|
|
}
|
|
}
|
|
app(DooPushClient::class)->pushToUsers($userids, $msg);
|
|
}
|
|
}
|