CheckDetailController.class.php
1.95 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
75
<?php
/**
* 【业绩比拼-手机端】分享审核详情
*
* @author: daijun
* @date: 2017-11-02
*/
namespace Api\Controller\Comment;
use Common\Service\ActivityService;
use Common\Service\CommentService;
class CheckDetailController extends \Api\Controller\AbstractController
{
public function Index_get()
{
if (empty($this->uid)) {
// 判断是否外部人员
E('_EMPTY_USER_ID');
}
// 获取参数
$ac_id = I('get.ac_id', 0, 'intval');
$comment_id = I('get.comment_id', 0, 'intval');
if (empty($ac_id)) {
// 验证活动ID参数
E('_EMPTY_ACTIVITY_ID');
}
if (empty($comment_id)) {
// 验证评论ID参数
E('_EMPTY_COMMENT_ID');
}
$activity_serv = new ActivityService();
// 获取活动详情
$activity = $activity_serv->get_by_conds(
[
'activity_status >?' => ActivityService::ACTIVITY_DRAFT,
'ac_id' => $ac_id,
'is_hide' => ActivityService::CLOSE_ACTIVITY_HIDE
]
);
if (empty($activity)) {
// 数据不存在时抛错
E('_ERR_DATA_NOT_EXIST');
}
$comment = new CommentService();
// 获取回帖详细内容
$info = $comment->get($comment_id);
if (empty($info)) {
// 数据不存在时抛错
E('_ERR_COMMENT_NOT_EXIST');
}
// 已经被审核 && 审核人不是自己 && 自己不是发起人
if (($info['check_status'] > ActivityService::CHECK_ING) && !in_array($this->uid, [$info['check_uid'], $info['uid']])) {
// 回复已经被其他人员审核
E('_ERR_COMMENT_OTHER_CHECK');
}
// 格式化详情数据
$result = $comment->format_check_detail_data($info, $this->uid, $activity);
$this->_result = $result;
return true;
}
}