You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
691 B
38 lines
691 B
package application
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/golangkit/formatime"
|
|
"log"
|
|
"recook/internal/back"
|
|
"recook/internal/dbc"
|
|
"recook/internal/model/application"
|
|
"recook/internal/model/user"
|
|
"recook/tools"
|
|
)
|
|
|
|
type launchParam struct {
|
|
UserId uint `json:"userId"`
|
|
}
|
|
|
|
func LaunchApp(c *gin.Context) {
|
|
var p launchParam
|
|
err := tools.ParseParams(&p, c)
|
|
if err != nil {
|
|
back.Fail(c, err.Error())
|
|
return
|
|
}
|
|
|
|
s := &application.LaunchScreen{}
|
|
dbc.DB.Last(s)
|
|
back.Suc(c, "", s)
|
|
|
|
if p.UserId > 0 {
|
|
var l = user.Login{ID: p.UserId}
|
|
err = dbc.DB.Model(&l).Updates(user.Login{LoginTime: formatime.NewSecondNow()}).Error
|
|
if err != nil {
|
|
log.Print(err)
|
|
}
|
|
}
|
|
}
|