<?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); } /** * @ApiTitle 申请提现 * @ApiReturn ({ "code": 1, "msg": "成功", "time": "1621562257", "data": { "withdraw": "申请提现", //申请提现 "hint": "申请成功,等待审核" //提现成功后提示 } }) */ public function withdraw(){ $link['withdraw']= config('site.withdraw'); //申请提现 $link['hint']= config('site.hint'); //提现成功后提示 $this->success('成功',$link); } }