fix bug
This commit is contained in:
65
app/controller/Share.php
Normal file
65
app/controller/Share.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
namespace app\controller;
|
||||
|
||||
use think\facade\Db;
|
||||
|
||||
class Share
|
||||
{
|
||||
public function ranking(): \think\response\Json
|
||||
{
|
||||
$lastIndex = lastindex();
|
||||
if($lastIndex == 0){
|
||||
$where = "id > 0";
|
||||
}else{
|
||||
$where = "id < ".$lastIndex;
|
||||
}
|
||||
$result['lastIndex'] = 0;
|
||||
$list = Db::name("app_users")->where($where)->order("share_count desc,order id desc")->select()->toArray();
|
||||
foreach($list as $vo){
|
||||
$result['lastIndex'] = $vo['id'];
|
||||
$result['data'] = [
|
||||
"id"=>$vo['id'],
|
||||
"nickname"=>$vo['nickname'],
|
||||
"count"=>$vo['share_count']
|
||||
];
|
||||
}
|
||||
|
||||
if (count($list) < env("PAGE_COUNT")) {
|
||||
$result["lastIndex"] = 0;
|
||||
}
|
||||
|
||||
return show(SUCCESS_MESSAGE.'!',SUCCESS_CODE,$result);
|
||||
}
|
||||
|
||||
public function UserShareList(){
|
||||
if(empty($GLOBALS['data']['data']['shiyou_id'])){
|
||||
return show("请上传用户信息!", ERROR_CODE,[]);
|
||||
}
|
||||
$shiYou_id =$GLOBALS['data']['data']['shiyou_id'];
|
||||
$lastIndex = lastindex();
|
||||
if($lastIndex == 0){
|
||||
$where = "id > 0";
|
||||
}else{
|
||||
$where = "id < ".$lastIndex;
|
||||
}
|
||||
$users = [];
|
||||
$result['lastIndex'] = 0;
|
||||
$list = Db::name("app_user_relation")->where("parent_id",$shiYou_id)->where($where)->select()->toArray();
|
||||
if(empty($list)){
|
||||
$users = getAllUsersMessage($list,"user_id","id,nickname,avatar");
|
||||
}
|
||||
foreach ($list as $vo) {
|
||||
$result['lastIndex'] = $vo['id'];
|
||||
$result["list"][] = [
|
||||
"id"=>$vo['user_id'],
|
||||
"ickname"=>$users[$vo['user_id']]['nickname'],
|
||||
"avatar"=>$users[$vo['user_id']]['avatar'],
|
||||
"data"=>date("Y-m-d",$vo['create_time'])
|
||||
];
|
||||
}
|
||||
if (count($list) < env("PAGE_COUNT")) {
|
||||
$result["lastIndex"] = 0;
|
||||
}
|
||||
return show(SUCCESS_MESSAGE.'!',SUCCESS_CODE,$result);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user