Log.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. namespace app\admin\controller;
  3. use think\Controller;
  4. use think\Session;
  5. use think\Db;
  6. use think\Request;
  7. class Log extends Controller
  8. {
  9. public function index(){
  10. }
  11. //下发命令
  12. public function add(){
  13. }
  14. public function status(){
  15. }
  16. public function delete(){
  17. }
  18. public function OneNetCeShi(){
  19. // if ($this->request->isPost()) {
  20. $data = input('');
  21. /* $rand=rand(0,2);
  22. $header=["Content-Type:application/json"];
  23. //将数据分配给不同的服务
  24. $httpserver=["http://47.98.153.212:1101","http://47.98.153.212:1102","http://47.98.153.212:1103"];
  25. $server=$httpserver[$rand];
  26. //将数据随机转发到别的平台做处理
  27. $res=curltest($server,$data,$header);
  28. */
  29. $list = array();
  30. if (is_array($data)) {
  31. $list['data'] = json_encode($data, 320);
  32. $getdata = json_decode($list['data'], true);//转成数组
  33. } else {
  34. $list['data'] = $data;
  35. $getdata = json_decode($list['data'], true);//转成数组
  36. }
  37. // $list['data']=11;
  38. // $list['response'] = "111";
  39. //
  40. // $list['notifyType'] = $getdata["notifyType"];
  41. // $list['deviceId'] = $getdata["deviceId"];
  42. // $list['addtime'] = date('Y-m-d H:i:s');
  43. $res = Db::name('one_net_data')->insertGetId($list);//将推送的数据存入总表
  44. $returnInformation['code'] = 200;
  45. $returnInformation['msg'] = "操作成功";
  46. return json_encode($returnInformation);
  47. // }
  48. }
  49. }