...
|
...
|
@@ -16,6 +16,7 @@ use api\index\model\VolunteerModel; |
|
|
use api\index\model\UserModel;
|
|
|
use cmf\controller\RestBaseController;
|
|
|
use EasyWeChat\Foundation\Application;
|
|
|
use think\Db;
|
|
|
use think\Validate;
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -640,15 +641,58 @@ class MemberCenterController extends RestBaseController |
|
|
$map['activity_id']=$id;
|
|
|
$map['j.delete_time']=0;
|
|
|
|
|
|
$info=db('join')->alias('j')
|
|
|
/* $info=db('join')->alias('j')
|
|
|
->group('j.user_id')
|
|
|
->field('v.*,j.*,j.id as join_id,j.status as status')
|
|
|
->join('volunteer v','v.user_id=j.user_id')
|
|
|
->where($map)
|
|
|
->order('j.id','asc')
|
|
|
->select()
|
|
|
->toArray();*/
|
|
|
/* $subQuery = db('join')->alias('j')
|
|
|
->field('j.user_id,v.name,v.photo,j.id as join_id,j.status as status,j.delete_time,j.activity_id,j.work_content')
|
|
|
->join('volunteer v','v.user_id=j.user_id')
|
|
|
->where($map)
|
|
|
->order('j.id','desc')
|
|
|
->buildSql();
|
|
|
dump($subQuery);
|
|
|
$info= Db::table($subQuery.'a')
|
|
|
->group('a.user_id')
|
|
|
->select()
|
|
|
->toArray();*/
|
|
|
|
|
|
$subQuery = db('join')->alias('j')
|
|
|
->field('max(j.id)')
|
|
|
->join('volunteer v','v.user_id=j.user_id')
|
|
|
->where($map)
|
|
|
->group('j.user_id')
|
|
|
->select()
|
|
|
->toArray();
|
|
|
if (!empty($subQuery)){
|
|
|
foreach ($subQuery as $k=>$v){
|
|
|
$new_map[]=$v["max(j.id)"];
|
|
|
}
|
|
|
}
|
|
|
$map1['j.id']=['in',implode(',',$new_map)];
|
|
|
|
|
|
|
|
|
$info=db('join')->alias('j')
|
|
|
->group('j.user_id')
|
|
|
->field('v.*,j.*,j.id as join_id,j.status as status')
|
|
|
->join('volunteer v','v.user_id=j.user_id')
|
|
|
->where($map1)
|
|
|
->order('j.id','asc')
|
|
|
->select()
|
|
|
->toArray();
|
|
|
|
|
|
/*$info=db('join_view')
|
|
|
->group('user_id')
|
|
|
->where($map)
|
|
|
->select()
|
|
|
->toArray();*/
|
|
|
|
|
|
// echo db('join')->getLastSql();
|
|
|
|
|
|
$return=[];
|
|
|
$i0=0;
|
|
|
$i1=0;
|
...
|
...
|
@@ -904,4 +948,5 @@ class MemberCenterController extends RestBaseController |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
\ No newline at end of file |
...
|
...
|
|