Skip to content

Commit

Permalink
feat:rpc
Browse files Browse the repository at this point in the history
  • Loading branch information
CocaineCong committed May 21, 2023
1 parent b43e82a commit 46ce37c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions app/gateway/internal/handler/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func GetTaskList(ctx *gin.Context) {
return
}
req.UserID = user.Id
r, err := rpc.TaskClient.TaskShow(ctx, &req)
r, err := rpc.TaskList(ctx, &req)
if err != nil {
ctx.JSON(http.StatusInternalServerError, ctl.RespError(ctx, err, "TaskShow RPC调用错误"))
return
Expand All @@ -43,7 +43,7 @@ func CreateTask(ctx *gin.Context) {
return
}
req.UserID = user.Id
r, err := rpc.TaskClient.TaskShow(ctx, &req)
r, err := rpc.TaskCreate(ctx, &req)
if err != nil {
ctx.JSON(http.StatusInternalServerError, ctl.RespError(ctx, err, "TaskShow RPC调用错误"))
return
Expand All @@ -64,7 +64,7 @@ func UpdateTask(ctx *gin.Context) {
return
}
req.UserID = user.Id
r, err := rpc.TaskClient.TaskUpdate(ctx, &req)
r, err := rpc.TaskUpdate(ctx, &req)
if err != nil {
ctx.JSON(http.StatusInternalServerError, ctl.RespError(ctx, err, "TaskShow RPC调用错误"))
return
Expand All @@ -85,7 +85,7 @@ func DeleteTask(ctx *gin.Context) {
return
}
req.UserID = user.Id
r, err := rpc.TaskClient.TaskDelete(ctx, &req)
r, err := rpc.TaskDelete(ctx, &req)
if err != nil {
ctx.JSON(http.StatusInternalServerError, ctl.RespError(ctx, err, "TaskShow RPC调用错误"))
return
Expand Down
6 changes: 3 additions & 3 deletions app/gateway/rpc/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ func UserLogin(ctx context.Context, req *userPb.UserRequest) (resp *userPb.UserR
}

func UserRegister(ctx context.Context, req *userPb.UserRequest) (resp *userPb.UserCommonResponse, err error) {
r, err := UserClient.UserRegister(ctx, req)
resp, err = UserClient.UserRegister(ctx, req)
if err != nil {
return
}

if r.Code != e.SUCCESS {
err = errors.New(r.Msg)
if resp.Code != e.SUCCESS {
err = errors.New(resp.Msg)
return
}

Expand Down

0 comments on commit 46ce37c

Please sign in to comment.