auth

package
v0.0.0-...-1fffc49 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 6, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AuthPubKey *rsa.PublicKey
View Source
var PriKey *rsa.PrivateKey

Functions

func InitAuth

func InitAuth() errors.WTError

func SendGetRequests

func SendGetRequests(u string, values url.Values) (string, errors.WTError)

func SendRequests

func SendRequests(data any, u string, r RespInterface) (*http.Response, errors.WTError)

func Verify

func Verify(w http.ResponseWriter, r *http.Request) (res bool)

func WriteResp

func WriteResp(w http.ResponseWriter, status string)

func WriteRespFail

func WriteRespFail(w http.ResponseWriter)

func WriteRespSuccess

func WriteRespSuccess(w http.ResponseWriter)

Types

type AuthResp

type AuthResp struct {
	Code string `json:"code"`
	Msg  string `json:"msg,omitempty"`
}

type CheckEmailTokenData

type CheckEmailTokenData struct {
	IsOK bool `json:"isOK"`
}

type CheckEmailTokenReq

type CheckEmailTokenReq struct {
	Token string `json:"token"`
	Email string `json:"email"`
}

type CheckEmailTokenResp

type CheckEmailTokenResp struct {
	Resp
	Data CheckEmailTokenData `json:"data"`
}

type CheckLoginTokenData

type CheckLoginTokenData struct {
	IsLogin bool         `json:"isLogin"`
	User    UserEasy     `json:"user"`
	Data    UserData     `json:"data"`
	Info    UserInfoEsay `json:"info"`
}

type CheckLoginTokenReq

type CheckLoginTokenReq struct {
	Token string `json:"token"`
}

type CheckLoginTokenResp

type CheckLoginTokenResp struct {
	Resp
	Data CheckLoginTokenData `json:"data"`
}

type CheckPhoneTokenData

type CheckPhoneTokenData struct {
	IsOK bool `json:"isOK"`
}

type CheckPhoneTokenReq

type CheckPhoneTokenReq struct {
	Token string `json:"token"`
	Phone string `json:"phone"`
}

type CheckPhoneTokenResp

type CheckPhoneTokenResp struct {
	Resp
	Data CheckPhoneTokenData `json:"data"`
}

type CheckSecondFATokenData

type CheckSecondFATokenData struct {
	IsOK bool `json:"isOK"`
}

type CheckSecondFATokenReq

type CheckSecondFATokenReq struct {
	Token  string `json:"token"`
	UserID string `json:"userID"`
}

type CheckSecondFATokenResp

type CheckSecondFATokenResp struct {
	Resp
	Data CheckSecondFATokenData `json:"data"`
}

type CreateDefrayData

type CreateDefrayData struct {
	Token   string `json:"token"`
	TradeID string `json:"tradeID"`
}

type CreateDefrayReq

type CreateDefrayReq struct {
	OwnerID            string `json:"ownerID,optional"`
	Subject            string `json:"subject"`   // 标题
	Price              int64  `json:"price"`     // 价格
	Quantity           int64  `json:"quantity"`  // 数量
	UnitPrice          int64  `json:"unitPrice"` // 单价
	Describe           string `json:"describe"`  // 描述
	InvitePre          int64  `json:"invitePre,optional"`
	DistributionLevel1 int64  `json:"distributionLevel1,optional"`
	DistributionLevel2 int64  `json:"distributionLevel2,optional"`
	DistributionLevel3 int64  `json:"distributionLevel3,optional"`
	CanWithdraw        bool   `json:"canWithdraw"`
	ReturnURL          string `json:"returnURL"`
	MustSelfDefray     bool   `json:"mustSelfDefray"`
}

type CreateDefrayResp

type CreateDefrayResp struct {
	Resp
	Data CreateDefrayData `json:"data"`
}

type QueryDefrayData

type QueryDefrayData struct {
	Status       string `json:"status"`
	PayerID      string `json:"payerID"`
	PayAt        int64  `json:"payAt"`
	ReturnAt     int64  `json:"returnAt"`
	ReturnReason string `json:"returnReason"`
}

