123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229 |
- <?php
- // +—————————————————————————————————————————————————————————————————————
- // | Created by Yunbao
- // +—————————————————————————————————————————————————————————————————————
- // | Copyright (c) 2013~2022 http://www.yunbaokj.com All rights reserved.
- // +—————————————————————————————————————————————————————————————————————
- // | Author: https://gitee.com/yunbaokeji
- // +—————————————————————————————————————————————————————————————————————
- // | Date: 2022-04-30
- // +—————————————————————————————————————————————————————————————————————
- class Api_Home extends PhalApi_Api {
- public function getRules() {
- return array(
- 'search' => array(
- 'uid' => array('name' => 'uid', 'type' => 'int', 'desc' => '用户ID'),
- 'key' => array('name' => 'key', 'type' => 'string', 'default'=>'' ,'desc' => '用户ID'),
- 'p' => array('name' => 'p', 'type' => 'int', 'default'=>'1' ,'desc' => '页数'),
- ),
- 'videoSearch' => array(
- 'uid' => array('name' => 'uid', 'type' => 'int', 'desc' => '用户ID'),
- 'key' => array('name' => 'key', 'type' => 'string', 'default'=>'' ,'desc' => '关键词'),
- 'p' => array('name' => 'p', 'type' => 'int', 'default'=>'1' ,'desc' => '页数'),
- ),
- );
- }
-
- /**
- * 获取配置信息
- * @desc 用于获取配置信息
- * @return int code 操作码,0表示成功
- * @return array info
- * @return array info[0] 配置信息
- * @return string msg 提示信息
- */
- public function getConfig() {
- $rs = array('code' => 0, 'msg' => '', 'info' => array());
- $configpri = getConfigPri();
- $info = getConfigPub();
- $info['video_audit_switch']=$configpri['video_audit_switch']; //视频审核是否开启
-
- /* 引导页 */
- $domain = new Domain_Guide();
- $guide_info = $domain->getGuide();
- $info['guide']=$guide_info;
- $info['qiniu_domain']=$configpri['qiniu_protocol'].'://'.$configpri['qiniu_domain'].'/';//七牛云存储空间地址
-
- $rs['info'][0] = $info;
- return $rs;
- }
- /**
- * 登录方式开关信息
- * @desc 用于获取登录方式开关信息
- * @return int code 操作码,0表示成功
- * @return array info
- * @return array info[0].login_type 开启的登录方式
- * @return string info[0].login_type.login_qq qq登录,0表示关闭,1表示开启
- * @return string info[0].login_type.login_wx 微信登录,0表示关闭,1表示开启
- * @return array info[0].login_alert 登录弹窗信息
- * @return array info[0].login_alert['title'] 登录弹窗标题
- * @return array info[0].login_alert['content'] 登录弹窗协议内容
- * @return array info[0].login_alert['login_title'] 登录页底部提示信息
- * @return array info[0].login_alert['message'] 登录页信息
- * @return array info[0].login_alert['message'][]['title'] 登录页弹窗信息标题
- * @return array info[0].login_alert['message'][]['url'] 登录页弹窗信息链接
- * @return string msg 提示信息
- */
- public function getLogin() {
- $rs = array('code' => 0, 'msg' => '', 'info' => array());
- $info = getConfigPub();
- //登录弹框那个地方
- $login_alert=array(
- 'title'=>$info['login_alert_title'],
- 'content'=>$info['login_alert_content'],
- 'login_title'=>$info['login_clause_title'],
- 'message'=>array(
- array(
- 'title'=>$info['login_service_title'],
- 'url'=>get_upload_path($info['login_service_url']),
- ),
- array(
- 'title'=>$info['login_private_title'],
- 'url'=>get_upload_path($info['login_private_url']),
- ),
- )
- );
- $configpri=getConfigPri();
- $sendcode_type='0'; //获取短信验证码方式 0国内 1 国外【用于登录或忘记密码时是否选择国家代号】
- $typecode_switch=$configpri['code_switch'];
- if($typecode_switch==1){ //阿里云
- $aly_sendcode_type=$configpri['aly_sendcode_type'];
- if($aly_sendcode_type==2){ //国外
- $sendcode_type='1';
- }
- }
- $rs['info'][0]['login_alert'] = $login_alert;
-
- $rs['info'][0]['sendcode_type']=$sendcode_type;
- return $rs;
- }
-
-
-
- /**
- * 首页搜索会员
- * @desc 用于首页搜索会员
- * @return int code 操作码,0表示成功
- * @return array info 会员列表
- * @return string info[].id 用户ID
- * @return string info[].user_nicename 用户昵称
- * @return string info[].avatar 头像
- * @return string info[].sex 性别
- * @return string info[].signature 签名
- * @return string info[].level 等级
- * @return string info[].isattention 是否关注,0未关注,1已关注
- * @return string msg 提示信息
- */
- public function search() {
- $rs = array('code' => 0, 'msg' => '', 'info' => array());
- $isBlackUser=isBlackUser($this->uid);
- if($isBlackUser=='0'){
- $rs['code'] = 700;
- $rs['msg'] = '该账号已被禁用';
- return $rs;
- }
-
- $uid=checkNull($this->uid);
- $key=checkNull($this->key);
- $p=checkNull($this->p);
- if($key==''){
- $rs['code'] = 1001;
- $rs['msg'] = "请填写关键词";
- return $rs;
- }
-
- if(!$p){
- $p=1;
- }
-
-
- $domain = new Domain_Home();
- $info = $domain->search($uid,$key,$p);
-
- $rs['info'] = $info;
- return $rs;
- }
-
-
- /**
- * 视频搜索
- * @desc 视频搜索
- * @return int code 状态码 0表示成功
- * @return string msg 提示信息
- * @return array info 返回信息
- * @return
- */
- public function videoSearch(){
- $rs = array('code' => 0, 'msg' => '', 'info' => array());
- $isBlackUser=isBlackUser($this->uid);
- if($isBlackUser=='0'){
- $rs['code'] = 700;
- $rs['msg'] = '该账号已被禁用';
- return $rs;
- }
-
-
- $uid=checkNull($this->uid);
- $key=checkNull($this->key);
- $p=checkNull($this->p);
- if($key==''){
- $rs['code'] = 1001;
- $rs['msg'] = "请填写关键词";
- return $rs;
- }
-
- if(!$p){
- $p=1;
- }
- $key1='videoSearch'.'_'.$key.'_'.$p;
- $info=getcache($key1);
- if(!$info){
- $domain = new Domain_Home();
- $info = $domain->videoSearch($uid,$key,$p);
- setcaches($key1,$info,2);
- }
-
- $rs['info'] = $info;
- return $rs;
- }
-
-
- }
|