|
- package svc
-
- import (
- "applet/app/admin/md"
- "applet/app/db"
- "applet/app/e"
- "applet/app/utils"
- "encoding/json"
- "github.com/gin-gonic/gin"
- )
-
- func MarkRecord(c *gin.Context) {
- var args map[string]string
- if err := c.ShouldBindJSON(&args); err != nil {
- e.OutErr(c, e.ERR_INVALID_ARGS, err)
- return
- }
- eg := db.Db
- list, total := db.GetOrderGoodsDoingList(eg, args)
- data := make([]map[string]string, 0)
- if list != nil {
- stateArr := []string{"待制作", "制作中", "制作完成", "烘焙完成", "分拣完成", "已取消"}
- adminIds := make([]int, 0)
- for _, v := range *list {
- adminIds = append(adminIds, v.AdminId)
- }
- adminMap := db.GetStaffMore(eg, adminIds)
-
- for _, v := range *list {
- adminName := ""
- _, ok1 := adminMap[v.AdminId]
- if ok1 {
- adminName = adminMap[v.AdminId].Name
- }
- if adminName == "" {
- adminName = v.AdminName
- }
- var tmp = map[string]string{
- "id": utils.IntToStr(v.Id),
- "state_str": stateArr[v.State],
- "state": utils.IntToStr(v.State),
- "time": v.Time.Format("2006-01-02 15:04:05"),
- "sku_str": "",
- "goods_title": v.GoodsTitle,
- "memo": v.Memo,
- "admin_name": adminName,
- "success_num": utils.IntToStr(v.SuccessNum),
- }
- skuData := make([]md.Sku, 0)
- json.Unmarshal([]byte(v.Sku), &skuData)
- skuStr := ""
- for _, v1 := range skuData {
- if skuStr != "" {
- skuStr += ";"
- }
- skuStr += v1.Value
- }
- tmp["sku_str"] = skuStr
- data = append(data, tmp)
- }
- }
- res := map[string]interface{}{
- "total": total,
- "list": data,
- }
- e.OutSuc(c, res, nil)
- return
- }
- func MarkRecordFlow(c *gin.Context) {
-
- }
|