Commit eb44aa60 authored by Cloud User's avatar Cloud User

update http api

parent 822fca34
......@@ -603,6 +603,7 @@ type ResponseJson struct {
TaskFee string `json:"task_fee"`
IsSuccess bool `json:"is_success"`
TaskError string `json:"task_error"`
ResultCode int32 `json:"task_code"`
}
func newCache(redisAddr, redisPass, mysqlIP, dbName, user, passwd string, port int) *cachedata.CacheData {
......@@ -1333,10 +1334,9 @@ func syncOrAsyncReturn(c *fiber.Ctx, resAsPb pbUpstream.TaskResponse, reqTaskId
func Return(c *fiber.Ctx, resAsPb pbUpstream.TaskResponse) error {
if resAsPb.TaskIsSucceed {
return c.Send(resAsPb.GetTaskResultBody())
}
// if resAsPb.TaskIsSucceed {
// return c.Send(resAsPb.GetTaskResultBody())
// }
//fmt.Println("syncMode-------------", syncMode)
resAsJson := ResponseJson{
......@@ -1346,31 +1346,32 @@ func Return(c *fiber.Ctx, resAsPb pbUpstream.TaskResponse) error {
TaskFee: resAsPb.TaskFee,
IsSuccess: resAsPb.TaskIsSucceed,
TaskError: resAsPb.TaskError,
//TaskResultCode: resAsPb.TaskResultCode,
}
return c.JSON(resAsJson)
}
func redirectReturn(c *fiber.Ctx, resAsPb pbUpstream.TaskResponse) error {
// func redirectReturn(c *fiber.Ctx, resAsPb pbUpstream.TaskResponse) error {
//c.Status(int(resAsPb.TaskResultCode)).Response().Header.SetL
// //c.Status(int(resAsPb.TaskResultCode)).Response().Header.SetL
if resAsPb.TaskIsSucceed {
// if resAsPb.TaskIsSucceed {
return c.Status(int(resAsPb.TaskResultCode)).Send(resAsPb.GetTaskResultBody())
}
// return c.Status(int(resAsPb.TaskResultCode)).Send(resAsPb.GetTaskResultBody())
// }
//fmt.Println("syncMode-------------", syncMode)
resAsJson := ResponseJson{
TaskId: resAsPb.TaskId,
TaskResult: resAsPb.GetTaskResultBody(),
TaskUid: resAsPb.TaskUid,
TaskFee: resAsPb.TaskFee,
IsSuccess: resAsPb.TaskIsSucceed,
TaskError: resAsPb.TaskError,
}
// //fmt.Println("syncMode-------------", syncMode)
// resAsJson := ResponseJson{
// TaskId: resAsPb.TaskId,
// TaskResult: resAsPb.GetTaskResultBody(),
// TaskUid: resAsPb.TaskUid,
// TaskFee: resAsPb.TaskFee,
// IsSuccess: resAsPb.TaskIsSucceed,
// TaskError: resAsPb.TaskError,
// }
return c.Status(int(resAsPb.TaskResultCode)).JSON(resAsJson)
// return c.Status(int(resAsPb.TaskResultCode)).JSON(resAsJson)
}
// }
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