quanwei
2025-12-04 12913c1069347ea4b1f6ab87f480da0f8d8c646a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
 
namespace app\shop\model\plus\regactivity;
 
use app\common\model\plus\regactivity\User as UserModel;
 
/**
 * 用户模型
 * Class User
 * @package app\shop\model\plus\team
 */
class User extends UserModel
{
    /**
     * 获取报名用户列表
     */
    public function getList($search, $limit = 20, $activity_id = "")
    {
        // 构建查询规则
        $model = $this->alias('reg')
            ->field('reg.*, user.nickName, user.avatarUrl')
            ->join('user', 'user.user_id = reg.user_id')
            ->where('reg.is_delete', '=', 0)
            ->order(['reg.create_time' => 'desc']);
        // 查询条件
        if (!empty($search)) {
            $model = $model->where('user.nickName|reg.user_name|reg.mobile', 'like', '%' . $search . '%');
        }
        if (!empty($activity_id)) {
            $model = $model->where('reg.activity_id', '=', $activity_id);
        }
        // 获取列表数据
        $list = $model->paginate($limit);
        return $list;
    }
 
    /**
     * 删除报名用户
     * @return mixed
     */
    public function setDelete()
    {
        return $this->transaction(function () {
            // 标记用户记录为已删除
            return $this->save([
                'is_delete' => 1
            ]);
        });
    }
 
 
}