面包店
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 

72 linhas
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. if adminName == "" {
  33. adminName = v.AdminName
  34. }
  35. var tmp = map[string]string{
  36. "id": utils.IntToStr(v.Id),
  37. "state_str": stateArr[v.State],
  38. "state": utils.IntToStr(v.State),
  39. "time": v.Time.Format("2006-01-02 15:04:05"),
  40. "sku_str": "",
  41. "goods_title": v.GoodsTitle,
  42. "memo": v.Memo,
  43. "admin_name": adminName,
  44. "success_num": utils.IntToStr(v.SuccessNum),
  45. }
  46. skuData := make([]md.Sku, 0)
  47. json.Unmarshal([]byte(v.Sku), &skuData)
  48. skuStr := ""
  49. for _, v1 := range skuData {
  50. if skuStr != "" {
  51. skuStr += ";"
  52. }
  53. skuStr += v1.Value
  54. }
  55. tmp["sku_str"] = skuStr
  56. data = append(data, tmp)
  57. }
  58. }
  59. res := map[string]interface{}{
  60. "total": total,
  61. "list": data,
  62. }
  63. e.OutSuc(c, res, nil)
  64. return
  65. }
  66. func MarkRecordFlow(c *gin.Context) {
  67. }