RuleAddController.class.php
927 Bytes
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
<?php
/**
* 【考试中心-后台】 新增试卷规则
* RuleAddController.class.php
* User: daijun
* Date: 2017-05-23
*/
namespace Apicp\Controller\Paper;
use Common\Service\PaperService;
class RuleAddController extends AbstractController
{
/** @var PaperService 试卷信息表 */
protected $paper_service;
public function before_action($action = '')
{
if (!parent::before_action($action)) {
return false;
}
// 实例化试卷信息表
$this->paper_service = new PaperService();
return true;
}
public function Index_post()
{
$param = I('post.');
// 验证数据并添加
if (!$ep_id = $this->paper_service->rule_add($param)) {
return false;
}
// 格式化返回数据
$this->_result = [
'ep_id' => intval($ep_id)
];
return true;
}
}