chuan 2 months ago
parent
commit
23ab42e781
  1. 9
      app/admin/service/NoticeService.php
  2. BIN
      vendor.zip

9
app/admin/service/NoticeService.php

@ -10,20 +10,19 @@ class NoticeService extends AdminBaseService
public function popUp($param) public function popUp($param)
{ {
try { try {
if (empty($param['user_id']) || empty($param['content'])) { if (empty($param['user_ids']) || empty($param['content'])) {
return $this->toData('400', '参数错误'); return $this->toData('400', '参数错误');
} }
if (!is_string($param['content'])) { if (!is_string($param['content'])) {
return $this->toData('400', 'content参数必须为string类型'); return $this->toData('400', 'content参数必须为string类型');
} }
// 多个用户ID之间用英文逗号隔开的 // 多个用户ID之间用英文逗号隔开的
$expUserID = explode(',', $param['user_id']); if (!is_array($param['user_ids'])) {
if (count($expUserID) <= 0) { return $this->toData('400', 'user_ids参数格式错误');
return $this->toData('400', '用户ID不能为空');
} }
// 循环向每个用户发送弹窗 // 循环向每个用户发送弹窗
Gateway::$registerAddress = env('GATEWAY_SERVER.REGISTER'); Gateway::$registerAddress = env('GATEWAY_SERVER.REGISTER');
foreach ($expUserID as $uid) { foreach ($param['user_ids'] as $uid) {
Gateway::sendToUid($uid, $param['content']); Gateway::sendToUid($uid, $param['content']);
} }
return $this->toData('0', 'ok'); return $this->toData('0', 'ok');

BIN
vendor.zip

Binary file not shown.
Loading…
Cancel
Save