123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399 |
- <?php
- // +—————————————————————————————————————————————————————————————————————
- // | Created by Yunbao
- // +—————————————————————————————————————————————————————————————————————
- // | Copyright (c) 2013~2022 http://www.yunbaokj.com All rights reserved.
- // +—————————————————————————————————————————————————————————————————————
- // | Author: https://gitee.com/yunbaokeji
- // +—————————————————————————————————————————————————————————————————————
- // | Date: 2022-02-17
- // +—————————————————————————————————————————————————————————————————————
- /**
- * 首页
- */
- class Api_Home extends PhalApi_Api {
- public function getRules() {
- return array(
- 'getConfig' => array(
- 'source'=>array('name' => 'source', 'type' => 'string','default'=>'app','desc' => '请求来源,app/wxmini'),
- 'qiniu_sign' => array('name' => 'qiniu_sign', 'type' => 'string','desc' => '七牛sign'),
- ),
-
- 'getHot' => array(
- 'uid' => array('name' => 'uid', 'type' => 'int', 'desc' => '用户ID'),
- 'p' => array('name' => 'p', 'type' => 'int', 'default'=>'1' ,'desc' => '页数'),
- ),
-
- 'search' => array(
- 'uid' => array('name' => 'uid', 'type' => 'int', 'require' => true, 'min'=>1 ,'desc' => '用户ID'),
- 'key' => array('name' => 'key', 'type' => 'string', 'default'=>'' ,'desc' => '用户ID'),
- 'p' => array('name' => 'p', 'type' => 'int', 'default'=>'1' ,'desc' => '页数'),
- ),
-
-
-
- 'getClassLive'=>array(
- 'liveclassid' => array('name' => 'liveclassid', 'type' => 'int', 'default'=>'0' ,'desc' => '直播分类ID'),
- 'p' => array('name' => 'p', 'type' => 'int', 'default'=>'1' ,'desc' => '页数'),
- ),
-
-
-
- );
- }
-
- /**
- * 配置信息
- * @desc 用于获取配置信息
- * @return int code 操作码,0表示成功
- * @return array info
- * @return array info[0] 配置信息
- * @return object info[0].guide 引导页
- * @return string info[0].guide.switch 开关,0关1开
- * @return string info[0].guide.type 类型,0图片1视频
- * @return string info[0].guide.time 图片时间
- * @return array info[0].guide.list
- * @return string info[0].guide.list[].thumb 图片、视频链接
- * @return string info[0].guide.list[].href 页面链接
- * @return string msg 提示信息
- */
- public function getConfig() {
- $rs = array('code' => 0, 'msg' => '', 'info' => array());
-
- $source=checkNull($this->source);
- $qiniu_sign=$this->qiniu_sign;
-
- $info = getConfigPub();
-
- unset($info['site_url']);
- unset($info['site_seo_title']);
- unset($info['site_seo_keywords']);
- unset($info['site_seo_description']);
- unset($info['site_icp']);
- unset($info['site_gwa']);
- unset($info['site_admin_email']);
- unset($info['site_analytics']);
- unset($info['copyright']);
- unset($info['qr_url']);
- unset($info['sina_icon']);
- unset($info['sina_title']);
- unset($info['sina_desc']);
- unset($info['sina_url']);
- unset($info['qq_icon']);
- unset($info['qq_title']);
- unset($info['qq_desc']);
- unset($info['qq_url']);
- unset($info['payment_des']);
- file_put_contents("qiniusign.txt", json_encode($qiniu_sign));
-
- $info_pri = getConfigPri();
-
- $list = getLiveClass();
- unset($info['voicelive_name']);
- unset($info['voicelive_icon']);
-
-
-
- $level= getLevelList();
-
- foreach($level as $k=>$v){
- unset($v['level_up']);
- unset($v['addtime']);
- unset($v['id']);
- unset($v['levelname']);
- $level[$k]=$v;
- }
-
- $levelanchor= getLevelAnchorList();
-
- foreach($levelanchor as $k=>$v){
- unset($v['level_up']);
- unset($v['addtime']);
- unset($v['id']);
- unset($v['levelname']);
- $levelanchor[$k]=$v;
- }
-
- $info['liveclass']=$list;
-
- $info['level']=$level;
-
- $info['levelanchor']=$levelanchor;
-
- /* 引导页 */
- $domain = new Domain_Guide();
- $guide_info = $domain->getGuide();
-
- $info['guide']=$guide_info;
-
- /** 敏感词集合*/
- $dirtyarr=array();
- if($info_pri['sensitive_words']){
- $dirtyarr=explode(',',$info_pri['sensitive_words']);
- }
- $info['sensitive_words']=$dirtyarr;
-
- $info['shopexplain_url']=$info['site']."/portal/page/index?id=38";
- $info['stricker_url']=$info['site']."/portal/page/index?id=39";
-
- $info['login_private_url']=get_upload_path($info['login_private_url']);
- $info['login_service_url']=get_upload_path($info['login_service_url']);
-
-
- $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[][0] 登录方式标识
- * @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']),
- ),
- )
- );
- $login_type=$info['login_type'];
- $rs['info'][0]['login_alert'] = $login_alert;
- $rs['info'][0]['login_type'] = $login_type;
-
-
- return $rs;
- }
-
-
-
-
- /**
- * 获取热门主播
- * @desc 用于获取首页热门主播
- * @return int code 操作码,0表示成功
- * @return array info
- * @return array info[0]['slide']
- * @return string info[0]['slide'][].slide_pic 图片
- * @return string info[0]['slide'][].slide_url 链接
- * @return array info[0]['list'] 热门直播列表
- * @return string info[0]['list'][].uid 主播id
- * @return string info[0]['list'][].avatar 主播头像
- * @return string info[0]['list'][].avatar_thumb 头像缩略图
- * @return string info[0]['list'][].user_nicename 直播昵称
- * @return string info[0]['list'][].title 直播标题
- * @return string info[0]['list'][].city 主播位置
- * @return string info[0]['list'][].stream 流名
- * @return string info[0]['list'][].pull 播流地址
- * @return string info[0]['list'][].nums 人数
- * @return string info[0]['list'][].thumb 直播封面
- * @return string info[0]['list'][].level_anchor 主播等级
- * @return string info[0]['list'][].type 直播类型
- * @return string info[0]['list'][].goodnum 靓号
- * @return string msg 提示信息
- */
- public function getHot() {
- $rs = array('code' => 0, 'msg' => '', 'info' => array());
- $uid=checkNull($this->uid);
- $p=checkNull($this->p);
- $domain = new Domain_Home();
- $key1='getSlide';
- $slide=getcaches($key1);
- if(!$slide){
- $where="status='1' and slide_id='2' ";
- $slide = $domain->getSlide($where);
- setcaches($key1,$slide);
- }
-
-
- //获取热门主播
- $key2="getHot_".$p;
- if(!$uid){
- $uid=-9999;
- }
- if($uid<0){
- $key2="getHot_".$uid.'_'.$p;
- }
- $list=getcaches($key2);
- if(!$list){
- $list = $domain->getHot($p);
- setcaches($key2,$list,2);
- }
-
-
- $rs['info'][0]['slide'] = $slide;
- $rs['info'][0]['list'] = $list;
-
- 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());
-
- $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 string info[].uid 主播id
- * @return string info[].avatar 主播头像
- * @return string info[].avatar_thumb 头像缩略图
- * @return string info[].user_nicename 直播昵称
- * @return string info[].title 直播标题
- * @return string info[].city 主播位置
- * @return string info[].stream 流名
- * @return string info[].pull 播流地址
- * @return string info[].nums 人数
- * @return string info[].distance 距离
- * @return string info[].thumb 直播封面
- * @return string info[].level_anchor 主播等级
- * @return string info[].type 直播类型
- * @return string info[].goodnum 靓号
- **/
-
- public function getClassLive(){
- $rs = array('code' => 0, 'msg' => '', 'info' => array());
- $liveclassid=checkNull($this->liveclassid);
- $p=checkNull($this->p);
-
- if(!$liveclassid){
- return $rs;
- }
- $domain=new Domain_Home();
- $res=$domain->getClassLive($liveclassid,$p);
- $rs['info']=$res;
- return $rs;
- }
- /**
- * 获取过滤词汇
- * @desc 用于获取聊天过滤词
- * @return int code 操作码,0表示成功
- * @return array info
- * @return array info[0] 配置信息
- * @return string msg 提示信息
- */
- public function getFilterField() {
- $rs = array('code' => 0, 'msg' => '', 'info' => array());
- $sensitive_words=getcaches('sensitive_words');
- if($sensitive_words){
- $rs['info']=$sensitive_words;
- }else{
- $configpri = getConfigPri();
- if($configpri['sensitive_words']){
- $rs['info'] =explode(',',$configpri['sensitive_words']);
- }
- setcaches("sensitive_words",$rs['info']);
- }
- return $rs;
- }
-
-
-
-
-
- }
|