Merge branch 'develop' of gitee.com:fusenpack/fusenapi into develop
This commit is contained in:
commit
c9385ab091
@ -13,7 +13,6 @@ import (
|
|||||||
|
|
||||||
func RenderNotifyHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
func RenderNotifyHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
var req types.RenderNotifyReq
|
var req types.RenderNotifyReq
|
||||||
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
|
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -94,6 +94,14 @@ func (l *RenderNotifyLogic) RenderNotify(req *types.RenderNotifyReq, userinfo *a
|
|||||||
return resp.SetStatusWithMessage(basic.CodeFileUploadErr, "failed to upload render resource image")
|
return resp.SetStatusWithMessage(basic.CodeFileUploadErr, "failed to upload render resource image")
|
||||||
}
|
}
|
||||||
uploadUnityRenderImageTakesTime := time.Now().UTC().UnixMilli() - unityRenderEndTime
|
uploadUnityRenderImageTakesTime := time.Now().UTC().UnixMilli() - unityRenderEndTime
|
||||||
|
//转换unity真实处理时间
|
||||||
|
duration, err := time.Parse("15:04:05.9999999", req.CostTime)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println("解析时间错误:", err)
|
||||||
|
return resp.SetStatusWithMessage(basic.CodeFileUploadErr, "转换unity时间错误")
|
||||||
|
}
|
||||||
|
// 将时间对象转换为毫秒数
|
||||||
|
unityRealTakesTime := duration.Nanosecond() / 1e6 + duration.Second()*1000 + duration.Minute() * 6000 + duration.Hour()*3600000
|
||||||
if ws.conn != nil {
|
if ws.conn != nil {
|
||||||
//发送到出口
|
//发送到出口
|
||||||
ws.sendRenderResultData(websocket_data.RenderImageRspMsg{
|
ws.sendRenderResultData(websocket_data.RenderImageRspMsg{
|
||||||
@ -102,6 +110,7 @@ func (l *RenderNotifyLogic) RenderNotify(req *types.RenderNotifyReq, userinfo *a
|
|||||||
RenderProcessTime: &websocket_data.RenderProcessTime{
|
RenderProcessTime: &websocket_data.RenderProcessTime{
|
||||||
UnityRenderTakesTime: fmt.Sprintf("%dms", unityRenderEndTime-unityRenderBeginTime),
|
UnityRenderTakesTime: fmt.Sprintf("%dms", unityRenderEndTime-unityRenderBeginTime),
|
||||||
UploadUnityRenderImageTakesTime: fmt.Sprintf("%dms", uploadUnityRenderImageTakesTime),
|
UploadUnityRenderImageTakesTime: fmt.Sprintf("%dms", uploadUnityRenderImageTakesTime),
|
||||||
|
UnityRealTakesTime: fmt.Sprintf("%dms",unityRealTakesTime),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
logx.Info("渲染回调成功,渲染结果图片为:", uploadRes.ResourceUrl)
|
logx.Info("渲染回调成功,渲染结果图片为:", uploadRes.ResourceUrl)
|
||||||
|
@ -273,6 +273,7 @@ func (w *wsConnectItem) renderImage(renderImageData websocket_data.RenderImageRe
|
|||||||
RenderProcessTime: &websocket_data.RenderProcessTime{
|
RenderProcessTime: &websocket_data.RenderProcessTime{
|
||||||
UnityRenderTakesTime: "cache",
|
UnityRenderTakesTime: "cache",
|
||||||
UploadUnityRenderImageTakesTime: "cache",
|
UploadUnityRenderImageTakesTime: "cache",
|
||||||
|
UnityRealTakesTime: "cache",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
|
@ -222,6 +222,7 @@ func ConsumeWebsocketStatData() {
|
|||||||
//保存统计
|
//保存统计
|
||||||
mapUserWsStat.Store(key, stat)
|
mapUserWsStat.Store(key, stat)
|
||||||
case TYPE_CUR_COMBINE_IMAGE_COUNT: //请求算法合图计数
|
case TYPE_CUR_COMBINE_IMAGE_COUNT: //请求算法合图计数
|
||||||
|
curCombineTotalCount += data.Num
|
||||||
//不存在
|
//不存在
|
||||||
if !ok {
|
if !ok {
|
||||||
continue
|
continue
|
||||||
@ -232,11 +233,11 @@ func ConsumeWebsocketStatData() {
|
|||||||
logx.Error("断言mapUserWsStatItem错误")
|
logx.Error("断言mapUserWsStatItem错误")
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
curCombineTotalCount += data.Num
|
|
||||||
stat.CurCombineCount += data.Num
|
stat.CurCombineCount += data.Num
|
||||||
//保存统计
|
//保存统计
|
||||||
mapUserWsStat.Store(key, stat)
|
mapUserWsStat.Store(key, stat)
|
||||||
case TYPE_CUR_UNITY_HANDLE_COUNT: //unity处理计数
|
case TYPE_CUR_UNITY_HANDLE_COUNT: //unity处理计数
|
||||||
|
curUnityHandleTotalCount += data.Num
|
||||||
if !ok {
|
if !ok {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@ -246,11 +247,11 @@ func ConsumeWebsocketStatData() {
|
|||||||
logx.Error("断言mapUserWsStatItem错误")
|
logx.Error("断言mapUserWsStatItem错误")
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
curUnityHandleTotalCount += data.Num
|
|
||||||
stat.CurUnityHandleCount += data.Num
|
stat.CurUnityHandleCount += data.Num
|
||||||
//保存统计
|
//保存统计
|
||||||
mapUserWsStat.Store(key, stat)
|
mapUserWsStat.Store(key, stat)
|
||||||
case TYPE_CUR_COMBINE_IMAGE_ERR_COUNT: //合图失败计数
|
case TYPE_CUR_COMBINE_IMAGE_ERR_COUNT: //合图失败计数
|
||||||
|
combineErrTotalCount += data.Num
|
||||||
if !ok {
|
if !ok {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@ -260,11 +261,11 @@ func ConsumeWebsocketStatData() {
|
|||||||
logx.Error("断言mapUserWsStatItem错误")
|
logx.Error("断言mapUserWsStatItem错误")
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
combineErrTotalCount += data.Num
|
|
||||||
stat.CombineErrCount += data.Num
|
stat.CombineErrCount += data.Num
|
||||||
//保存统计
|
//保存统计
|
||||||
mapUserWsStat.Store(key, stat)
|
mapUserWsStat.Store(key, stat)
|
||||||
case TYPE_UNITY_ERR_COUNT: //unity错误信息
|
case TYPE_UNITY_ERR_COUNT: //unity错误信息
|
||||||
|
unityErrTotalCount += data.Num
|
||||||
if !ok {
|
if !ok {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@ -274,7 +275,6 @@ func ConsumeWebsocketStatData() {
|
|||||||
logx.Error("断言mapUserWsStatItem错误")
|
logx.Error("断言mapUserWsStatItem错误")
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
unityErrTotalCount += data.Num
|
|
||||||
stat.UnityErrCount += data.Num
|
stat.UnityErrCount += data.Num
|
||||||
//保存统计
|
//保存统计
|
||||||
mapUserWsStat.Store(key, stat)
|
mapUserWsStat.Store(key, stat)
|
||||||
|
@ -14,6 +14,7 @@ type RenderNotifyReq struct {
|
|||||||
Image string `json:"image"`
|
Image string `json:"image"`
|
||||||
Code int `json:"code,optional"`
|
Code int `json:"code,optional"`
|
||||||
Msg string `json:"msg,optional"`
|
Msg string `json:"msg,optional"`
|
||||||
|
CostTime string `json:"cost_time"` //unity处理时间
|
||||||
}
|
}
|
||||||
|
|
||||||
type CommonNotifyReq struct {
|
type CommonNotifyReq struct {
|
||||||
|
@ -33,6 +33,7 @@ type RenderNotifyReq {
|
|||||||
Image string `json:"image"`
|
Image string `json:"image"`
|
||||||
Code int `json:"code,optional"`
|
Code int `json:"code,optional"`
|
||||||
Msg string `json:"msg,optional"`
|
Msg string `json:"msg,optional"`
|
||||||
|
CostTime string `json:"cost_time"` //unity处理时间
|
||||||
}
|
}
|
||||||
//通用回调接口
|
//通用回调接口
|
||||||
type CommonNotifyReq {
|
type CommonNotifyReq {
|
||||||
|
@ -35,6 +35,7 @@ type RenderImageRspMsg struct {
|
|||||||
type RenderProcessTime struct {
|
type RenderProcessTime struct {
|
||||||
UnityRenderTakesTime string `json:"unity_render_takes_time"` //unity渲染用时
|
UnityRenderTakesTime string `json:"unity_render_takes_time"` //unity渲染用时
|
||||||
UploadUnityRenderImageTakesTime string `json:"upload_unity_render_image_takes_time"` //上传unity渲染结果图时间
|
UploadUnityRenderImageTakesTime string `json:"upload_unity_render_image_takes_time"` //上传unity渲染结果图时间
|
||||||
|
UnityRealTakesTime string `json:"unity_real_takes_time"`//unity真实处理时间
|
||||||
}
|
}
|
||||||
|
|
||||||
// 合图返回数据
|
// 合图返回数据
|
||||||
|
Loading…
x
Reference in New Issue
Block a user