Double.php
4.2 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<?php
namespace app\school\controller\project_approval;
use app\common\controller\DoubleBase;
use app\school\model\project_approval\ProjectRegister;
use app\school\model\project_common\ProjectDouble;
use app\school\model\project_common\ProjectDoubleApply;
use think\Db;
class Double extends DoubleBase
{
protected $containerId = null;
protected $model = null;
protected $shopIdAutoCondition = false;
public function _initialize()
{
parent::_initialize();
$this->containerId = $_COOKIE['container_id'];
$this->model = new ProjectDouble();
}
public function index()
{
return $this->view->fetch();
}
/**
* 查看成员信息
* @return array|mixed
*/
public function membersView()
{
if ($this->request->isAjax()) {
$doubleId = $this->request->param('project_double_id');
$dataWhere = ['a.project_double_id' => $doubleId, 'a.proposer_state' => 1, 'a.proposer_type' => 0];
$rows = (new ProjectDoubleApply())
->alias('a')
->field('a.*, b.username, b.student_no')
->join('fa_user b', 'a.proposer_id = b.id', 'left')
->where($dataWhere)
->select();
$total = count($rows);
$res = [
'total' => $total,
'rows' => $rows
];
return $res;
}
return $this->fetch();
}
/**
* 查看指导教师信息
* @return array|mixed
*/
public function teachersView()
{
if ($this->request->isAjax()) {
$doubleId = $this->request->param('project_double_id');
$dataWhere = ['a.project_double_id' => $doubleId, 'a.proposer_state' => 1, 'a.proposer_type' => 1];
$rows = (new ProjectDoubleApply())
->alias('a')
->field('a.*, b.username, b.job_num')
->join('fa_teacher b', 'a.proposer_id = b.id', 'left')
->where($dataWhere)
->select();
$total = count($rows);
$res = [
'total' => $total,
'rows' => $rows
];
return $res;
}
return $this->fetch();
}
/**
* 教师申请的双选项目
*/
public function teacherProjects()
{
if ($this->request->isAjax()) {
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
$dataWhere = ['a.project_container_id' => $this->containerId, 'a.captain_type' => 1];
$total = $this->model->alias('a')->where($dataWhere)->where($where)->count();
$rows = $this->model->alias('a')
->field('a.*, b.username, b.job_num')
->join('fa_teacher b', 'a.captain_id = b.id', 'left')
->where($dataWhere)
->where($where)
->limit($offset, $limit)
->select();
foreach ($rows as $k=>$v){
$teacher = Db::name("teacher")->where("id",$v['user_id'])->find();
$v['username'] = $teacher["username"];
$v['job_num'] = $teacher["job_num"];
$rows[$k] = $v;
}
$res = [
'total' => $total,
'rows' => $rows
];
return $res;
}
}
/**
* 学生申请的双选项目
*/
public function studentProjects()
{
if ($this->request->isAjax()) {
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
$dataWhere = ['a.project_container_id' => $this->containerId, 'a.captain_type' => 0];
$total = $this->model->alias('a')->where($dataWhere)->where($where)->count();
$rows = $this->model->alias('a')
->field('a.*, b.username, b.student_no')
->join('fa_user b', 'a.captain_id = b.id', 'left')
->where($dataWhere)
->where($where)
->limit($offset, $limit)
->select();
$res = [
'total' => $total,
'rows' => $rows
];
return $res;
}
}
}