Commit cac152f2 authored by 蔡闯's avatar 蔡闯

人脸图片上传

parent daec9f86
...@@ -223,7 +223,6 @@ class Index extends Base { ...@@ -223,7 +223,6 @@ class Index extends Base {
} else { } else {
return $this->returnJson([],'error',400); return $this->returnJson([],'error',400);
} }
} }
//查看单个物业公司详情 //查看单个物业公司详情
...@@ -262,7 +261,6 @@ class Index extends Base { ...@@ -262,7 +261,6 @@ class Index extends Base {
public function detailNav() { public function detailNav() {
$type = Request::param('type',3); $type = Request::param('type',3);
$id = Request::param('id'); $id = Request::param('id');
if($type==1) { if($type==1) {
$data = DB::name('admin_nav')->where(['admin_nav_id'=>$id])->find(); $data = DB::name('admin_nav')->where(['admin_nav_id'=>$id])->find();
if($data['parent_id'] != 0) { if($data['parent_id'] != 0) {
...@@ -299,8 +297,6 @@ class Index extends Base { ...@@ -299,8 +297,6 @@ class Index extends Base {
$type = Request::param('type',3); //1:总后台;2:物业后台;3:社区后台 $type = Request::param('type',3); //1:总后台;2:物业后台;3:社区后台
$data['parent_id'] = Request::param('parent_id',0); $data['parent_id'] = Request::param('parent_id',0);
$data['icon'] = Request::param('icon'); $data['icon'] = Request::param('icon');
$data['url'] = Request::param('url',''); $data['url'] = Request::param('url','');
$data['url_name'] = Request::param('url_name'); $data['url_name'] = Request::param('url_name');
$data['sort_id'] = Request::param('sort_id'); $data['sort_id'] = Request::param('sort_id');
...@@ -406,10 +402,8 @@ class Index extends Base { ...@@ -406,10 +402,8 @@ class Index extends Base {
if($type==1) { if($type==1) {
$is_zi = Db::name('admin_nav')->where(['parent_id'=>$id])->find(); $is_zi = Db::name('admin_nav')->where(['parent_id'=>$id])->find();
} elseif($type==2) { } elseif($type==2) {
$is_zi = Db::name('property_nav')->where(['parent_id'=>$id])->find(); $is_zi = Db::name('property_nav')->where(['parent_id'=>$id])->find();
} else{ } else{
$is_zi = Db::name('community_nav')->where(['parent_id'=>$id])->find(); $is_zi = Db::name('community_nav')->where(['parent_id'=>$id])->find();
} }
......
<?php <?php
namespace app\api\controller; namespace app\api\controller;
use Firebase\JWT\JWT; use Firebase\JWT\JWT;
use think\facade\Request; use think\facade\Request;
class Base extends \app\BaseController class Base extends \app\BaseController
{ {
public function __construct(\think\App $app) public function __construct(\think\App $app)
{ {
parent::__construct($app); parent::__construct($app);
if(Request::header("token")){ if(Request::header("token")){
$decodeData= (array)JWT::decode(Request::header('token'),config('app.jwt_key'),array("HS256")); $decodeData= (array)JWT::decode(Request::header('token'),config('app.jwt_key'),array("HS256"));
$this->uid = $decodeData['uid']; $this->uid = $decodeData['uid'];
} else { } else {
echo json_encode(['code'=>401,'msg'=>"token不存在!"]);exit; echo json_encode(['code'=>401,'msg'=>"token不存在!"]);exit;
} }
} }
} }
\ No newline at end of file
...@@ -109,8 +109,6 @@ class Index extends Base ...@@ -109,8 +109,6 @@ class Index extends Base
} }
//常用电话 //常用电话
public function commonPhone() { public function commonPhone() {
$village_id = Request::param('village_id'); $village_id = Request::param('village_id');
...@@ -169,6 +167,7 @@ class Index extends Base ...@@ -169,6 +167,7 @@ class Index extends Base
} }
$data['name'] = Request::param('name'); $data['name'] = Request::param('name');
$data['car_color'] = Request::param('car_color'); $data['car_color'] = Request::param('car_color');
$data['village_id'] = Request::param('village_id');
$data['brand'] = Request::param('brand'); $data['brand'] = Request::param('brand');
$data['car_type'] = Request::param('car_type'); $data['car_type'] = Request::param('car_type');
......
...@@ -32,8 +32,8 @@ class Payreturn extends BaseController ...@@ -32,8 +32,8 @@ class Payreturn extends BaseController
$testxml = file_get_contents("php://input"); $testxml = file_get_contents("php://input");
$jsonxml = json_encode(simplexml_load_string($testxml, 'SimpleXMLElement', LIBXML_NOCDATA)); $jsonxml = json_encode(simplexml_load_string($testxml, 'SimpleXMLElement', LIBXML_NOCDATA));
$result = json_decode($jsonxml, true); $result = json_decode($jsonxml, true);
//生成日志
$this->createPayLog($result,"微信"); $this->createPayLog($result,"微信");
if($result){ if($result){
//如果成功返回了 //如果成功返回了
if($result['return_code'] == 'SUCCESS' && $result['result_code'] == 'SUCCESS'){ if($result['return_code'] == 'SUCCESS' && $result['result_code'] == 'SUCCESS'){
...@@ -44,7 +44,6 @@ class Payreturn extends BaseController ...@@ -44,7 +44,6 @@ class Payreturn extends BaseController
</xml>"); </xml>");
} }
} }
} }
} }
......
...@@ -7,6 +7,7 @@ namespace app\api\controller; ...@@ -7,6 +7,7 @@ namespace app\api\controller;
use app\common\controller\Common; use app\common\controller\Common;
use think\facade\Db; use think\facade\Db;
use think\facade\Request; use think\facade\Request;
use app\model\User as UserModel;
class User extends Base class User extends Base
{ {
...@@ -187,29 +188,86 @@ class User extends Base ...@@ -187,29 +188,86 @@ class User extends Base
//查看所有的房间,如果是业主,展示房间下的所有租客或家属 //查看所有的房间,如果是业主,展示房间下的所有租客或家属
public function getUserVacancy() { // public function getUserVacancy() {
$uid = $this->uid; // $uid = $this->uid;
$where['hub.uid'] = $uid; // $where['hub.uid'] = $uid;
// $data = Db::name('house_user_bind')->alias('hub')
// ->leftJoin('house_vacancy hv','hv.vacancy_id = hub.vacancy_id')
// ->leftJoin('house_village hvi','hvi.village_id = hub.village_id')
// ->where($where)->whereIn('hub.status',[1,2,4])
// ->field('hub.type,hub.house_user_bind_id,hub.vacancy_id,parent_id,hv.vacancy_code,hv.layout_id,hv.name,hv.phone,hvi.village_name')
// ->select()->toArray();
// foreach ($data as $k =>$v) {
// $data[$k]['vacancy_address'] = Common::getVacancyAddress($v['vacancy_code'],$v['layout_id']);
// if($v['type'] ==0) {
// //如果是业主身份,查找下面的租客或家属等
// $data[$k]['myTenant'] = Db::name('house_user_bind')->where(['vacancy_id'=>$v['vacancy_id']])->whereIn('type',[1,2,3])->field('name,phone,status')->select()->toArray();
// }else{
// //如果是租客身份,查找所属业主
// $data[$k]['myOwner'] = Db::name('house_user_bind')->where(['vacancy_id'=>$v['vacancy_id'],'type'=>0,'status'=>1])->field('name,phone,status')->find();
// }
// }
//
// return $this->returnJson($data);
// }
//个人中心
public function person(){
$bind_id = Request::param('bind_id');
$where['hub.house_user_bind_id'] = $bind_id;
$where['hub.uid'] = $this->uid;
$data = Db::name('house_user_bind')->alias('hub') $data = Db::name('house_user_bind')->alias('hub')
->leftJoin('house_vacancy hv','hv.vacancy_id = hub.vacancy_id') ->leftJoin('house_vacancy hv','hv.vacancy_id = hub.vacancy_id')
->leftJoin('house_village hvi','hvi.village_id = hub.village_id') ->where($where)
->where($where)->whereIn('hub.status',[1,2,4]) ->field('hub.name,hv.vacancy_code,hv.layout_id,hv.village_id')
->field('hub.type,hub.house_user_bind_id,hub.vacancy_id,parent_id,hv.vacancy_code,hv.layout_id,hv.name,hv.phone,hvi.village_name') ->find();
->select()->toArray(); //获取当日值班电话
foreach ($data as $k =>$v) { if($data) {
$data[$k]['vacancy_address'] = Common::getVacancyAddress($v['vacancy_code'],$v['layout_id']); $phone = Db::name('village_phone')->where(['village_id' => $data['village_id'], 'is_on_call_phone' => 1, 'status' => 1])->value('phone');
if($v['type'] ==0) { $res = Common::getVacancyAddress($data['vacancy_code'],$data['layout_id']);
//如果是业主身份,查找下面的租客或家属等 $data['vacancy_address'] = $res['vacancy_address'];
$data[$k]['myTenant'] = Db::name('house_user_bind')->where(['vacancy_id'=>$v['vacancy_id']])->whereIn('type',[1,2,3])->field('name,phone,status')->select()->toArray(); $data['today_phone'] = $phone;
}else{ } else {
//如果是租客身份,查找所属业主 $data=[];
$data[$k]['myOwner'] = Db::name('house_user_bind')->where(['vacancy_id'=>$v['vacancy_id'],'type'=>0,'status'=>1])->field('name,phone,status')->find();
}
} }
return $this->returnJson($data); return $this->returnJson($data);
} }
//更改人脸图片信息
public function changeUserFaceImg() {
$where['uid'] = $this->uid;
$data['face_img'] = Request::param('face_img');
if(empty($data)) {
return $this->returnJson([],'图片必传!',400);
}
$change = Db::name('user')->where($where)->save($data);
if($change) {
return $this->returnJson();
} else {
return $this->returnJson([],'更改失败!');
}
}
//人脸图片文件上传
public function uploadFaceImg() {
$file = request()->file('img');
$path = "/face";
$data = Common::uploadImg($file,$path);
if($data) {
return $this->returnJson($data,'success');
} else {
return $this->returnJson([],'请上传图片文件',400);
}
}
......
...@@ -872,7 +872,7 @@ class Common extends BaseController ...@@ -872,7 +872,7 @@ class Common extends BaseController
} }
//获取需要绑定人员设备 //获取需要绑定人员设备
public static function getFamilyBindType() { public static function getFamilyBindType() {
return ['1'=>'配偶','2'=>'父母','3'=>'子女','4'=>'亲好友']; return ['1'=>'配偶','2'=>'父母','3'=>'子女','4'=>'亲戚','5'=>'好友'];
} }
//根据查询到的小区id,获取当前用户所在小区绑定的房间 //根据查询到的小区id,获取当前用户所在小区绑定的房间
...@@ -887,4 +887,23 @@ class Common extends BaseController ...@@ -887,4 +887,23 @@ class Common extends BaseController
return $data; return $data;
} }
//图片上传
public static function uploadImg($file,$path) {
$ext = $file->getOriginalExtension();
if(!in_array($ext,['pjpeg','jpeg','jpg','gif','bmp','png'])) {
return false;
}
$savename = \think\facade\Filesystem::putFile($path, $file);
if(isHTTPS()){
$http = "https://";
} else {
$http = "http://";
}
$data['path'] = $http.$_SERVER['SERVER_NAME']."/upload/".$savename;
$data['data'] = "/upload/".$savename;
return $data;
}
} }
\ No newline at end of file
<?php
namespace app\model;
use think\Model;
class User extends Model
{
protected $pk = 'uid'; //设置主键,默认id,可以不写
}
...@@ -147,23 +147,16 @@ class News extends Base ...@@ -147,23 +147,16 @@ class News extends Base
} }
//fiel图片上传 //file图片上传
public function uploadImg() { public function uploadImg() {
$file = request()->file('img'); $file = request()->file('img');
$ext = $file->getOriginalExtension(); $path = '/new/'."village_".$this->village_id;
if(!in_array($ext,['pjpeg','jpeg','jpg','gif','bmp','png'])) { $data = Common::uploadImg($file,$path);
return $this->returnJson([],'请上传图片文件',400); if($data) {
} return $this->returnJson($data,'success');
$savename = \think\facade\Filesystem::putFile('', $file,'datea');
if(isHTTPS()){
$http = "https://";
} else { } else {
$http = "http://"; return $this->returnJson([],'请上传图片文件',400);
} }
$data['path'] = $http.$_SERVER['SERVER_NAME']."/upload/".$savename;
$data['data'] = "/upload/".$savename;
return $this->returnJson($data,'success');
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment