- Store birth month and day in user_pref with default 10/18 - Migrate existing user_pref rows to fill missing birthday fields - Expose birthday editing in the webui profile page - Replace hardcoded birthday values in user info, top info, and product list responses - Fix birthday month/day field alignment in the profile form Signed-off-by: Sean Du <do4suki@gmail.com>
36 lines
747 B
Go
36 lines
747 B
Go
package user
|
|
|
|
import (
|
|
"honoka-chan/internal/middleware"
|
|
"honoka-chan/internal/router"
|
|
userschema "honoka-chan/internal/schema/user"
|
|
"honoka-chan/internal/session"
|
|
"time"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
func userInfo(ctx *gin.Context) {
|
|
ss := session.Get(ctx)
|
|
defer ss.Finalize()
|
|
|
|
userResp := userschema.UserInfoResp{
|
|
ResponseData: userschema.UserInfoData{
|
|
User: ss.GetUserInfo(),
|
|
Birth: userschema.Birth{
|
|
BirthMonth: ss.UserPref.EffectiveBirthMonth(),
|
|
BirthDay: ss.UserPref.EffectiveBirthDay(),
|
|
},
|
|
ServerTimestamp: time.Now().Unix(),
|
|
},
|
|
ReleaseInfo: []any{},
|
|
StatusCode: 200,
|
|
}
|
|
|
|
ss.Respond(userResp)
|
|
}
|
|
|
|
func init() {
|
|
router.AddHandler("main.php", "POST", "/user/userInfo", middleware.Common, userInfo)
|
|
}
|