Add update device id api call #104
This commit is contained in:
parent
bb3ac8ecd4
commit
32d6c7238c
2 changed files with 24 additions and 0 deletions
|
|
@ -99,3 +99,8 @@ api_jo_history:
|
|||
path: /api/job_order/history
|
||||
controller: App\Controller\APIController:getJOHistory
|
||||
methods: [GET]
|
||||
|
||||
api_device_id:
|
||||
path: /api/device_id
|
||||
controller: App\Controller\APIController:updateDeviceID
|
||||
methods: [POST]
|
||||
|
|
|
|||
|
|
@ -1290,4 +1290,23 @@ class APIController extends Controller
|
|||
// response
|
||||
return $res->getReturnResponse();
|
||||
}
|
||||
|
||||
public function updateDeviceID(Request $req)
|
||||
{
|
||||
$required_params = [
|
||||
'device_id',
|
||||
];
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$res = $this->checkParamsAndKey($req, $em, $required_params);
|
||||
if ($res->isError())
|
||||
return $res->getReturnResponse();
|
||||
|
||||
$device_id = $req->request->get('device_id');
|
||||
$this->session->setDevicePushID($device_id);
|
||||
|
||||
$em->flush();
|
||||
|
||||
// response
|
||||
return $res->getReturnResponse();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue