查询聊天记录
This commit is contained in:
@@ -141,3 +141,30 @@ func GetOperateEvents(db *DaoDB, name string, apiFunctions []string, operateType
|
||||
}
|
||||
return operateEventExt, totalCount, err
|
||||
}
|
||||
|
||||
func GetImMessageRecord(db *DaoDB, vendorOrderID, userID string, storeID, vendorID int) (msg []*model.ImMessageRecord, err error) {
|
||||
sql := `
|
||||
SELECT *
|
||||
FROM im_message_record
|
||||
WHERE 1 = 1
|
||||
`
|
||||
sqlParams := []interface{}{}
|
||||
if vendorOrderID != "" {
|
||||
sql += " AND vendor_order_id = ?"
|
||||
sqlParams = append(sqlParams, vendorOrderID)
|
||||
}
|
||||
if userID != "" {
|
||||
sql += " AND user_id = ?"
|
||||
sqlParams = append(sqlParams, userID)
|
||||
}
|
||||
if storeID != 0 {
|
||||
sql += " AND store_id = ?"
|
||||
sqlParams = append(sqlParams, storeID)
|
||||
}
|
||||
if vendorID >= 0 {
|
||||
sql += " AND vendor_id = ?"
|
||||
sqlParams = append(sqlParams, vendorID)
|
||||
}
|
||||
err = GetRows(db, &msg, sql, sqlParams)
|
||||
return msg, err
|
||||
}
|
||||
|
||||
@@ -178,3 +178,17 @@ func handleMessages() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// @Title 查询聊天记录
|
||||
// @Description 查询聊天记录
|
||||
// @Param token header string true "认证token"
|
||||
// @Param vendorOrderID query string true "订单号"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /GetImMessageRecord [get]
|
||||
func (c *EventController) GetImMessageRecord() {
|
||||
c.callGetImMessageRecord(func(params *tEventGetImMessageRecordParams) (retVal interface{}, errCode string, err error) {
|
||||
retVal, err = dao.GetImMessageRecord(dao.GetDB(), params.VendorOrderID, "", 0, -1)
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
@@ -430,6 +430,15 @@ func init() {
|
||||
Filters: nil,
|
||||
Params: nil})
|
||||
|
||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:EventController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:EventController"],
|
||||
beego.ControllerComments{
|
||||
Method: "GetImMessageRecord",
|
||||
Router: `/GetImMessageRecord`,
|
||||
AllowHTTPMethods: []string{"get"},
|
||||
MethodParams: param.Make(),
|
||||
Filters: nil,
|
||||
Params: nil})
|
||||
|
||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:EventController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:EventController"],
|
||||
beego.ControllerComments{
|
||||
Method: "GetOperateEvents",
|
||||
|
||||
Reference in New Issue
Block a user