37 lines
594 B
Go
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)
|
|
}
|