diff --git a/app/admin/svc/order/svc_order_pay.go b/app/admin/svc/order/svc_order_pay.go index f46adbe..bb5891b 100644 --- a/app/admin/svc/order/svc_order_pay.go +++ b/app/admin/svc/order/svc_order_pay.go @@ -81,6 +81,7 @@ func GoodsPayCreate(c *gin.Context) { Price: skuPrice[v.SkuId], EnterpriseId: utils.StrToInt(req.EnterpriseId), State: 1, + IsNew: 1, } goodsTotal[tmp.GoodsId] += tmp.Num orderGoods = append(orderGoods, tmp) diff --git a/app/bigData/hdl/hdl_making_data.go b/app/bigData/hdl/hdl_making_data.go index 818cda7..b6422b8 100644 --- a/app/bigData/hdl/hdl_making_data.go +++ b/app/bigData/hdl/hdl_making_data.go @@ -1,10 +1,15 @@ package hdl import ( + "applet/app/admin/md" "applet/app/bigData/svc" "applet/app/db" + "applet/app/db/model" "applet/app/e" + "applet/app/utils" + "encoding/json" "github.com/gin-gonic/gin" + "strings" ) func MakingData(c *gin.Context) { @@ -43,3 +48,50 @@ func NewOrderNotice(c *gin.Context) { e.OutSuc(c, res, nil) return } +func NewOrderInfoNotice(c *gin.Context) { + var data []model.OrderGoods + db.Db.Where("is_new=1").Find(&data) + sysCfgDb := db.SysCfgDb{} + sysCfgDb.Set() + cfg, _ := sysCfgDb.SysCfgGetOne("new_order_notice") + str := "" + if cfg != nil { + str = cfg.Val + } + skuDatas := make(map[int64]map[string]string, 0) + for _, v := range data { + _, ok := skuDatas[v.SkuId] + if ok == false { + skuDatas[v.SkuId] = make(map[string]string) + } + skuDatas[v.SkuId]["goods_title"] = v.GoodsTitle + skuDatas[v.SkuId]["sku"] = v.Sku + skuDatas[v.SkuId]["count"] = utils.IntToStr(utils.StrToInt(skuDatas[v.SkuId]["count"]) + v.Num) + } + res := make([]map[string]string, 0) + for _, v := range skuDatas { + skuData := make([]md.Sku, 0) + json.Unmarshal([]byte(v["sku"]), &skuData) + skuStr := "" + for _, v1 := range skuData { + if skuStr != "" { + skuStr += ";" + } + skuStr += v1.Value + } + tip := str + tip = strings.ReplaceAll(tip, "[商品名称]", v["goods_title"]) + tip = strings.ReplaceAll(tip, "[规格]", skuStr) + tip = strings.ReplaceAll(tip, "[数量]", v["count"]) + tmp := map[string]string{ + "str": tip, + } + res = append(res, tmp) + } + for _, v := range data { + v.IsNew = 0 + db.Db.Where("id=?", v.Id).Cols("is_new").Update(&v) + } + e.OutSuc(c, res, nil) + return +} diff --git a/app/db/model/order_goods.go b/app/db/model/order_goods.go index 5b945b5..ce96bf6 100644 --- a/app/db/model/order_goods.go +++ b/app/db/model/order_goods.go @@ -9,6 +9,7 @@ type OrderGoods struct { SkuId int64 `json:"sku_id" xorm:"default 0 comment('sku') BIGINT(20)"` Num int `json:"num" xorm:"default 0 comment('购买数量') INT(11)"` OldNum int `json:"old_num" xorm:"default 0 comment('购买数量') INT(11)"` + IsNew int `json:"is_new" xorm:"default 0 comment('购买数量') INT(11)"` Price string `json:"price" xorm:"default 0.00 comment('单价') DECIMAL(20,2)"` State int `json:"state" xorm:"default 0 comment('状态 0待制作 1制作中 2烘焙中 3分拣中 4已完成 ') INT(11)"` SkuCode string `json:"sku_code" xorm:"VARCHAR(255)"` diff --git a/app/router/big_data_router.go b/app/router/big_data_router.go index c16c96c..3edced5 100644 --- a/app/router/big_data_router.go +++ b/app/router/big_data_router.go @@ -19,9 +19,10 @@ func rData(r *gin.RouterGroup) { r.GET("/leftData", hdl.LeftData) //左侧数据 r.POST("/rightData", hdl.RightData) //右侧数据 - r.GET("/making_data", hdl.MakingData) //制作区数据 - r.GET("/baking_data", hdl.BakingData) //烘焙区数据 - r.GET("/sorting_data", hdl.SortingData) //分拣区数据 - r.GET("/new_order_notice", hdl.NewOrderNotice) //新订单提醒 + r.GET("/making_data", hdl.MakingData) //制作区数据 + r.GET("/baking_data", hdl.BakingData) //烘焙区数据 + r.GET("/sorting_data", hdl.SortingData) //分拣区数据 + r.GET("/new_order_notice", hdl.NewOrderNotice) //新订单提醒 + r.GET("/new_order_info_notice", hdl.NewOrderInfoNotice) //新订单提醒 } diff --git a/etc/cfg.yml b/etc/cfg.yml index 8549d49..a47c022 100644 --- a/etc/cfg.yml +++ b/etc/cfg.yml @@ -11,10 +11,10 @@ redis_password: '' # 连接官网数据库获取db mapping db: - host: 'zhios123.rwlb.rds.aliyuncs.com:3306' + host: '119.23.182.117:3306' name: 'bakery' - user: 'canal' - psw: 'canal' + user: 'root' + psw: 'Fnuo123com@' show_log: true max_lifetime: 30 max_open_conns: 100