all(); $uid = $this->uid; $regId = trim(getProp($all, 'reg_id')); $appId = trim(getProp($all, 'app_id')); if (empty($regId) || empty($appId)) { Utils::throwError(ErrorConst::PARAM_ERROR_CODE); } // 更新用户reg_id $result = PushService::setUserRegId($uid, $regId, $appId); if (!$result) { Utils::throwError(ErrorConst::SYS_EXCEPTION); } return $this->success(compact('uid', 'regId')); } public function sendMessage(Request $request) { $all = $request->all(); $taskId = (int)getProp($all, 'task_id'); if (empty($taskId)) { Utils::throwError(ErrorConst::PARAM_ERROR_CODE); } // 更新用户reg_id $result = PushService::sendMessage($taskId); if (!$result) { Utils::throwError(ErrorConst::SYS_EXCEPTION); } return $this->success(); } }