123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- <?php
- namespace app\watch\controller;
- use think\Db;
- use think\Exception;
- use think\facade\Log;
- class Push extends Base
- {
- public function initialize()
- {
- parent::initialize();
- }
- //位置数据发送
- public function location(){
- $data = request()->post();
- }
- //SOS数据发送
- public function sos(){
- $data = request()->post();
- if(isset($data['imei']) &&!empty($data['imei'])){
- try{
- $info = Db::name('bracelet_device')
- ->where('imei',$data['imei'])
- ->where('del',0)
- ->find();
- if(!empty($info)){
- $insertData = [
- 'imei'=>$info['imei'],
- 'org_id'=>$info['org_id'],
- 'time_begin'=>isset($data['time_begin'])?$data['time_begin']:'',
- 'heartrate'=>isset($data['heartrate'])?$data['heartrate']:0,
- 'address'=>isset($data['address'])?$data['address']:'',
- 'lon'=>isset($data['lon'])?$data['lon']:'',
- 'lat'=>isset($data['lat'])?$data['lat']:'',
- 'type'=>isset($data['type'])?$data['type']:0,
- ];
- Db::name('sos_data')
- ->insertGetId($insertData);
- }
- }catch (Exception $e){
- Log::info($e->getMessage());
- }
- }
- }
- //心率数据发送
- public function heart(){
- }
- //计步数据发送
- public function steps(){
- }
- //睡眠数据发送
- public function sleep(){
- }
- //开关机数据发送
- public function switchs(){
- $data = request()->post();
- file_put_contents('kaiji.txt',json_encode($data));
- }
- //血压数据发送
- public function blood(){
- }
- //跌倒数据发送
- public function tumble(){
- }
- //提醒答复数据发送
- public function remind(){
- }
- //血氧数据发送
- public function oxygen(){
- }
- //消息通知
- public function notices(){
- }
- }
|