This commit is contained in:
邹宗楠
2025-07-15 18:16:09 +08:00
parent aa03e543b6
commit c3fb38473c
8 changed files with 262 additions and 9 deletions

View File

@@ -5,6 +5,29 @@ import (
"time"
)
func GetStoreContract(db *DaoDB, storeId int, orderId string) (*model.LakalaContract, error) {
merchantObj := &model.LakalaContract{}
param := []interface{}{}
sql := ` SELECT * FROM lakala_contract WHERE 1=1`
if storeId != 0 {
{
sql += ` AND store_id = ?`
param = append(param, storeId)
}
}
if orderId != "" {
sql += ` AND contract_id = ?`
param = append(param, orderId)
}
if err := GetRow(db, merchantObj, sql, param...); err != nil {
return nil, err
}
return merchantObj, nil
}
// GetStoreInfoByMerchantID 门店进件/分账商户
func GetStoreInfoByMerchantID(db *DaoDB, merchantNo string, storeId int, applyId, OrderID string) (*model.LakalaIncoming, error) {
merchantObj := &model.LakalaIncoming{}
@@ -284,3 +307,44 @@ func WithdrawalList(merchantNo, drawJnl, acctName string, startTime, endTime tim
return pagedInfo, nil
}
// QueryApplyContractList 门店合同生气记录
func QueryApplyContractList(orderNo string, storeID, pageSize, offset int) (pagedInfo *model.PagedInfo, err error) {
db := GetDB()
txDB, _ := Begin(db)
defer func() {
if r := recover(); r != nil {
Rollback(db, txDB)
panic(r)
}
}()
var recipient []*model.LakalaContract
var param = []interface{}{}
sql := ` SELECT SQL_CALC_FOUND_ROWS r.* FROM lakala_contract r WHERE 1=1 `
if storeID != 0 {
sql += ` AND r.store_id = ?`
param = append(param, storeID)
}
if orderNo != "" {
sql += ` AND r.contract_id = ? `
param = append(param, orderNo)
}
sql += `
ORDER BY r.id desc
LIMIT ? OFFSET ?
`
param = append(param, pageSize, offset)
if err = GetRowsTx(txDB, &recipient, sql, param...); err == nil {
pagedInfo = &model.PagedInfo{
TotalCount: GetLastTotalRowCount2(db, txDB),
Data: recipient,
}
}
return pagedInfo, nil
}

View File

@@ -37,6 +37,22 @@ const (
CmdTypeFallBack = "FALLBACK" // 分账退回
)
type LakalaContract struct {
ModelIDCUL
ContractId string `orm:"column(contract_id);size(20)" json:"contractId"` // 订单编号
ContractApplyId string `orm:"column(contract_apply_id);size(20)" json:"contractApplyId"` // 电子合同编号
ContractStatus string `orm:"column(contract_status);size(20)" json:"ContractStatus"` // 合同状态
StoreId int `orm:"column(store_id);size(16)" json:"storeId"` // 京西门店ID
ApplyType string `orm:"column(apply_type);size(16)" json:"applyType"` // 申请类型
}
func (o *LakalaContract) TableUnique() [][]string {
return [][]string{
[]string{"StoreID"},
[]string{"contract_id"},
}
}
// LakalaIncoming 进件账户状态,分账状态
type LakalaIncoming struct {
ModelIDCUL