diff --git a/app/admin/controller/Notice.php b/app/admin/controller/Notice.php index b257f1b..7590565 100644 --- a/app/admin/controller/Notice.php +++ b/app/admin/controller/Notice.php @@ -116,10 +116,12 @@ class Notice extends BaseController // 验证失败 输出错误信息 return to_assign(1, $e->getError()); } - $adds=Db::table('fa_szxc_information_useraddress')->where('admin_id',$this->adminInfo['id'])->find(); - $param['area_id']=$adds['area_id']; - $param['street_id']=$adds['street_id']; - $param['village_id']=$adds['village_id']; + if($this->adminInfo['position_id'] != 1) { //不是超级管理员 + $adds=Db::table('fa_szxc_information_useraddress')->where('admin_id',$this->adminInfo['id'])->find(); + $param['area_id']=$adds['area_id']; + $param['street_id']=$adds['street_id']; + $param['village_id']=$adds['village_id']; + } $this->model->addNotice($param); }else{ @@ -188,8 +190,7 @@ class Notice extends BaseController { $param = get_params(); $id = isset($param['id']) ? $param['id'] : 0; - $type = isset($param['type']) ? $param['type'] : 0; - $this->model->delNoticeById($id,$type); + $this->model->delNoticeById($id,1); } } diff --git a/app/api/controller/Statistics.php b/app/api/controller/Statistics.php index 704f07b..55b6a4d 100644 --- a/app/api/controller/Statistics.php +++ b/app/api/controller/Statistics.php @@ -3,6 +3,7 @@ namespace app\api\controller; use app\api\BaseController; +use think\facade\Cache; use think\facade\Db; /** @@ -1221,5 +1222,40 @@ class Statistics extends BaseController $this->apiSuccess('获取成功',$return); } +//获取天气 + public function get_weather(){ + // 获取天气 +// 101271007 纳溪 510503 +// 101271002 江阳区 510502 +// 101271008 龙马潭区 510504 +// 101271003 泸县 510521 +// 101271004 合江 510522 +// 101271006 古蔺 510525 +// 101271005 叙永 510524 +// 判断区域 + $name = '101271002'; + + $url = "https://devapi.qweather.com/v7/weather/now?key=b3e94fa75aae4551b6a5db150b409261&location=".$name; + $url1 = "https://devapi.qweather.com/v7/indices/1d?key=b3e94fa75aae4551b6a5db150b409261&type=0&location=".$name; + $is_cun = Cache::store('redis')->get($name); + $is_cun1 = Cache::store('redis')->get($name.'-1'); + if($is_cun){ + $data = json_decode($is_cun,1); + $data1 = json_decode($is_cun1,1); + $news['weather'] = $data; + $news['weather_indices'] = $data1; + }else{ + $data = file_get_contents("compress.zlib://".$url); + $data1 = file_get_contents("compress.zlib://".$url1); + Cache::store('redis')->set($name,$data,1800); + Cache::store('redis')->set($name.'-1',$data1,1800); + $data = json_decode($data,1); + $data1 = json_decode($data1,1); + $news['weather'] = $data; + $news['weather_indices'] = $data1; + } + $this->apiSuccess('获取成功', $news); + } + } diff --git a/app/api/controller/Userinfo.php b/app/api/controller/Userinfo.php index ab798ac..6dfa098 100644 --- a/app/api/controller/Userinfo.php +++ b/app/api/controller/Userinfo.php @@ -142,6 +142,8 @@ class Userinfo extends BaseController $post['address_name'] = $area_name.$street_name.$village.$brigade_name; // 更新用户表 + $u_up['nickname'] = $post['name']; + Db::table('fa_user')->where($where)->update($u_up); // $header = Request::header('x-Token'); // if(isset($header['x-token']) && !empty($header['x-token'])){ // $phone['mobile'] = $post['phone']??'';