<?php
|
|
namespace app\operations\model\branch;
|
|
use app\common\model\branch\ActivityUser as ActivityUserModel;
|
|
/**
|
* 用户模型
|
* Class User
|
* @package app\operations\model\plus\team
|
*/
|
class ActivityUser extends ActivityUserModel
|
{
|
/**
|
* 删除报名用户
|
* @return mixed
|
*/
|
public function setDelete()
|
{
|
return $this->transaction(function () {
|
// 标记用户记录为已删除
|
return $this->save([
|
'is_delete' => 1
|
]);
|
});
|
}
|
|
/**
|
* 获取报名用户列表
|
*/
|
public function getList($params = [], $is_page = true, $limit = false)
|
{
|
// 构建查询规则
|
$model = $this->alias('auser')
|
->field('auser.*, user.nickName, user.avatarUrl')
|
->join('user', 'user.user_id = auser.user_id')
|
->with(['activity'=>['branch'],'branch'])
|
->where('auser.is_delete', '=', 0)
|
->order(['auser.create_time' => 'desc']);
|
// 查询条件
|
if (!empty($params['keyword'])) {
|
$model = $model->where('user.nickName|auser.real_name|auser.mobile', 'like', '%' . $params['keyword'] . '%');
|
}
|
if (!empty($params['activity_id'])) {
|
$model = $model->where('auser.activity_id', '=', $params['activity_id']);
|
}
|
if (!empty($params['pay_status'])) {
|
if ($params['pay_status']>0){
|
$model = $model->where('auser.pay_status', '=', $params['pay_status']);
|
}
|
}
|
if (isset($params['status'])) {
|
if ($params['status']>-1) {
|
$model = $model->where('auser.status', '=', $params['status']);
|
}
|
}
|
// 如果不分页
|
if (!$is_page) {
|
if ($limit) {
|
$model = $model->limit($limit);
|
}
|
return $model->select();
|
}
|
// 获取列表数据
|
return $model->paginate($params);
|
}
|
}
|