mirror of https://gitee.com/answerdev/answer.git
feat(siteinfo): add custom css html response in siteinfo api
This commit is contained in:
parent
4fa01db61c
commit
08478d8213
|
@ -55,6 +55,11 @@ func (sc *SiteinfoController) GetSiteInfo(ctx *gin.Context) {
|
|||
if err != nil {
|
||||
log.Error(err)
|
||||
}
|
||||
|
||||
resp.CustomCssHtml, err = sc.siteInfoService.GetSiteCustomCssHTML(ctx)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
}
|
||||
handler.HandleResponse(ctx, nil, resp)
|
||||
}
|
||||
|
||||
|
|
|
@ -488,3 +488,17 @@ func (uc *UserController) UserChangeEmailVerify(ctx *gin.Context) {
|
|||
uc.actionService.ActionRecordDel(ctx, schema.ActionRecordTypeEmail, ctx.ClientIP())
|
||||
handler.HandleResponse(ctx, err, nil)
|
||||
}
|
||||
|
||||
// UserRanking get user ranking
|
||||
// @Summary get user ranking
|
||||
// @Description get user ranking
|
||||
// @Tags User
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Success 200 {object} handler.RespBody{data=schema.GetUserToSetShowResp}
|
||||
// @Router /answer/api/v1/user/ranking [get]
|
||||
func (uc *UserController) UserRanking(ctx *gin.Context) {
|
||||
resp, err := uc.userService.UserRanking(ctx)
|
||||
handler.HandleResponse(ctx, err, resp)
|
||||
}
|
||||
|
|
|
@ -44,8 +44,8 @@ type User struct {
|
|||
Website string `xorm:"not null default '' VARCHAR(255) website"`
|
||||
Location string `xorm:"not null default '' VARCHAR(100) location"`
|
||||
IPInfo string `xorm:"not null default '' VARCHAR(255) ip_info"`
|
||||
//IsAdmin bool `xorm:"not null default false BOOL is_admin"`
|
||||
Language string `xorm:"not null default '' VARCHAR(100) language"`
|
||||
IsAdmin bool `xorm:"not null default false BOOL is_admin"`
|
||||
Language string `xorm:"not null default '' VARCHAR(100) language"`
|
||||
}
|
||||
|
||||
// TableName user table name
|
||||
|
|
|
@ -3,6 +3,7 @@ package activity_common
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/answerdev/answer/internal/entity"
|
||||
"github.com/answerdev/answer/internal/service/activity_common"
|
||||
|
@ -106,3 +107,9 @@ func (ar *ActivityRepo) AddActivity(ctx context.Context, activity *entity.Activi
|
|||
}
|
||||
return
|
||||
}
|
||||
|
||||
// GetUsersWhoHasGainedTheMostReputation get users who has gained the most reputation over a period of time
|
||||
func (ar *ActivityRepo) GetUsersWhoHasGainedTheMostReputation(
|
||||
ctx context.Context, startTime, endTime time.Time, limit int) (userIDs []string, err error) {
|
||||
return
|
||||
}
|
||||
|
|
|
@ -116,6 +116,7 @@ func (a *AnswerAPIRouter) RegisterUnAuthAnswerAPIRouter(r *gin.RouterGroup) {
|
|||
r.GET("/user/logout", a.userController.UserLogout)
|
||||
r.PUT("/user/email", a.userController.UserChangeEmailVerify)
|
||||
r.POST("/user/email/change/code", a.userController.UserChangeEmailSendCode)
|
||||
r.GET("/user/ranking", a.userController.UserRanking)
|
||||
|
||||
//answer
|
||||
r.GET("/answer/info", a.answerController.Get)
|
||||
|
|
|
@ -131,11 +131,12 @@ type SiteSeoResp SiteSeoReq
|
|||
|
||||
// SiteInfoResp get site info response
|
||||
type SiteInfoResp struct {
|
||||
General *SiteGeneralResp `json:"general"`
|
||||
Interface *SiteInterfaceResp `json:"interface"`
|
||||
Branding *SiteBrandingResp `json:"branding"`
|
||||
Login *SiteLoginResp `json:"login"`
|
||||
Theme *SiteThemeResp `json:"theme"`
|
||||
General *SiteGeneralResp `json:"general"`
|
||||
Interface *SiteInterfaceResp `json:"interface"`
|
||||
Branding *SiteBrandingResp `json:"branding"`
|
||||
Login *SiteLoginResp `json:"login"`
|
||||
Theme *SiteThemeResp `json:"theme"`
|
||||
CustomCssHtml *SiteCustomCssHTMLResp `json:"custom_css_html"`
|
||||
}
|
||||
type TemplateSiteInfoResp struct {
|
||||
General *SiteGeneralResp `json:"general"`
|
||||
|
|
|
@ -417,3 +417,22 @@ type UserVerifyEmailSendReq struct {
|
|||
CaptchaID string `validate:"omitempty,gt=0,lte=500" json:"captcha_id"`
|
||||
CaptchaCode string `validate:"omitempty,gt=0,lte=500" json:"captcha_code"`
|
||||
}
|
||||
|
||||
// UserRankingResp user ranking response
|
||||
type UserRankingResp struct {
|
||||
UsersWithTheMostReputation []*UserRankingSimpleInfo `json:"users_with_the_most_reputation"`
|
||||
UsersWithTheMostVote []*UserRankingSimpleInfo `json:"users_with_the_most_vote"`
|
||||
Staffs []*UserRankingSimpleInfo `json:"staffs"`
|
||||
}
|
||||
|
||||
// UserRankingSimpleInfo user ranking simple info
|
||||
type UserRankingSimpleInfo struct {
|
||||
// username
|
||||
Username string `json:"username"`
|
||||
// rank
|
||||
Rank int `json:"rank"`
|
||||
// display name
|
||||
DisplayName string `json:"display_name"`
|
||||
// avatar
|
||||
Avatar string `json:"avatar"`
|
||||
}
|
||||
|
|
|
@ -555,3 +555,9 @@ func (us *UserService) getSiteUrl(ctx context.Context) string {
|
|||
}
|
||||
return siteGeneral.SiteUrl
|
||||
}
|
||||
|
||||
// UserRanking get user ranking
|
||||
func (us *UserService) UserRanking(ctx context.Context) (resp []*schema.UserRankingResp, err error) {
|
||||
//us.userRepo.GetByUserID()
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue