Push.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <?php
  2. namespace app\watch\controller;
  3. use think\Db;
  4. use think\Exception;
  5. use think\facade\Log;
  6. class Push extends Base
  7. {
  8. public function initialize()
  9. {
  10. parent::initialize();
  11. }
  12. //位置数据发送
  13. public function location(){
  14. $data = request()->post();
  15. }
  16. //SOS数据发送
  17. public function sos(){
  18. $data = request()->post();
  19. if(isset($data['imei']) &&!empty($data['imei'])){
  20. try{
  21. $info = Db::name('bracelet_device')
  22. ->where('imei',$data['imei'])
  23. ->where('del',0)
  24. ->find();
  25. if(!empty($info)){
  26. $insertData = [
  27. 'imei'=>$info['imei'],
  28. 'org_id'=>$info['org_id'],
  29. 'time_begin'=>isset($data['time_begin'])?$data['time_begin']:'',
  30. 'heartrate'=>isset($data['heartrate'])?$data['heartrate']:0,
  31. 'address'=>isset($data['address'])?$data['address']:'',
  32. 'lon'=>isset($data['lon'])?$data['lon']:'',
  33. 'lat'=>isset($data['lat'])?$data['lat']:'',
  34. 'type'=>isset($data['type'])?$data['type']:0,
  35. ];
  36. Db::name('sos_data')
  37. ->insertGetId($insertData);
  38. }
  39. }catch (Exception $e){
  40. Log::info($e->getMessage());
  41. }
  42. }
  43. }
  44. //心率数据发送
  45. public function heart(){
  46. }
  47. //计步数据发送
  48. public function steps(){
  49. }
  50. //睡眠数据发送
  51. public function sleep(){
  52. }
  53. //开关机数据发送
  54. public function switchs(){
  55. $data = request()->post();
  56. file_put_contents('kaiji.txt',json_encode($data));
  57. }
  58. //血压数据发送
  59. public function blood(){
  60. }
  61. //跌倒数据发送
  62. public function tumble(){
  63. }
  64. //提醒答复数据发送
  65. public function remind(){
  66. }
  67. //血氧数据发送
  68. public function oxygen(){
  69. }
  70. //消息通知
  71. public function notices(){
  72. }
  73. }