|
@@ -246,22 +246,6 @@ class Index extends Api
|
|
|
|
|
|
|
|
|
|
|
|
- protected function getRealIpAddr() {
|
|
|
- if (!empty($_SERVER['HTTP_CLIENT_IP'])) //check ip from share internet
|
|
|
- {
|
|
|
- $ip=$_SERVER['HTTP_CLIENT_IP'];
|
|
|
- }
|
|
|
- elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) //to check ip is pass from proxy
|
|
|
- {
|
|
|
- $ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- $ip=$_SERVER['REMOTE_ADDR'];
|
|
|
- }
|
|
|
- return $ip;
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -271,7 +255,7 @@ class Index extends Api
|
|
|
public function zhiyint_registration()
|
|
|
{
|
|
|
$iparr = ["182.37.138.94","18.162.169.63","18.166.207.228","18.167.62.130","18.163.198.60","18.163.33.249","16.163.157.213", "43.198.99.226", "43.198.98.100", "18.163.210.144", "18.167.165.212", "18.166.28.150", "16.163.99.187", "18.163.210.126", "43.198.84.109", "18.163.182.173", "16.162.109.227", "16.162.87.8", "18.162.111.92", "18.166.214.252"];
|
|
|
- $ip = $this->getRealIpAddr();
|
|
|
+ $ip = request()->ip();
|
|
|
if(!in_array($ip,$iparr)) {
|
|
|
echo json_encode(['error' => "IP not found"]); exit;
|
|
|
}
|
|
@@ -296,16 +280,7 @@ class Index extends Api
|
|
|
echo json_encode($data);
|
|
|
}
|
|
|
|
|
|
-// /**
|
|
|
-// * 生成不重复的随机数字字母组合
|
|
|
-// */
|
|
|
-// function getUinqueNo($length = 8) {
|
|
|
-// $newid = Random::build("alnum",$length);
|
|
|
-//// if(in_array($newid,$nos)) {
|
|
|
-//// $this->getUinqueNo(8);
|
|
|
-//// }
|
|
|
-// return $newid;
|
|
|
-// }
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -319,18 +294,6 @@ class Index extends Api
|
|
|
$this->success("获取成功!",$res);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 联系我们
|
|
|
- */
|
|
|
- public function contactus() {
|
|
|
- $list = \app\common\model\Config::where(["group"=>"basic","name"=>["in",["email","mobile"]]])->select();
|
|
|
- $data = [];
|
|
|
- foreach($list as $k => $v) {
|
|
|
- $v["name"] == "email" && $data["email"] = $v["value"];
|
|
|
- $v["name"] == "mobile" && $data["mobile"] = $v["value"];
|
|
|
- }
|
|
|
- $this->success("获取成功!",$data);
|
|
|
- }
|
|
|
|
|
|
/*
|
|
|
* 获取系统消息列表
|
|
@@ -348,11 +311,11 @@ class Index extends Api
|
|
|
if($flag == 1) {
|
|
|
$list = $obj->find();
|
|
|
$list || $list = [];
|
|
|
- $list && $list["createtime"] = $this->get_last_time($list["createtime"]);
|
|
|
+ $list && $list["createtime"] = get_last_time($list["createtime"]);
|
|
|
} else {
|
|
|
$list = $obj->select();
|
|
|
if($list) foreach($list as $k => &$v) {
|
|
|
- $v["createtime"] = $this->get_last_time($v["createtime"]);
|
|
|
+ $v["createtime"] = get_last_time($v["createtime"]);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -377,84 +340,7 @@ class Index extends Api
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 获取主播魅力值排行
|
|
|
- */
|
|
|
- public function getUserCharmRankList() {
|
|
|
- $time = $this->request->request("time",0,"intval"); //时间筛选 1=小时榜,2=今日榜,3=本周榜,4=月榜
|
|
|
- if(!in_array($time,[1,2,3,4])) {
|
|
|
- $this->error("参数传入错误!");
|
|
|
- }
|
|
|
|
|
|
- $hour = strtotime(date("Y-m-d H:00:00"));
|
|
|
- $today = strtotime(date("Y-m-d 00:00:00"));
|
|
|
- $weekend = strtotime('monday this week');
|
|
|
-// $weekend = mktime(0, 0 , 0,date("m"),date("d")-date("w")+1,date("Y"));
|
|
|
- $month = strtotime(date("Y-m-01 00:00:00"));
|
|
|
- // 剩余时间
|
|
|
- $thistime = time();
|
|
|
- switch ($time) {
|
|
|
- case 1:
|
|
|
- $redtime = 3600-($thistime - $hour);
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- $redtime = 3600*24-($thistime - $today);
|
|
|
- break;
|
|
|
- case 3:
|
|
|
- $redtime = 3600*24*7-($thistime - $weekend);
|
|
|
- break;
|
|
|
- case 4:
|
|
|
- $monthend = mktime(23,59,59,date("m"),date("t"),date("Y"));
|
|
|
- $redtime = ($monthend - $month)-($thistime - $month);
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
- $timeArr = [1=>$hour,2=>$today,3=>$weekend,4=>$month];
|
|
|
- $where = [];
|
|
|
- $where["a.createtime"] = ["gt",$timeArr[$time]];
|
|
|
- $list = \app\common\model\UserCharmRank::alias("a")
|
|
|
- ->field("p.id,sum(a.charm) as charm,u.avatar,u.nickname,u.gender,u.level")
|
|
|
- ->where($where)
|
|
|
- ->join("hx_user u","u.id = a.user_id")
|
|
|
- ->join("hx_party p","p.user_id = a.user_id")
|
|
|
- ->group("a.user_id")
|
|
|
- ->order("charm","desc")
|
|
|
- ->limit(100)
|
|
|
- ->select();
|
|
|
-
|
|
|
- $data = [];
|
|
|
- $data["redtime"] = $redtime;
|
|
|
- $data["data"] = $list;
|
|
|
- $this->success("获取成功!",$data);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取派对热度排序
|
|
|
- */
|
|
|
- public function getPartyHotList() {
|
|
|
- // 剩余时间
|
|
|
- $thistime = time();
|
|
|
- $hour = strtotime(date("Y-m-d H:00:00"));
|
|
|
- $redtime = 3600-($thistime - $hour);
|
|
|
-
|
|
|
- $where = [];
|
|
|
- $where["a.createtime"] = ["gt",$hour];
|
|
|
- $where["p.room_type"] = 1;
|
|
|
- $list = \app\common\model\PartyHot::alias("a")
|
|
|
- ->field("sum(a.hot) as hot,p.id,u.avatar,p.party_name,p.party_logo")
|
|
|
- ->where($where)
|
|
|
- ->join("hx_party p","p.id = a.party_id")
|
|
|
- ->join("hx_user u","u.id = p.user_id")
|
|
|
- ->group("a.party_id")
|
|
|
- ->order("hot","desc")
|
|
|
- ->limit(100)
|
|
|
- ->select();
|
|
|
-
|
|
|
- $data = [];
|
|
|
- $data["redtime"] = $redtime;
|
|
|
- $data["data"] = $list;
|
|
|
- $this->success("获取成功!",$data);
|
|
|
- }
|
|
|
|
|
|
/**
|
|
|
* 首页搜索
|
|
@@ -528,12 +414,6 @@ class Index extends Api
|
|
|
$this->success("获取成功!",["url"=>$this->httpurl(config("site.appShare"))]);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 获取开机动画(暂时关闭)
|
|
|
- */
|
|
|
- private function getBootAnimation() {
|
|
|
- $this->success("获取成功!",["url"=>$this->httpurl(config("site.bootAnimationUrl")),"time"=>floatval(config("site.bootAnimationTime"))]);
|
|
|
- }
|
|
|
|
|
|
/**
|
|
|
* 获取版本更新信息
|
|
@@ -630,59 +510,6 @@ class Index extends Api
|
|
|
$this->success("获取成功!",$savepath);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 获取银行列表
|
|
|
- */
|
|
|
- public function getBankList() {
|
|
|
- $this->success("获取成功!",["banklist"=>\app\common\model\Bank::select()]);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取开关配置
|
|
|
- */
|
|
|
- public function getSwitch() {
|
|
|
- $this->success("获取成功!",["switch"=>config("site.switch")]);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 评论时间转换
|
|
|
- * @param null $time
|
|
|
- * @return false|string
|
|
|
- */
|
|
|
- private function get_last_time($time = NULL) {
|
|
|
- $text = '';
|
|
|
- $time = $time === NULL || $time > time() ? time() : intval($time);
|
|
|
- $t = time() - $time; //时间差 (秒)
|
|
|
- $y = date('Y', $time)-date('Y', time());//是否跨年
|
|
|
- switch($t){
|
|
|
- case $t == 0:
|
|
|
- $text = '刚刚';
|
|
|
- break;
|
|
|
- case $t < 60:
|
|
|
- $text = $t . '秒前'; // 一分钟内
|
|
|
- break;
|
|
|
- case $t < 60 * 60:
|
|
|
- $text = floor($t / 60) . '分钟前'; //一小时内
|
|
|
- break;
|
|
|
- case $t < 60 * 60 * 24:
|
|
|
- $text = floor($t / (60 * 60)) . '小时前'; // 一天内
|
|
|
- break;
|
|
|
- case $t < 60 * 60 * 24 * 3:
|
|
|
- $text = floor($time/(60*60*24)) ==1 ?'昨天 ' . date('H:i', $time) : '前天 ' . date('H:i', $time) ; //昨天和前天
|
|
|
- break;
|
|
|
- case $t < 60 * 60 * 24 * 30:
|
|
|
- $text = date('m月d日 H:i', $time); //一个月内
|
|
|
- break;
|
|
|
- case $t < 60 * 60 * 24 * 365&&$y==0:
|
|
|
- $text = date('m月d日', $time); //一年内
|
|
|
- break;
|
|
|
- default:
|
|
|
- $text = date('Y年m月d日', $time); //一年以前
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
- return $text;
|
|
|
- }
|
|
|
|
|
|
//轮播图
|
|
|
public function banner() {
|
|
@@ -1046,23 +873,7 @@ class Index extends Api
|
|
|
$this->success('Success', $data);
|
|
|
}
|
|
|
|
|
|
- // 获取版本更新信息(知心app)
|
|
|
- public function getversionZx() {
|
|
|
- // 获取二维码
|
|
|
- $is_force = config("site.is_force_zx"); //是否强制更新 1是 0否
|
|
|
- $apk_url = config("site.apk_url_zx"); //下载链接
|
|
|
- $apk_name = config("site.apk_name_zx"); //apk更新标题
|
|
|
- $apk_desc = config("site.apk_desc_zx"); //apk更新描述
|
|
|
- $version_code = config("site.version_code_zx"); //版本迭代号
|
|
|
-
|
|
|
- $data['is_force'] = $is_force;
|
|
|
- $data['apk_url'] = $apk_url;
|
|
|
- $data['apk_name'] = str_replace('知音','知心',$apk_name);
|
|
|
- $data['apk_desc'] = $apk_desc;
|
|
|
- $data['version_code'] = $version_code;
|
|
|
|
|
|
- $this->success('Success', $data);
|
|
|
- }
|
|
|
|
|
|
//获取ios版本更新信息
|
|
|
public function getiosversion() {
|