作者 sgj
1 个管道 的构建 通过 耗费 0 秒

接口完成

... ... @@ -11,6 +11,7 @@ namespace api\index\controller;
use api\index\model\AboutModel;
use api\index\model\ContactModel;
use api\index\model\JoinModel;
use api\index\model\VolunteerModel;
use api\index\model\UserModel;
use cmf\controller\RestBaseController;
... ... @@ -451,6 +452,24 @@ class MemberCenterController extends RestBaseController
$data = $contactModel->findData(array('id'=>1));
$this->success('获取成功!',$data);
}
/**
* @title 我参加的活动
* @description 参加过的活动
* @author XiaoGang Wang
* @url /index/member_center/joined
* @method GET
*
* @header name:XX-Token require:1 default: desc:token
*/
public function joined(){
$userId=$this->getUserId();
$Join=new JoinModel();
$join=$Join->getUserJoin($userId);
foreach ($join as $k=>$v){
$join[$k]['thumbnail']=cmf_get_image_url($v['thumbnail']);
}
$this->success('',$join);
}
... ...
... ... @@ -45,4 +45,22 @@ class JoinModel extends Model
return $info;
}
/**
* @param $userId 用户参加活动id
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getUserJoin($userId){
$where['j.user_id']=$userId;
$where['j.status']=['>',1];
$info=$this->alias('j')
->join('cmf_activity a','a.id=j.activity_id')
->join('cmf_activity_type at','a.activity_type=at.id')
->where($where)
->select()
->toArray();
return $info;
}
}
\ No newline at end of file
... ...