WillUserApplyController.class.php
2.8 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
<?php
/**
* Created by PhpStorm.
* User: 29925
* Date: 2018/4/26
* Time: 11:32
*/
namespace Admin\Controller;
use Common\Controller\AdminbaseController;
class WillUserApplyController extends AdminbaseController {
protected $user_model;
protected $will_user_apply_model;
function _initialize() {
parent::_initialize(); // TODO: Change the autogenerated stub
$this->will_user_apply_model = D('Common/WillUserApply');
$this->user_model = D('Common/User');
}
// 鹿鸣社申请列表
public function index() {
$this->assign('list', $this->will_user_apply_model->getList(I('get.p'), I('post.keyword'), strtotime(I('post.start_time')), strtotime(I('post.end_time'))));
$count = $this->will_user_apply_model->getCount(I('post.keyword'), strtotime(I('post.start_time')), strtotime(I('post.end_time')));
$page = $this->page($count, C('MAX_PAGE_NUM'));
$this->assign('page', $page->show('Admin'));
$this->assign('formget', I('post.'));
$this->assign('keyword', I('post.keyword'));
$this->display();
}
// 查看
public function view(){
$id = I("get.id",0,'intval');
$info = $this->will_user_apply_model->where(array('id'=>$id, 'is_del'=>0))->find();
$info['images'] = explode(',', $info['images']);
$this->assign($info);
$this->display();
}
//用户认证编辑
public function edit_post(){
if(IS_POST) {
$post = I('post.');
$id = I('post.id');
$user_id = $this->will_user_apply_model->where(array('id'=>$id))->getField('user_id');
if($this->will_user_apply_model->save($post)) {
if(I('post.status') == 2) {
$this->user_model->where(array('id'=>$user_id))->save(array('status'=>2,'join_time'=>time()));
} else {
$this->user_model->where(array('id'=>$user_id))->save(array('status'=>1));
}
$this->success('保存成功');
} else {
$this->error('保存失败');
}
}
}
// 删除
public function delete(){
if(I('get.id')){
$id = I("get.id",0,'intval');
if ($this->will_produce_apply_model->where(array('id'=>$id))->save(array('is_del'=>1,'dtime'=>time())) !==false) {
$this->success("删除成功!");
} else {
$this->error("删除失败!");
}
}
if(I('post.ids')){
$ids = I('post.ids/a');
if (!$this->will_produce_apply_model->where(array('id'=>array('in',$ids)))->save(array('is_del'=>1,'dtime'=>time()))) {
$this->error("删除失败!");
}
$this->success("删除成功!");
}
}
}