TmpGetJxBadComments添加可选参数keyword

This commit is contained in:
gazebo
2019-11-11 17:33:19 +08:00
parent e763aac526
commit ef5e755544
2 changed files with 13 additions and 5 deletions

View File

@@ -1123,7 +1123,7 @@ func TmpGetJxBadCommentsNo(ctx *jxcontext.Context, storeID int) (count int, err
return count, err
}
func TmpGetJxBadCommentsByStoreId(ctx *jxcontext.Context, storeIDs []int, offset, pageSize, commentType int, fromTime, toTime time.Time) (retVal map[string]interface{}, err error) {
func TmpGetJxBadCommentsByStoreId(ctx *jxcontext.Context, keyword string, 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
@@ -1136,6 +1136,13 @@ func TmpGetJxBadCommentsByStoreId(ctx *jxcontext.Context, storeIDs []int, offset
WHERE 1 = 1
`
sqlParams := []interface{}{}
if keyword != "" {
keywordLike := "%" + keyword + "%"
sql += `
AND (t1.order_id LIKE ? OR t1.jxstoreid LIKE ? OR t1.userphone LIKE ? OR t1.scorecontent LIKE ? OR t1.vendertags LIKE ? OR t1.updated_scorecontent LIKE ?
OR t1.updated_vendertags LIKE ? OR t2.name LIKE ?)`
sqlParams = append(sqlParams, keywordLike, keywordLike, keywordLike, keywordLike, keywordLike, keywordLike, keywordLike, keywordLike)
}
if len(storeIDs) > 0 {
sql += " AND t1.jxstoreid IN (" + dao.GenQuestionMarks(len(storeIDs)) + ")"
sqlParams = append(sqlParams, storeIDs)