Home.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <?php
  2. defined('BASEPATH') OR exit('No direct script access allowed');
  3. require_once('MyBaseController.php');
  4. class Home extends MyBaseController {
  5. public function __construct()
  6. {
  7. parent::__construct();
  8. if ($this->session->userinfo==null) {
  9. $this->redirect('/Account/logout');
  10. exit;
  11. }
  12. $userId = $this->input->post('userId');
  13. $r = $this->getNewToken($userId);
  14. $_POST['token'] = $r;
  15. // var_dump($this->session->userinfo);exit();
  16. }
  17. public function index()
  18. {
  19. $this->load->view('index');
  20. }
  21. //取当前的userid
  22. protected function self_user_id()
  23. {
  24. return $this->session->userinfo->userId;
  25. }
  26. //取当前的org
  27. protected function self_org_id()
  28. {
  29. return $this->session->userinfo->orgId;
  30. }
  31. public function queryConveyAddrList(){
  32. $url = $this->config->item('api_url2')."api/v1/server/ConveyAddr/queryConveyAddrList";
  33. $ret = curl_post($url,$_POST);
  34. header('Content-Type:application/json; charset=utf-8');
  35. exit($ret);
  36. }
  37. public function ConveyDeviceLists(){
  38. $url = $this->config->item('api_url2')."api/v1/server/ConveyDevice/lists";
  39. $ret = curl_post($url,$_POST);
  40. header('Content-Type:application/json; charset=utf-8');
  41. exit($ret);
  42. }
  43. public function queryUserOrdersByMode(){
  44. $url = $this->config->item('api_url2')."api/v1/server/Orders/queryUserOrdersByMode";
  45. $ret = curl_post($url,$_POST);
  46. header('Content-Type:application/json; charset=utf-8');
  47. exit($ret);
  48. }
  49. public function orderYhadd(){
  50. $url = $this->config->item('api_url2')."api/v1/server/Orders/yhadd";
  51. $ret = curl_post($url,$_POST);
  52. header('Content-Type:application/json; charset=utf-8');
  53. exit($ret);
  54. }
  55. public function commentYhadd(){
  56. $url = $this->config->item('api_url2')."api/v1/server/Comment/yhadd";
  57. $ret = curl_post($url,$_POST);
  58. header('Content-Type:application/json; charset=utf-8');
  59. exit($ret);
  60. }
  61. public function orderQueryDetail(){
  62. $url = $this->config->item('api_url2')."api/v1/server/Orders/queryDetail";
  63. $ret = curl_post($url,$_POST);
  64. header('Content-Type:application/json; charset=utf-8');
  65. exit($ret);
  66. }
  67. public function conveyCateLists(){
  68. $url = $this->config->item('api_url2')."api/v1/server/ConveyCate/lists";
  69. $ret = curl_post($url,$_POST);
  70. header('Content-Type:application/json; charset=utf-8');
  71. exit($ret);
  72. }
  73. public function updateOrderModeByUser(){
  74. $url = $this->config->item('api_url2')."api/v1/server/Orders/updateOrderModeByUser";
  75. $ret = curl_post($url,$_POST);
  76. header('Content-Type:application/json; charset=utf-8');
  77. exit($ret);
  78. }
  79. public function conveyXqTime(){
  80. $url = $this->config->item('api_url2')."api/v1/server/ConveyCate/getXqTime";
  81. $ret = curl_post($url,$_POST);
  82. header('Content-Type:application/json; charset=utf-8');
  83. exit($ret);
  84. }
  85. public function getNewToken($userId){
  86. $url = $this->config->item('api_url2')."api/v1/User/getToken";
  87. $ret = curl_post($url,['userId'=>$userId]);
  88. $data = json_decode($ret,true);
  89. return $data['data']['token'];
  90. }
  91. }