|
|
@@ -119,16 +119,32 @@ func QueryRecieptOrder(c *gin.Context) {
|
|
|
datas = append(datas, d2...)
|
|
|
|
|
|
// 过滤相关账号下非买一卖一的单据(如买一卖一有多张单则都要显示)
|
|
|
- // 先按价格倒序排列
|
|
|
- sort.Slice(datas, func(i int, j int) bool {
|
|
|
- return datas[i].Orderprice > datas[j].Orderprice
|
|
|
- })
|
|
|
+ if req.BuyOrSell == 0 {
|
|
|
+ // 买,先按价格倒序排列
|
|
|
+ sort.Slice(datas, func(i int, j int) bool {
|
|
|
+ return datas[i].Orderprice > datas[j].Orderprice
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ // 卖,先按价格顺序排列
|
|
|
+ sort.Slice(datas, func(i int, j int) bool {
|
|
|
+ return datas[i].Orderprice < datas[j].Orderprice
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
tmpDatas := make([]QueryRecieptOrderRsp, 0)
|
|
|
for _, v := range datas {
|
|
|
needAdd := true
|
|
|
for _, t := range tmpDatas {
|
|
|
- if t.AccountID == v.AccountID && t.Buyorsell == v.Buyorsell && t.Orderprice > v.Orderprice {
|
|
|
- needAdd = false
|
|
|
+ if req.BuyOrSell == 0 {
|
|
|
+ // 买
|
|
|
+ if t.AccountID == v.AccountID && t.Buyorsell == v.Buyorsell && t.Orderprice > v.Orderprice {
|
|
|
+ needAdd = false
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 卖
|
|
|
+ if t.AccountID == v.AccountID && t.Buyorsell == v.Buyorsell && t.Orderprice < v.Orderprice {
|
|
|
+ needAdd = false
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
if needAdd {
|