面包店
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 
 

69 satır
1.6 KiB

  1. package svc
  2. import (
  3. "applet/app/admin/md"
  4. "applet/app/db"
  5. "applet/app/e"
  6. "applet/app/utils"
  7. "encoding/json"
  8. "github.com/gin-gonic/gin"
  9. )
  10. func MarkRecord(c *gin.Context) {
  11. var args map[string]string
  12. if err := c.ShouldBindJSON(&args); err != nil {
  13. e.OutErr(c, e.ERR_INVALID_ARGS, err)
  14. return
  15. }
  16. eg := db.Db
  17. list, total := db.GetOrderGoodsDoingList(eg, args)
  18. data := make([]map[string]string, 0)
  19. if list != nil {
  20. stateArr := []string{"待制作", "制作中", "制作完成", "烘焙完成", "分拣完成", "已取消"}
  21. adminIds := make([]int, 0)
  22. for _, v := range *list {
  23. adminIds = append(adminIds, v.AdminId)
  24. }
  25. adminMap := db.GetStaffMore(eg, adminIds)
  26. for _, v := range *list {
  27. adminName := ""
  28. _, ok1 := adminMap[v.AdminId]
  29. if ok1 {
  30. adminName = adminMap[v.AdminId].Name
  31. }
  32. var tmp = map[string]string{
  33. "id": utils.IntToStr(v.Id),
  34. "state_str": stateArr[v.State],
  35. "state": utils.IntToStr(v.State),
  36. "time": v.Time.Format("2006-01-02 15:04:05"),
  37. "sku_str": "",
  38. "goods_title": v.GoodsTitle,
  39. "memo": v.Memo,
  40. "admin_name": adminName,
  41. "success_num": utils.IntToStr(v.SuccessNum),
  42. }
  43. skuData := make([]md.Sku, 0)
  44. json.Unmarshal([]byte(v.Sku), &skuData)
  45. skuStr := ""
  46. for _, v1 := range skuData {
  47. if skuStr != "" {
  48. skuStr += ";"
  49. }
  50. skuStr += v1.Value
  51. }
  52. tmp["sku_str"] = skuStr
  53. data = append(data, tmp)
  54. }
  55. }
  56. res := map[string]interface{}{
  57. "total": total,
  58. "list": data,
  59. }
  60. e.OutSuc(c, res, nil)
  61. return
  62. }
  63. func MarkRecordFlow(c *gin.Context) {
  64. }