huangjiajun pirms 4 mēnešiem
vecāks
revīzija
733cd5045c
7 mainītis faili ar 68 papildinājumiem un 9 dzēšanām
  1. +3
    -1
      app/admin/hdl/order/hdl_order_list.go
  2. +41
    -1
      app/admin/svc/order/svc_order_list.go
  3. +1
    -1
      app/bigData/svc/svc_data.go
  4. +9
    -6
      app/db/db_order_goods_make_stock.go
  5. +12
    -0
      app/db/db_order_list.go
  6. +1
    -0
      app/db/model/order_goods_make_stock.go
  7. +1
    -0
      app/router/admin_router.go

+ 3
- 1
app/admin/hdl/order/hdl_order_list.go Parādīt failu

@@ -27,7 +27,9 @@ func OrderGoodsTotal(c *gin.Context) {
func OrderCancel(c *gin.Context) {
order.OrderCancel(c)
}

func OrderUpdateState(c *gin.Context) {
order.OrderUpdateState(c)
}
func OrderDetail(c *gin.Context) {
order.OrderDetail(c)
}


+ 41
- 1
app/admin/svc/order/svc_order_list.go Parādīt failu

@@ -752,7 +752,46 @@ func OrderCancel(c *gin.Context) {
e.OutSuc(c, "success", nil)
return
}

func OrderUpdateState(c *gin.Context) {
var args map[string]string
if err := c.ShouldBindJSON(&args); err != nil {
e.OutErr(c, e.ERR_INVALID_ARGS, err)
return
}
eg := db.Db
sess := eg.NewSession()
defer sess.Close()
sess.Begin()
order := db.GetOrderByMore(sess, args)
if order == nil {
sess.Rollback()
e.OutErr(c, 400, e.NewErr(400, "订单不存在"))
return
}
sess1 := sess.Where("state!=5")
if args["ids"] != "" {
sess1.In("oid", strings.Split(args["ids"], ","))
}
_, err := sess1.Cols("state").Update(&model.Order{State: 4})
if err != nil {
sess.Rollback()
e.OutErr(c, 400, e.NewErr(400, "操作失败"))
return
}
sess2 := sess.Where("state!=5")
if args["ids"] != "" {
sess2.In("oid", strings.Split(args["ids"], ","))
}
_, err = sess2.Cols("state").Update(&model.OrderGoods{State: 4})
if err != nil {
sess.Rollback()
e.OutErr(c, 400, e.NewErr(400, "操作失败"))
return
}
sess.Commit()
e.OutSuc(c, "success", nil)
return
}
func OrderDetail(c *gin.Context) {
var args map[string]string
if err := c.ShouldBindJSON(&args); err != nil {
@@ -1373,6 +1412,7 @@ func OrderEditNum(c *gin.Context) {
Sku: skuStr,
GoodsType: 0,
MakeDate: orderGoods.MakeDate,
CreateTime: int(time.Now().Unix()),
}
sess.Insert(tmp)
}


+ 1
- 1
app/bigData/svc/svc_data.go Parādīt failu

@@ -585,7 +585,7 @@ func NewSortingGoodsData(arg map[string]string) []map[string]string {
}
oIds = append(oIds, utils.Int64ToStr(v.Oid))
}
sql := `SELECT SUM(num) as num,SUM(success_num) as success_num,goods_title,sku,goods_id,sku_id,enterprise_id FROM order_goods WHERE oid in (%s) and goods_id=%s and goods_type=0 and sku_id=%s and make_date=%s GROUP BY enterprise_id`
sql := `SELECT SUM(num) as num,SUM(success_num) as success_num,goods_title,sku,goods_id,sku_id,enterprise_id FROM order_goods WHERE oid in (%s) and goods_id=%s and goods_type=0 and sku_id=%s and make_date=%s GROUP BY enterprise_id ORDER BY id asc`
sql = fmt.Sprintf(sql, strings.Join(oIds, ","), arg["goods_id"], arg["sku_id"], now)
nativeString, err := db.QueryNativeString(engine, sql)
for _, v := range nativeString {


+ 9
- 6
app/db/db_order_goods_make_stock.go Parādīt failu

@@ -3,6 +3,7 @@ package db
import (
"applet/app/db/model"
"applet/app/utils"
"time"
"xorm.io/xorm"
)

@@ -67,7 +68,7 @@ func GetOrderGoodsMakeStockByBigData(eg *xorm.Engine, param map[string]string) (
}
sess.In("gid", gids)
sess.In("sku_id", skuids)
count, err := sess.OrderBy("id asc").FindAndCount(&order)
count, err := sess.OrderBy("create_time asc,id asc").FindAndCount(&order)
if err != nil {
return nil, count
}
@@ -82,8 +83,9 @@ func GetOrderGoodsMakeStock(sess *xorm.Session, gid, skuId int64) *model.OrderGo
}
if get == false {
data = model.OrderGoodsMakeStock{
Gid: gid,
SkuId: skuId,
Gid: gid,
SkuId: skuId,
CreateTime: int(time.Now().Unix()),
}
insert, err := sess.Insert(&data)
if insert == 0 || err != nil {
@@ -126,9 +128,10 @@ func GetOrderGoodsMakeStockByDate(sess *xorm.Session, gid, skuId int64, date int
}
if get == false {
data = model.OrderGoodsMakeStock{
Gid: gid,
SkuId: skuId,
MakeDate: date,
Gid: gid,
SkuId: skuId,
MakeDate: date,
CreateTime: int(time.Now().Unix()),
}
insert, err := sess.Insert(&data)
if insert == 0 || err != nil {


+ 12
- 0
app/db/db_order_list.go Parādīt failu

@@ -16,6 +16,18 @@ func GetOrderById(eg *xorm.Engine, id string) *model.Order {
}
return &order
}
func GetOrderByMore(sess *xorm.Session, args map[string]string) *[]model.Order {
var order []model.Order
sess1 := sess.Where("state!=5")
if args["ids"] != "" {
sess1.In("oid", strings.Split(args["ids"], ","))
}
err := sess1.Find(&order)
if err != nil {
return nil
}
return &order
}
func GetOrderByIds(eg *xorm.Engine, id []string) *[]model.Order {
var order []model.Order
err := eg.In("oid", id).Find(&order)


+ 1
- 0
app/db/model/order_goods_make_stock.go Parādīt failu

@@ -13,4 +13,5 @@ type OrderGoodsMakeStock struct {
SuccessNum int `json:"success_num" xorm:"default 0 comment('已分拣') INT(11)"`
GoodsType int `json:"goods_type" xorm:"default 0 comment('') INT(11)"`
MakeDate int `json:"make_date" xorm:"comment('') default 0 INT(11)"`
CreateTime int `json:"create_time" xorm:"comment('') default 0 INT(11)"`
}

+ 1
- 0
app/router/admin_router.go Parādīt failu

@@ -141,6 +141,7 @@ func rOrder(r *gin.RouterGroup) {
r.POST("/goods/total", orderHdl.OrderGoodsTotal) //用户订单统计
r.POST("/total", orderHdl.OrderTotal) //用户订单统计
r.POST("/cancel", orderHdl.OrderCancel) //用户订单取消
r.POST("/update/state", orderHdl.OrderUpdateState) //修改状态
r.POST("/detail", orderHdl.OrderDetail) //用户订单详情
r.POST("/output", orderHdl.OrderOutput) //用户订单导出
r.POST("/goods/output", orderHdl.OrderGoodsOutput) //用户订单导出


Notiek ielāde…
Atcelt
Saglabāt