diff --git a/application/index/controller/Share.php b/application/index/controller/Share.php
index f35f5534..71fc98c4 100644
--- a/application/index/controller/Share.php
+++ b/application/index/controller/Share.php
@@ -222,36 +222,39 @@ class Share extends Controller{
$shareId = input('post.id');
$shareObj = new ShareHandler($shareId,false);
if(!$shareObj->querryStatus){
- return array(
+ return json(array(
"error" => 1,
"msg" => "分享不存在"
- );
+ ));
}
- return $shareObj->deleteShare($this->userObj->uid);
+ return json($shareObj->deleteShare($this->userObj->uid));
}
public function ChangePromission(){
$shareId = input('post.id');
$shareObj = new ShareHandler($shareId,false);
if(!$shareObj->querryStatus){
- return array(
+ return json(array(
"error" => 1,
"msg" => "分享不存在"
- );
+ ));
}
- return $shareObj->changePromission($this->userObj->uid);
+ return json($shareObj->changePromission($this->userObj->uid));
}
- public function My(){
+ public function ListMyShare(){
if(!$this->userObj->loginStatus){
$this->redirect(url('/Login','',''));
exit();
}
- $userInfo = $this->userObj->getInfo();
- $groupData = $this->userObj->getGroupData();
- $list = Db::name('shares')->where('owner',$this->userObj->uid)->order('share_time DESC')->paginate(30);
- $listData = $list->all();
+ $list = Db::name('shares')
+ ->where('owner',$this->userObj->uid)
+ ->order('share_time DESC')
+ ->page(input("post.page").",18")
+ ->select();
+ $listData = $list;
foreach ($listData as $key => $value) {
+ unset($listData[$key]["source_name"]);
if($value["source_type"]=="file"){
$listData[$key]["fileData"] = Db::name('files')->where('id',$value["source_name"])->find()["orign_name"];
@@ -259,12 +262,20 @@ class Share extends Controller{
$listData[$key]["fileData"] = $value["source_name"];
}
}
+ return json($listData);
+ }
+
+ public function My(){
+ if(!$this->userObj->loginStatus){
+ $this->redirect(url('/Login','',''));
+ exit();
+ }
+ $userInfo = $this->userObj->getInfo();
+ $groupData = $this->userObj->getGroupData();
return view('share_home', [
- 'options' => Option::getValues(['basic','share']),
- 'userInfo' => $userInfo,
+ 'options' => Option::getValues(['basic','share'],$this->userObj->userSQLData),
+ 'userData' => $userInfo,
'groupData' => $groupData,
- 'list' => $listData,
- 'listOrigin' => $list
]);
}
diff --git a/application/index/model/ShareHandler.php b/application/index/model/ShareHandler.php
index 5e4823dc..9278fa7e 100644
--- a/application/index/model/ShareHandler.php
+++ b/application/index/model/ShareHandler.php
@@ -57,13 +57,15 @@ class ShareHandler extends Model{
"msg" => "无权操作"
);
}
+ $newPwd = self::getRandomKey(6);
Db::name('shares')->where('share_key',$this->shareData["share_key"])->update([
'type' => $this->shareData["type"] == "public"?"private":"public",
- 'share_pwd' => self::getRandomKey(6)
+ 'share_pwd' => $newPwd
]);
return array(
"error" =>0,
- "msg" => "更改成功"
+ "msg" => "更改成功",
+ "newPwd" => $newPwd,
);
}
diff --git a/application/index/view/home/home.html b/application/index/view/home/home.html
index 1572af84..8209f248 100644
--- a/application/index/view/home/home.html
+++ b/application/index/view/home/home.html
@@ -84,10 +84,11 @@
-
-
-
+
+
+
+