面包店
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

55 lines
1.2 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 CommMakingData(c *gin.Context, args map[string]string) {
  11. eg := db.Db
  12. data, _ := db.GetOrderGoodsMakeStockByBigData(eg, args)
  13. list := make([]map[string]string, 0)
  14. if data != nil {
  15. for _, v := range *data {
  16. var tmp = map[string]string{
  17. "num": "",
  18. "state_str": "",
  19. "goods_title": v.GoodsTitle,
  20. "state": "",
  21. }
  22. if args["state"] == "1" {
  23. tmp["num"] = utils.IntToStr(v.WaitMakeNum)
  24. tmp["state_str"] = "制作中"
  25. tmp["state"] = "1"
  26. }
  27. if args["state"] == "2" {
  28. tmp["num"] = utils.IntToStr(v.WaitBakingNum)
  29. tmp["state_str"] = "烘焙中"
  30. tmp["state"] = "2"
  31. }
  32. if args["state"] == "3" {
  33. tmp["num"] = utils.IntToStr(v.WaitSortingNum)
  34. tmp["state_str"] = "分拣中"
  35. tmp["state"] = "3"
  36. }
  37. skuData := make([]md.Sku, 0)
  38. json.Unmarshal([]byte(v.Sku), &skuData)
  39. skuStr := ""
  40. for _, v1 := range skuData {
  41. if skuStr != "" {
  42. skuStr += ";"
  43. }
  44. skuStr += v1.Value
  45. }
  46. tmp["sku_str"] = skuStr
  47. list = append(list, tmp)
  48. }
  49. }
  50. e.OutSuc(c, list, nil)
  51. return
  52. }