@@ -81,6 +81,7 @@ func GoodsPayCreate(c *gin.Context) { | |||||
Price: skuPrice[v.SkuId], | Price: skuPrice[v.SkuId], | ||||
EnterpriseId: utils.StrToInt(req.EnterpriseId), | EnterpriseId: utils.StrToInt(req.EnterpriseId), | ||||
State: 1, | State: 1, | ||||
IsNew: 1, | |||||
} | } | ||||
goodsTotal[tmp.GoodsId] += tmp.Num | goodsTotal[tmp.GoodsId] += tmp.Num | ||||
orderGoods = append(orderGoods, tmp) | orderGoods = append(orderGoods, tmp) | ||||
@@ -1,10 +1,15 @@ | |||||
package hdl | package hdl | ||||
import ( | import ( | ||||
"applet/app/admin/md" | |||||
"applet/app/bigData/svc" | "applet/app/bigData/svc" | ||||
"applet/app/db" | "applet/app/db" | ||||
"applet/app/db/model" | |||||
"applet/app/e" | "applet/app/e" | ||||
"applet/app/utils" | |||||
"encoding/json" | |||||
"github.com/gin-gonic/gin" | "github.com/gin-gonic/gin" | ||||
"strings" | |||||
) | ) | ||||
func MakingData(c *gin.Context) { | func MakingData(c *gin.Context) { | ||||
@@ -43,3 +48,50 @@ func NewOrderNotice(c *gin.Context) { | |||||
e.OutSuc(c, res, nil) | e.OutSuc(c, res, nil) | ||||
return | 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 | |||||
} |
@@ -9,6 +9,7 @@ type OrderGoods struct { | |||||
SkuId int64 `json:"sku_id" xorm:"default 0 comment('sku') BIGINT(20)"` | SkuId int64 `json:"sku_id" xorm:"default 0 comment('sku') BIGINT(20)"` | ||||
Num int `json:"num" xorm:"default 0 comment('购买数量') INT(11)"` | Num int `json:"num" xorm:"default 0 comment('购买数量') INT(11)"` | ||||
OldNum int `json:"old_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)"` | 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)"` | State int `json:"state" xorm:"default 0 comment('状态 0待制作 1制作中 2烘焙中 3分拣中 4已完成 ') INT(11)"` | ||||
SkuCode string `json:"sku_code" xorm:"VARCHAR(255)"` | SkuCode string `json:"sku_code" xorm:"VARCHAR(255)"` | ||||
@@ -19,9 +19,10 @@ func rData(r *gin.RouterGroup) { | |||||
r.GET("/leftData", hdl.LeftData) //左侧数据 | r.GET("/leftData", hdl.LeftData) //左侧数据 | ||||
r.POST("/rightData", hdl.RightData) //右侧数据 | 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) //新订单提醒 | |||||
} | } |
@@ -11,10 +11,10 @@ redis_password: '' | |||||
# 连接官网数据库获取db mapping | # 连接官网数据库获取db mapping | ||||
db: | db: | ||||
host: 'zhios123.rwlb.rds.aliyuncs.com:3306' | |||||
host: '119.23.182.117:3306' | |||||
name: 'bakery' | name: 'bakery' | ||||
user: 'canal' | |||||
psw: 'canal' | |||||
user: 'root' | |||||
psw: 'Fnuo123com@' | |||||
show_log: true | show_log: true | ||||
max_lifetime: 30 | max_lifetime: 30 | ||||
max_open_conns: 100 | max_open_conns: 100 | ||||