48 lines
889 B
Go
48 lines
889 B
Go
package controller
|
|
|
|
import (
|
|
"github.com/codinl/go-logger"
|
|
"github.com/gin-gonic/gin"
|
|
"mh-server/lib/status"
|
|
"mh-server/model"
|
|
)
|
|
|
|
func StoreList(c *gin.Context) {
|
|
req := struct {
|
|
GameCardId uint64 `json:"game_card_id"`
|
|
}{}
|
|
if err := c.ShouldBindJSON(&req); err != nil {
|
|
logger.Error(err)
|
|
RespJson(c, status.BadRequest, nil)
|
|
return
|
|
}
|
|
|
|
stores, err := model.GetStoreList(req.GameCardId)
|
|
if err != nil {
|
|
logger.Error("err:", err)
|
|
RespJson(c, status.InternalServerError, nil)
|
|
return
|
|
}
|
|
RespOK(c, stores)
|
|
}
|
|
|
|
func StoreInfo(c *gin.Context) {
|
|
req := struct {
|
|
StoreId uint32 `json:"store_id"`
|
|
}{}
|
|
if err := c.ShouldBindJSON(&req); err != nil {
|
|
logger.Error(err)
|
|
RespJson(c, status.BadRequest, nil)
|
|
return
|
|
}
|
|
store := model.Store{}
|
|
store.ID = req.StoreId
|
|
err := store.Info()
|
|
if err != nil {
|
|
logger.Error("err:", err)
|
|
return
|
|
}
|
|
RespOK(c, store)
|
|
return
|
|
}
|