Accept Merge Request #131: (yonghui -> mark)
Merge Request: 增加同步返回错误 Created By: @苏尹岚 Accepted By: @苏尹岚 URL: https://rosydev.coding.net/p/jx-callback/d/jx-callback/git/merge/131
This commit is contained in:
@@ -141,6 +141,8 @@ func InitServiceInfo(version string, buildTime time.Time, gitCommit string) {
|
||||
"autoReplyTypeName": model.AutoReplyTypeName,
|
||||
"complaintReasons": model.ComplaintReasons,
|
||||
"supplementType": model.SupplementTypeName,
|
||||
"operateType": model.OperateTypeName,
|
||||
"thingType": model.ThingTypeName,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,54 @@
|
||||
package event
|
||||
|
||||
import "git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||
import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
func AddOperateEvent(ctx *jxcontext.Context) {
|
||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||
)
|
||||
|
||||
func AddOperateEvent(ctx *jxcontext.Context, accessUUID string) (err error) {
|
||||
var (
|
||||
apiFunction string
|
||||
db = dao.GetDB()
|
||||
)
|
||||
url := ctx.GetRequest().URL.Path
|
||||
if url != "" {
|
||||
apiFunction = url[strings.LastIndex(url, "/")+1 : len(url)]
|
||||
}
|
||||
event := &model.OperateEvent{
|
||||
CreatedAt: time.Now(),
|
||||
LastOperator: ctx.GetUserName(),
|
||||
APIFunction: apiFunction,
|
||||
UserID: ctx.GetUserID(),
|
||||
AccessUUID: accessUUID,
|
||||
}
|
||||
dao.Begin(db)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
dao.Rollback(db)
|
||||
panic(r)
|
||||
}
|
||||
}()
|
||||
err = dao.CreateEntity(db, event)
|
||||
dao.Commit(db)
|
||||
return err
|
||||
}
|
||||
|
||||
func AddOperateEventDetail(ctx *jxcontext.Context) {
|
||||
|
||||
func AddOperateEventDetail(operateEventDetail *model.OperateEventDetail) (err error) {
|
||||
db := dao.GetDB()
|
||||
dao.Begin(db)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
dao.Rollback(db)
|
||||
panic(r)
|
||||
}
|
||||
}()
|
||||
err = dao.CreateEntity(db, operateEventDetail)
|
||||
dao.Commit(db)
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user