-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: add rust proto , add face callbcak api
- Loading branch information
Showing
13 changed files
with
5,714 additions
and
2,060 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package impl | ||
|
||
import ( | ||
"context" | ||
"github.com/jumpserver/wisp/pkg/jms-sdk-go/service" | ||
pb "github.com/jumpserver/wisp/protobuf-go/protobuf" | ||
) | ||
|
||
func (j *JMServer) FaceRecognitionCallback(ctx context.Context, req *pb.FaceRecognitionCallbackRequest) (*pb.FaceRecognitionCallbackResponse, error) { | ||
var status pb.Status | ||
|
||
result := service.FaceRecognitionResult{ | ||
Token: req.Token, | ||
Success: req.Success, | ||
ErrorMessage: req.ErrorMessage, | ||
FaceCode: req.FaceCode, | ||
} | ||
if err := j.apiClient.SendFaceRecognitionCallback(result); err != nil { | ||
status.Ok = false | ||
status.Err = err.Error() | ||
} else { | ||
status.Ok = true | ||
} | ||
return &pb.FaceRecognitionCallbackResponse{ | ||
Status: &status, | ||
}, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package service | ||
|
||
type FaceRecognitionResult struct { | ||
Token string `json:"token"` | ||
Success bool `json:"success"` | ||
ErrorMessage string `json:"error_message"` | ||
FaceCode string `json:"face_code"` | ||
} | ||
|
||
func (s *JMService) SendFaceRecognitionCallback(result FaceRecognitionResult) error { | ||
var resp = map[string]interface{}{} | ||
if _, err := s.authClient.Post(FaceRecognitionURL, &result, &resp); err != nil { | ||
return err | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.