\ No newline at end of file
diff --git a/app/Plugins/User/resources/views/home/comment.blade.php b/app/Plugins/User/resources/views/home/comment.blade.php
new file mode 100644
index 000000000..2ce151e1a
--- /dev/null
+++ b/app/Plugins/User/resources/views/home/comment.blade.php
@@ -0,0 +1,122 @@
+
+
\ No newline at end of file
diff --git a/app/Plugins/User/resources/views/home/fans.blade.php b/app/Plugins/User/resources/views/home/fans.blade.php
new file mode 100644
index 000000000..5caf296e6
--- /dev/null
+++ b/app/Plugins/User/resources/views/home/fans.blade.php
@@ -0,0 +1,61 @@
+
+
\ No newline at end of file
diff --git a/app/Plugins/User/resources/views/home/following.blade.php b/app/Plugins/User/resources/views/home/following.blade.php
new file mode 100644
index 000000000..bc969b0db
--- /dev/null
+++ b/app/Plugins/User/resources/views/home/following.blade.php
@@ -0,0 +1,61 @@
+
+
\ No newline at end of file
diff --git a/app/Plugins/User/resources/views/home/overview.blade.php b/app/Plugins/User/resources/views/home/overview.blade.php
new file mode 100644
index 000000000..5cdb1365e
--- /dev/null
+++ b/app/Plugins/User/resources/views/home/overview.blade.php
@@ -0,0 +1,357 @@
+
+
+
+ Download more icon variants from https://tabler-icons.io/i/currency-dollar
+
+
+
+
+
+
+
+
+ {{$user->options->money}}
+
+
+ {{get_options('wealth_money_name','余额')}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Download more icon variants from https://tabler-icons.io/i/credit-card
+
+
+
+
+
+
+
+
+
+
+ {{$user->options->credits}}
+
+
+ {{get_options('wealth_credit_name','积分')}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Download more icon variants from https://tabler-icons.io/i/coin
+
+
+
+
+
+
+
+
+
+ {{$user->options->golds}}
+
+
+ {{get_options('wealth_golds_name','金币')}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Download more icon variants from https://tabler-icons.io/i/activity
+
+
+
+
+
+
+
+ {{$user->options->exp}}
+
+
+ {{get_options('wealth_exp_name','经验')}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{format_date($user->created_at)}}
+
+
+ {{__("user.register time")}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Download more icon variants from https://tabler-icons.io/i/message-circle
+
+
+
+
+
+
+
+
+
+
+ {{$user->comments->count()}}
+
+
+ {{__("user.comment count")}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Download more icon variants from https://tabler-icons.io/i/note
+
+
+
+
+
+
+
+
+ {{$user->topic->count()}}
+
+
+ {{__("user.topic count")}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Download more icon variants from https://tabler-icons.io/i/star
+
+
+
+
+
+
+
+ {{$user->collections->count()}}
+
+
+ {{__("user.collection count")}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Download more icon variants from https://tabler-icons.io/i/user-circle
+
+
+
+
+
+
+
+
+
+ {{$user->fan->count()}}
+
+
+ {{__("user.fans count")}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Download more icon variants from https://tabler-icons.io/i/tag
+
+
+
+
+
+
+
+
+ {{$user->tags->count()}}
+
+
+ {{__("user.topic tag count")}}
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/Plugins/User/resources/views/home/topic.blade.php b/app/Plugins/User/resources/views/home/topic.blade.php
new file mode 100644
index 000000000..ae8d2fd8a
--- /dev/null
+++ b/app/Plugins/User/resources/views/home/topic.blade.php
@@ -0,0 +1,113 @@
+
+
\ No newline at end of file
diff --git a/app/Plugins/User/resources/views/setting/admin/wealth.blade.php b/app/Plugins/User/resources/views/setting/admin/wealth.blade.php
new file mode 100644
index 000000000..67fa77539
--- /dev/null
+++ b/app/Plugins/User/resources/views/setting/admin/wealth.blade.php
@@ -0,0 +1,34 @@
+
\ No newline at end of file
diff --git a/app/Plugins/User/resources/views/setting/user/code.blade.php b/app/Plugins/User/resources/views/setting/user/code.blade.php
new file mode 100644
index 000000000..30fb54ac3
--- /dev/null
+++ b/app/Plugins/User/resources/views/setting/user/code.blade.php
@@ -0,0 +1,11 @@
+
+
+
+
+ 默认开启
+
+
+
+
+
\ No newline at end of file
diff --git a/app/Plugins/User/src/Controller/ApiController.php b/app/Plugins/User/src/Controller/ApiController.php
index 39297b33b..8da1d2482 100644
--- a/app/Plugins/User/src/Controller/ApiController.php
+++ b/app/Plugins/User/src/Controller/ApiController.php
@@ -147,6 +147,9 @@ public function user_follow(){
return Json_Api(401,false,['msg' => '未登录!']);
}
+ if(!User::query()->where('id',$user_id)->exists()){
+ return Json_Api(401,false,['msg' =>'用户不存在!']);
+ }
// 禁止关注自己
if($user_id==auth()->id()){
return Json_Api(401,false,['msg' => '不能关注自己']);
@@ -154,7 +157,6 @@ public function user_follow(){
if(UserFans::query()->where(['user_id'=>$user_id,'fans_id' => auth()->id()])->exists()){
UserFans::query()->where(['user_id'=>$user_id,'fans_id' => auth()->id()])->delete();
- User::query()->where("id",$user_id)->decrement("fans",1);
// 发送取关通知
user_notice()->send($user_id,
@@ -163,7 +165,6 @@ public function user_follow(){
);
return Json_Api(201,true,['msg' =>'已取关!']);
}
- User::query()->where("id",$user_id)->increment("fans",1);
UserFans::query()->create(['user_id'=>$user_id,'fans_id' => auth()->id()]);
// 发送通知
@@ -172,7 +173,7 @@ public function user_follow(){
view("User::notice.userfollow",['user' => auth()->data()])
);
- return Json_Api(200,true,['msg' =>'已关注!']);
+ return Json_Api(200,true,['msg' =>'已关注']);
}
// 查询关注状态
diff --git a/app/Plugins/User/src/Controller/UserController.php b/app/Plugins/User/src/Controller/UserController.php
index 02ad9d008..575f8c9f7 100644
--- a/app/Plugins/User/src/Controller/UserController.php
+++ b/app/Plugins/User/src/Controller/UserController.php
@@ -41,8 +41,8 @@ public function data($username){
if(!User::query()->where("username",$username)->count()){
return admin_abort("用户名为:".$username."的用户不存在");
}
- $data = User::query()->with("Class","Options")->where("username",$username)->first();
- return view("User::data",['data'=>$data]);
+ $user = User::query()->where("username",$username)->first();
+ return view("User::data",['user'=>$user]);
}
#[GetMapping(path:"/users/group/{id}.html")]
diff --git a/app/Plugins/User/src/Models/User.php b/app/Plugins/User/src/Models/User.php
index 52ce98d2d..6e5b6623a 100755
--- a/app/Plugins/User/src/Models/User.php
+++ b/app/Plugins/User/src/Models/User.php
@@ -4,6 +4,9 @@
namespace App\Plugins\User\src\Models;
use App\Model\Model;
+use App\Plugins\Comment\src\Model\TopicComment;
+use App\Plugins\Topic\src\Models\Topic;
+use App\Plugins\Topic\src\Models\TopicTag;
use Carbon\Carbon;
/**
@@ -54,7 +57,48 @@ public function Class()
return $this->belongsTo(UserClass::class,"class_id","id");
}
- public function Options(){
+
+ public function options(){
return $this->belongsTo(UsersOption::class,"options_id","id");
}
+
+ /**
+ * 获取用户的评论
+ * @return \Hyperf\Database\Model\Relations\HasMany
+ */
+ public function comments(){
+ return $this->hasMany(TopicComment::class,"user_id","id");
+ }
+
+ /**
+ * 获取用户的话题
+ * @return \Hyperf\Database\Model\Relations\HasMany
+ */
+ public function topic(){
+ return $this->hasMany(Topic::class,"user_id","id");
+ }
+
+ /**
+ * 收藏
+ * @return \Hyperf\Database\Model\Relations\HasMany
+ */
+ public function collections(){
+ return $this->hasMany(UsersCollection::class,"user_id","id");
+ }
+
+ /**
+ * 粉丝
+ * @return \Hyperf\Database\Model\Relations\HasMany
+ */
+ public function fan(){
+ return $this->hasMany(UserFans::class,"user_id","id");
+ }
+
+ /**
+ * 主题标签
+ * @return \Hyperf\Database\Model\Relations\HasMany
+ */
+ public function tags(){
+ return $this->hasMany(TopicTag::class,"user_id","id");
+ }
}
\ No newline at end of file
diff --git a/app/Plugins/User/src/Models/UserFans.php b/app/Plugins/User/src/Models/UserFans.php
index 82ea9a415..f4ae81772 100644
--- a/app/Plugins/User/src/Models/UserFans.php
+++ b/app/Plugins/User/src/Models/UserFans.php
@@ -37,4 +37,8 @@ class UserFans extends Model
public function fans(){
return $this->belongsTo(User::class,"fans_id","id");
}
+
+ public function user(){
+ return $this->belongsTo(User::class,"user_id","id");
+ }
}
\ No newline at end of file
diff --git a/app/Plugins/User/src/migrations/2022_05_28_132345_update_users_settings_table.php b/app/Plugins/User/src/migrations/2022_05_28_132345_update_users_settings_table.php
new file mode 100644
index 000000000..40f716afc
--- /dev/null
+++ b/app/Plugins/User/src/migrations/2022_05_28_132345_update_users_settings_table.php
@@ -0,0 +1,28 @@
+longText('value')->change();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ Schema::table('users_settings', function (Blueprint $table) {
+ //
+ });
+ }
+}
diff --git a/app/Plugins/User/src/migrations/2022_05_29_132749_update_users_table.php b/app/Plugins/User/src/migrations/2022_05_29_132749_update_users_table.php
new file mode 100644
index 000000000..fdc42564d
--- /dev/null
+++ b/app/Plugins/User/src/migrations/2022_05_29_132749_update_users_table.php
@@ -0,0 +1,28 @@
+dropColumn(['fans']);
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ Schema::table('users', function (Blueprint $table) {
+ //
+ });
+ }
+}
diff --git a/app/Themes/CodeFec/resources/views/user/setting/options.blade.php b/app/Themes/CodeFec/resources/views/user/setting/options.blade.php
index fe9329542..ff2c14686 100644
--- a/app/Themes/CodeFec/resources/views/user/setting/options.blade.php
+++ b/app/Themes/CodeFec/resources/views/user/setting/options.blade.php
@@ -22,7 +22,7 @@
@include($value['view'])
+ {{__("app.Published on")}}:{{format_date(get_topic_comment($value->type_id)->created_at)}} +