EditController.class.php
1.07 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
<?php
/**
* 【后台】员工激励编辑接口
* EditController.class.php
* @author:daijun
* @date:2017-08-31
*/
namespace Apicp\Controller\Incentives;
use Common\Service\IncentivesService;
class EditController extends \Apicp\Controller\AbstractController
{
/**
* 员工激励编辑接口
* @author daijun
*/
public function Index_post()
{
// 获取参数
$params = I('post.');
$incentives_serv = new IncentivesService();
// 传入参数验证
$check = $incentives_serv->check_edit_data($params);
if (!$check) {
return false;
}
$medal = '';
if (!empty($params['medal'])) {
$medal = implode(';', $params['medal']);
}
// 组织数据
$update_data = [
'sr_medal' => $medal,
'sr_score' => intval($params['score']),
'sr_credit' => (int)$params['credit'],
];
// 更新激励数据
$incentives_serv->update($params['sr_id'], $update_data);
return true;
}
}