Feat: user profile

This commit is contained in:
HFO4
2020-02-18 15:34:40 +08:00
parent f91792bc64
commit 33a917cc75
6 changed files with 67 additions and 7 deletions

View File

@@ -234,7 +234,7 @@ func ListShares(uid uint, page, pageSize int, order string, publicOnly bool) ([]
dbChain := DB
dbChain = dbChain.Where("user_id = ?", uid)
if publicOnly {
dbChain.Where("password = ?", "")
dbChain = dbChain.Where("password = ?", "")
}
// 计算总数用于分页

View File

@@ -54,7 +54,7 @@ type User struct {
// UserOption 用户个性化配置字段
type UserOption struct {
ProfileOff int `json:"profile_off,omitempty"`
ProfileOff bool `json:"profile_off,omitempty"`
PreferredPolicy uint `json:"preferred_policy"`
PreferredTheme string `json:"preferred_theme"`
}
@@ -181,9 +181,7 @@ func GetUserByEmail(email string) (User, error) {
// NewUser 返回一个新的空 User
func NewUser() User {
options := UserOption{
ProfileOn: 1,
}
options := UserOption{}
return User{
Avatar: "default",
OptionsSerialized: options,