- add TmpGetJxBadComments
This commit is contained in:
@@ -608,7 +608,7 @@ func TmpGetJxBadCommentsNo(ctx *jxcontext.Context, storeID int) (count int, err
|
||||
return count, err
|
||||
}
|
||||
|
||||
func TmpGetJxBadCommentsByStoreId(ctx *jxcontext.Context, storeID, pageNo, pageSize, commentType int, fromTime, toTime time.Time) (retVal map[string]interface{}, err error) {
|
||||
func TmpGetJxBadCommentsByStoreId(ctx *jxcontext.Context, storeIDs []int, offset, pageSize, commentType int, fromTime, toTime time.Time) (retVal map[string]interface{}, err error) {
|
||||
db := dao.GetDB()
|
||||
sql := `
|
||||
SELECT SQL_CALC_FOUND_ROWS *
|
||||
@@ -616,9 +616,9 @@ func TmpGetJxBadCommentsByStoreId(ctx *jxcontext.Context, storeID, pageNo, pageS
|
||||
WHERE 1 = 1
|
||||
`
|
||||
sqlParams := []interface{}{}
|
||||
if storeID > 0 {
|
||||
sql += " AND jxstoreid = ?"
|
||||
sqlParams = append(sqlParams, storeID)
|
||||
if len(storeIDs) > 0 {
|
||||
sql += " AND jxstoreid IN (" + dao.GenQuestionMarks(len(storeIDs)) + ")"
|
||||
sqlParams = append(sqlParams, storeIDs)
|
||||
}
|
||||
if commentType == GET_BAD_COMMENTS_TYPE {
|
||||
sql += " AND status = ?"
|
||||
@@ -634,7 +634,6 @@ func TmpGetJxBadCommentsByStoreId(ctx *jxcontext.Context, storeID, pageNo, pageS
|
||||
}
|
||||
sql += " ORDER BY createtime DESC"
|
||||
pageSize = jxutils.FormalizePageSize(pageSize)
|
||||
offset := (pageNo - 1) * pageSize
|
||||
if offset < 0 {
|
||||
offset = 0
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ func (c *StoreController) TmpGetJxBadCommentsNo() {
|
||||
}
|
||||
|
||||
// @Title 得到门店差评总数
|
||||
// @Description 得到门店差评总数
|
||||
// @Description 得到门店差评总数(使用TmpGetJxBadComments替代)
|
||||
// @Param token header string true "认证token"
|
||||
// @Param jxStoreId query int true "门店ID"
|
||||
// @Param type query int true "评论类型,0:差评,1:所有"
|
||||
@@ -217,7 +217,34 @@ func (c *StoreController) TmpGetJxBadCommentsByStoreId() {
|
||||
c.callTmpGetJxBadCommentsByStoreId(func(params *tStoreTmpGetJxBadCommentsByStoreIdParams) (retVal interface{}, errCode string, err error) {
|
||||
timeList, err2 := jxutils.BatchStr2Time(params.FromTime, params.ToTime)
|
||||
if err = err2; err == nil {
|
||||
retVal, err = cms.TmpGetJxBadCommentsByStoreId(params.Ctx, params.JxStoreId, params.Page, params.Size, params.Type, timeList[0], timeList[1])
|
||||
pageSize := jxutils.FormalizePageSize(params.Size)
|
||||
offset := (params.Page - 1) * pageSize
|
||||
retVal, err = cms.TmpGetJxBadCommentsByStoreId(params.Ctx, []int{params.JxStoreId}, offset, pageSize, params.Type, timeList[0], timeList[1])
|
||||
}
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 得到门店差评总数
|
||||
// @Description 得到门店差评总数
|
||||
// @Param token header string true "认证token"
|
||||
// @Param type query int true "评论类型,0:差评,1:所有"
|
||||
// @Param storeIDs query string false "门店I列表"
|
||||
// @Param offset query int false "起始页,从1开始"
|
||||
// @Param pageSize query int false "页大小(-1表示无限大)"
|
||||
// @Param fromTime query string false "创建起始时间"
|
||||
// @Param toTime query string false "创建结束时间"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /TmpGetJxBadComments [get]
|
||||
func (c *StoreController) TmpGetJxBadComments() {
|
||||
c.callTmpGetJxBadComments(func(params *tStoreTmpGetJxBadCommentsParams) (retVal interface{}, errCode string, err error) {
|
||||
var storeIDs []int
|
||||
if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDs); err == nil {
|
||||
timeList, err2 := jxutils.BatchStr2Time(params.FromTime, params.ToTime)
|
||||
if err = err2; err == nil {
|
||||
retVal, err = cms.TmpGetJxBadCommentsByStoreId(params.Ctx, storeIDs, params.Offset, params.PageSize, params.Type, timeList[0], timeList[1])
|
||||
}
|
||||
}
|
||||
return retVal, "", err
|
||||
})
|
||||
|
||||
@@ -703,6 +703,14 @@ func init() {
|
||||
MethodParams: param.Make(),
|
||||
Params: nil})
|
||||
|
||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreController"],
|
||||
beego.ControllerComments{
|
||||
Method: "TmpGetJxBadComments",
|
||||
Router: `/TmpGetJxBadComments`,
|
||||
AllowHTTPMethods: []string{"get"},
|
||||
MethodParams: param.Make(),
|
||||
Params: nil})
|
||||
|
||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreController"],
|
||||
beego.ControllerComments{
|
||||
Method: "TmpGetJxBadCommentsByStoreId",
|
||||
|
||||
Reference in New Issue
Block a user