DeleteAgencyController.class.php
1.77 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
<?php
/**
* Created by PhpStorm.
* 删除待办事项
* User: tangxingguo
* Date: 2018-6-4
* Time: 16:31:57
*/
namespace Apicp\Controller\HomePage;
use Common\Service\CommonAgencyRecordService;
class DeleteAgencyController extends AbstractController
{
/**
* 代办事项
*/
const ACTIVE_LIST = [
'needReadingPaper', // 考试待批阅
'approvalTrainSignUp', // 企业培训报名待审核
'approvalIntegralConvert', // 积分待审核
'approvalWorkmate', // 话题待审核
'approvalInvite', // 邀请待审核
'approvalAnswer', // 问答待审核
'notConcerned', // 获取人员未关注数量
'completeEpInfo' // 完善企业信息
];
/**
* DeleteAgency
* @author tangxingguo
* @desc 删除待办事项
* @param String id:true 待办事项ID
* @param Int app_data_id 数据ID
*/
public function index()
{
// 待办事项
$agencyAction = I('post.id', '');
// 数据ID
$appDataId = I('post.app_data_id', 0);
if (empty($agencyAction) || !in_array($agencyAction, self::ACTIVE_LIST)) {
E('_ERR_AGENCY_ID_ERROR');
}
// 过滤
$data = [
'ea_id' => $this->_login->user['eaId'],
'username' => empty($this->_login->user['memUsername']) ?
$this->_login->user['eaRealname'] : $this->_login->user['memUsername'],
'agency_action' => $agencyAction,
'app_data_id' => $appDataId,
];
$agencyRecordServ = new CommonAgencyRecordService();
$agency = $agencyRecordServ->get_by_conds($data);
// 插入关闭的待办事项记录
if (empty($agency)) {
$agencyRecordServ->insert($data);
}
}
}