From 3a4912083c38e1b64b9c5a5aa88ee1d219287dd5 Mon Sep 17 00:00:00 2001 From: HFO4 <912394456@qq.com> Date: Thu, 14 Mar 2019 10:00:53 +0800 Subject: [PATCH] Feat: User profile --- application/index/controller/Profile.php | 61 ++-- application/index/view/home/home.html | 7 +- application/index/view/member/setting.html | 4 +- .../index/view/member/setting_old.html | 265 ------------------ application/index/view/profile/profile.html | 192 ++++++------- 5 files changed, 128 insertions(+), 401 deletions(-) delete mode 100644 application/index/view/member/setting_old.html diff --git a/application/index/controller/Profile.php b/application/index/controller/Profile.php index 458d78df..ff9a77c3 100644 --- a/application/index/controller/Profile.php +++ b/application/index/controller/Profile.php @@ -14,47 +14,46 @@ class Profile extends Controller{ public $siteOptions; public function _initialize(){ - $this->siteOptions = Option::getValues(["basic"]); } - public function index(){ - $this->visitorObj = new User(cookie('user_id'),cookie('login_key')); - $userId = (string)input("param.uid"); + public function getList(){ + $userId = (string)input("post.uid"); $userData = Db::name("users")->where("id",$userId)->find(); + $page = (int)input("post.page"); if (empty($userId) || empty($userData) || $userData["profile"] == 0){ - $this->error('用户主页不存或者用户关闭了个人主页',404,$this->siteOptions); - } - $groupData = Db::name("groups")->where("id",$userData["user_group"])->find(); - $shareCount = Db::name('shares') - ->where('owner',$userId) - ->where('type',"public") - ->count(); - $regDays = (int)((time()-strtotime($userData["user_date"]))/86400); - switch (input("get.type")) { + $this->error('用户主页不存或者用户关闭了个人主页',404,$this->siteOptions); + } + switch (input("post.type")) { case 'all': $list = Db::name('shares') ->where('owner',$userId) ->where('type',"public") ->order('share_time DESC') - ->paginate(10); + ->page($page.',10') + ->select(); break; case 'hot': $num = Option::getValue("hot_share_num"); $list = Db::name('shares') ->where('owner',$userId) ->where('type',"public") - ->paginate($num); + ->order('download_num DESC') + ->limit($num) + ->select(); break; default: $list = Db::name('shares') ->where('owner',$userId) ->where('type',"public") ->order('share_time DESC') - ->paginate(10); + ->page($page.',10') + ->select(); break; } - $listData = $list->all(); + $listData = $list; foreach ($listData as $key => $value) { + unset($listData[$key]["share_pwd"]); + unset($listData[$key]["source_name"]); if($value["source_type"]=="file"){ $listData[$key]["fileData"] = Db::name('files')->where('id',$value["source_name"])->find()["orign_name"]; @@ -63,14 +62,34 @@ class Profile extends Controller{ $listData[$key]["fileData"] = end($pathDir); } } + + return json($listData); + + + } + + public function index(){ + $this->visitorObj = new User(cookie('user_id'),cookie('login_key')); + $this->siteOptions = Option::getValues(["basic"],$this->visitorObj->userSQLData); + $userId = (string)input("param.uid"); + $userData = Db::name("users")->where("id",$userId)->find(); + if (empty($userId) || empty($userData) || $userData["profile"] == 0){ + $this->error('用户主页不存或者用户关闭了个人主页',404,$this->siteOptions); + } + $groupData = Db::name("groups")->where("id",$userData["user_group"])->find(); + $shareCount = Db::name('shares') + ->where('owner',$userId) + ->where('type',"public") + ->count(); + $regDays = (int)((time()-strtotime($userData["user_date"]))/86400); + return view("profile",[ "options" => $this->siteOptions, 'loginStatus' => $this->visitorObj->loginStatus, - 'userInfo' => $userData, - 'userData' => $this->visitorObj->userSQLData, + 'targetUserInfo' => $userData, + 'userSQL' => $this->visitorObj->userSQLData, + 'userInfo' => $this->visitorObj->getInfo(), 'groupData' => $groupData, - 'list' => $listData, - 'listOrigin' => $list, 'type' => input("get.type"), 'shareCount' => $shareCount, 'regDays' => $regDays, diff --git a/application/index/view/home/home.html b/application/index/view/home/home.html index 97cb3d47..1572af84 100644 --- a/application/index/view/home/home.html +++ b/application/index/view/home/home.html @@ -83,10 +83,11 @@ - - - + + + + \ No newline at end of file diff --git a/application/index/view/member/setting.html b/application/index/view/member/setting.html index 8dc95349..b0058fd5 100644 --- a/application/index/view/member/setting.html +++ b/application/index/view/member/setting.html @@ -74,8 +74,10 @@ - + + + diff --git a/application/index/view/member/setting_old.html b/application/index/view/member/setting_old.html deleted file mode 100644 index 1ea4a7ac..00000000 --- a/application/index/view/member/setting_old.html +++ /dev/null @@ -1,265 +0,0 @@ -{extend name="header_home" /} -{block name="title"}用户设置- {$options.siteName}{/block} -{block name="content"} - - - - -
- {include file="navbar_home" /} - -
-

用户设置

-
-
-
-
- -
-
-
-
-
-
-
-
-
{$userInfo.uid}
-
-
-
-
-
- -
-
- -
-
-
- -
-
-
-
-
-
{$groupData.group_name}
-
-
-
-
-
-
{$userInfo.regDate}
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
- {eq name="$userSQL.two_step" value="0"} - - {else} - - {/eq} -
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
- -
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
- -
-
-
- {eq name="groupData.webdav" value="0"} - - {else/} -
-
-
- -
-
-
-
-
- -
-
-
-
-
- -
-
- {/eq}
-

你可以使用任何支持WebDAV协议的文件管理工具或操作系统将网盘映射到本地,方便多端同步管理。初次使用请先设置WebDAV登录密码,此密码默认与登录密码不相同。

-
-
-
- -
-
-
-
公告
-
- 公告内容 -
-
-
-
-
-
-
- -
-
-
- - - - - - - - - {$options.js_code} - - {/block} \ No newline at end of file diff --git a/application/index/view/profile/profile.html b/application/index/view/profile/profile.html index 82c7f6ff..a596c2b2 100644 --- a/application/index/view/profile/profile.html +++ b/application/index/view/profile/profile.html @@ -1,115 +1,85 @@ -{extend name="header_public" /} -{block name="title"}用户主页 - {$options.siteName}{/block} -{block name="content"} - + + + + + + + + + + + + 用户主页 - {$options.siteName} + - -