Create & Init Project...

This commit is contained in:
2019-04-22 18:49:16 +08:00
commit fc4fa37393
25440 changed files with 4054998 additions and 0 deletions

View File

@@ -0,0 +1,56 @@
load(
"@io_bazel_rules_go//proto:def.bzl",
"go_proto_library",
)
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
proto_library(
name = "v1_proto",
srcs = [
"graph.proto",
"risk.proto",
],
tags = ["automanaged"],
deps = ["@gogo_special_proto//github.com/gogo/protobuf/gogoproto"],
)
go_proto_library(
name = "v1_go_proto",
compilers = ["@io_bazel_rules_go//proto:gogofast_grpc"],
importpath = "go-common/app/service/openplatform/anti-fraud/api/grpc/v1",
proto = ":v1_proto",
tags = ["automanaged"],
deps = ["@com_github_gogo_protobuf//gogoproto:go_default_library"],
)
go_library(
name = "go_default_library",
srcs = [],
embed = [":v1_go_proto"],
importpath = "go-common/app/service/openplatform/anti-fraud/api/grpc/v1",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"@com_github_gogo_protobuf//gogoproto:go_default_library",
"@com_github_gogo_protobuf//proto:go_default_library",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_x_net//context:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,50 @@
//存放api使用的模型
syntax = "proto3";
package open.service.antifraud.v1;
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
option go_package = "v1";
option (gogoproto.goproto_getters_all) = false;
option (gogoproto.goproto_stringer_all) = false;
option (gogoproto.stringer_all) = true;
message GraphPrepareRequest{
int64 mid = 1 [(gogoproto.jsontag) = "mid", (gogoproto.customname) = "MID",(gogoproto.moretags) = "form:\"mid\" validate:\"required\""];
string ip = 2 [(gogoproto.jsontag) = "ip", (gogoproto.customname) = "IP",(gogoproto.moretags) = "form:\"ip\" validate:\"required\""];
int64 customer = 3 [(gogoproto.jsontag) = "customer", (gogoproto.moretags) = "form:\"customer\" validate:\"required\""];
int64 item_id = 4 [(gogoproto.jsontag) = "item_id", (gogoproto.customname) = "ItemID", (gogoproto.moretags) = "form:\"item_id\" validate:\"required\""];
string client_type = 5 [(gogoproto.jsontag) = "client_type", (gogoproto.moretags) = "form:\"client_type\" validate:\"required\""];
}
message GraphPrepareResponse{
int64 success = 1 [(gogoproto.jsontag) = "success"];
string captcha_id = 2 [(gogoproto.jsontag) = "captcha_id", (gogoproto.customname) = "CaptchaID"];
string challenge = 3 [(gogoproto.jsontag) = "challenge"];
int64 new_captcha = 4 [(gogoproto.jsontag) = "new_captcha"];
string voucher = 5 [(gogoproto.jsontag) = "voucher"];
}
message GraphCheckRequest{
int64 mid = 1 [(gogoproto.jsontag) = "mid", (gogoproto.customname) = "MID",(gogoproto.moretags) = "form:\"mid\" validate:\"required\""];
string ip = 2 [(gogoproto.jsontag) = "ip", (gogoproto.customname) = "IP",(gogoproto.moretags) = "form:\"ip\" validate:\"required\""];
int64 customer = 3 [(gogoproto.jsontag) = "customer", (gogoproto.moretags) = "form:\"customer\" validate:\"required\""];
int64 item_id = 4 [(gogoproto.jsontag) = "item_id", (gogoproto.customname) = "ItemID",(gogoproto.moretags) = "form:\"item_id\" validate:\"required\""];
string voucher = 5 [(gogoproto.jsontag) = "voucher", (gogoproto.moretags) = "form:\"voucher\" validate:\"required\""];
string challenge = 6 [(gogoproto.jsontag) = "challenge", (gogoproto.moretags) = "form:\"challenge\" validate:\"required\""];
string validate = 7 [(gogoproto.jsontag) = "validate", (gogoproto.moretags) = "form:\"validate\" validate:\"required\""];
string seccode = 8 [(gogoproto.jsontag) = "seccode", (gogoproto.moretags) = "form:\"seccode\" validate:\"required\""];
string client_type = 9 [(gogoproto.jsontag) = "client_type", (gogoproto.moretags) = "form:\"client_type\" validate:\"required\""];
int64 success = 10 [(gogoproto.jsontag) = "success", (gogoproto.moretags) = "form:\"success\" validate:\"required\""];
}
message GraphCheckResponse{
string new_voucher = 1 [(gogoproto.jsontag) = "new_voucher"];
}
service Graph {
// 拉起极验
rpc GraphPrepare(GraphPrepareRequest) returns (GraphPrepareResponse);
// 极验验证
rpc GraphCheck(GraphCheckRequest) returns (GraphCheckResponse);
}

View File

@@ -0,0 +1,917 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: app/service/openplatform/anti-fraud/api/grpc/v1/risk.proto
package v1
import proto "github.com/gogo/protobuf/proto"
import fmt "fmt"
import math "math"
import _ "github.com/gogo/protobuf/gogoproto"
import (
context "golang.org/x/net/context"
grpc "google.golang.org/grpc"
)
import strings "strings"
import reflect "reflect"
import io "io"
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
type RiskCheckRequest struct {
MID int64 `protobuf:"varint,1,opt,name=mid,proto3" json:"mid" form:"mid" validate:"required"`
IP string `protobuf:"bytes,2,opt,name=ip,proto3" json:"ip" form:"ip" validate:"required"`
ItemID int64 `protobuf:"varint,3,opt,name=item_id,json=itemId,proto3" json:"item_id" form:"item_id" validate:"required"`
Path string `protobuf:"bytes,4,opt,name=path,proto3" json:"path" form:"path" validate:"required"`
Customer int64 `protobuf:"varint,5,opt,name=customer,proto3" json:"customer" form:"customer" validate:"required"`
OpenTime int64 `protobuf:"varint,6,opt,name=open_time,json=openTime,proto3" json:"open_time" form:"open_time" validate:"required"`
Voucher string `protobuf:"bytes,7,opt,name=voucher,proto3" json:"voucher" form:"voucher"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *RiskCheckRequest) Reset() { *m = RiskCheckRequest{} }
func (*RiskCheckRequest) ProtoMessage() {}
func (*RiskCheckRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_risk_5894149e138ee66f, []int{0}
}
func (m *RiskCheckRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *RiskCheckRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_RiskCheckRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalTo(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (dst *RiskCheckRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_RiskCheckRequest.Merge(dst, src)
}
func (m *RiskCheckRequest) XXX_Size() int {
return m.Size()
}
func (m *RiskCheckRequest) XXX_DiscardUnknown() {
xxx_messageInfo_RiskCheckRequest.DiscardUnknown(m)
}
var xxx_messageInfo_RiskCheckRequest proto.InternalMessageInfo
type RiskCheckResponse struct {
Success int64 `protobuf:"varint,1,opt,name=success,proto3" json:"success"`
Rank int64 `protobuf:"varint,2,opt,name=rank,proto3" json:"rank"`
Method int64 `protobuf:"varint,3,opt,name=method,proto3" json:"method"`
Desc string `protobuf:"bytes,4,opt,name=desc,proto3" json:"desc"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *RiskCheckResponse) Reset() { *m = RiskCheckResponse{} }
func (*RiskCheckResponse) ProtoMessage() {}
func (*RiskCheckResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_risk_5894149e138ee66f, []int{1}
}
func (m *RiskCheckResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *RiskCheckResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_RiskCheckResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalTo(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (dst *RiskCheckResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_RiskCheckResponse.Merge(dst, src)
}
func (m *RiskCheckResponse) XXX_Size() int {
return m.Size()
}
func (m *RiskCheckResponse) XXX_DiscardUnknown() {
xxx_messageInfo_RiskCheckResponse.DiscardUnknown(m)
}
var xxx_messageInfo_RiskCheckResponse proto.InternalMessageInfo
func init() {
proto.RegisterType((*RiskCheckRequest)(nil), "open.service.antifraud.v1.RiskCheckRequest")
proto.RegisterType((*RiskCheckResponse)(nil), "open.service.antifraud.v1.RiskCheckResponse")
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConn
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion4
// RiskClient is the client API for Risk service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type RiskClient interface {
// 风险检查
RiskCheck(ctx context.Context, in *RiskCheckRequest, opts ...grpc.CallOption) (*RiskCheckResponse, error)
}
type riskClient struct {
cc *grpc.ClientConn
}
func NewRiskClient(cc *grpc.ClientConn) RiskClient {
return &riskClient{cc}
}
func (c *riskClient) RiskCheck(ctx context.Context, in *RiskCheckRequest, opts ...grpc.CallOption) (*RiskCheckResponse, error) {
out := new(RiskCheckResponse)
err := c.cc.Invoke(ctx, "/open.service.antifraud.v1.Risk/RiskCheck", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// RiskServer is the server API for Risk service.
type RiskServer interface {
// 风险检查
RiskCheck(context.Context, *RiskCheckRequest) (*RiskCheckResponse, error)
}
func RegisterRiskServer(s *grpc.Server, srv RiskServer) {
s.RegisterService(&_Risk_serviceDesc, srv)
}
func _Risk_RiskCheck_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(RiskCheckRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RiskServer).RiskCheck(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/open.service.antifraud.v1.Risk/RiskCheck",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RiskServer).RiskCheck(ctx, req.(*RiskCheckRequest))
}
return interceptor(ctx, in, info, handler)
}
var _Risk_serviceDesc = grpc.ServiceDesc{
ServiceName: "open.service.antifraud.v1.Risk",
HandlerType: (*RiskServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "RiskCheck",
Handler: _Risk_RiskCheck_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "app/service/openplatform/anti-fraud/api/grpc/v1/risk.proto",
}
func (m *RiskCheckRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *RiskCheckRequest) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
if m.MID != 0 {
dAtA[i] = 0x8
i++
i = encodeVarintRisk(dAtA, i, uint64(m.MID))
}
if len(m.IP) > 0 {
dAtA[i] = 0x12
i++
i = encodeVarintRisk(dAtA, i, uint64(len(m.IP)))
i += copy(dAtA[i:], m.IP)
}
if m.ItemID != 0 {
dAtA[i] = 0x18
i++
i = encodeVarintRisk(dAtA, i, uint64(m.ItemID))
}
if len(m.Path) > 0 {
dAtA[i] = 0x22
i++
i = encodeVarintRisk(dAtA, i, uint64(len(m.Path)))
i += copy(dAtA[i:], m.Path)
}
if m.Customer != 0 {
dAtA[i] = 0x28
i++
i = encodeVarintRisk(dAtA, i, uint64(m.Customer))
}
if m.OpenTime != 0 {
dAtA[i] = 0x30
i++
i = encodeVarintRisk(dAtA, i, uint64(m.OpenTime))
}
if len(m.Voucher) > 0 {
dAtA[i] = 0x3a
i++
i = encodeVarintRisk(dAtA, i, uint64(len(m.Voucher)))
i += copy(dAtA[i:], m.Voucher)
}
if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized)
}
return i, nil
}
func (m *RiskCheckResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *RiskCheckResponse) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
if m.Success != 0 {
dAtA[i] = 0x8
i++
i = encodeVarintRisk(dAtA, i, uint64(m.Success))
}
if m.Rank != 0 {
dAtA[i] = 0x10
i++
i = encodeVarintRisk(dAtA, i, uint64(m.Rank))
}
if m.Method != 0 {
dAtA[i] = 0x18
i++
i = encodeVarintRisk(dAtA, i, uint64(m.Method))
}
if len(m.Desc) > 0 {
dAtA[i] = 0x22
i++
i = encodeVarintRisk(dAtA, i, uint64(len(m.Desc)))
i += copy(dAtA[i:], m.Desc)
}
if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized)
}
return i, nil
}
func encodeVarintRisk(dAtA []byte, offset int, v uint64) int {
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return offset + 1
}
func (m *RiskCheckRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.MID != 0 {
n += 1 + sovRisk(uint64(m.MID))
}
l = len(m.IP)
if l > 0 {
n += 1 + l + sovRisk(uint64(l))
}
if m.ItemID != 0 {
n += 1 + sovRisk(uint64(m.ItemID))
}
l = len(m.Path)
if l > 0 {
n += 1 + l + sovRisk(uint64(l))
}
if m.Customer != 0 {
n += 1 + sovRisk(uint64(m.Customer))
}
if m.OpenTime != 0 {
n += 1 + sovRisk(uint64(m.OpenTime))
}
l = len(m.Voucher)
if l > 0 {
n += 1 + l + sovRisk(uint64(l))
}
if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized)
}
return n
}
func (m *RiskCheckResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Success != 0 {
n += 1 + sovRisk(uint64(m.Success))
}
if m.Rank != 0 {
n += 1 + sovRisk(uint64(m.Rank))
}
if m.Method != 0 {
n += 1 + sovRisk(uint64(m.Method))
}
l = len(m.Desc)
if l > 0 {
n += 1 + l + sovRisk(uint64(l))
}
if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized)
}
return n
}
func sovRisk(x uint64) (n int) {
for {
n++
x >>= 7
if x == 0 {
break
}
}
return n
}
func sozRisk(x uint64) (n int) {
return sovRisk(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (this *RiskCheckRequest) String() string {
if this == nil {
return "nil"
}
s := strings.Join([]string{`&RiskCheckRequest{`,
`MID:` + fmt.Sprintf("%v", this.MID) + `,`,
`IP:` + fmt.Sprintf("%v", this.IP) + `,`,
`ItemID:` + fmt.Sprintf("%v", this.ItemID) + `,`,
`Path:` + fmt.Sprintf("%v", this.Path) + `,`,
`Customer:` + fmt.Sprintf("%v", this.Customer) + `,`,
`OpenTime:` + fmt.Sprintf("%v", this.OpenTime) + `,`,
`Voucher:` + fmt.Sprintf("%v", this.Voucher) + `,`,
`XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`,
`}`,
}, "")
return s
}
func (this *RiskCheckResponse) String() string {
if this == nil {
return "nil"
}
s := strings.Join([]string{`&RiskCheckResponse{`,
`Success:` + fmt.Sprintf("%v", this.Success) + `,`,
`Rank:` + fmt.Sprintf("%v", this.Rank) + `,`,
`Method:` + fmt.Sprintf("%v", this.Method) + `,`,
`Desc:` + fmt.Sprintf("%v", this.Desc) + `,`,
`XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`,
`}`,
}, "")
return s
}
func valueToStringRisk(v interface{}) string {
rv := reflect.ValueOf(v)
if rv.IsNil() {
return "nil"
}
pv := reflect.Indirect(rv).Interface()
return fmt.Sprintf("*%v", pv)
}
func (m *RiskCheckRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowRisk
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: RiskCheckRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: RiskCheckRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field MID", wireType)
}
m.MID = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowRisk
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.MID |= (int64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field IP", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowRisk
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthRisk
}
postIndex := iNdEx + intStringLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.IP = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ItemID", wireType)
}
m.ItemID = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowRisk
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ItemID |= (int64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Path", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowRisk
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthRisk
}
postIndex := iNdEx + intStringLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Path = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 5:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Customer", wireType)
}
m.Customer = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowRisk
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Customer |= (int64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
case 6:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field OpenTime", wireType)
}
m.OpenTime = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowRisk
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.OpenTime |= (int64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
case 7:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Voucher", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowRisk
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthRisk
}
postIndex := iNdEx + intStringLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Voucher = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipRisk(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthRisk
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *RiskCheckResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowRisk
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: RiskCheckResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: RiskCheckResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Success", wireType)
}
m.Success = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowRisk
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Success |= (int64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Rank", wireType)
}
m.Rank = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowRisk
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Rank |= (int64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Method", wireType)
}
m.Method = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowRisk
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Method |= (int64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Desc", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowRisk
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthRisk
}
postIndex := iNdEx + intStringLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Desc = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipRisk(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthRisk
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipRisk(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowRisk
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowRisk
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
return iNdEx, nil
case 1:
iNdEx += 8
return iNdEx, nil
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowRisk
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
iNdEx += length
if length < 0 {
return 0, ErrInvalidLengthRisk
}
return iNdEx, nil
case 3:
for {
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowRisk
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
innerWire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
innerWireType := int(innerWire & 0x7)
if innerWireType == 4 {
break
}
next, err := skipRisk(dAtA[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
}
return iNdEx, nil
case 4:
return iNdEx, nil
case 5:
iNdEx += 4
return iNdEx, nil
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
}
panic("unreachable")
}
var (
ErrInvalidLengthRisk = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowRisk = fmt.Errorf("proto: integer overflow")
)
func init() {
proto.RegisterFile("app/service/openplatform/anti-fraud/api/grpc/v1/risk.proto", fileDescriptor_risk_5894149e138ee66f)
}
var fileDescriptor_risk_5894149e138ee66f = []byte{
// 541 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0x41, 0x6f, 0xd3, 0x30,
0x14, 0xc7, 0x97, 0xb4, 0xb4, 0xab, 0x91, 0x10, 0xf8, 0x14, 0xa6, 0x2d, 0xae, 0x02, 0x48, 0x93,
0x46, 0x13, 0xca, 0x84, 0x90, 0x8a, 0x10, 0x52, 0xe1, 0xd2, 0x03, 0x02, 0x45, 0x3b, 0x71, 0x99,
0xd2, 0xc4, 0x6d, 0xad, 0xce, 0xb5, 0x67, 0x3b, 0x39, 0x73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, 0x14, 0x6f, 0x17, 0xf0, 0x18, 0x74, 0x45, 0xb2,
0x59, 0xdb, 0x91, 0x77, 0xa6, 0x87, 0xe6, 0x6c, 0x4d, 0x1c, 0xdb, 0x2f, 0x0c, 0x40, 0x8f, 0x62,
0xb5, 0x62, 0xdb, 0x71, 0x82, 0x4a, 0xa3, 0x56, 0x89, 0xdb, 0xbf, 0x21, 0x64, 0x58, 0xa6, 0xed,
0x74, 0x2c, 0xc1, 0xc4, 0xb1, 0xfd, 0xbe, 0xdc, 0x80, 0xae, 0xf1, 0x06, 0x17, 0x60, 0xb0, 0xf3,
0x08, 0xcf, 0xc2, 0x3b, 0x5f, 0x42, 0xf8, 0xef, 0xb5, 0x3e, 0x7a, 0xfe, 0x7f, 0xc5, 0xcd, 0xb6,
0xa7, 0xc7, 0x37, 0xb7, 0xfe, 0xc1, 0xcf, 0x5b, 0xff, 0xe0, 0x6b, 0xe9, 0x3b, 0x37, 0xa5, 0xef,
0xfc, 0x28, 0x7d, 0xe7, 0x57, 0xe9, 0x3b, 0x5f, 0xdc, 0x62, 0x3c, 0xef, 0xd9, 0xe7, 0x73, 0xfe,
0x3b, 0x00, 0x00, 0xff, 0xff, 0x79, 0xb3, 0x6d, 0xb9, 0xc6, 0x03, 0x00, 0x00,
}

View File

@@ -0,0 +1,32 @@
//存放api使用的模型
syntax = "proto3";
package open.service.antifraud.v1;
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
option go_package = "v1";
option (gogoproto.goproto_getters_all) = false;
option (gogoproto.goproto_stringer_all) = false;
option (gogoproto.stringer_all) = true;
message RiskCheckRequest{
int64 mid = 1 [(gogoproto.jsontag) = "mid", (gogoproto.customname) = "MID",(gogoproto.moretags) = "form:\"mid\" validate:\"required\""];
string ip = 2 [(gogoproto.jsontag) = "ip", (gogoproto.customname) = "IP",(gogoproto.moretags) = "form:\"ip\" validate:\"required\""];
int64 item_id = 3 [(gogoproto.jsontag) = "item_id", (gogoproto.customname) = "ItemID",(gogoproto.moretags) = "form:\"item_id\" validate:\"required\""];
string path = 4 [(gogoproto.jsontag) = "path",(gogoproto.moretags) = "form:\"path\" validate:\"required\""];
int64 customer = 5 [(gogoproto.jsontag) = "customer",(gogoproto.moretags) = "form:\"customer\" validate:\"required\""];
int64 open_time = 6 [(gogoproto.jsontag) = "open_time",(gogoproto.moretags) = "form:\"open_time\" validate:\"required\""];
string voucher = 7 [(gogoproto.jsontag) = "voucher",(gogoproto.moretags) = "form:\"voucher\""];
}
message RiskCheckResponse{
int64 success = 1 [(gogoproto.jsontag) = "success"];
int64 rank = 2 [(gogoproto.jsontag) = "rank"];
int64 method = 3 [(gogoproto.jsontag) = "method"];
string desc = 4 [(gogoproto.jsontag) = "desc"];
}
service Risk {
// 风险检查
rpc RiskCheck(RiskCheckRequest) returns (RiskCheckResponse);
}