AbstractController.class.php
1.29 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
<?php
/**
* Created by PhpStorm.
* User: yingcai
* Date: 2017/4/14
* Time: 上午09:55
*/
namespace Apicp\Controller;
use \Common\Controller\Apicp\AbstractController as BaseAbstractController;
use Common\Service\ActivityService;
use Common\Service\CommentService;
abstract class AbstractController extends BaseAbstractController
{
/**
* 根据评论ID获取评论与活动详情(含验证)
*
* @param $comment_id
*
* @return array
*/
public function get_ac_info_by_comment_id($comment_id)
{
// 查询评论详情
$comment_s = new CommentService();
$comment_info = $comment_s->get($comment_id);
if (empty($comment_info)) {
// 评论不存在或已被删除
E('_ERR_COMMENT_NOT_FOUND');
}
// 查询活动详情
$activity_s = new ActivityService();
$activity_info = $activity_s->get($comment_info['ac_id']);
if (empty($activity_info)) {
// 只开启审核未开启红包,存在活动被删除的情况
E('_ERR_ACTIVITY_NOT_FOUND');
}
// 返回评论详情与活动详情
return [
'comment_info' => $comment_info, // 评论详情
'activity_info' => $activity_info, // 活动详情
];
}
}