- use JxBadCommentsEx in TmpGetJxBadCommentsByStoreId

This commit is contained in:
gazebo
2019-02-21 10:21:28 +08:00
parent 324bc5ea7b
commit 009f38dbd1

View File

@@ -45,6 +45,12 @@ type StoresInfo struct {
Stores []*StoreExt `json:"stores"`
}
type JxBadCommentsEx struct {
legacymodel.JxBadComments
StoreName string `json:"storeName"`
CityName string `json:"cityName"`
}
var (
ErrMissingInput = errors.New("没有有效的输入参数")
ErrCanNotFindVendor = errors.New("vendorID参数不合法")
@@ -611,8 +617,11 @@ func TmpGetJxBadCommentsNo(ctx *jxcontext.Context, storeID int) (count int, err
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 *
FROM jx_bad_comments
SELECT SQL_CALC_FOUND_ROWS
t1.*, t2.name store_name, t3.name city_name
FROM jx_bad_comments t1
LEFT JOIN store t2 ON t2.id = t1.jxstoreid
JOIN place t3 ON t3.code = t2.city_code
WHERE 1 = 1
`
sqlParams := []interface{}{}
@@ -639,7 +648,7 @@ func TmpGetJxBadCommentsByStoreId(ctx *jxcontext.Context, storeIDs []int, offset
}
sql += " LIMIT ? OFFSET ?"
sqlParams = append(sqlParams, pageSize, offset)
var commentList []*legacymodel.JxBadComments
var commentList []*JxBadCommentsEx
dao.Begin(db)
defer func() {
dao.Rollback(db)