Commit cac152f2 authored by 蔡闯's avatar 蔡闯

人脸图片上传

parent daec9f86
......@@ -223,7 +223,6 @@ class Index extends Base {
} else {
return $this->returnJson([],'error',400);
}
}
//查看单个物业公司详情
......@@ -262,7 +261,6 @@ class Index extends Base {
public function detailNav() {
$type = Request::param('type',3);
$id = Request::param('id');
if($type==1) {
$data = DB::name('admin_nav')->where(['admin_nav_id'=>$id])->find();
if($data['parent_id'] != 0) {
......@@ -299,8 +297,6 @@ class Index extends Base {
$type = Request::param('type',3); //1:总后台;2:物业后台;3:社区后台
$data['parent_id'] = Request::param('parent_id',0);
$data['icon'] = Request::param('icon');
$data['url'] = Request::param('url','');
$data['url_name'] = Request::param('url_name');
$data['sort_id'] = Request::param('sort_id');
......@@ -406,10 +402,8 @@ class Index extends Base {
if($type==1) {
$is_zi = Db::name('admin_nav')->where(['parent_id'=>$id])->find();
} elseif($type==2) {
$is_zi = Db::name('property_nav')->where(['parent_id'=>$id])->find();
} else{
$is_zi = Db::name('community_nav')->where(['parent_id'=>$id])->find();
}
......
......@@ -109,8 +109,6 @@ class Index extends Base
}
//常用电话
public function commonPhone() {
$village_id = Request::param('village_id');
......@@ -169,6 +167,7 @@ class Index extends Base
}
$data['name'] = Request::param('name');
$data['car_color'] = Request::param('car_color');
$data['village_id'] = Request::param('village_id');
$data['brand'] = Request::param('brand');
$data['car_type'] = Request::param('car_type');
......
......@@ -32,8 +32,8 @@ class Payreturn extends BaseController
$testxml = file_get_contents("php://input");
$jsonxml = json_encode(simplexml_load_string($testxml, 'SimpleXMLElement', LIBXML_NOCDATA));
$result = json_decode($jsonxml, true);
//生成日志
$this->createPayLog($result,"微信");
if($result){
//如果成功返回了
if($result['return_code'] == 'SUCCESS' && $result['result_code'] == 'SUCCESS'){
......@@ -44,7 +44,6 @@ class Payreturn extends BaseController
</xml>");
}
}
}
}
......
......@@ -7,6 +7,7 @@ namespace app\api\controller;
use app\common\controller\Common;
use think\facade\Db;
use think\facade\Request;
use app\model\User as UserModel;
class User extends Base
{
......@@ -187,29 +188,86 @@ class User extends Base
//查看所有的房间,如果是业主,展示房间下的所有租客或家属
public function getUserVacancy() {
$uid = $this->uid;
$where['hub.uid'] = $uid;
// public function getUserVacancy() {
// $uid = $this->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')
->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();
}
->where($where)
->field('hub.name,hv.vacancy_code,hv.layout_id,hv.village_id')
->find();
//获取当日值班电话
if($data) {
$phone = Db::name('village_phone')->where(['village_id' => $data['village_id'], 'is_on_call_phone' => 1, 'status' => 1])->value('phone');
$res = Common::getVacancyAddress($data['vacancy_code'],$data['layout_id']);
$data['vacancy_address'] = $res['vacancy_address'];
$data['today_phone'] = $phone;
} else {
$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
}
//获取需要绑定人员设备
public static function getFamilyBindType() {
return ['1'=>'配偶','2'=>'父母','3'=>'子女','4'=>'亲好友'];
return ['1'=>'配偶','2'=>'父母','3'=>'子女','4'=>'亲戚','5'=>'好友'];
}
//根据查询到的小区id,获取当前用户所在小区绑定的房间
......@@ -887,4 +887,23 @@ class Common extends BaseController
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
}
//fiel图片上传
//file图片上传
public function uploadImg() {
$file = request()->file('img');
$ext = $file->getOriginalExtension();
if(!in_array($ext,['pjpeg','jpeg','jpg','gif','bmp','png'])) {
return $this->returnJson([],'请上传图片文件',400);
}
$savename = \think\facade\Filesystem::putFile('', $file,'datea');
if(isHTTPS()){
$http = "https://";
$path = '/new/'."village_".$this->village_id;
$data = Common::uploadImg($file,$path);
if($data) {
return $this->returnJson($data,'success');
} 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