Commit 91582e58 authored by sugar's avatar sugar

Merge branch 'dev' of http://rungit.jxdsy.cn:10000/sugar/zhupu into dev

parents c235dc61 043875ce
Pipeline #751 canceled with stages
...@@ -36,4 +36,5 @@ return [ ...@@ -36,4 +36,5 @@ return [
'Audit 1' => '通过', 'Audit 1' => '通过',
'Audit 2' => '失败', 'Audit 2' => '失败',
'Sleep_place' => '安息地', 'Sleep_place' => '安息地',
'Type_label' =>'标签',
]; ];
...@@ -27,6 +27,12 @@ ...@@ -27,6 +27,12 @@
{:build_radios('row[ext0]', ['0'=>__('否'), '1'=>__('是'), '2'=>__('未知')], 1)} {:build_radios('row[ext0]', ['0'=>__('否'), '1'=>__('是'), '2'=>__('未知')], 1)}
</div> </div>
</div> </div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Type_label')}:</label>
<div class="col-xs-12 col-sm-8">
{:build_radios('row[type_label]', ['1'=>__('千古流芳'), '2'=>__('当代名流')], 1)}
</div>
</div>
<div class="form-group"> <div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Photo')}:</label> <label class="control-label col-xs-12 col-sm-2">{:__('Photo')}:</label>
<div class="col-xs-12 col-sm-8"> <div class="col-xs-12 col-sm-8">
......
...@@ -26,6 +26,12 @@ ...@@ -26,6 +26,12 @@
{:build_radios('row[ext0]', ['0'=>__('否'), '1'=>__('是'), '2'=>__('未知')], $row.ext0)} {:build_radios('row[ext0]', ['0'=>__('否'), '1'=>__('是'), '2'=>__('未知')], $row.ext0)}
</div> </div>
</div> </div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Type_label')}:</label>
<div class="col-xs-12 col-sm-8">
{:build_radios('row[type_label]', ['1'=>__('千古流芳'), '2'=>__('当代名流')], $row.type_label)}
</div>
</div>
<div class="form-group"> <div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Photo')}:</label> <label class="control-label col-xs-12 col-sm-2">{:__('Photo')}:</label>
<div class="col-xs-12 col-sm-8"> <div class="col-xs-12 col-sm-8">
......
...@@ -80,7 +80,7 @@ class Family extends Api ...@@ -80,7 +80,7 @@ class Family extends Api
$FamilyTreeMate=FamilyModel::myFamilyTreeMateList("ftm.people_id = " . $val['id']); $FamilyTreeMate=FamilyModel::myFamilyTreeMateList("ftm.people_id = " . $val['id']);
array_push($arr,$FamilyTree,$FamilyTreeMate); array_push($arr,$FamilyTree,$FamilyTreeMate);
} }
$data =call_user_func_array("array_merge",$arr); $data =array_unique(call_user_func_array("array_merge",$arr));
} }
$arr = []; $arr = [];
foreach ($data as $key=>$val){ foreach ($data as $key=>$val){
...@@ -94,6 +94,14 @@ class Family extends Api ...@@ -94,6 +94,14 @@ class Family extends Api
$addr=Db::name("addr")->where(['ID'=>$val['area_id']])->field('ID as value,Name as name, ParentId,MergerName')->find(); $addr=Db::name("addr")->where(['ID'=>$val['area_id']])->field('ID as value,Name as name, ParentId,MergerName')->find();
$data[$key]['addr']= $addr['MergerName']; $data[$key]['addr']= $addr['MergerName'];
} }
$rw_user_ids=explode(",",$val['rw_user_id']);
$array=array();
foreach ($rw_user_ids as $k=>$v){
$realname=UsersModel::where(['id'=>$v])->value("realname");
array_push($array,$realname);
$realname?array_push($array,$realname):'';
}
$data[$key]['agent_realname'] = array_unique($array);
if($val['type'] == 2){//有族谱就显示族谱 if($val['type'] == 2){//有族谱就显示族谱
$arr[]=$val; $arr[]=$val;
} }
......
...@@ -631,8 +631,10 @@ class FamilyTree extends Api ...@@ -631,8 +631,10 @@ class FamilyTree extends Api
public function celebrityList(){ public function celebrityList(){
$page = $this->request->param('page',1); $page = $this->request->param('page',1);
$type = $this->request->param('type',1); $type = $this->request->param('type',1);
$type_label = $this->request->param('type_label',1);
$map['type'] = 2; $map['type'] = 2;
$map['status'] = 1; $map['status'] = 1;
$map['type_label'] = $type_label;
if($type == 2){//同姓 if($type == 2){//同姓
$Surname=SurnameModel::where(["ID"=>$this->auth->surname_id])->value("Surname"); $Surname=SurnameModel::where(["ID"=>$this->auth->surname_id])->value("Surname");
$map['surname'] = $Surname; $map['surname'] = $Surname;
...@@ -640,6 +642,10 @@ class FamilyTree extends Api ...@@ -640,6 +642,10 @@ class FamilyTree extends Api
$map['province_id'] = $this->auth->province_id; $map['province_id'] = $this->auth->province_id;
}else if($type == 4){//同城 }else if($type == 4){//同城
$map['city_id'] = $this->auth->city_id; $map['city_id'] = $this->auth->city_id;
}else if($type == 5){//同县
$map['area_id'] = $this->auth->area_id;
}else if($type == 6){//同乡
$map['village_id'] = $this->auth->village_id;
} }
$data=FamilyPeopleModel::where(['type'=>2,'status'=>1])->field("*")->page($page)->limit(10)->order("ranking desc,id desc")->select(); $data=FamilyPeopleModel::where(['type'=>2,'status'=>1])->field("*")->page($page)->limit(10)->order("ranking desc,id desc")->select();
$this->success("",$data); $this->success("",$data);
......
...@@ -12,6 +12,7 @@ use app\api\model\FriendCommentModel; ...@@ -12,6 +12,7 @@ use app\api\model\FriendCommentModel;
use app\api\model\FriendLikeModel; use app\api\model\FriendLikeModel;
use app\api\model\HotcircleModel; use app\api\model\HotcircleModel;
use app\api\model\JoinCircle; use app\api\model\JoinCircle;
use app\api\model\UsersModel;
use app\common\controller\Api; use app\common\controller\Api;
use fast\Tree; use fast\Tree;
use think\Db; use think\Db;
...@@ -346,29 +347,69 @@ class Friend extends Api{ ...@@ -346,29 +347,69 @@ class Friend extends Api{
* 随机推荐好友 * 随机推荐好友
*/ */
public function getRandomFriends(){ public function getRandomFriends(){
$where = ['user_id' =>['neq',$this->auth->id]]; $type=$this->request->post("type",1);
$total = Db::name('fastim_user')->where($where)->count(); if($type==1){//推荐
$min = Db::name('fastim_user')->where($where)->min('id');//统计某个字段最小数据 $where = ['user_id' =>['neq',$this->auth->id]];
$num = 30; $total = Db::name('fastim_user')->where($where)->count();
if($total < $num){$num = $min;} $min = Db::name('fastim_user')->where($where)->min('id');//统计某个字段最小数据
$i = 1; $num = 30;
$flag = 0; if($total < $num){$num = $min;}
$ary = []; $i = 1;
while($i<=$num){ $flag = 0;
$rundnum = rand($min, $total);//抽取随机数 $ary = [];
if($flag != $rundnum){ while($i<=$num){
//过滤重复 $rundnum = rand($min, $total);//抽取随机数
if(!in_array($rundnum,$ary)){ if($flag != $rundnum){
$ary[] = $rundnum; //过滤重复
$flag = $rundnum; if(!in_array($rundnum,$ary)){
}else{ $ary[] = $rundnum;
$i--; $flag = $rundnum;
}else{
$i--;
}
$i++;
} }
$i++;
} }
$map['id'] = ['in',$ary];
}else {
if($type==2){//同姓
$where['surname_id'] = $this->auth->surname_id;
}else if($type==3){//同乡
$where['village_id'] = $this->auth->village_id;
}else if($type==4){//同校
$where = '';
$educational=UsersModel::where(['id'=>$this->auth->id])->value("educational");
if($educational){
$school=array_column(json_decode($educational), "school");
foreach ($school as $k=>$v){
if($k==0){
$where = " educational like '%".$v."%'";
}else{
$where = $where. " OR educational like '%".$v."%'";
}
}
}
}else if($type==5){//同事
$where = '';
$work_experience=UsersModel::where(['id'=>$this->auth->id])->value("work_experience");
if($work_experience){
$company=array_column(json_decode($work_experience), "company");
foreach ($company as $k=>$v){
if($k==0){
$where = " work_experience like '%".$v."%'";
}else{
$where = $where. " OR work_experience like '%".$v."%'";
}
}
}
}
$ids=UsersModel::where($where)->column("id");
$map['user_id'] = ['in',$ids];
} }
$list = Db::name('fastim_user')->where($where)->where(['id'=>['in',$ary]])->select();
$this->success('操作成功',['list' =>$list]);
$list = Db::name('fastim_user')->where(['user_id'=>['neq',$this->auth->id]])->where($map)->limit(30)->select();
$this->success('操作成功',['list' =>$list]);
} }
} }
\ No newline at end of file
...@@ -133,11 +133,36 @@ class Users extends Api ...@@ -133,11 +133,36 @@ class Users extends Api
*/ */
public function getUserinfo() public function getUserinfo()
{ {
$userinfo = $this->auth->getUserinfo(); $userinfo = UsersModel::getUserinfo($this->auth->id);
$userinfo['certification_fee'] = \think\Config::get('site.certification_fee'); $userinfo['certification_fee'] = \think\Config::get('site.certification_fee');
//处理教育,工作字段
$userinfo['educational'] = $userinfo['educational']?json_decode($userinfo['educational']):'';
$userinfo['work_experience'] = $userinfo['work_experience']?json_decode($userinfo['work_experience']):'';
if($this->auth->village_id >0) {
$userinfo['addr_name']= Db::name("addr_village")->where(['village_code' => $this->auth->village_id])->field('province,city,county,town,village')->find();
}
$this->success('获取成功', ['userinfo' => $userinfo]); $this->success('获取成功', ['userinfo' => $userinfo]);
} }
/**
* 修改用户信息
*/
public function updateUserinfo(){
$params=$this->request->param();
if(!empty($params['educational'])){
$params['educational']=htmlspecialchars_decode($params['educational']);
}
if(!empty($params['work_experience'])){
$params['work_experience']=htmlspecialchars_decode($params['work_experience']);
}
UsersModel::where(['id'=>$this->auth->id])->update($params);
$this->success("修改成功");
}
/** /**
* 创建IM用户并初始化 * 创建IM用户并初始化
......
...@@ -72,4 +72,10 @@ class UsersModel extends BaseModel { ...@@ -72,4 +72,10 @@ class UsersModel extends BaseModel {
} }
return false; return false;
} }
public static function getUserinfo($id,$field = ['id', 'username', 'nickname', 'mobile', 'avatar', 'score', 'prevtime' ,'wx_openid', 'app_openid', 'unionid', 'money', 'level','is_shaikh','commission','agent_money', 'province_id', 'city_id','area_id','town_id','village_id','educational','work_experience']){
return self::where(['id'=>$id])->field($field)->find();
}
} }
\ No newline at end of file
...@@ -29,7 +29,7 @@ class Auth ...@@ -29,7 +29,7 @@ class Auth
//默认配置 //默认配置
protected $config = []; protected $config = [];
protected $options = []; protected $options = [];
protected $allowFields = ['id', 'username', 'nickname', 'mobile', 'avatar', 'score', 'prevtime' ,'wx_openid', 'app_openid', 'unionid', 'money', 'level','is_shaikh','commission','agent_money', 'province_id', 'city_id','area_id','town_id','village_id']; protected $allowFields = ['id', 'username','surname_id', 'nickname', 'mobile', 'avatar', 'score', 'prevtime' ,'wx_openid', 'app_openid', 'unionid', 'money', 'level','is_shaikh','commission','agent_money', 'province_id', 'city_id','area_id','town_id','village_id'];
public function __construct($options = []) public function __construct($options = [])
{ {
......
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