Skip to content

Commit cdf65a9

Browse files
authored
Fix invalid orderKey (flipped-aurora#950)
* fix unmatched type of id field * fix invalid order key
1 parent 3ab0580 commit cdf65a9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

server/service/system/sys_api.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package system
22

33
import (
44
"errors"
5+
"fmt"
56

67
"github.com/flipped-aurora/gin-vue-admin/server/global"
78
"github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
@@ -89,6 +90,9 @@ func (apiService *ApiService) GetAPIInfoList(api system.SysApi, info request.Pag
8990
} else {
9091
OrderStr = order
9192
}
93+
} else { // didn't matched any order key in `orderMap`
94+
err = fmt.Errorf("非法的排序字段: %v", order)
95+
return err, apiList, total
9296
}
9397

9498
err = db.Order(OrderStr).Find(&apiList).Error

0 commit comments

Comments
 (0)