- 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/jxutils"
|
||||||
"git.rosy.net.cn/jx-callback/business/model"
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
"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 {
|
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) {
|
func DeleteStore(db *dao.DaoDB, storeID int, userName string) (num int64, err error) {
|
||||||
return 0, err
|
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
|
||||||
|
}
|
||||||
|
|||||||
@@ -33,24 +33,24 @@ func (*JxBackendUser) TableName() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type JxBadComments struct {
|
type JxBadComments struct {
|
||||||
Id int `orm:"column(id)"`
|
Id int `json:"id" orm:"column(id)"`
|
||||||
OrderId string `orm:"column(order_id);size(25);unique" description:"订单ID"`
|
OrderId string `json:"order_id" orm:"column(order_id);size(25);unique" description:"订单ID"`
|
||||||
Jxstoreid string `orm:"column(jxstoreid);size(11)" description:"京西门店ID"`
|
Jxstoreid string `json:"jxstoreid" orm:"column(jxstoreid);size(11);index" description:"京西门店ID"`
|
||||||
Userphone string `orm:"column(userphone);size(255);null" description:"评价的用户的联系方式"`
|
Userphone string `json:"userPhone" orm:"column(userphone);size(255);null" description:"评价的用户的联系方式"`
|
||||||
Status int `orm:"column(status)" description:"当前评论的状态(0:未解决 1:已解决)"`
|
Status int `json:"status" orm:"column(status)" description:"当前评论的状态(0:未解决 1:已解决)"`
|
||||||
Createtime string `orm:"column(createtime);size(255);null" description:"评论的创建时间"`
|
Createtime string `json:"createTime" orm:"column(createtime);size(255);null" description:"评论的创建时间"`
|
||||||
Maxmodifytime int `orm:"column(maxmodifytime);null" description:"评论可修改的最大时间"`
|
Maxmodifytime int `json:"maxModifyTime" orm:"column(maxmodifytime);null" description:"评论可修改的最大时间"`
|
||||||
Score int `orm:"column(score)" description:"评论的星级"`
|
Score int `json:"score4" orm:"column(score)" description:"评论的星级"`
|
||||||
Scorecontent string `orm:"column(scorecontent);size(255);null" description:"评论的内容"`
|
Scorecontent string `json:"score4Content" orm:"column(scorecontent);size(255);null" description:"评论的内容"`
|
||||||
Vendertags string `orm:"column(vendertags);size(255);null" description:"评论的标签"`
|
Vendertags string `json:"venderTags" orm:"column(vendertags);size(255);null" description:"评论的标签"`
|
||||||
UpdatedScore int `orm:"column(updated_score);null" description:"更改后的分数"`
|
UpdatedScore int `json:"updatedScore" orm:"column(updated_score);null" description:"更改后的分数"`
|
||||||
UpdatedScorecontent string `orm:"column(updated_scorecontent);size(255);null" description:"更改后的评论信息"`
|
UpdatedScorecontent string `json:"updatedScoreContent" orm:"column(updated_scorecontent);size(255);null" description:"更改后的评论信息"`
|
||||||
UpdatedVendertags string `orm:"column(updated_vendertags);size(255);null" description:"更改后的标签信息"`
|
UpdatedVendertags string `json:"updatedVenderTags" orm:"column(updated_vendertags);size(255);null" description:"更改后的标签信息"`
|
||||||
OrderFlag string `orm:"column(order_flag);size(255);null" description:"订单类别(0:京东 1:美团 2:饿了么)"`
|
OrderFlag string `json:"order_flag" orm:"column(order_flag);size(255);null" description:"订单类别(0:京东 1:美团 2:饿了么)"`
|
||||||
Msg string `orm:"column(msg);type(text)" description:"未解决差评的原始信息"`
|
Msg string `json:"-" orm:"column(msg);type(text)" description:"未解决差评的原始信息"`
|
||||||
UpdatedMsg string `orm:"column(updated_msg);null" description:"解决后的差评的原始信息"`
|
UpdatedMsg string `json:"updatedMsg" orm:"column(updated_msg);null" description:"解决后的差评的原始信息"`
|
||||||
LastPushTime string `orm:"column(last_push_time);size(255);null" description:"上一次推送的时间"`
|
LastPushTime string `json:"-" orm:"column(last_push_time);size(255);null" description:"上一次推送的时间"`
|
||||||
PushNo int `orm:"column(push_no);null" description:"推送次数"`
|
PushNo int `json:"-" orm:"column(push_no);null" description:"推送次数"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*JxBadComments) TableName() string {
|
func (*JxBadComments) TableName() string {
|
||||||
|
|||||||
@@ -169,3 +169,34 @@ func (c *StoreController) DeleteStoreVendorMap() {
|
|||||||
return retVal, "", err
|
return retVal, "", err
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Title 得到门店差评总数
|
||||||
|
// @Description 得到门店差评总数,此函数为兼容老系统,之后会被替换
|
||||||
|
// @Param token header string true "认证token"
|
||||||
|
// @Param jxStoreId query int true "门店ID"
|
||||||
|
// @Success 200 {object} controllers.CallResult
|
||||||
|
// @Failure 200 {object} controllers.CallResult
|
||||||
|
// @router /TmpGetJxBadCommentsNo [get]
|
||||||
|
func (c *StoreController) TmpGetJxBadCommentsNo() {
|
||||||
|
c.callTmpGetJxBadCommentsNo(func(params *tStoreTmpGetJxBadCommentsNoParams) (retVal interface{}, errCode string, err error) {
|
||||||
|
retVal, err = cms.TmpGetJxBadCommentsNo(params.JxStoreId)
|
||||||
|
return retVal, "", err
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Title 得到门店差评总数
|
||||||
|
// @Description 得到门店差评总数
|
||||||
|
// @Param token header string true "认证token"
|
||||||
|
// @Param jxStoreId query int true "门店ID"
|
||||||
|
// @Param type query int true "评论类型,0:差评,1:所有"
|
||||||
|
// @Param page query int true "起始页,从1开始"
|
||||||
|
// @Param size query int true "页大小"
|
||||||
|
// @Success 200 {object} controllers.CallResult
|
||||||
|
// @Failure 200 {object} controllers.CallResult
|
||||||
|
// @router /TmpGetJxBadCommentsByStoreId [get]
|
||||||
|
func (c *StoreController) TmpGetJxBadCommentsByStoreId() {
|
||||||
|
c.callTmpGetJxBadCommentsByStoreId(func(params *tStoreTmpGetJxBadCommentsByStoreIdParams) (retVal interface{}, errCode string, err error) {
|
||||||
|
retVal, err = cms.TmpGetJxBadCommentsByStoreId(params.JxStoreId, params.Page, params.Size, params.Type)
|
||||||
|
return retVal, "", err
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -335,6 +335,22 @@ func init() {
|
|||||||
MethodParams: param.Make(),
|
MethodParams: param.Make(),
|
||||||
Params: nil})
|
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: "GetJxBadCommentsByStoreId",
|
||||||
|
Router: `/GetJxBadCommentsByStoreId`,
|
||||||
|
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: "GetJxBadCommentsNo",
|
||||||
|
Router: `/GetJxBadCommentsNo`,
|
||||||
|
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.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreController"],
|
||||||
beego.ControllerComments{
|
beego.ControllerComments{
|
||||||
Method: "GetStoreVendorMaps",
|
Method: "GetStoreVendorMaps",
|
||||||
|
|||||||
Reference in New Issue
Block a user