diff --git a/app/controller/Share.php b/app/controller/Share.php new file mode 100644 index 0000000..17514db --- /dev/null +++ b/app/controller/Share.php @@ -0,0 +1,65 @@ + 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); + } +}