GetExtFieldsController.class.php
1.24 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
<?php
/**
* 【业绩比拼-手机端】获取自定义字段
*
* @author: heyuelong
* @date: 2018年1月26日09:55:05
*/
namespace Api\Controller\Activity;
use Common\Service\ActivityService;
class GetExtFieldsController extends \Api\Controller\AbstractController
{
public function Index_get()
{
// 获取参数
$ac_id = I('get.ac_id', 0, 'intval');
if (empty($ac_id)) {
// 验证参数
E('_EMPTY_ACTIVITY_ID');
}
if (empty($this->uid)) {
// 判断是否外部人员
E('_EMPTY_USER_ID');
}
// 实例化活动Service
$activity_serv = new ActivityService();
// 获取活动详细内容
$info = $activity_serv->get_by_conds(
[
'activity_status >?' => ActivityService::ACTIVITY_DRAFT,
'ac_id' => $ac_id,
'is_hide' => ActivityService::CLOSE_ACTIVITY_HIDE
]
);
if (empty($info)) {
// 数据不存在时抛错
E('_ERR_DATA_NOT_EXIST');
}
// 返回自定义字段
$this->_result = ['list' => !empty($info['ext_fields']) ? unserialize($info['ext_fields']) : []];
return true;
}
}