AddEventDetail中处理没有request的情况
This commit is contained in:
@@ -1204,21 +1204,24 @@ func getSkuSaleStatus(inSkuBind *StoreSkuBindSkuInfo, skuNameBindInfo *StoreSkuB
|
||||
}
|
||||
|
||||
func AddEventDetail(db *dao.DaoDB, ctx *jxcontext.Context, operateType, thingID, thingType, storeID int, beforeData, afterData string) (err error) {
|
||||
url := ctx.GetRequest().URL.Path
|
||||
apiFunction := url[strings.LastIndex(url, "/")+1 : len(url)]
|
||||
if ctx.GetUserName() == "jxadmin" && !strings.Contains(apiFunction, "AutoPayForPopluarMan") {
|
||||
return err
|
||||
req := ctx.GetRequest()
|
||||
if req != nil {
|
||||
url := req.URL.Path
|
||||
apiFunction := url[strings.LastIndex(url, "/")+1 : len(url)]
|
||||
if ctx.GetUserName() == "jxadmin" && !strings.Contains(apiFunction, "AutoPayForPopluarMan") {
|
||||
return err
|
||||
}
|
||||
operateEventDetail := &model.OperateEventDetail{
|
||||
OperateType: operateType,
|
||||
ThingID: thingID,
|
||||
ThingType: thingType,
|
||||
StoreID: storeID,
|
||||
AccessUUID: ctx.GetTrackInfo()[0:strings.Index(ctx.GetTrackInfo(), ",")],
|
||||
BeforeData: beforeData,
|
||||
AfterData: afterData,
|
||||
}
|
||||
err = event.AddOperateEventDetail(db, operateEventDetail)
|
||||
}
|
||||
operateEventDetail := &model.OperateEventDetail{
|
||||
OperateType: operateType,
|
||||
ThingID: thingID,
|
||||
ThingType: thingType,
|
||||
StoreID: storeID,
|
||||
AccessUUID: ctx.GetTrackInfo()[0:strings.Index(ctx.GetTrackInfo(), ",")],
|
||||
BeforeData: beforeData,
|
||||
AfterData: afterData,
|
||||
}
|
||||
err = event.AddOperateEventDetail(db, operateEventDetail)
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user