StopController.class.php
1.08 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
<?php
/**
* 【后台】终止培训计划接口
* StopController.class.php
* User: yingcai
* Date: 2017/8/29
* Time: 下午6:12
*/
namespace Apicp\Controller\Education;
use Common\Service\EducationService;
class StopController extends \Apicp\Controller\AbstractController
{
public function Index_post()
{
$ed_id = I('ed_id', 0, 'intval');
// 培训ID是否为空
if (!$ed_id) {
E('_EMPTY_ED_ID');
}
$education_service = new EducationService();
// 判断培训是否存在
$education = $education_service->get($ed_id);
if (empty($education)) {
E('_ERR_EDUCATION_NOT_EXIST');
}
// 判断培训是否是进行中,进行中的才可以终止
if (EducationService::EDUCATION_PROCESS_ON_GOING != $education_service->get_ed_status($education)) {
E('_ERR_EDUCATION_LODING_DELETE');
}
// 更改培训状态
$education_service->update(
$ed_id,
['ed_end_time' => MILLI_TIME]
);
return true;
}
}