You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
677 B
37 lines
677 B
package AuthGrpc
|
|
|
|
import (
|
|
"context"
|
|
"dsDataex/MyService/Auth/AuthGrpc/AuthGrpcProto"
|
|
"dsDataex/MyService/Auth/AuthService"
|
|
)
|
|
|
|
//服务对象
|
|
type Rpc struct{}
|
|
|
|
var out AuthGrpcProto.Result
|
|
|
|
func (s *Rpc) SystemAuth(ctx context.Context, in *AuthGrpcProto.Auth) (*AuthGrpcProto.Result, error) {
|
|
|
|
if in.SystemID=="" || in.SystemToken=="" || in.AuthTime=="" {
|
|
out.Success = false
|
|
out.Message = "接入系统鉴权参数不能为空"
|
|
|
|
return &out,nil
|
|
}
|
|
|
|
success,result,token:= AuthService.CreateToken(in.SystemID,in.SystemToken,in.AuthTime)
|
|
|
|
if success{
|
|
|
|
out.Success=true
|
|
out.Message=token
|
|
}else {
|
|
|
|
out.Success=false
|
|
out.Message=result
|
|
}
|
|
|
|
return &out,nil
|
|
}
|