作者 郭文星

123

@@ -2,7 +2,9 @@ @@ -2,7 +2,9 @@
2 2
3 namespace app\api\controller\reservoir; 3 namespace app\api\controller\reservoir;
4 4
  5 +use app\api\controller\v8\User;
5 use app\common\controller\Api; 6 use app\common\controller\Api;
  7 +use app\common\helper\HttpHelper;
6 use fast\Tree; 8 use fast\Tree;
7 use think\Request; 9 use think\Request;
8 use think\Db; 10 use think\Db;
@@ -16,6 +18,7 @@ class Index extends Api @@ -16,6 +18,7 @@ class Index extends Api
16 protected $model = ''; 18 protected $model = '';
17 protected $noNeedLogin = ['list','reservoirinfo', 'playscore','getReiverorList', 'latest', 'latests', 'abnormal', 'latestdam', 'water_equipment']; 19 protected $noNeedLogin = ['list','reservoirinfo', 'playscore','getReiverorList', 'latest', 'latests', 'abnormal', 'latestdam', 'water_equipment'];
18 protected $noNeedRight = '*'; 20 protected $noNeedRight = '*';
  21 + protected $sxjApiurl="http://124.71.107.128:9040/";
19 22
20 public function _initialize() 23 public function _initialize()
21 { 24 {
@@ -275,37 +278,15 @@ class Index extends Api @@ -275,37 +278,15 @@ class Index extends Api
275 // 水库列表 278 // 水库列表
276 public function list() 279 public function list()
277 { 280 {
278 - //查询当前用户所属部门id  
279 - $id = $this->auth->id;  
280 - $depart_id = Db::name("inspection_staff")->where("user_id", $id)->value("depart_id");  
281 -  
282 - if (!empty($depart_id)) {  
283 - //获取下级所有子部门ID  
284 - $tree = Tree::instance();  
285 - $departModel = new \app\admin\model\inspection\Depart();  
286 - $tree->init(collection($departModel->order('weigh asc,id asc')->select())->toArray(), 'pid');  
287 - $depart_ids = $tree->getChildrenIds($depart_id, true); 281 + $user=new User();
  282 + $token=$user->uimsApitoken();
  283 + $url=$this->sxjApiurl."data_api/v1/getWaterworksListData";
  284 + $res =HttpHelper::postheader($url,"","",$token);
  285 + $res=json_decode($res,true);
  286 + foreach ($res['data']['list'] as $k=>$v){
  287 + $res['data']['list'][$k]['thumbnail_images']="https://yysw_ynzhsk_cn/image_jg/work.png";
288 } 288 }
289 -  
290 - $where = [];  
291 - if (!empty($depart_ids)) {  
292 - $where["inspection_depart_id"] = ["IN", $depart_ids];  
293 - }  
294 -  
295 - $list = $this->model  
296 - ->field('id,name,thumbnail_images,completetime,user_name,address')  
297 - ->where($where)  
298 -// ->where('county_id',1)  
299 - // ->where('reservoir_id',"in",[4,6,9])  
300 - ->select();  
301 - if (!empty($list)) {  
302 - foreach ($list as $k => $v) {  
303 - $list[$k]['thumbnail_images'] = full_image_kevin($v['thumbnail_images']);  
304 - $list[$k]['completetime_text'] = date('Y年m月d日', $v['completetime']);  
305 - }  
306 - }  
307 -  
308 - $this->success('', $list); 289 + return $this->success($res['message'],$res['data']);
309 } 290 }
310 291
311 public function test() 292 public function test()