123456789101112131415161718192021222324252627282930313233343536373839404142 |
- package customer
- import (
- "github.com/gin-gonic/gin"
- "zhiyuan/pkg/app"
- "zhiyuan/pkg/utils"
- "zhiyuan/services/aftersale"
- )
- func QaList(c *gin.Context) {
- page := app.HandlePageNum(c)
- where := map[string]interface{}{"deleted_at": 0}
- type Qa struct {
- ID int `json:"id"`
- Title string `json:"title"`
- Content string `json:"content"`
- DeletedAt int `json:"deleted_at"`
- CreatedAt string `json:"created_at"`
- UpdatedAt string `json:"updated_at"`
- }
- qaList := make([]*Qa, 0)
- if _, err := aftersale.GetQaList(where, nil, page, &qaList); err != nil {
- app.Error(c, err.Error())
- return
- }
- for k, v := range qaList {
- v.CreatedAt = utils.DateS(v.CreatedAt, "YYYY-MM-DD")
- v.UpdatedAt = utils.DateS(v.UpdatedAt, "YYYY-MM-DD")
- qaList[k] = v
- }
- app.Success(c, qaList)
- }
- func QaInfo(c *gin.Context) {
- id := utils.StrTo(c.Param("id")).MustInt()
- if id <= 0 {
- app.Error(c, "类型id有误")
- return
- }
- info, _ := aftersale.GetQaOne(map[string]interface{}{"id": id}, nil, nil)
- app.Success(c, info)
- }
|