Video.php
8.8 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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
<?php
namespace app\api\controller;
use app\api\model\Job;
use app\common\controller\Api;
use app\common\model\Apply;
use app\common\model\Service;
use app\common\model\Question;
use app\common\model\Deposit;
use app\common\model\Partner;
use app\common\model\Record;
/**
* 三开接口
* Class Video
* @package app\api\controller
*/
class Video extends Api
{
protected $noNeedLogin = '*';
protected $noNeedRight = ['record','deposit','apply'];
public function _initialize()
{
parent::_initialize();
}
/**
* @ApiTitle 视频教程
* @ApiMethod (POST)
* @ApiReturn ({
"code": 1,
"msg": "成功",
"time": "1619747595",
"data": {
"id": 1, //视频id
"title": "教程", //标题
"video": "http://www.recruit3.net/uploads/20210429/ea261362d353244651a710d8775f2511.mp4", //视频路径
"content": "<p>教程教程<br/></p>" //文本内容
}
})
*/
public function video(){
$video= model('\app\common\model\Video')
->find();
if (!empty($video)){
$video['video']=cdnurl($video['video']);
}
$this->success('成功',$video);
}
/**
* @ApiTitle 联系客服文本
* @ApiMethod (POST)
* @ApiReturn ({
"code": 1,
"msg": "成功",
"time": "1619748418",
"data": {
"id": 1,
"content": "请联系客服" //文本
}
})
*/
public function service(){
$service = new Service;
$servinfo= $service
->field('id,content')
->find();
$this->success('成功',$servinfo);
}
/**
* @ApiTitle 法律援助
* @ApiMethod (POST)
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
* @param int $type 类型:1=问题列表,2=进入详情
* @param int $id 问题id
* @ApiReturn ({
"code": 1,
"msg": "成功",
"time": "1619749791",
//问题列表
"data": [
{
"id": 1, //问题id
"title": "想入职如何入职?" //问题
}
]
}
* @ApiReturn ({
"code": 1,
"msg": "成功",
"time": "1619749877",
//问题详情
"data": {
"id": 1,
"title": "想入职如何入职?", //问题
"content": "详细情况请问客服" //详情
}
})
*/
public function question(){
$type = $this->request->param('type');
$id = $this->request->param('id');
$question = new Question;
$where['deletetime'] = null;
if ($type ==1){
$field = ('id,title');
$questlist = $question
->where($where)
->field($field)
->select();
}
if ($type ==2){
if (!empty($id)){
$where['id']=$id;
}
$field = ('id,title,content');
$questlist = $question
->where($where)
->field($field)
->find();
}
$this->success('成功',$questlist);
}
/**
* @ApiTitle 合作
* @ApiMethod (POST)
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
* @param int $type 类型:1=合作列表,2=进入详情
* @param int $id 合作id
* @ApiReturn ({
"code": 1,
"msg": "成功",
"time": "1619750787",
//合作列表
"data": [
{
"id": 1, //合作id
"title": "合作者", //标题
"image": "合作者" //图片
}
]
}
* @ApiReturn ({
"code": 1,
"msg": "成功",
"time": "1619750879",
//详情
"data": {
"id": 1,
"title": "合作者", //标题
"content": "<p>合作合作合作合作合作合作合作合作合作合作合作合作合作</p>" //内容
}
})
*/
public function partner(){
$type = $this->request->param('type');
$id = $this->request->param('id');
$partner = new Partner;
$where['deletetime'] = null;
if ($type ==1){
$field = ('id,title,image');
$parlist = $partner
->where($where)
->field($field)
->select();
foreach ($parlist as $v){
$v['image']=cdnurl($v['image']);
}
}
if ($type ==2){
if (!empty($id)){
$where['id']=$id;
}
$field = ('id,title,content');
$parlist = $partner
->where($where)
->field($field)
->find();
$parlist['content'] = str_replace('src="/uploads/','src="'.request()->domain().'/uploads/',$parlist['content']);
}
$this->success('成功',$parlist);
}
/**
* @ApiTitle 通知记录
* @ApiMethod (POST)
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
* @param string $status 类型:0未入职,1已入职
* @ApiReturn ({
"code": 1,
"msg": "成功",
"time": "1619761387",
"data": [
{
"id": 2, //id
"content": "光和热刚放假呢", //通知内容
"createtime": "2021-04-29 16:47:35", //时间
"data": "0" //状态:0=未读,1=已读
}
]
})
*/
public function record(){
$user_id = $this->auth->id; //用户id
$status = $this->request->param('status');
$record = new Record;
$where['user_id']=$user_id;
if ($status == 0){
$where['status']='0';
}
if ($status == 1){
$where['status']='1';
}
$reclist = $record
->where($where)
->field('id,content,createtime,data')
->select();
$this->success('成功',$reclist);
}
/**
* @ApiTitle 申请提现
* @ApiMethod (POST)
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
*/
public function deposit(){
$user_id = $this->auth->id; //用户id
$deposit = new Deposit;
$deint = $deposit
->insert(['user_id'=>$user_id,'createtime'=>time(),'updatetime'=>time()]);
if ($deint){
$this->success('成功');
}else{
$this->error('申请失败');
}
}
/**
* @ApiTitle 报名
* @ApiMethod (POST)
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
* @param string $job_id 职位id
* @param string $name 姓名
* @param string $phone 手机号
*/
public function apply(){
$user_id=$this->auth->id;
$job_id = input('job_id','','trim');
$name = input('name','','trim');
$phone = input('phone','','trim');
if (empty($job_id)){
$this->error('必要参数不可为空');
}
if (empty($name)){
$this->error('请输入姓名');
}
if (empty($phone)){
$this->error('请输入手机号');
}
$apply = new Apply();
$appsel = $apply
->where(['user_id'=>$user_id,'job_id'=>$job_id])
->find();
if (empty($appsel)){
$add=$apply
->insert(['user_id'=>$user_id,'job_id'=>$job_id,'name'=>$name,'phone'=>$phone,'createtime'=>time(),'updatetime'=>time()]);
if ($add){
$job = new Job();
$job->where(['id'=>$job_id])->setInc('people_num',1);
$this->success('报名成功');
}else{
$this->error('报名失败');
}
}
if (!empty($appsel)){
$this->error('您已报名');
}
}
/**
* @ApiTitle 公众号链接
* @ApiReturn ({
"code": 1,
"msg": "成功",
"time": "1621308817",
"data": {
"link": "https://mp.weixin.qq.com/s?__biz=MzkwNTIzOTMyMA==&mid=100000003&idx=1&sn=2c2f7a3d14016a5cab1bc926f9827789&chksm=40fb8f74778c06625363df68550c8a6e3b7b77c3a37a9acb0d45ca67473d1b3bfbe019946fe7&mpshare=1&scene=1&srcid=0517B23dia4DeM9arotlNkYL&sharer_sharetime=1621246415044&sharer_shareid=0222b3ff489427a506473cee3e8233b9#rd", //链接
"guan": "关注公众号" //关注公众号
}
})
*/
public function link(){
$link['link']= config('site.link');
$link['guan']= config('site.guan');
$this->success('成功',$link);
}
}