This commit is contained in:
suyl
2021-06-03 17:24:36 +08:00
parent f4aab63317
commit e0bba30696
4 changed files with 73 additions and 2 deletions

View File

@@ -4901,8 +4901,14 @@ func AuditStoreMap(ctx *jxcontext.Context, ID int, vendorOrgCode, vendorStoreID
if vendorStoreID == "" {
return fmt.Errorf("请输入绑定的平台门店ID")
}
storeMap := &model.StoreMap{}
AddStoreVendorMap(ctx, db, storeMapAudit.VendorID, vendorOrgCode, storeMapAudit.StoreID, storeMap)
storeMap := &model.StoreMap{
VendorStoreID: vendorStoreID,
IsSync: 0,
AutoPickup: 1,
DeliveryCompetition: 1,
PricePercentage: 100,
}
_, err = AddStoreVendorMap(ctx, db, storeMapAudit.VendorID, vendorOrgCode, storeMapAudit.StoreID, storeMap)
} else {
if comment == "" {
fmt.Errorf("审核不通过请输入原因!")
@@ -4914,3 +4920,7 @@ func AuditStoreMap(ctx *jxcontext.Context, ID int, vendorOrgCode, vendorStoreID
dao.UpdateEntity(db, storeMapAudit, "AuditStatus", "AuditAt", "AuditOperator")
return err
}
func GetStoreMapAudit(ctx *jxcontext.Context, storeIDs, vendorIDs, auditStatuss []int, fromTime, toTime string, offset, pageSize int) (page *model.PagedInfo, err error) {
return dao.GetStoreMapAudit(dao.GetDB(), storeIDs, vendorIDs, auditStatuss, utils.Str2Time(fromTime), utils.Str2Time(toTime), offset, pageSize)
}

View File

@@ -1283,3 +1283,48 @@ func GetStoreManageStateSimple(db *DaoDB, storeIDs, brandIDs []int, vendorID int
err = GetRows(db, &pagedInfo, sql, sqlParams...)
return pagedInfo, err
}
func GetStoreMapAudit(db *DaoDB, storeIDs, vendorIDs, auditStatuss []int, fromTime, toTime time.Time, offset, pageSize int) (page *model.PagedInfo, err error) {
var (
storeMapAudits []*model.StoreMapAudit
)
sql := `
SELECT SQL_CALC_FOUND_ROWS *
FROM store_map_audit
WHERE 1 = 1
`
sqlParams := []interface{}{}
if len(storeIDs) > 0 {
sql += " AND store_id IN (" + GenQuestionMarks(len(storeIDs)) + ")"
sqlParams = append(sqlParams, storeIDs)
}
if len(vendorIDs) > 0 {
sql += " AND vendor_id IN (" + GenQuestionMarks(len(vendorIDs)) + ")"
sqlParams = append(sqlParams, vendorIDs)
}
if len(auditStatuss) > 0 {
sql += " AND audit_status IN (" + GenQuestionMarks(len(auditStatuss)) + ")"
sqlParams = append(sqlParams, auditStatuss)
}
if fromTime != utils.ZeroTimeValue {
sql += " AND a.created_at > ?"
sqlParams = append(sqlParams, fromTime)
}
if toTime != utils.ZeroTimeValue {
sql += " AND a.created_at < ?"
sqlParams = append(sqlParams, toTime)
}
sql += " LIMIT ? OFFSET ?"
pageSize = jxutils.FormalizePageSize(pageSize)
offset = jxutils.FormalizePageOffset(offset)
sqlParams = append(sqlParams, pageSize, offset)
txDB, _ := Begin(db)
defer Commit(db, txDB)
if err = GetRowsTx(txDB, &storeMapAudits, sql, sqlParams...); err == nil {
page = &model.PagedInfo{
TotalCount: GetLastTotalRowCount2(db, txDB),
Data: storeMapAudits,
}
}
return page, err
}