TrainApplyController.class.php
2.3 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
<?php
/**
* Created by PhpStorm.
* User: 29925
* Date: 2018/4/27
* Time: 21:16
*/
namespace Admin\Controller;
use Common\Controller\AdminbaseController;
class TrainApplyController extends AdminbaseController {
protected $train_apply_model;
protected $train_model;
function _initialize() {
parent::_initialize(); // TODO: Change the autogenerated stub
$this->train_apply_model = D('Common/TrainApply');
$this->train_model = D('Common/Train');
}
// 体验培训报名列表
public function index() {
$this->assign('list', $this->train_apply_model->getList(I('get.p'), I('post.keyword'), strtotime(I('post.start_time')), strtotime(I('post.end_time'))));
$count = $this->train_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->train_apply_model->where(array('id'=>$id, 'is_del'=>0))->find();
$info['images'] = explode(',', $info['images']);
$this->assign($info);
$this->display();
}
// 发布
public function send(){
$id = I("get.id",0,'intval');
$info = $this->train_apply_model->where(array('id'=>$id, 'is_del'=>0))->find();
$info['images'] = explode(',', $info['images'])[0];
$this->assign($info);
$this->display();
}
// 删除
public function delete(){
if(I('get.id')){
$id = I("get.id",0,'intval');
if ($this->train_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->train_apply_model->where(array('id'=>array('in',$ids)))->save(array('is_del'=>1,'dtime'=>time()))) {
$this->error("删除失败!");
}
$this->success("删除成功!");
}
}
}