|
|
@@ -10,18 +10,18 @@ import (
|
|
|
)
|
|
|
|
|
|
const (
|
|
|
- order_dt_items_tablename = "order_base_details"
|
|
|
+ order_dt_items_tablename = "base_details"
|
|
|
)
|
|
|
|
|
|
type OrderDtItem struct {
|
|
|
- Id int64 `orm:"column(id);pk" json:"id"` // int(11)
|
|
|
- OrderId int64 `orm:"column(order_id)" json:"order_id"` // int(11)
|
|
|
- OrderNo string `orm:"column(order_no);null" json:"order_no"` // varchar(64)
|
|
|
- OrderDtId int64 `orm:"column(order_dt_id)" json:"order_dt_id"` // int(11)
|
|
|
- ProductId int64 `orm:"column(product_id)" json:"product_id"` // int(11)
|
|
|
- Title string `orm:"column(title);null" json:"title"` // varchar(64)
|
|
|
- Nums int64 `orm:"column(nums);null" json:"nums"` // tinyint(1)
|
|
|
- Send bool `orm:"column(send)" json:"send"`
|
|
|
+ Id int64 `orm:"column(id);pk" json:"id"` // int(11)
|
|
|
+ OrderId int64 `orm:"column(order_id)" json:"order_id"` // int(11)
|
|
|
+ OrderNo string `orm:"column(order_no);null" json:"order_no"` // varchar(64)
|
|
|
+ OrderDtId int64 `orm:"column(dt_id)" json:"order_dt_id"` // int(11)
|
|
|
+ ProductId int64 `orm:"column(product_id)" json:"product_id"` // int(11)
|
|
|
+ Title string `orm:"column(product_name);null" json:"title"` // varchar(64)
|
|
|
+ Nums int64 `orm:"column(nums);null" json:"nums"` // tinyint(1)
|
|
|
+ Send bool `orm:"column(is_zeng)" json:"send"`
|
|
|
CreatedAt time.Time `orm:"column(created_at);auto_now_add;type(datetime)" json:"-"` // datetime
|
|
|
UpdatedAt time.Time `orm:"column(updated_at);auto_now;type(datetime)" json:"-"` // datetime
|
|
|
}
|
|
|
@@ -86,8 +86,8 @@ func GetOrderDetailPackages(orderDtId, nums int64, useCache bool) (list []*Produ
|
|
|
|
|
|
sql :=
|
|
|
fmt.Sprintf(`
|
|
|
- select product_id as item_id,title as item_title,ceil(nums/%d) as nums from
|
|
|
- order_base_details
|
|
|
+ select product_id as item_id,product_name as item_title,ceil(nums/%d) as nums from
|
|
|
+ base_details
|
|
|
where order_dt_id = ? ;
|
|
|
`, nums)
|
|
|
_, err := orm.NewOrm().Raw(sql, orderDtId).QueryRows(&list)
|
|
|
@@ -112,7 +112,7 @@ func GetDetailSoldCountByPId(pId int64, useCache bool) int64 {
|
|
|
}
|
|
|
ret := &Ret{}
|
|
|
o := orm.NewOrm()
|
|
|
- new_tbn := "order_base_details"
|
|
|
+ new_tbn := "base_details"
|
|
|
tbn := new(Order).TableName()
|
|
|
sql := fmt.Sprintf("SELECT sum(`nums`) as count FROM `%s` WHERE order_no in ( select order_id from `%s` where status not in (?, ?) ) and product_id=?;", new_tbn, tbn)
|
|
|
err := o.Raw(sql, STATUS_CLOSED, STATUS_UNPAY, pId).QueryRow(ret)
|