修复气站合同用户权限与服务关系边界
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
// 功能描述:实现气站范围内的配送合同、合同气瓶和燃气配送订单接口。
|
||||
// 版本:v1.1.0
|
||||
package gas
|
||||
|
||||
import (
|
||||
@@ -5,6 +7,8 @@ import (
|
||||
"encoding/json"
|
||||
"io"
|
||||
"reflect"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.apinb.com/bsm-sdk/core/errcode"
|
||||
"git.apinb.com/bsm-sdk/core/infra"
|
||||
@@ -59,8 +63,26 @@ func ListGasorderContract(ctx *gin.Context) {
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
listScoped(ctx, &models.GasorderContract{}, common.ActiveRecords(impl.DBService.Model(&models.GasorderContract{})).
|
||||
Where("gas_basic_id = ?", station.ID), "gasorder_contract.created_at desc")
|
||||
page, size := common.PageSize(ctx)
|
||||
query := common.ApplyKeywordFilter(ctx,
|
||||
platformgasorder.ContractPartyDisplayQuery(impl.DBService).
|
||||
Where("gasorder_contract.gas_basic_id = ?", station.ID),
|
||||
&models.GasorderContract{})
|
||||
candidate := strings.TrimSpace(ctx.Query("candidate"))
|
||||
if candidate == "order" || candidate == "binding" {
|
||||
query = platformgasorder.FilterGasorderContractCandidates(query, candidate, time.Now())
|
||||
}
|
||||
var total int64
|
||||
if err := query.Count(&total).Error; err != nil {
|
||||
infra.Response.Error(ctx, err)
|
||||
return
|
||||
}
|
||||
var list []platformgasorder.ContractPartyDisplay
|
||||
if err := query.Order("gasorder_contract.created_at desc").Offset((page - 1) * size).Limit(size).Scan(&list).Error; err != nil {
|
||||
infra.Response.Error(ctx, err)
|
||||
return
|
||||
}
|
||||
respondList(ctx, list, total)
|
||||
}
|
||||
|
||||
func GetGasorderContract(ctx *gin.Context) {
|
||||
|
||||
Reference in New Issue
Block a user