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,60 @@
load(
"@io_bazel_rules_go//proto:def.bzl",
"go_proto_library",
)
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"const.go",
"qq.go",
"sns.go",
"weibo.go",
],
embed = [":model_go_proto"],
importpath = "go-common/app/service/main/passport-sns/model",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"//app/service/main/passport-sns/api:go_default_library",
"@com_github_gogo_protobuf//gogoproto:go_default_library",
"@com_github_golang_protobuf//proto: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"],
)
proto_library(
name = "model_proto",
srcs = ["sns.proto"],
tags = ["automanaged"],
deps = ["@gogo_special_proto//github.com/gogo/protobuf/gogoproto"],
)
go_proto_library(
name = "model_go_proto",
compilers = ["@io_bazel_rules_go//proto:gogofast_proto"],
importpath = "go-common/app/service/main/passport-sns/model",
proto = ":model_proto",
tags = ["automanaged"],
deps = ["@com_github_gogo_protobuf//gogoproto:go_default_library"],
)

View File

@@ -0,0 +1,25 @@
package model
// platform
const (
PlatformQQ = 1
PlatformWEIBO = 2
PlatformAll = "all"
PlatformQQStr = "qq"
PlatformWEIBOStr = "weibo"
)
// business
const (
BusinessMain = 10
BusinessMall = 20
)
// operate
const (
OperateBind = 1
OperateUnbind = 2
OperateDelete = 3
OperateLogin = 4
)

View File

@@ -0,0 +1,7 @@
#! /bin/sh
# proto.sh
gopath=$GOPATH/src
gogopath=$GOPATH/src/go-common/vendor/github.com/gogo/protobuf
protoc --gofast_out=. --proto_path=$gopath:$gogopath:. *.proto

View File

@@ -0,0 +1,18 @@
package model
// QQAccessResp qq access response
type QQAccessResp struct {
Token string `json:"access_token"`
Refresh string `json:"refresh_token"`
Expires int64 `json:"expires_in"`
Code int `json:"error"`
Description string `json:"error_description"`
}
// QQOpenIDResp qq open id response
type QQOpenIDResp struct {
UnionID string `json:"unionid"`
OpenID string `json:"openid"`
Code int `json:"error"`
Description string `json:"error_description"`
}

View File

@@ -0,0 +1,98 @@
package model
import (
"go-common/app/service/main/passport-sns/api"
)
// SnsApps .
type SnsApps struct {
AppID string
AppSecret string
Platform int
Business int
}
// SnsUser .
type SnsUser struct {
Mid int64 `json:"mid"`
UnionID string `json:"unionid"`
Platform int `json:"platform"`
Expires int64 `json:"expires"`
}
// SnsOpenID .
type SnsOpenID struct {
Mid int64 `json:"mid"`
OpenID string `json:"openid"`
UnionID string `json:"unionid"`
AppID string `json:"appid"`
Platform int `json:"platform"`
}
// SnsToken .
type SnsToken struct {
Mid int64 `json:"mid"`
OpenID string `json:"openid"`
UnionID string `json:"unionid"`
Platform int `json:"platform"`
Token string `json:"token"`
Expires int64 `json:"expires"`
AppID string `json:"appid"`
}
// SnsLog .
type SnsLog struct {
Mid int64 `json:"mid"`
OpenID string `json:"openid"`
UnionID string `json:"unionid"`
AppID string `json:"appid"`
Platform int `json:"platform"`
Operator string `json:"operator"`
Operate int `json:"operate"`
Description string `json:"description"`
}
// CheckBindResp .
type CheckBindResp struct {
Bind bool `json:"bind"`
Mid int64 `json:"mid"`
}
// Oauth2Info oauth2 info
type Oauth2Info struct {
UnionID string `json:"unionid"`
OpenID string `json:"openid"`
Token string `json:"access_token"`
Refresh string `json:"refresh_token"`
Expires int64 `json:"expires"`
}
// ConvertToProto .
func (t *SnsUser) ConvertToProto() *SnsProto {
return &SnsProto{
Mid: t.Mid,
UnionID: t.UnionID,
Platform: int32(t.Platform),
Expires: t.Expires,
}
}
// ConvertToInfo .
func (p *SnsProto) ConvertToInfo() *api.Info {
return &api.Info{
Mid: p.Mid,
Platform: parsePlatformStr(p.Platform),
UnionId: p.UnionID,
Expires: p.Expires,
}
}
func parsePlatformStr(platform int32) string {
switch platform {
case PlatformQQ:
return PlatformQQStr
case PlatformWEIBO:
return PlatformWEIBOStr
}
return ""
}