type QueryDefrayReq

type QueryDefrayReq struct {
	TradeID string `json:"tradeID"`
}

type QueryDefrayResp

type QueryDefrayResp struct {
	Resp
	Data QueryDefrayData `json:"data"`
}

type Resp

type Resp struct {
	Code       string `json:"code"`
	SubCode    string `json:"subCode"`
	NumCode    int64  `json:"_code"`
	NumSubCode int64  `json:"_subCode"`
	Msg        string `json:"msg,omitempty"`
}

func (Resp) GetCode

func (r Resp) GetCode() string

func (Resp) GetMsg

func (r Resp) GetMsg() string

func (Resp) GetSubCode

func (r Resp) GetSubCode() string

type RespInterface

type RespInterface interface {
	GetCode() string
	GetSubCode() string
	GetMsg() string
}

type ReturnDefrayReq

type ReturnDefrayReq struct {
	TradeID string `json:"tradeID"`
	Reason  string `json:"reason"`
	Must    bool   `json:"must"`
}

type SendAuditReq

type SendAuditReq struct {
	UserID  string `json:"userID"`
	Content string `json:"content"`
}

type SendMsgData

type SendMsgData struct {
	Have    bool `json:"have"`
	Success bool `json:"success"`
}

type SendMsgReq

type SendMsgReq struct {
	UserID  string `json:"userID"`
	Title   string `json:"title"`
	Content string `json:"content"`
}

type SendMsgResp

type SendMsgResp struct {
	Resp
	Data SendMsgData `json:"data"`
}

type SendWorkOrder

type SendWorkOrder struct {
	UserID  string              `json:"userID"`
	Title   string              `json:"title"`
	Content string              `json:"content"`
	File    []SendWorkOrderFile `json:"file"`
}

type SendWorkOrderFile

type SendWorkOrderFile struct {
	FileName string `json:"fileName"`
	File     string `json:"file"`
}

type UserData

type UserData struct {
	HasPassword             bool   `json:"hasPassword"`
	HasEmail                bool   `json:"hasEmail"`
	Has2FA                  bool   `json:"has2FA"`
	HasWeChat               bool   `json:"hasWeChat"`
	HasUnionID              bool   `json:"hasUnionId"`
	HasVerified             bool   `json:"hasVerified"`
	IsCompany               bool   `json:"isCompany"`
	HasUserOriginal         bool   `json:"hasUserOriginal"`
	HasUserFaceCheck        bool   `json:"hasUserFaceCheck"`
	HasCompanyOriginal      bool   `json:"hasCompanyOriginal"`
	HasLegalPersonFaceCheck bool   `json:"hasLegalPersonFaceCheck"`
	VerifiedPhone           string `json:"verifiedPhone,omitempty"`
}

type UserEasy

type UserEasy struct {
	UID            string `json:"id"`
	Phone          string `json:"phone"`
	RoleID         int64  `json:"roleID,omitempty"`
	RoleName       string `json:"roleName"`
	UserName       string `json:"userName,omitempty"`
	NickName       string `json:"nickname,omitempty"`
	Header         string `json:"header,omitempty"`
	Email          string `json:"email,omitempty"`
	UserRealName   string `json:"userRealName,omitempty"`
	CompanyName    string `json:"companyName,omitempty"`
	WeChatNickName string `json:"wechatNickName,omitempty"`
	WeChatHeader   string `json:"wechatHeader,omitempty"`
	UnionID        string `json:"unionID,omitempty"`
	Signin         bool   `json:"signin"`
	Status         string `json:"status"`
}

type UserInfoEsay

type UserInfoEsay struct {
	HasVerified bool   `json:"hasVerified"`
	UserName    string `json:"userName"`

	IsCompany       bool   `json:"isCompany"`
	LegalPersonName string `json:"legalPersonName,omitempty"`
	CompanyName     string `json:"companyName,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL