IndexController.php
7.7 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2018/12/31
* Time: 11:30
*/
namespace api\index\controller;
use api\index\model\ActivityModel;
use api\index\model\SlideItemModel;
use api\index\model\UserModel;
use api\index\model\VolunteerModel;
use cmf\controller\RestBaseController;
/**
* @title 首页
* @description 首页
*/
class IndexController extends RestBaseController
{
public function _initialize()
{
$user_id = $this->getUserId();
$userModel = new UserModel();
$user = $userModel->where(array('id'=>$user_id))->find();
if($user['user_status'] == 0){
$this->error('兄嘚,你已被列入黑名单!');
}
}
/**
* @title 首页
* @description 首页
* @author Xiaogang Wang
* @url /index/index/index
* @method GET
*
* @param name:volunteer_page type:int require:0 other: desc:志愿者当前页(0为第一页)(默认0)
* @param name:volunteer_pageNum type:int require:0 other: desc:活动显示数量(默认3)
* @param name:activity_page type:int require:0 other: desc:活动当前页(0为第一页)(默认0)
* @param name:activity_pageNum type:int require:0 other: desc:活动显示数量(默认4)
*
* @return volunteer:志愿者@
* @volunteer id:id name:姓名 sex:性别 birthday:生日 nation:民族 politics:政治面貌 education:学历 unit:工作单位 duty:职务 addr:通讯地址 postcode:邮编 school:毕业院校 card_number:身份证号 fixed_phone:固定电话 move_phone:移动电话 email:email urgency_phone:紧急联系电话 qq:qq province:省 city:市 county:区/县 address:详细地址 type:志愿者类型(0医院志愿者,2社会志愿者,3办事处志愿者) record:个人履历@ front_card:身份证正面照 reverse_card:身份证背面照 photo:照片 status:状态(1审核中,2审核成功,3审核失败) user_id:用户id
* @record record_start_time:开始时间 record_end_time:结束时间 record_unit:单位 record_duty:职务 record_name:证明人 record_phone:证明人电话
* @return activity:活动@
* @activity id:id activity_name:活动名称 abstract:摘要 thumbnail:缩略图 time:时间 content:内容
* @return volunteer_page:志愿者下一页
* @return activity_page:活动下一页
*/
public function index(){
$param = $this->request->param();
$volunteer_page = $param['volunteer_page'] ? $param['volunteer_page'] : 0;//当前页数下标
$volunteer_pageNum = $param['volunteer_pageNum'] ? $param['volunteer_pageNum'] : 3;//每页显示几条数据
$activity_page = $param['activity_page'] ? $param['activity_page'] : 0;//当前页数下标
$activity_pageNum = $param['activity_pageNum'] ? $param['activity_pageNum'] : 4;//每页显示几条数据
//获取志愿者
$volunteerModel = new VolunteerModel();
$volunteer = $volunteerModel->selectData($volunteer_page,$volunteer_pageNum);
//活动
$activityModel = new ActivityModel();
$activity = $activityModel->selectData($activity_page,$activity_pageNum);
//幻灯片
$slideItemModel = new SlideItemModel();
$slide = $slideItemModel->selectData(array('slide_id'=>1));
$data['slide'] = $slide;
$data['volunteer'] = $volunteer;
$data['activity'] = $activity;
$data['volunteer_page'] = $volunteer_page+1;
$data['activity_page'] = $activity_page+1;
$this->success('获取成功!',$data);
}
/**
* @title 更多志愿者
* @description 更多志愿者
* @author Xiaogang Wang
* @url /index/index/volunteer
* @method GET
*
* @param name:page type:int require:0 other: desc:志愿者当前页(0为第一页)(默认0)
* @param name:pageNum type:int require:0 other: desc:活动显示数量(默认10)
*
* @return volunteer:志愿者@
* @volunteer id:id name:姓名 sex:性别 birthday:生日 nation:民族 politics:政治面貌 education:学历 unit:工作单位 duty:职务 addr:通讯地址 postcode:邮编 school:毕业院校 card_number:身份证号 fixed_phone:固定电话 move_phone:移动电话 email:email urgency_phone:紧急联系电话 qq:qq province:省 city:市 county:区/县 address:详细地址 type:志愿者类型(0医院志愿者,2社会志愿者,3办事处志愿者) record:个人履历@ front_card:身份证正面照 reverse_card:身份证背面照 photo:照片 status:状态(1审核中,2审核成功,3审核失败) user_id:用户id
* @record record_start_time:开始时间 record_end_time:结束时间 record_unit:单位 record_duty:职务 record_name:证明人 record_phone:证明人电话
* @return page:志愿者下一页
* @return page:活动下一页
*/
public function volunteer(){
$param = $this->request->param();
$page = $param['page'] ? $param['page'] : 0;//当前页数下标
$pageNum = $param['pageNum'] ? $param['pageNum'] : 10;//每页显示几条数据
//获取志愿者
$volunteerModel = new VolunteerModel();
$volunteer = $volunteerModel->selectData($page,$pageNum);
$data['volunteer'] = $volunteer;
$data['page'] = $page+1;
$this->success('获取成功!',$data);
}
/**
* @title 志愿者详情
* @description 志愿者详情
* @author Xiaogang Wang
* @url /index/index/volunteer_info
* @method GET
*
* @param name:id type:int require:1 other: desc:志愿者id
*
* @return id:id
* @return name:姓名
* @return sex:性别
* @return birthday:生日
* @return nation:民族
* @return politics:政治面貌
* @return education:学历
* @return unit:工作单位
* @return duty:职务
* @return addr:通讯地址
* @return postcode:邮编
* @return school:毕业院校
* @return card_number:身份证号
* @return fixed_phone:固定电话
* @return move_phone:移动电话
* @return email:email
* @return urgency_phone:紧急联系电话
* @return qq:qq
* @return province:省
* @return city:市
* @return county:区/县
* @return address:详细地址
* @return type:志愿者类型(0医院志愿者,2社会志愿者,3办事处志愿者)
* @return record:个人履历@
* @record record_start_time:开始时间 record_end_time:结束时间 record_unit:单位 record_duty:职务 record_name:证明人 record_phone:证明人电话
* @return front_card:身份证正面照
* @return reverse_card:身份证背面照
* @return photo:照片
* @return status:状态(1审核中,2审核成功,3审核失败)
* @return user_id:用户id
*/
public function volunteer_info(){
$id = $this->request->param('id');
//获取志愿者
$volunteerModel = new VolunteerModel();
$volunteer = $volunteerModel->findData(array('id'=>$id));
$this->success('获取成功!',$volunteer);
}
/**
* @title 活动详情
* @description 活动详情
* @author Xiaogang Wang
* @url /index/index/activity_info
* @method GET
*
* @param name:id type:int require:1 other: desc:活动id
*
* @return id:id
* @return activity_name:活动名称
* @return abstract:摘要
* @return thumbnail:缩略图
* @return time:时间
* @return content:内容
*/
public function activity_info(){
$id = $this->request->param('id');
//活动
$activityModel = new ActivityModel();
$activity = $activityModel->findData(array('id'=>$id));
$this->success('获取成功!',$activity);
}
}