View File

@@ -0,0 +1,799 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: sns.proto
/*
Package model is a generated protocol buffer package.
It is generated from these files:
sns.proto
It has these top-level messages:
SnsProto
Oauth2Proto
*/
package model
import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
import _ "github.com/gogo/protobuf/gogoproto"
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.ProtoPackageIsVersion2 // please upgrade the proto package
type SnsProto struct {
Mid int64 `protobuf:"varint,1,opt,name=Mid,proto3" json:"mid"`
UnionID string `protobuf:"bytes,2,opt,name=UnionID,proto3" json:"unionid"`
Platform int32 `protobuf:"varint,3,opt,name=Platform,proto3" json:"platform"`
Expires int64 `protobuf:"varint,4,opt,name=Expires,proto3" json:"expires"`
}
func (m *SnsProto) Reset() { *m = SnsProto{} }
func (m *SnsProto) String() string { return proto.CompactTextString(m) }
func (*SnsProto) ProtoMessage() {}
func (*SnsProto) Descriptor() ([]byte, []int) { return fileDescriptorSns, []int{0} }
func (m *SnsProto) GetMid() int64 {
if m != nil {
return m.Mid
}
return 0
}
func (m *SnsProto) GetUnionID() string {
if m != nil {
return m.UnionID
}
return ""
}
func (m *SnsProto) GetPlatform() int32 {
if m != nil {
return m.Platform
}
return 0
}
func (m *SnsProto) GetExpires() int64 {
if m != nil {
return m.Expires
}
return 0
}
type Oauth2Proto struct {
Mid int64 `protobuf:"varint,1,opt,name=Mid,proto3" json:"mid"`
UnionID string `protobuf:"bytes,2,opt,name=UnionID,proto3" json:"unionid"`
OpenID string `protobuf:"bytes,3,opt,name=OpenID,proto3" json:"openid"`
Platform int32 `protobuf:"varint,4,opt,name=Platform,proto3" json:"platform"`
AppID string `protobuf:"bytes,5,opt,name=AppID,proto3" json:"appid"`
Token string `protobuf:"bytes,6,opt,name=Token,proto3" json:"token"`
Expires int64 `protobuf:"varint,7,opt,name=Expires,proto3" json:"expires"`
}
func (m *Oauth2Proto) Reset() { *m = Oauth2Proto{} }
func (m *Oauth2Proto) String() string { return proto.CompactTextString(m) }
func (*Oauth2Proto) ProtoMessage() {}
func (*Oauth2Proto) Descriptor() ([]byte, []int) { return fileDescriptorSns, []int{1} }
func (m *Oauth2Proto) GetMid() int64 {
if m != nil {
return m.Mid
}
return 0
}
func (m *Oauth2Proto) GetUnionID() string {
if m != nil {
return m.UnionID
}
return ""
}
func (m *Oauth2Proto) GetOpenID() string {
if m != nil {
return m.OpenID
}
return ""
}
func (m *Oauth2Proto) GetPlatform() int32 {
if m != nil {
return m.Platform
}
return 0
}
func (m *Oauth2Proto) GetAppID() string {
if m != nil {
return m.AppID
}
return ""
}
func (m *Oauth2Proto) GetToken() string {
if m != nil {
return m.Token
}
return ""
}
func (m *Oauth2Proto) GetExpires() int64 {
if m != nil {
return m.Expires
}
return 0
}
func init() {
proto.RegisterType((*SnsProto)(nil), "passport.service.sns.SnsProto")
proto.RegisterType((*Oauth2Proto)(nil), "passport.service.sns.Oauth2Proto")
}
func (m *SnsProto) 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 *SnsProto) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
if m.Mid != 0 {
dAtA[i] = 0x8
i++
i = encodeVarintSns(dAtA, i, uint64(m.Mid))
}
if len(m.UnionID) > 0 {
dAtA[i] = 0x12
i++
i = encodeVarintSns(dAtA, i, uint64(len(m.UnionID)))
i += copy(dAtA[i:], m.UnionID)
}
if m.Platform != 0 {
dAtA[i] = 0x18
i++
i = encodeVarintSns(dAtA, i, uint64(m.Platform))
}
if m.Expires != 0 {
dAtA[i] = 0x20
i++
i = encodeVarintSns(dAtA, i, uint64(m.Expires))
}
return i, nil
}
func (m *Oauth2Proto) 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 *Oauth2Proto) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
if m.Mid != 0 {
dAtA[i] = 0x8
i++
i = encodeVarintSns(dAtA, i, uint64(m.Mid))
}
if len(m.UnionID) > 0 {
dAtA[i] = 0x12
i++
i = encodeVarintSns(dAtA, i, uint64(len(m.UnionID)))
i += copy(dAtA[i:], m.UnionID)
}
if len(m.OpenID) > 0 {
dAtA[i] = 0x1a
i++
i = encodeVarintSns(dAtA, i, uint64(len(m.OpenID)))
i += copy(dAtA[i:], m.OpenID)
}
if m.Platform != 0 {
dAtA[i] = 0x20
i++
i = encodeVarintSns(dAtA, i, uint64(m.Platform))
}
if len(m.AppID) > 0 {
dAtA[i] = 0x2a
i++
i = encodeVarintSns(dAtA, i, uint64(len(m.AppID)))
i += copy(dAtA[i:], m.AppID)
}
if len(m.Token) > 0 {
dAtA[i] = 0x32
i++
i = encodeVarintSns(dAtA, i, uint64(len(m.Token)))
i += copy(dAtA[i:], m.Token)
}
if m.Expires != 0 {
dAtA[i] = 0x38
i++
i = encodeVarintSns(dAtA, i, uint64(m.Expires))
}
return i, nil
}
func encodeVarintSns(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 *SnsProto) Size() (n int) {
var l int
_ = l
if m.Mid != 0 {
n += 1 + sovSns(uint64(m.Mid))
}
l = len(m.UnionID)
if l > 0 {
n += 1 + l + sovSns(uint64(l))
}
if m.Platform != 0 {
n += 1 + sovSns(uint64(m.Platform))
}
if m.Expires != 0 {
n += 1 + sovSns(uint64(m.Expires))
}
return n
}
func (m *Oauth2Proto) Size() (n int) {
var l int
_ = l
if m.Mid != 0 {
n += 1 + sovSns(uint64(m.Mid))
}
l = len(m.UnionID)
if l > 0 {
n += 1 + l + sovSns(uint64(l))
}
l = len(m.OpenID)
if l > 0 {
n += 1 + l + sovSns(uint64(l))
}
if m.Platform != 0 {
n += 1 + sovSns(uint64(m.Platform))
}
l = len(m.AppID)
if l > 0 {
n += 1 + l + sovSns(uint64(l))
}
l = len(m.Token)
if l > 0 {
n += 1 + l + sovSns(uint64(l))
}
if m.Expires != 0 {
n += 1 + sovSns(uint64(m.Expires))
}
return n
}
func sovSns(x uint64) (n int) {
for {
n++
x >>= 7
if x == 0 {
break
}
}
return n
}
func sozSns(x uint64) (n int) {
return sovSns(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *SnsProto) 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 ErrIntOverflowSns
}
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: SnsProto: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: SnsProto: 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 ErrIntOverflowSns
}
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 UnionID", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowSns
}
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 ErrInvalidLengthSns
}
postIndex := iNdEx + intStringLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.UnionID = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Platform", wireType)
}
m.Platform = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowSns
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Platform |= (int32(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
case 4:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Expires", wireType)
}
m.Expires = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowSns
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Expires |= (int64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipSns(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthSns
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *Oauth2Proto) 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 ErrIntOverflowSns
}
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: Oauth2Proto: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Oauth2Proto: 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 ErrIntOverflowSns
}
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 UnionID", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowSns
}
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 ErrInvalidLengthSns
}
postIndex := iNdEx + intStringLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.UnionID = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field OpenID", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowSns
}
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 ErrInvalidLengthSns
}
postIndex := iNdEx + intStringLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.OpenID = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Platform", wireType)
}
m.Platform = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowSns
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Platform |= (int32(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field AppID", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowSns
}
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 ErrInvalidLengthSns
}
postIndex := iNdEx + intStringLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.AppID = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 6:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Token", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowSns
}
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 ErrInvalidLengthSns
}
postIndex := iNdEx + intStringLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Token = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 7:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Expires", wireType)
}
m.Expires = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowSns
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Expires |= (int64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipSns(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthSns
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipSns(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, ErrIntOverflowSns
}
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, ErrIntOverflowSns
}
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, ErrIntOverflowSns
}
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, ErrInvalidLengthSns
}
return iNdEx, nil
case 3:
for {
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowSns
}
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 := skipSns(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 (
ErrInvalidLengthSns = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowSns = fmt.Errorf("proto: integer overflow")
)
func init() { proto.RegisterFile("sns.proto", fileDescriptorSns) }
var fileDescriptorSns = []byte{
// 326 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x91, 0x3f, 0x4e, 0xf3, 0x30,
0x18, 0xc6, 0x3f, 0x37, 0x4d, 0xd2, 0xba, 0xdf, 0x54, 0x21, 0x61, 0x18, 0xe2, 0xaa, 0x12, 0x52,
0x16, 0x52, 0x09, 0x4e, 0x40, 0x54, 0x86, 0x0e, 0xa8, 0x95, 0x81, 0x85, 0x2d, 0x6d, 0xdc, 0xd6,
0xa2, 0xb1, 0xad, 0xd8, 0x41, 0x9c, 0x80, 0x33, 0xb0, 0x70, 0x1f, 0x46, 0x4e, 0x10, 0xa1, 0xb0,
0xe5, 0x14, 0xc8, 0x4e, 0xcb, 0x9f, 0x01, 0x26, 0xb6, 0xbc, 0xbf, 0xe7, 0xa7, 0x27, 0x79, 0xdf,
0xc0, 0xae, 0xe2, 0x2a, 0x92, 0xb9, 0xd0, 0xa2, 0xbf, 0x27, 0x13, 0xa5, 0xa4, 0xc8, 0x75, 0xa4,
0x68, 0x7e, 0xc7, 0x16, 0x34, 0x52, 0x5c, 0x1d, 0x1e, 0xaf, 0x98, 0x5e, 0x17, 0xf3, 0x68, 0x21,
0xb2, 0xd1, 0x4a, 0xac, 0xc4, 0xc8, 0xca, 0xf3, 0x62, 0x69, 0x27, 0x3b, 0xd8, 0xa7, 0xa6, 0x64,
0xf8, 0x04, 0x60, 0xe7, 0x92, 0xab, 0x99, 0x6d, 0x3c, 0x80, 0xce, 0x05, 0x4b, 0x11, 0x18, 0x80,
0xd0, 0x89, 0xfd, 0xba, 0xc4, 0x4e, 0xc6, 0x52, 0x62, 0x58, 0xff, 0x08, 0xfa, 0xd7, 0x9c, 0x09,
0x3e, 0x19, 0xa3, 0xd6, 0x00, 0x84, 0xdd, 0xb8, 0x57, 0x97, 0xd8, 0x2f, 0x0c, 0x62, 0x29, 0xd9,
0x65, 0xfd, 0x10, 0x76, 0x66, 0x9b, 0x44, 0x2f, 0x45, 0x9e, 0x21, 0x67, 0x00, 0x42, 0x37, 0xfe,
0x5f, 0x97, 0xb8, 0x23, 0xb7, 0x8c, 0x7c, 0xa4, 0xa6, 0xf0, 0xfc, 0x5e, 0xb2, 0x9c, 0x2a, 0xd4,
0xb6, 0xef, 0xb3, 0x85, 0xb4, 0x41, 0x64, 0x97, 0x0d, 0x1f, 0x5a, 0xb0, 0x37, 0x4d, 0x0a, 0xbd,
0x3e, 0xf9, 0xab, 0x4f, 0x1c, 0x42, 0x6f, 0x2a, 0xa9, 0xb1, 0x1c, 0x6b, 0xc1, 0xba, 0xc4, 0x9e,
0x90, 0xd4, 0x48, 0xdb, 0xe4, 0xdb, 0x1a, 0xed, 0x5f, 0xd7, 0xc0, 0xd0, 0x3d, 0x93, 0x72, 0x32,
0x46, 0xae, 0x2d, 0xeb, 0xd6, 0x25, 0x76, 0x13, 0x29, 0x59, 0x4a, 0x1a, 0x6e, 0x84, 0x2b, 0x71,
0x4b, 0x39, 0xf2, 0x3e, 0x05, 0x6d, 0x00, 0x69, 0xf8, 0xd7, 0x43, 0xf8, 0x3f, 0x1f, 0x22, 0xde,
0x7f, 0xae, 0x02, 0xf0, 0x52, 0x05, 0xe0, 0xb5, 0x0a, 0xc0, 0xe3, 0x5b, 0xf0, 0xef, 0xc6, 0xcd,
0x44, 0x4a, 0x37, 0x73, 0xcf, 0xfe, 0xc8, 0xd3, 0xf7, 0x00, 0x00, 0x00, 0xff, 0xff, 0x6e, 0x2d,
0x91, 0x85, 0x1a, 0x02, 0x00, 0x00,
}

View File

@@ -0,0 +1,22 @@
syntax = "proto3";
package passport.service.sns;
option go_package = "model";
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
message SnsProto {
int64 Mid = 1 [(gogoproto.jsontag) = "mid"];
string UnionID = 2 [(gogoproto.jsontag) = "unionid"];
int32 Platform = 3 [(gogoproto.jsontag) = "platform"];
int64 Expires = 4 [(gogoproto.jsontag) = "expires"];
}
message Oauth2Proto {
int64 Mid = 1 [(gogoproto.jsontag) = "mid"];
string UnionID = 2 [(gogoproto.jsontag) = "unionid"];
string OpenID = 3 [(gogoproto.jsontag) = "openid"];
int32 Platform = 4 [(gogoproto.jsontag) = "platform"];
string AppID = 5 [(gogoproto.jsontag) = "appid"];
string Token = 6 [(gogoproto.jsontag) = "token"];
int64 Expires = 7 [(gogoproto.jsontag) = "expires"];
}

View File

@@ -0,0 +1,12 @@
package model
// WeiboAccessResp weibo access response
type WeiboAccessResp struct {
Token string `json:"access_token"`
Refresh string `json:"refresh_token"`
Expires int64 `json:"expires_in"` // access_token的生命周期单位是秒数
OpenID string `json:"uid"`
Code int `json:"error_code"`
Error string `json:"error"`
Description string `json:"error_description"`
}