23 lines
593 B
Go
23 lines
593 B
Go
package controller
|
|
|
|
import (
|
|
"net/http"
|
|
"twin-api/app/api/service"
|
|
"twin-api/base/config"
|
|
|
|
"git.u8t.cn/open/go-server/session"
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/spf13/cast"
|
|
)
|
|
|
|
type Pkg struct{}
|
|
|
|
// Latest 返回最新可用包的下载链接
|
|
func (p *Pkg) Latest(ctx *gin.Context) {
|
|
sess := ctx.Keys[session.ContextSession].(*session.ApiSession)
|
|
limit := cast.ToInt64(sess.GetExperiment().GetParam(config.ServicePackageLimit, config.KeysDefault[config.ServicePackageLimit]))
|
|
|
|
link := service.NewPkg().Latest(limit)
|
|
ctx.JSON(http.StatusOK, session.NewRsp(gin.H{"link": link}))
|
|
}
|