Drop LevelDB and move all the things to SQLite. Implemented endpoints: /api <unit, accessoryMaterialAll> /api <unit, accessoryTab> /live/continue /live/partyList /unit/favoriteAccessory (WIP) /unit/sale Signed-off-by: Sean Du <do4suki@gmail.com>
38 lines
844 B
Go
38 lines
844 B
Go
package profile
|
|
|
|
import (
|
|
"honoka-chan/internal/middleware"
|
|
usermodel "honoka-chan/internal/model/user"
|
|
"honoka-chan/internal/router"
|
|
profileschema "honoka-chan/internal/schema/profile"
|
|
"honoka-chan/internal/session"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/tidwall/gjson"
|
|
)
|
|
|
|
func register(ctx *gin.Context) {
|
|
ss := session.Get(ctx)
|
|
defer ss.Finalize()
|
|
|
|
req := gjson.Parse(ctx.PostForm("request_data"))
|
|
pref := usermodel.UserPref{
|
|
UserDesc: req.Get("introduction").String(),
|
|
}
|
|
|
|
_, err := ss.UserEng.Table("user_pref").Where("user_id = ?", ss.UserID).Update(&pref)
|
|
if ss.CheckErr(err) {
|
|
return
|
|
}
|
|
|
|
ss.Respond(profileschema.RegisterResp{
|
|
ResponseData: []any{},
|
|
ReleaseInfo: []any{},
|
|
StatusCode: 200,
|
|
})
|
|
}
|
|
|
|
func init() {
|
|
router.AddHandler("main.php", "POST", "/profile/profileRegister", middleware.Common, register)
|
|
}
|