123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823 |
- <?php
- // +—————————————————————————————————————————————————————————————————————
- // | Created by Yunbao
- // +—————————————————————————————————————————————————————————————————————
- // | Copyright (c) 2013~2022 http://www.yunbaokj.com All rights reserved.
- // +—————————————————————————————————————————————————————————————————————
- // | Author: https://gitee.com/yunbaokeji
- // +—————————————————————————————————————————————————————————————————————
- // | Date: 2022-04-30
- // +—————————————————————————————————————————————————————————————————————
- session_start();
- class Api_User extends PhalApi_Api {
- public function getRules() {
- return array(
- 'iftoken' => array(
- 'uid' => array('name' => 'uid', 'type' => 'int', 'min' => 1, 'require' => true, 'desc' => '用户ID'),
- 'token' => array('name' => 'token', 'type' => 'string', 'require' => true, 'desc' => '用户token'),
- ),
-
- 'getBaseInfo' => array(
- 'uid' => array('name' => 'uid', 'type' => 'int', 'min' => 1, 'require' => true, 'desc' => '用户ID'),
- 'token' => array('name' => 'token', 'type' => 'string', 'require' => true, 'desc' => '用户token'),
-
- ),
-
- 'updateAvatar' => array(
- 'uid' => array('name' => 'uid', 'type' => 'int', 'min' => 1, 'require' => true, 'desc' => '用户ID'),
- 'token' => array('name' => 'token', 'type' => 'string', 'require' => true, 'desc' => '用户token'),
- 'file' => array('name' => 'file','type' => 'file', 'min' => 0, 'max' => 1024 * 1024 * 30, 'range' => array('image/jpg', 'image/jpeg', 'image/png'), 'ext' => array('jpg', 'jpeg', 'png')),
- ),
-
- 'updateFields' => array(
- 'uid' => array('name' => 'uid', 'type' => 'int', 'min' => 1, 'require' => true, 'desc' => '用户ID'),
- 'token' => array('name' => 'token', 'type' => 'string', 'require' => true, 'desc' => '用户token'),
- 'fields' => array('name' => 'fields', 'type' => 'string', 'require' => true, 'desc' => '修改信息,json字符串'),
- ),
-
- 'setAttent' => array(
- 'uid' => array('name' => 'uid', 'type' => 'int', 'min' => 1, 'require' => true, 'desc' => '用户ID'),
- 'token' => array('name' => 'token', 'type' => 'string', 'require' => true, 'desc' => '用户token'),
- 'touid' => array('name' => 'touid', 'type' => 'int', 'require' => true, 'desc' => '对方ID'),
- ),
-
- 'isAttent' => array(
- 'uid' => array('name' => 'uid', 'type' => 'int', 'min' => 1, 'require' => true, 'desc' => '用户ID'),
- 'touid' => array('name' => 'touid', 'type' => 'int', 'require' => true, 'desc' => '对方ID'),
- ),
-
-
- 'getFollowsList' => array(
- 'uid' => array('name' => 'uid', 'type' => 'int', 'require' => true, 'desc' => '用户ID'),
- 'touid' => array('name' => 'touid', 'type' => 'int', 'require' => true, 'desc' => '对方ID'),
- 'key' => array('name' => 'key', 'type' => 'string', 'desc' => '搜索关键词'),
- 'p' => array('name' => 'p', 'type' => 'int', 'min' => 1, 'default'=>1,'desc' => '页数'),
- ),
-
- 'getFansList' => array(
- 'uid' => array('name' => 'uid', 'type' => 'int', 'require' => true, 'desc' => '用户ID'),
- 'touid' => array('name' => 'touid', 'type' => 'int', 'require' => true, 'desc' => '对方ID'),
- 'p' => array('name' => 'p', 'type' => 'int', 'min' => 1, 'default'=>1,'desc' => '页数'),
- ),
-
- 'getUserHome' => array(
- 'uid' => array('name' => 'uid', 'type' => 'int', 'desc' => '用户ID'),
- 'touid' => array('name' => 'touid', 'type' => 'int', 'require' => true, 'desc' => '对方ID'),
- ),
-
- 'getLikeVideos'=>array(
- 'uid' => array('name' => 'uid', 'type' => 'int', 'require' => true, 'desc' => '用户ID'),
- 'touid' => array('name' => 'touid', 'type' => 'int', 'require' => true, 'desc' => '对方ID'),
- 'p' => array('name' => 'p', 'type' => 'int', 'default'=>'1' ,'desc' => '页数'),
- ),
- 'getBalance' => array(
- 'uid' => array('name' => 'uid', 'type' => 'int', 'min' => 1, 'require' => true, 'desc' => '用户ID'),
- 'token' => array('name' => 'token', 'type' => 'string', 'require' => true, 'desc' => '用户token'),
- ),
- 'updateBgImg' => array(
- 'uid' => array('name' => 'uid', 'type' => 'int', 'min' => 1, 'require' => true, 'desc' => '用户ID'),
- 'token' => array('name' => 'token', 'type' => 'string', 'require' => true, 'desc' => '用户token'),
- 'img' => array('name' => 'img','type' => 'string','require' => true, 'desc' => '背景图' ),
- ),
-
- );
- }
- /**
- * 判断token
- * @desc 用于判断token
- * @return int code 操作码,0表示成功, 1表示用户不存在
- * @return array info
- * @return string msg 提示信息
- */
- public function iftoken() {
- $rs = array('code' => 0, 'msg' => '', 'info' => array());
- $uid=checkNull($this->uid);
- $token=checkNull($this->token);
-
- $checkToken=checkToken($uid,$token);
- if($checkToken==700){
- $rs['code'] = $checkToken;
- $rs['msg'] = '您的登陆状态失效,请重新登陆!';
- return $rs;
- }else if($checkToken==10020){
- $rs['code'] = 700;
- $rs['msg'] = '该账号已被禁用';
- return $rs;
- }
- //获取用户信息存入app本地
- $domain=new Domain_User();
- $info=$domain->getBaseInfo($uid);
- $rs['info'][0]=$info;
- return $rs;
- }
- /**
- * 获取用户信息
- * @desc 用于获取单个用户基本信息
- * @return int code 操作码,0表示成功, 1表示用户不存在
- * @return array info
- * @return array info[0] 用户信息
- * @return int info[0].id 用户ID
- * @return string info[0].follows 关注数
- * @return string info[0].fans 粉丝数
- * @return string info[0].bg_img 背景墙图片
- * @return string msg 提示信息
- */
- public function getBaseInfo(){
- $rs = array('code' => 0, 'msg' => '', 'info' => array());
- $uid=checkNull($this->uid);
- $token=checkNull($this->token);
-
- $checkToken=checkToken($uid,$token);
- if($checkToken==700){
- $rs['code'] = $checkToken;
- $rs['msg'] = '您的登陆状态失效,请重新登陆!';
- return $rs;
- }else if($checkToken==10020){
- $rs['code'] = 700;
- $rs['msg'] = '该账号已被禁用';
- return $rs;
- }
- $domain = new Domain_User();
- $info = $domain->getBaseInfo($uid);
- if(!$info){
- $rs['code'] = 700;
- $rs['msg'] = '您的登陆状态失效,请重新登陆!';
- return $rs;
- }
- $rs['info'][0] = $info;
- return $rs;
- }
- /**
- * 头像上传 (七牛)[根据后台的配置信息来决定是走七牛云存储还是走腾讯云存储]
- * @desc 用于用户修改头像
- * @return int code 操作码,0表示成功
- * @return array info
- * @return string list[0].avatar 用户主头像
- * @return string list[0].avatar_thumb 用户头像缩略图
- * @return string msg 提示信息
- */
- public function updateAvatar() {
- $rs = array('code' => 0 , 'msg' => '', 'info' => array());
- $uid=checkNull($this->uid);
- $token=checkNull($this->token);
- $checkToken=checkToken($uid,$token);
- if($checkToken==700){
- $rs['code'] = $checkToken;
- $rs['msg'] = '您的登陆状态失效,请重新登陆!';
- return $rs;
- }else if($checkToken==10020){
- $rs['code'] = 700;
- $rs['msg'] = '该账号已被禁用';
- return $rs;
- }
- if (!isset($_FILES['file'])) {
- $rs['code'] = 1001;
- $rs['msg'] = T('miss upload file');
- return $rs;
- }
- if ($_FILES["file"]["error"] > 0) {
- $rs['code'] = 1002;
- $rs['msg'] = T('failed to upload file with error: {error}', array('error' => $_FILES['file']['error']));
- DI()->logger->debug('failed to upload file with error: ' . $_FILES['file']['error']);
- return $rs;
- }
-
- //获取后台配置的云存储方式
- $configpri=getConfigPri();
- $cloudtype=$configpri['cloudtype'];
- if($cloudtype==1){
- //七牛
- $url = DI()->qiniu->uploadFile($_FILES['file']['tmp_name'],$configpri['qiniu_accesskey'],$configpri['qiniu_secretkey'],$configpri['qiniu_bucket'],$configpri['qiniu_domain_url']);
- if (!empty($url)) {
- $avatar= $url.'?imageView2/2/w/600/h/600'; //600 X 600
- $avatar_thumb= $url.'?imageView2/2/w/200/h/200'; // 200 X 200
- $data=array(
- "avatar"=>setCloudType($avatar),
- "avatar_thumb"=>setCloudType($avatar_thumb),
- );
- }
- }else if($cloudtype==0){
- //本地上传
- //设置上传路径 设置方法参考3.2
- DI()->ucloud->set('save_path','avatar/'.date("Ymd"));
- //新增修改文件名设置上传的文件名称
- // DI()->ucloud->set('file_name', $this->uid);
- //上传表单名
- $res = DI()->ucloud->upfile($_FILES['file']);
-
- $files='../upload/'.$res['file'];
- $newfiles=str_replace(".png","_thumb.png",$files);
- $newfiles=str_replace(".jpg","_thumb.jpg",$newfiles);
- $newfiles=str_replace(".gif","_thumb.gif",$newfiles);
- $PhalApi_Image = new Image_Lite();
- //打开图片
- $PhalApi_Image->open($files);
- /**
- * 可以支持其他类型的缩略图生成,设置包括下列常量或者对应的数字:
- * IMAGE_THUMB_SCALING //常量,标识缩略图等比例缩放类型
- * IMAGE_THUMB_FILLED //常量,标识缩略图缩放后填充类型
- * IMAGE_THUMB_CENTER //常量,标识缩略图居中裁剪类型
- * IMAGE_THUMB_NORTHWEST //常量,标识缩略图左上角裁剪类型
- * IMAGE_THUMB_SOUTHEAST //常量,标识缩略图右下角裁剪类型
- * IMAGE_THUMB_FIXED //常量,标识缩略图固定尺寸缩放类型
- */
- // 按照原图的比例生成一个最大为150*150的缩略图并保存为thumb.jpg
-
- $PhalApi_Image->thumb(660, 660, IMAGE_THUMB_SCALING);
- $PhalApi_Image->save($files);
- $PhalApi_Image->thumb(200, 200, IMAGE_THUMB_SCALING);
- $PhalApi_Image->save($newfiles);
-
- $avatar= $res['url']; //600 X 600
-
- $avatar_thumb=str_replace(".png","_thumb.png",$avatar);
- $avatar_thumb=str_replace(".jpg","_thumb.jpg",$avatar_thumb);
- $avatar_thumb=str_replace(".gif","_thumb.gif",$avatar_thumb);
- $data=array(
- "avatar"=>$avatar,
- "avatar_thumb"=>$avatar_thumb,
- );
-
- }
-
- @unlink($_FILES['file']['tmp_name']);
- /* 清除缓存 */
- delCache("userinfo_".$uid);
-
- $domain = new Domain_User();
- $info = $domain->userUpdate($uid,$data);
- $rs['info'][0] = $data;
- return $rs;
- }
-
- /**
- * 修改用户信息
- * @desc 用于修改用户信息
- * @return int code 操作码,0表示成功
- * @return array info
- * @return string list[0].msg 修改成功提示信息
- * @return string msg 提示信息
- */
- public function updateFields() {
- $rs = array('code' => 0, 'msg' => '', 'info' => array());
- $uid=checkNull($this->uid);
- $token=checkNull($this->token);
-
- $checkToken=checkToken($uid,$token);
- if($checkToken==700){
- $rs['code'] = $checkToken;
- $rs['msg'] = '您的登陆状态失效,请重新登陆!';
- return $rs;
- }else if($checkToken==10020){
- $rs['code'] = 700;
- $rs['msg'] = '该账号已被禁用';
- return $rs;
- }
- $fields=urldecode($this->fields);
- $fields=json_decode($fields,true);
-
- $domain = new Domain_User();
- foreach($fields as $k=>$v){
- $fields[$k]=checkNull($v);
- }
-
- if(array_key_exists('user_nicename', $fields)){
- if($fields['user_nicename']==''){
- $rs['code'] = 1002;
- $rs['msg'] = '昵称不能为空';
- return $rs;
- }
-
-
- //判断昵称中是否有敏感词
- $keywordsIsExist=checkSensitiveWords($fields['user_nicename']);
- if($keywordsIsExist){
- $rs['code'] = 1002;
- $rs['msg'] = '输入非法,请重新输入';
- return $rs;
- }
- $isexist = $domain->checkName($uid,$fields['user_nicename']);
- if(!$isexist){
- $rs['code'] = 1002;
- $rs['msg'] = '昵称重复,请修改';
- return $rs;
- }
- //判断昵称里是否包含已注销
- if(strstr($fields['user_nicename'], '已注销')!==false){ //昵称包含已注销三个字
- $rs['code'] = 10011;
- $rs['msg'] = '输入非法,请重新输入';
- return $rs;
- }
- $fields['user_nicename']=filterField($fields['user_nicename']);
- }
- //个性签名
- if(array_key_exists('signature', $fields)){
- //判断个性签名中是否有敏感词
- $keywordsIsExist=checkSensitiveWords($fields['signature']);
- if($keywordsIsExist){
- $rs['code'] = 1002;
- $rs['msg'] = '个性签名输入非法,请重新输入';
- return $rs;
- }
- $fields['signature']=filterField($fields['signature']);
- }
- //手机号
- if(array_key_exists('mobile', $fields)){
- if($fields['mobile']==''){
- $rs['code'] = 1002;
- $rs['msg'] = '手机号码不能为空';
- return $rs;
- }
- $isexist = $domain->checkMobile($uid,$fields['mobile']);
- if(!$isexist){
- $rs['code'] = 1002;
- $rs['msg'] = '手机号码重复,请修改';
- return $rs;
- }
- $fields['mobile']=filterField($fields['mobile']);
- }
- //根据生日计算年龄
- if(array_key_exists('birthday', $fields)){
- if($fields['birthday']==''){
- $rs['code'] = 1002;
- $rs['msg'] = '请选择生日';
- return $rs;
- }
- $now=time();
- $time1=strtotime($fields['birthday']);
- $nowYear=date("Y",$now);
- $birthdayYear=date("Y",$time1);
- $nowMonth=date("m",$now);
- $month=date("m",$time1);
- if($nowMonth>=$month){
- $cha=0;
- }else{
- $cha=1;
- }
- $age=$nowYear-$birthdayYear-$cha;
- $fields['age']=$age;
- }
-
-
- $info = $domain->userUpdate($uid,$fields);
-
- if($info===false){
- $rs['code'] = 1001;
- $rs['msg'] = '修改失败';
- return $rs;
- }
- /* 清除缓存 */
- delCache("userinfo_".$uid);
- $rs['info'][0]['msg']='修改成功';
- return $rs;
- }
-
-
- /**
- * 判断是否关注
- * @desc 用于判断是否关注
- * @return int code 操作码,0表示成功
- * @return array info
- * @return string info[0].isattent 关注信息,0表示未关注,1表示已关注
- * @return string msg 提示信息
- */
- public function isAttent() {
- $rs = array('code' => 0, 'msg' => '', 'info' => array());
- $uid=checkNull($this->uid);
- $touid=checkNull($this->touid);
- $isBlackUser=isBlackUser($uid);
- if($isBlackUser=='0'){
- $rs['code'] = 700;
- $rs['msg'] = '该账号已被禁用';
- return $rs;
- }
-
- $info = isAttention($uid,$touid);
-
- $rs['info'][0]['isattent']=(string)$info;
- return $rs;
- }
-
- /**
- * 关注/取消关注
- * @desc 用于关注/取消关注
- * @return int code 操作码,0表示成功
- * @return array info
- * @return string info[0].isattent 关注信息,0表示未关注,1表示已关注
- * @return string msg 提示信息
- */
- public function setAttent() {
- $rs = array('code' => 0, 'msg' => '', 'info' => array());
- $uid=checkNull($this->uid);
- $token=checkNull($this->token);
- $touid=$this->touid;
- $isBlackUser=isBlackUser($uid);
- if($isBlackUser=='0'){
- $rs['code'] = 700;
- $rs['msg'] = '该账号已被禁用';
- return $rs;
- }
- $checkToken=checkToken($uid,$token);
- if($checkToken==700){
- $rs['code'] = $checkToken;
- $rs['msg'] = '您的登陆状态失效,请重新登陆!';
- return $rs;
- }else if($checkToken==10020){
- $rs['code'] = 700;
- $rs['msg'] = '该账号已被禁用';
- return $rs;
- }
-
- if($uid==$touid){
- $rs['code']=1001;
- $rs['msg']='不能关注自己';
- return $rs;
- }
- $domain = new Domain_User();
- $info = $domain->setAttent($uid,$touid);
-
- $rs['info'][0]['isattent']=(string)$info;
- return $rs;
- }
-
- /**
- * 获取用户的关注列表
- * @desc 用于获取用户的关注列表
- * @return int code 操作码,0表示成功
- * @return array info
- * @return string info[].isattent 是否关注,0表示未关注,1表示已关注
- * @return string msg 提示信息
- */
- public function getFollowsList() {
- $rs = array('code' => 0, 'msg' => '', 'info' => array());
- $uid=checkNull($this->uid);
- $touid=checkNull($this->touid);
- $p=checkNull($this->p);
- $key=checkNull($this->key);
- $isBlackUser=isBlackUser($uid);
- if($isBlackUser=='0'){
- $rs['code'] = 700;
- $rs['msg'] = '该账号已被禁用';
- return $rs;
- }
-
- $domain = new Domain_User();
- $info = $domain->getFollowsList($uid,$touid,$p,$key);
-
- $rs['info']=$info;
- return $rs;
- }
-
- /**
- * 获取用户的粉丝列表
- * @desc 用于获取用户的粉丝列表
- * @return int code 操作码,0表示成功
- * @return array info
- * @return string info[].isattent 是否关注,0表示未关注,1表示已关注
- * @return string msg 提示信息
- */
- public function getFansList() {
- $rs = array('code' => 0, 'msg' => '', 'info' => array());
- $uid=checkNull($this->uid);
- $touid=checkNull($this->touid);
- $p=checkNull($this->p);
- $isBlackUser=isBlackUser($uid);
- if($isBlackUser=='0'){
- $rs['code'] = 700;
- $rs['msg'] = '该账号已被禁用';
- return $rs;
- }
-
- $domain = new Domain_User();
- $info = $domain->getFansList($uid,$touid,$p);
-
- $rs['info']=$info;
- return $rs;
- }
- /**
- * 个人主页
- * @desc 用于获取个人主页数据
- * @return int code 操作码,0表示成功
- * @return array info
- * @return string info[0].id 用户id
- * @return string info[0].avatar 用户头像
- * @return string info[0].avatar_thumb 用户小头像
- * @return string info[0].sex 性别
- * @return string info[0].signature 用户签名
- * @return array info[0].province 省份
- * @return array info[0].city 城市
- * @return string info[0].birthday 生日
- * @return array info[0].age 年龄
- * @return array info[0].praise 视频点赞总数
- * @return array info[0].fans 粉丝数
- * @return array info[0].follows 关注数
- * @return array info[0].workVideos 作品数
- * @return array info[0].likeVideos 喜欢视频数
- * @return array info[0].isattention 是否关注
- * @return array info[0].isshop 是否开店
- * @return array info[0].shopname 店铺名称
- * @return array info[0].shop_thumb 店铺封面
- * @return array info[0].vipinfo 用户vip信息
- * @return array info[0].bonus_switch 签到奖励开关 0 关 1 开
- * @return array info[0].vipinfo['isvip'] 用户是否开通vip
- * @return array info[0].vipinfo['vip_endtime'] vip到期时间
- * @return string msg 提示信息
- */
- public function getUserHome() {
- $rs = array('code' => 0, 'msg' => '', 'info' => array());
- $uid=checkNull($this->uid);
- $touid=checkNull($this->touid);
- if($uid>0){ //非游客
- $isBlackUser=isBlackUser($uid);
- if($isBlackUser=='0'){
- $rs['code'] = 700;
- $rs['msg'] = '该账号已被禁用';
- return $rs;
- }
- }
-
-
- $domain = new Domain_User();
- $info=$domain->getUserHome($uid,$touid);
-
- $rs['info'][0]=$info;
- return $rs;
- }
- /**
- * 获取用户喜欢的视频
- * @desc 用户获取用户喜欢的视频
- * @return int code 状态码,0表示成功
- * @return string msg 提示信息
- * @return array info
- * @return string info[0].uid 视频发布者id
- * @return string info[0].title 视频标题
- * @return string info[0].thumb 视频封面图
- * @return string info[0].thumb_s 视频封面小图
- * @return string info[0].href 视频地址
- * @return string info[0].likes 视频被喜欢总数
- * @return string info[0].views 视频被浏览数
- * @return string info[0].comments 视频评论数
- * @return string info[0].shares 视频被分享数
- * @return string info[0].addtime 视频发布时间
- * @return string info[0].city 视频发布城市
- * @return string info[0].datetime 视频发布时间(格式化为汉字形式)
- * @return string info[0].userinfo 视频发布者信息
- */
- public function getLikeVideos(){
- $rs = array('code' => 0, 'msg' => '', 'info' => array());
- $uid=checkNull($this->uid);
- $touid=checkNull($this->touid);
- $p=checkNull($this->p);
- $domain = new Domain_User();
- $res=$domain->getLikeVideos($uid,$touid,$p);
- if($res==1001){
- $rs['code']=0;
- $rs['msg']="暂无视频列表";
- return $rs;
- }
- $rs['info']=$res;
- return $rs;
- }
- /**
- * 获取用户余额,充值规则 支付方式信息
- * @desc 用于获取用户余额,充值规则 支付方式信息
- * @return int code 操作码,0表示成功
- * @return array info
- * @return string info[0].coin 用户余额
- * @return string msg 提示信息
- */
- public function getBalance() {
- $rs = array('code' => 0, 'msg' => '', 'info' => array());
-
- $uid=checkNull($this->uid);
- $token=checkNull($this->token);
- $checkToken=checkToken($uid,$token);
- if($checkToken==700){
- $rs['code'] = $checkToken;
- $rs['msg'] = '您的登陆状态失效,请重新登陆!';
- return $rs;
- }else if($checkToken==10020){
- $rs['code'] = 700;
- $rs['msg'] = '该账号已被禁用';
- return $rs;
- }
-
- $domain = new Domain_User();
- $info = $domain->getBalance($uid);
- $rs['info'][0]=$info;
- return $rs;
- }
- /**
- * 获取用户是否可开播、是否可上传视频、发布视频时是否可发布商品、是否可发布广告链接
- * @desc 用于获取用户是否可开播、是否可上传视频、发布视频时是否可发布商品、是否可发布广告链接
- * @return int code 状态码 0表示成功
- * @return string msg 状态码 0表示成功
- * @return array info 返回信息
- * @return int info[0].live_status 是否可开播 0 否 1 是
- * @return int info[0].video_status 是否可发布视频 0 否 1 是
- * @return int info[0].setvideo_charge 发布视频时是否可设置视频收费价格 0 否 1 是
- * @return int info[0].isshop 发布视频时是否可发布商品 0 否 1 是
- * @return int info[0].isad 发布视频时是否可发布广告链接 0 否 1 是
- * @return string info[0].video_msg 发布视频受限 提示语
- * @return string info[0].live_msg 开播受限 提示语
- */
- public function checkLiveVipStatus(){
- $rs=array('code'=>0,'msg'=>"",'info'=>array());
- $uid=checkNull($this->uid);
- $token=checkNull($this->token);
- $checkToken=checkToken($uid,$token);
- if($checkToken==700){
- $rs['code'] = $checkToken;
- $rs['msg'] = '您的登陆状态失效,请重新登陆!';
- return $rs;
- }else if($checkToken==10020){
- $rs['code'] = 700;
- $rs['msg'] = '该账号已被禁用';
- return $rs;
- }
- $domain=new Domain_User();
- $result=$domain->checkLiveVipStatus($uid);
- if($result==1001){
- $rs['code']=1001; //此code值固定为1001,app要进行判断弹窗提示,并按钮跳转认证页面
- $rs['msg']="未认证,无法发布视频";
- return $rs;
- }
- $rs['info'][0]=$result;
- return $rs;
- }
-
-
-
- /**
- * 更换个人中心背景图
- * @desc 更换个人中心背景图
- * @retun int code 状态码,0表示成功
- * @retun string msg 返回信息
- * @retun array info 返回信息
- * @retun array info[0]['bg_img'] 返回上传的背景图
- * */
- public function updateBgImg(){
- $rs = array('code' => 0, 'msg' => '背景图更换成功', 'info' => array());
-
- $uid=checkNull($this->uid);
- $token=checkNull($this->token);
- $img=checkNull($this->img);
- $checkToken=checkToken($uid,$token);
- if($checkToken==700){
- $rs['code'] = $checkToken;
- $rs['msg'] = '您的登陆状态失效,请重新登陆!';
- return $rs;
- }
- if(!$img){
- $rs['code']=1001;
- $rs['msg']='请上传背景图';
- return $rs;
- }
- $img=setCloudType($img);
- $domain=new Domain_User();
- $res=$domain->updateBgImg($uid,$img);
- if($res==1001){
- $rs['code']=1002;
- $rs['msg']='背景图更换失败';
- return $rs;
- }
- $userinfo=getUserInfo($uid);
- $rs['info'][0]['bg_img']=$userinfo['bg_img'];
- return $rs;
- }
- }
|