mirror of
https://github.com/easychen/pushdeer.git
synced 2025-01-10 23:15:30 +08:00
未注册设备的情况下发送消息,显示注册提示
This commit is contained in:
parent
ef14fa680a
commit
3e0cc65957
@ -62,7 +62,7 @@ class PushDeerMessageController extends Controller
|
|||||||
|
|
||||||
$key = PushDeerKey::where('key', $validated['pushkey'])->get()->first();
|
$key = PushDeerKey::where('key', $validated['pushkey'])->get()->first();
|
||||||
|
|
||||||
$result = false;
|
$result = [];
|
||||||
|
|
||||||
if ($key) {
|
if ($key) {
|
||||||
$readkey = Str::random(32);
|
$readkey = Str::random(32);
|
||||||
@ -75,8 +75,7 @@ class PushDeerMessageController extends Controller
|
|||||||
$the_message['pushkey_name'] = $key->name;
|
$the_message['pushkey_name'] = $key->name;
|
||||||
$pd_message = Message::create($the_message);
|
$pd_message = Message::create($the_message);
|
||||||
|
|
||||||
$devices = PushDeerDevice::where('uid', $key->uid)->get();
|
if ($devices = PushDeerDevice::where('uid', $key->uid)->get()) {
|
||||||
|
|
||||||
foreach ($devices as $device) {
|
foreach ($devices as $device) {
|
||||||
if ($device) {
|
if ($device) {
|
||||||
$func_name = $device['type'].'_send';
|
$func_name = $device['type'].'_send';
|
||||||
@ -85,6 +84,9 @@ class PushDeerMessageController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return send_error('没有可用的设备,请先注册', ErrorCode('ARGS'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return http_result(['result'=>$result]);
|
return http_result(['result'=>$result]);
|
||||||
|
Loading…
Reference in New Issue
Block a user