Commit e64bc432 authored by Bess严根旺's avatar Bess严根旺

修改

parent fdb66e0d
...@@ -16,6 +16,7 @@ import ( ...@@ -16,6 +16,7 @@ import (
func recoverPanicToPro() { func recoverPanicToPro() {
if r := recover(); r != nil { if r := recover(); r != nil {
fmt.Println(r)
logger.Error("执行转换异常", r) logger.Error("执行转换异常", r)
} }
} }
...@@ -74,16 +75,22 @@ func toDoData(c context.Context) int8 { ...@@ -74,16 +75,22 @@ func toDoData(c context.Context) int8 {
for _, item := range projectData { for _, item := range projectData {
//执行转换 //执行转换
ali, msgError := DoConversionToAli(c, item.ID) ali, msgError := DoConversionToAli(c, item.ID)
fmt.Printf("脚本请求阿里文件转换完成: %d\n", item.ID)
var statusVal int32 = 1 var statusVal int32 = 1
if ali == false { if ali == false {
statusVal = 5 statusVal = 5
} }
_, errUpdate := db.GetServerSiteMicrosDB().DocServerProject.UpdateOneID(item.ID).SetStatus(statusVal).SetCallbackRes(msgError.Error()).Save(c) var msg string = "success"
if msgError != nil {
msg = msgError.Error()
}
_, errUpdate := db.GetServerSiteMicrosDB().DocServerProject.UpdateOneID(item.ID).SetStatus(statusVal).SetCallbackRes(msg).Save(c)
if errUpdate != nil { if errUpdate != nil {
log.Info("修改状态出错" + errUpdate.Error()) log.Info("修改状态出错" + errUpdate.Error())
continue continue
} }
fmt.Printf("脚本请求阿里文件转换完成: %d\n", item.ID)
log.Info("脚本请求阿里文件转换完成: " + string(item.ID)) log.Info("脚本请求阿里文件转换完成: " + string(item.ID))
} }
......
...@@ -100,6 +100,7 @@ func (o *Conversion) checkParam(arg DoConversionRequest) error { ...@@ -100,6 +100,7 @@ func (o *Conversion) checkParam(arg DoConversionRequest) error {
if arg.TargetType == "" { if arg.TargetType == "" {
return errors.New("TargetType 不能为空") return errors.New("TargetType 不能为空")
} }
return nil return nil
} }
......
...@@ -62,12 +62,34 @@ func (doc *DocServiceService) DoConversion(c context.Context, req *pb.DoConversi ...@@ -62,12 +62,34 @@ func (doc *DocServiceService) DoConversion(c context.Context, req *pb.DoConversi
CallBackData := &pb.CallBackData{ CallBackData := &pb.CallBackData{
Id: req.CallbackData.Id, Id: req.CallbackData.Id,
} }
resp.Code = 10001
resp.Data = nil
if req.SourceUrl == "" {
resp.Msg = "SourceUrl 不能为空"
return resp, err
}
if req.ProjectName == "" {
resp.Msg = "ProjectName 不能为空"
return resp, err
}
if req.SourceType == "" {
resp.Msg = "SourceType 不能为空"
return resp, err
}
if req.TargetType == "" {
resp.Msg = "TargetType 不能为空"
return resp, err
}
if req.TargetUrl == "" {
resp.Msg = "TargetUrl 不能为空"
return resp, err
}
if req.CallbackUrl == "" {
resp.Msg = "CallbackUrl 不能为空"
return resp, err
}
//校验格式 //校验格式
if !inFileType(req.SourceType) { if !inFileType(req.SourceType) {
resp.Msg = "source_type不合法"
resp.Code = 10001
resp.Data = nil
return resp, err return resp, err
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment