AdminResumeController.php
7.4 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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
<?php
// +----------------------------------------------------------------------
// | bronet [ 以客户为中心 以奋斗者为本 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2017 http://www.bronet.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 老猫 <bronet@126.com>
// +----------------------------------------------------------------------
namespace app\portal\controller;
use app\portal\model\ArtModel;
use app\portal\model\BannerModel;
use app\portal\model\HireModel;
use app\portal\model\OrderModel;
use app\portal\model\ResumeModel;
use cmf\controller\AdminBaseController;
use FontLib\Table\Type\post;
use think\Db;
use think\Loader;
/**
* Class AdminResumeController
* @package app\portal\controller
* @adminMenuRoot(
* 'name' =>'简历管理',
* 'action' =>'default',
* 'parent' =>'',
* 'display'=> true,
* 'order' => 30,
* 'icon' =>'th',
* 'remark' =>'简历管理'
* )
*/
class AdminResumeController extends AdminBaseController
{
/**
* 简历列表
* @adminMenu(
* 'name' => '简历列表',
* 'parent' => 'portal/AdminResume/default',
* 'display'=> true,
* 'hasView'=> true,
* 'order' => 10000,
* 'icon' => '',
* 'remark' => '简历列表',
* 'param' => ''
* )
*/
public function index(){
$data = $this->request->param();
$final = $this->adminIndex($data);
$arr = array();
if(!empty($final['where_arr']['create_time'])){
$where_coo['r.create_time'] = $final['where_arr']['create_time'];
$arr['create_time'] = $final['where_arr']['create_time'];
}
if(!empty($data['address'])){
$arr['address'] = $data['address'];
$where_coo['r.address'] = array('like',"%".$data['address']."%");
$this->assign('address',$data['address']);
}
if(!empty($data['name'])){
$arr['name'] = $data['name'];
$where_coo['m.name'] = array('like',"%".$data['name']."%");
$this->assign('name',$data['name']);
}
if(!empty($data['select'])){
$arr['select'] = $data['select'];
$where_coo['r.select_id'] = $data['select'];
$this->assign('select',$data['select']);
}
$where_coo['r.status'] = array('neq',9);
$coo_list = Db::name('Resume')->alias('r')
->where($where_coo)
->join("Select s",'s.id = r.select_id')
->join("Member m",'m.id = r.user_id')
->field('r.* , s.name as select_name ,m.name as member_name ')
->order('r.create_time desc')
->paginate(10,false,['query'=>$arr]);
$this->assign('list',$coo_list);
$where_sel['type'] = 2;
$where_sel['status'] = array('neq',9);
$sel = Db::name('Select')->where($where_sel)->select()->toArray();
$this->assign('sel',$sel);
return $this->fetch();
}
/**
* 查看简历
* @adminMenu(
* 'name' => '查看简历',
* 'parent' => 'index',
* 'display'=> false,
* 'hasView'=> true,
* 'order' => 10000,
* 'icon' => '',
* 'remark' => '查看简历',
* 'param' => ''
* )
*/
public function view()
{
$where_coo['r.id'] = $this->request->param('id');
$where_coo['r.status'] = array('neq',9);
$list = Db::name('Resume')->alias('r')
->where($where_coo)
->join("Select s",'s.id = r.select_id')
->join("Member m",'m.id = r.user_id')
->field('r.* , s.name as select_name ,m.name as member_name ')
->order('r.create_time desc')
->find();
$list['create_time'] = date('Y-m-d H:i:s',$list['create_time']);
$list['update_time'] = date('Y-m-d H:i:s',$list['update_time']);
$this->assign('list',$list);
// 雇佣事项
$where_select['type'] = 2;
$where_select['status'] = array('neq',9);
$select = Db::name('Select')->where($where_select)->select()->toArray();
$this->assign('select',$select);
return $this->fetch();
}
// 聘用信息审核
public function operation(){
$data = $this->request->param();
// 拒绝
if($data['type'] == 4){
// 判断是否重复提交
$where_log['type'] = 2;
$where_log['compareId'] = $data['id'];
$isSet = Db::name('Refund')->where($where_log)->find();
if($isSet){
$this->apiResponse('0','请勿重复操作!');
}
$add_log['type'] = 2;
$add_log['compareId'] = $data['id'];
$add_log['content'] = $data['refund'];
$add_log['create_time'] = time();
$add_log['update_time'] = time();
$res_refund = Db::name('Refund')->where($add_log)->insertGetId($add_log);
if(!$res_refund){
$this->apiResponse('0','操作失败');
}
}
$model = new ResumeModel();
$up_order['id'] = $data['id'];
$up_order['status'] = $data['type'];
$up_order['update_time'] = time();
$res = $model->isUpdate(true)->save($up_order);
if($res){
// 发送模板消息
$this->apiResponse('1','操作成功');
}else{
$this->apiResponse('0','操作失败');
}
}
/**
* 编辑简历
* @adminMenu(
* 'name' => '编辑简历',
* 'parent' => 'index',
* 'display'=> false,
* 'hasView'=> true,
* 'order' => 10000,
* 'icon' => '',
* 'remark' => '编辑简历',
* 'param' => ''
* )
*/
public function edit()
{
// 添加数据
$data = $this->request->post();
unset($data['create_time']);
unset($data['update_time']);
unset($data['member_name']);
$validate = Loader::validate('Resume');
if(!$validate->scene('')->check($data)){
$mes = $validate->getError();
$this->error("$mes");
}
$model = new ResumeModel();
$final = $model->isUpdate(true)->save($data);
if($final){
$this->success('成功',url('index'));
}else{
$this->error('失败');
}
}
/**
* 删除聘用信息
* @adminMenu(
* 'name' => '删除聘用信息',
* 'parent' => 'index',
* 'display'=> false,
* 'hasView'=> true,
* 'order' => 10000,
* 'icon' => '',
* 'remark' => '删除聘用信息',
* 'param' => ''
* )
*/
public function del(){
$ids = $this->request->post();
$id = $this->request->param('id');
if($ids){
$add_del['id'] = array('in',$ids['ids']);
}else if($id){
$add_del['id'] = $id;
}else{
$this->error('删除失败');
}
$add_del['status'] = 9;
$model = new ResumeModel();
$del = $model->isUpdate(true)->allowField(true)->save($add_del);
if($del){
$this->success('删除成功',url('index'));
}else{
$this->error('删除失败');
}
}
}