订单详情增加用户信息
This commit is contained in:
@@ -136,11 +136,22 @@ func (c *OrderManager) GetOrderInfo(ctx *jxcontext.Context, vendorOrderID string
|
|||||||
|
|
||||||
// 这里用QueryRows而不用QueryRow的原因是用QueryRow在这种情况下不能将数据读出,很奇怪。大概的原因是QueryRow对于GoodsOrderExt这种有嵌入的struct处理有问题
|
// 这里用QueryRows而不用QueryRow的原因是用QueryRow在这种情况下不能将数据读出,很奇怪。大概的原因是QueryRow对于GoodsOrderExt这种有嵌入的struct处理有问题
|
||||||
num, err := db.Raw(`
|
num, err := db.Raw(`
|
||||||
SELECT t1.*, t2.status waybill_status, t2.courier_name, t2.courier_mobile
|
SELECT t3.*,ROUND(t3.shop_price/t3.count) avg_price, t1.*, t2.status waybill_status, t2.courier_name, t2.courier_mobile
|
||||||
FROM goods_order t1
|
FROM goods_order t1
|
||||||
LEFT JOIN waybill t2 ON t1.vendor_waybill_id = t2.vendor_waybill_id AND t1.waybill_vendor_id = t2.waybill_vendor_id
|
LEFT JOIN waybill t2 ON t1.vendor_waybill_id = t2.vendor_waybill_id AND t1.waybill_vendor_id = t2.waybill_vendor_id
|
||||||
|
JOIN (
|
||||||
|
SELECT count(*) count,SUM(b.shop_price) -
|
||||||
|
IFNULL(SUM(c.sku_user_money+c.freight_user_money+c.afs_freight_money+c.box_money+c.tongcheng_freight_money+c.sku_box_money),0) shop_price,a.vendor_user_id,count(d.score < 3 or NULL) bad_comment_count
|
||||||
|
FROM goods_order a
|
||||||
|
JOIN order_sku b ON a.vendor_order_id = b.vendor_order_id AND a.vendor_id = b.vendor_id
|
||||||
|
LEFT JOIN afs_order c ON a.vendor_order_id = c.vendor_order_id AND c.vendor_id = a.vendor_id
|
||||||
|
LEFT JOIN jx_bad_comments d ON d.order_id = a.vendor_order_id AND d.order_flag = a.vendor_id
|
||||||
|
WHERE a.order_created_at BETWEEN ? AND NOW()
|
||||||
|
AND a.vendor_user_id = (SELECT vendor_user_id FROM goods_order WHERE vendor_order_id = ?)
|
||||||
|
GROUP BY a.vendor_user_id
|
||||||
|
)t3 ON t3.vendor_user_id = t1.vendor_user_id
|
||||||
WHERE t1.vendor_order_id = ? AND vendor_id = ?
|
WHERE t1.vendor_order_id = ? AND vendor_id = ?
|
||||||
`, vendorOrderID, vendorID).QueryRows(&orders)
|
`, time.Now().AddDate(0, -1, 0), vendorOrderID, vendorOrderID, vendorID).QueryRows(&orders)
|
||||||
if err == nil && num > 0 {
|
if err == nil && num > 0 {
|
||||||
order = orders[0]
|
order = orders[0]
|
||||||
if isRefresh && vendorID == model.VendorIDJD {
|
if isRefresh && vendorID == model.VendorIDJD {
|
||||||
|
|||||||
@@ -39,9 +39,13 @@ type GoodsOrderExt struct {
|
|||||||
CityName string `json:"cityName"`
|
CityName string `json:"cityName"`
|
||||||
PayPercentage int `json:"payPercentage"`
|
PayPercentage int `json:"payPercentage"`
|
||||||
|
|
||||||
SkuInfo string `json:"skuInfo,omitempty"`
|
SkuInfo string `json:"skuInfo,omitempty"`
|
||||||
ShortSkuInfo `json:"-"`
|
ShortSkuInfo `json:"-"`
|
||||||
SkuList []*ShortSkuInfo `json:"skuList,omitempty"`
|
SkuList []*ShortSkuInfo `json:"skuList,omitempty"`
|
||||||
|
Count int `json:"count"`
|
||||||
|
ShopPrice int64 `json:"shopPrice"`
|
||||||
|
AvgPrice int64 `json:"avgPrice"`
|
||||||
|
BadCommentCount int `json:"badCommentCount"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type OrderSkuExt struct {
|
type OrderSkuExt struct {
|
||||||
|
|||||||
Reference in New Issue
Block a user