新查询接口,
This commit is contained in:
@@ -2484,7 +2484,7 @@ func SyncStoresQualify(ctx *jxcontext.Context, storeIDs []int, isAsync, isContin
|
||||
|
||||
func GetStoreListByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDistance bool) (storeList []*Store4User, err error) {
|
||||
const (
|
||||
maxRadius = 8000
|
||||
maxRadius = 20000
|
||||
maxStoreCount4User = 5
|
||||
)
|
||||
|
||||
|
||||
@@ -4442,3 +4442,8 @@ func RefreshJdsSkusStatus(ctx *jxcontext.Context) (err error) {
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func GetStoreSkuAudit(ctx *jxcontext.Context, storeIDs, nameIDs, skuIDs []int, status int, name, remark string, applyTimeStart, applyTimeEnd, auditTimeStart, auditTimeEnd time.Time, pageSize, offset int) (pagedInfo *model.PagedInfo, err error) {
|
||||
pagedInfo, err = dao.GetStoreSkuAudit(dao.GetDB(), storeIDs, nameIDs, skuIDs, status, name, remark, applyTimeStart, applyTimeEnd, auditTimeStart, auditTimeEnd, pageSize, offset)
|
||||
return pagedInfo, err
|
||||
}
|
||||
|
||||
@@ -1533,3 +1533,54 @@ func UpdateJdsWareID(db *DaoDB, storeSkuSyncInfo *StoreSkuSyncInfo) (err error)
|
||||
_, err = ExecuteSQL(db, sql, sqlParams)
|
||||
return err
|
||||
}
|
||||
|
||||
func GetStoreSkuAudit(db *DaoDB, storeIDs, nameIDs, skuIDs []int, status int, name, remark string, applyTimeStart, applyTimeEnd, auditTimeStart, auditTimeEnd time.Time, pageSize, offset int) (pagedInfo *model.PagedInfo, err error) {
|
||||
var requestList []*model.StoreSkuAudit
|
||||
sql := `
|
||||
SELECT SQL_CALC_FOUND_ROWS a.*
|
||||
FROM store_sku_audit a, user b
|
||||
WHERE a.deleted_at = ?
|
||||
AND a.user_id = b.user_id
|
||||
`
|
||||
sqlParams := []interface{}{utils.DefaultTimeValue}
|
||||
if len(storeIDs) > 0 {
|
||||
sql += " AND a.store_id IN (" + GenQuestionMarks(len(storeIDs)) + ")"
|
||||
sqlParams = append(sqlParams, storeIDs)
|
||||
}
|
||||
if len(nameIDs) > 0 {
|
||||
sql += " AND a.name_id IN (" + GenQuestionMarks(len(nameIDs)) + ")"
|
||||
sqlParams = append(sqlParams, nameIDs)
|
||||
}
|
||||
if status != model.StoreAuditStatusAll {
|
||||
sql += " AND a.status = ? "
|
||||
sqlParams = append(sqlParams, status)
|
||||
}
|
||||
if remark != "" {
|
||||
sql += " AND a.remark LIKE ? "
|
||||
sqlParams = append(sqlParams, "%"+remark+"%")
|
||||
}
|
||||
if name != "" {
|
||||
sql += " AND b.name LIKE ? "
|
||||
sqlParams = append(sqlParams, "%"+name+"%")
|
||||
}
|
||||
if applyTimeStart != utils.ZeroTimeValue && applyTimeEnd != utils.ZeroTimeValue {
|
||||
sql += " AND a.created_at BETWEEN ? AND ?"
|
||||
sqlParams = append(sqlParams, applyTimeStart, applyTimeEnd)
|
||||
}
|
||||
if auditTimeStart != utils.ZeroTimeValue && auditTimeEnd != utils.ZeroTimeValue {
|
||||
sql += " AND a.updated_at BETWEEN ? AND ?"
|
||||
sqlParams = append(sqlParams, applyTimeStart, applyTimeEnd)
|
||||
}
|
||||
sql += "LIMIT ? OFFSET ?"
|
||||
pageSize = jxutils.FormalizePageSize(pageSize)
|
||||
sqlParams = append(sqlParams, pageSize, offset)
|
||||
Begin(db)
|
||||
defer Commit(db)
|
||||
if err = GetRows(db, &requestList, sql, sqlParams...); err == nil {
|
||||
return &model.PagedInfo{
|
||||
TotalCount: GetLastTotalRowCount(db),
|
||||
Data: requestList,
|
||||
}, nil
|
||||
}
|
||||
return pagedInfo, err
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ type StoreSkuAudit struct {
|
||||
Type int8 `json:"type"` //1为改价
|
||||
StoreID int `orm:"column(store_id)" json:"storeID"`
|
||||
NameID int `orm:"column(name_id)" json:"nameID"` // 这个根据type不同,可能是SKUNAME ID或SKU ID
|
||||
Status int8 `json:"status"`
|
||||
Status int8 `json:"status"` //
|
||||
UserID string `orm:"size(48);column(user_id)" json:"userID"`
|
||||
OriginUnitPrice int `json:"originPrice"` // 表示原价
|
||||
UnitPrice int `json:"unitPrice"`
|
||||
|
||||
@@ -811,3 +811,37 @@ func (c *StoreSkuController) SyncMatterC4ToGy() {
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 得到商家商品修改价格请求信息
|
||||
// @Description 得到商家商品修改价格请求信息
|
||||
// @Param token header string true "认证token"
|
||||
// @Param applyTimeStart query string false "申请开始时间"
|
||||
// @Param applyTimeEnd query string false "申请结束时间"
|
||||
// @Param auditTimeStart query string false "审核开始时间"
|
||||
// @Param auditTimeEnd query string false "审核结束时间"
|
||||
// @Param name query string false "审核人"
|
||||
// @Param remark query string false "不通过原因"
|
||||
// @Param storeIDs query string false "门店ID列表"
|
||||
// @Param nameIDs query string false "id列表对象,当前指skuname id"
|
||||
// @Param status query int false "审核状态"
|
||||
// @Param offset query int false "门店列表起始序号(以0开始,缺省为0)"
|
||||
// @Param pageSize query int false "门店列表页大小(缺省为50,-1表示全部)"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /GetStoreSkuAudit [get]
|
||||
func (c *StoreSkuController) GetStoreSkuAudit() {
|
||||
c.callGetStoreSkuAudit(func(params *tStoreSkuGetStoreSkuAuditParams) (retVal interface{}, errCode string, err error) {
|
||||
var (
|
||||
timeList []time.Time
|
||||
storeIDs, nameIDs []int
|
||||
)
|
||||
if timeList, err = jxutils.BatchStr2Time(params.ApplyTimeStart, params.ApplyTimeEnd, params.AuditTimeStart, params.AuditTimeEnd); err != nil {
|
||||
return retVal, "", err
|
||||
}
|
||||
if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDs, params.NameIDs, &nameIDs); err != nil {
|
||||
return retVal, "", err
|
||||
}
|
||||
retVal, err = cms.GetStoreSkuAudit(params.Ctx, storeIDs, nameIDs, nil, params.Status, params.Name, params.Remark, timeList[0], timeList[1], timeList[2], timeList[3], params.PageSize, params.Offset)
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user