- get funs for jd bad comments.
This commit is contained in:
@@ -9,6 +9,12 @@ import (
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
)
|
||||
|
||||
const (
|
||||
GET_BAD_COMMENTS_TYPE = 0 //获取差评的标志
|
||||
GET_ALL_COMMENTS_TYPE = 1 //获取所有评论的标志
|
||||
)
|
||||
|
||||
type StoreExt struct {
|
||||
@@ -322,3 +328,44 @@ func UpdateStoreVendorMap(db *dao.DaoDB, storeID, vendorID int, payload map[stri
|
||||
func DeleteStore(db *dao.DaoDB, storeID int, userName string) (num int64, err error) {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
func TmpGetJxBadCommentsNo(storeID int) (count int, err error) {
|
||||
db := dao.GetDB()
|
||||
var ctInfo struct {
|
||||
Ct int
|
||||
}
|
||||
if err = dao.GetRow(db, &ctInfo, "SELECT COUNT(*) ct FROM jx_bad_comments WHERE status = 0 AND jxstoreid = ?", utils.Int2Str(storeID)); err == nil {
|
||||
count = ctInfo.Ct
|
||||
}
|
||||
return count, err
|
||||
}
|
||||
|
||||
func TmpGetJxBadCommentsByStoreId(storeID, page, size, commentType int) (retVal map[string]interface{}, err error) {
|
||||
db := dao.GetDB()
|
||||
sql := `
|
||||
SELECT SQL_CALC_FOUND_ROWS *
|
||||
FROM jx_bad_comments
|
||||
WHERE jxstoreid = ?
|
||||
`
|
||||
if commentType == GET_BAD_COMMENTS_TYPE {
|
||||
sql += " AND status = 0"
|
||||
}
|
||||
sql += " ORDER BY createtime DESC LIMIT ? OFFSET ?"
|
||||
var commentList []*model.JxBadComments
|
||||
dao.Begin(db)
|
||||
defer func() {
|
||||
dao.Rollback(db)
|
||||
}()
|
||||
globals.SugarLogger.Debug(sql)
|
||||
if err = dao.GetRows(db, &commentList, sql, utils.Int2Str(storeID), size, (page-1)*size); err == nil {
|
||||
countInfo := &struct{ Ct int }{}
|
||||
if err = dao.GetRow(db, countInfo, "SELECT FOUND_ROWS() ct"); err == nil {
|
||||
dao.Commit(db)
|
||||
retVal = map[string]interface{}{
|
||||
"total": countInfo.Ct,
|
||||
"list": commentList,
|
||||
}
|
||||
}
|
||||
}
|
||||
return retVal, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user