aozhiwei 9c5c88b31d 1
2024-11-13 11:34:09 +08:00

37 lines
594 B
Go

package chip
import (
"q5"
"f5"
"main/service"
"main/constant"
"main/common"
"main/vo"
"github.com/gin-gonic/gin"
)
type ChipApi struct {
}
func (this *ChipApi) List(c *gin.Context) {
s := c.MustGet(constant.SESSION_KEY).(common.Session)
if s == nil {
return
}
err, chips := service.Chip.List(s.GetAccountId())
if err != nil {
f5.RspErr(c, 500, "server internal error")
return
}
rspObj := struct {
vo.BaseVo
Data []*vo.Chip `json:"data"`
}{}
for _, m := range chips {
v := new(vo.Chip)
v.FromModel(m)
q5.AppendSlice(&rspObj.Data, v)
}
c.JSON(200, rspObj)
}