- TmpGetJxBadCommentsByStoreId

This commit is contained in:
gazebo
2019-02-19 17:12:27 +08:00
parent c0d659e300
commit f2c479e62b
2 changed files with 6 additions and 4 deletions

View File

@@ -608,7 +608,7 @@ func TmpGetJxBadCommentsNo(ctx *jxcontext.Context, storeID int) (count int, err
return count, err return count, err
} }
func TmpGetJxBadCommentsByStoreId(ctx *jxcontext.Context, storeID, offset, pageSize, commentType int, fromTime, toTime time.Time) (retVal map[string]interface{}, err error) { func TmpGetJxBadCommentsByStoreId(ctx *jxcontext.Context, storeID, pageNo, pageSize, commentType int, fromTime, toTime time.Time) (retVal map[string]interface{}, err error) {
db := dao.GetDB() db := dao.GetDB()
sql := ` sql := `
SELECT SQL_CALC_FOUND_ROWS * SELECT SQL_CALC_FOUND_ROWS *
@@ -634,6 +634,7 @@ func TmpGetJxBadCommentsByStoreId(ctx *jxcontext.Context, storeID, offset, pageS
} }
sql += " ORDER BY createtime DESC" sql += " ORDER BY createtime DESC"
pageSize = jxutils.FormalizePageSize(pageSize) pageSize = jxutils.FormalizePageSize(pageSize)
offset := (pageNo - 1) * pageSize
if offset < 0 { if offset < 0 {
offset = 0 offset = 0
} }
@@ -644,7 +645,8 @@ func TmpGetJxBadCommentsByStoreId(ctx *jxcontext.Context, storeID, offset, pageS
defer func() { defer func() {
dao.Rollback(db) dao.Rollback(db)
}() }()
globals.SugarLogger.Debug(sql) // globals.SugarLogger.Debug(sql)
// globals.SugarLogger.Debug(utils.Format4Output(sqlParams, false))
if err = dao.GetRows(db, &commentList, sql, sqlParams...); err == nil { if err = dao.GetRows(db, &commentList, sql, sqlParams...); err == nil {
retVal = map[string]interface{}{ retVal = map[string]interface{}{
"total": dao.GetLastTotalRowCount(db), "total": dao.GetLastTotalRowCount(db),

View File

@@ -207,7 +207,7 @@ func (c *StoreController) TmpGetJxBadCommentsNo() {
// @Param jxStoreId query int true "门店ID" // @Param jxStoreId query int true "门店ID"
// @Param type query int true "评论类型0差评1所有" // @Param type query int true "评论类型0差评1所有"
// @Param page query int true "起始页从1开始" // @Param page query int true "起始页从1开始"
// @Param size query int true "页大小" // @Param size query int true "页大小-1表示无限大"
// @Param fromTime query string false "创建起始时间" // @Param fromTime query string false "创建起始时间"
// @Param toTime query string false "创建结束时间" // @Param toTime query string false "创建结束时间"
// @Success 200 {object} controllers.CallResult // @Success 200 {object} controllers.CallResult
@@ -217,7 +217,7 @@ func (c *StoreController) TmpGetJxBadCommentsByStoreId() {
c.callTmpGetJxBadCommentsByStoreId(func(params *tStoreTmpGetJxBadCommentsByStoreIdParams) (retVal interface{}, errCode string, err error) { c.callTmpGetJxBadCommentsByStoreId(func(params *tStoreTmpGetJxBadCommentsByStoreIdParams) (retVal interface{}, errCode string, err error) {
timeList, err2 := jxutils.BatchStr2Time(params.FromTime, params.ToTime) timeList, err2 := jxutils.BatchStr2Time(params.FromTime, params.ToTime)
if err = err2; err == nil { if err = err2; err == nil {
retVal, err = cms.TmpGetJxBadCommentsByStoreId(params.Ctx, params.JxStoreId, (params.Page-1)*params.Size, params.Size, params.Type, timeList[0], timeList[1]) retVal, err = cms.TmpGetJxBadCommentsByStoreId(params.Ctx, params.JxStoreId, params.Page, params.Size, params.Type, timeList[0], timeList[1])
} }
return retVal, "", err return retVal, "", err
}) })