http_api

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TextSystemUpgrade = "The service is under maintenance, please try again later."
)

Variables

This section is empty.

Functions

func CaptureMessage added in v1.2.0

func CaptureMessage(msg string)

func NewGormDB added in v1.2.0

func NewGormDB(addr, user, password, dbName string, maxOpenConn, maxIdleConn int) (*gorm.DB, error)

func NewGormDBWithLog added in v1.2.0

func NewGormDBWithLog(addr, user, password, dbName string, maxOpenConn, maxIdleConn int, log *mylog.Logger) (*gorm.DB, error)

func RecoverPanic added in v1.2.0

func RecoverPanic()

func ReqIdMiddleware added in v1.2.0

func ReqIdMiddleware() gin.HandlerFunc

func SendReq

func SendReq(url string, req, data interface{}) error

func SentryInit added in v1.2.0

func SentryInit(dsn string) (err error)

func VerifySignature

func VerifySignature(signType common.DasAlgorithmId, signMsg, signature, address string) (bool, string, error)

Types

type ApiCode

type ApiCode = int
const (
	ApiCodeSuccess        ApiCode = 0
	ApiCodeError500       ApiCode = 500
	ApiCodeParamsInvalid  ApiCode = 10000
	ApiCodeMethodNotExist ApiCode = 10001
	ApiCodeDbError        ApiCode = 10002
	ApiCodeCacheError     ApiCode = 10003

	ApiCodeTransactionNotExist ApiCode = 11001
	//ApiCodePermissionDenied    ApiCode = 11002
	ApiCodeNotSupportAddress   ApiCode = 11005
	ApiCodeInsufficientBalance ApiCode = 11007
	ApiCodeTxExpired           ApiCode = 11008
	ApiCodeAmountInvalid       ApiCode = 11010
	ApiCodeRejectedOutPoint    ApiCode = 11011
	ApiCodeSyncBlockNumber     ApiCode = 11012
	ApiCodeOperationFrequent   ApiCode = 11013
	ApiCodeNotEnoughChange     ApiCode = 11014
	ApiCodeTransactionSendFail ApiCode = 11015
)

common

const (
	ApiCodeReverseAlreadyExist ApiCode = 12001
	ApiCodeReverseNotExist     ApiCode = 12002
)

reverse

const (
	ApiCodeAccountFormatInvalid   ApiCode = 20006
	ApiCodeIndexerAccountNotExist ApiCode = 20007
	ApiCodeAccountOnLock          ApiCode = 20008
)

account-indexer

const (
	ApiCodeNotOpenForRegistration       ApiCode = 30001
	ApiCodeAccountNotExist              ApiCode = 30003
	ApiCodeAccountAlreadyRegister       ApiCode = 30004
	ApiCodeAccountLenInvalid            ApiCode = 30014
	ApiCodeOrderNotExist                ApiCode = 30006
	ApiCodeAccountIsExpired             ApiCode = 30010
	ApiCodePermissionDenied             ApiCode = 30011
	ApiCodeAccountContainsInvalidChar   ApiCode = 30015
	ApiCodeReservedAccount              ApiCode = 30017
	ApiCodeInviterAccountNotExist       ApiCode = 30018
	ApiCodeSystemUpgrade                ApiCode = 30019
	ApiCodeRecordInvalid                ApiCode = 30020
	ApiCodeRecordsTotalLengthExceeded   ApiCode = 30021
	ApiCodeSameLock                     ApiCode = 30023
	ApiCodeChannelAccountNotExist       ApiCode = 30026
	ApiCodeOrderPaid                    ApiCode = 30027
	ApiCodeUnAvailableAccount           ApiCode = 30029
	ApiCodeAccountStatusNotNormal       ApiCode = 30031 //repeat
	ApiCodeAccountStatusOnSaleOrAuction ApiCode = 30031
	ApiCodePayTypeInvalid               ApiCode = 30032
	ApiCodeSameOrderInfo                ApiCode = 30033
	ApiCodeSigErr                       ApiCode = 30034 // contracte -31
	ApiCodeOnCross                      ApiCode = 30035
	ApiCodeSubAccountNotEnabled         ApiCode = 30036
	ApiCodeParentAccountExpired         ApiCode = 30036
	ApiCodeAfterGracePeriod             ApiCode = 30037
	ApiCodeCouponInvalid                ApiCode = 30038
	ApiCodeCouponUsed                   ApiCode = 30039
	ApiCodeCouponUnopen                 ApiCode = 30040
	ApiCodeReverseSmtPending            ApiCode = 30040
	ApiCodeAccountStatusOnCross         ApiCode = 30041
	ApiCodeNoAccountPermissions         ApiCode = 30042
	ApiCodeRecommendAccEmpty            ApiCode = 30043

	ApiCodeAuctionAccountNotFound ApiCode = 30404
	ApiCodeAuctionAccountBided    ApiCode = 30405
	ApiCodeAuctionOrderNotFound   ApiCode = 30406
	ApiCodeInvalidTargetAddress   ApiCode = 30407
	ApiCodeTooManyRecords         ApiCode = 30408
	ApiCodeNotYetDueForRecycle    ApiCode = 30409
	ApiCodeAnyLockAddressInvalid  ApiCode = 30410
)

register

const (
	ApiCodeEnableSubAccountIsOn               ApiCode = 40000
	ApiCodeNotExistEditKey                    ApiCode = 40001
	ApiCodeNotExistConfirmAction              ApiCode = 40002
	ApiCodeSignError                          ApiCode = 40003
	ApiCodeNotExistSignType                   ApiCode = 40004
	ApiCodeNotSubAccount                      ApiCode = 40005
	ApiCodeEnableSubAccountIsOff              ApiCode = 40006
	ApiCodeCreateListCheckFail                ApiCode = 40007
	ApiCodeTaskInProgress                     ApiCode = 40008
	ApiCodeDistributedLockPreemption          ApiCode = 40009
	ApiCodeRecordDoing                        ApiCode = 40010
	ApiCodeUnableInit                         ApiCode = 40011
	ApiCodeNotHaveManagementPermission        ApiCode = 40012
	ApiCodeSmtDiff                            ApiCode = 40013
	ApiCodeSuspendOperation                   ApiCode = 40014
	ApiCodeTaskNotExist                       ApiCode = 40015
	ApiCodeSameCustomScript                   ApiCode = 40016
	ApiCodeNotExistCustomScriptConfigPrice    ApiCode = 40017
	ApiCodeCustomScriptSet                    ApiCode = 40018
	ApiCodeProfitNotEnough                    ApiCode = 40019
	ApiCodeNoSupportPaymentToken              ApiCode = 40020
	ApiCodeSubAccOrderNotExist                ApiCode = 40021 //remove
	ApiCodeRuleDataErr                        ApiCode = 40022
	ApiCodeParentAccountNotExist              ApiCode = 40023
	ApiCodeSubAccountMinting                  ApiCode = 40024
	ApiCodeSubAccountMinted                   ApiCode = 40025
	ApiCodeBeyondMaxYears                     ApiCode = 40026
	ApiCodeHitBlacklist                       ApiCode = 40027
	ApiCodeNoTSetRules                        ApiCode = 40028
	ApiCodeTokenIdNotSupported                ApiCode = 40029
	ApiCodeNoSubAccountDistributionPermission ApiCode = 40030
	ApiCodeSubAccountNoEnable                 ApiCode = 40031
	ApiCodeAutoDistributionClosed             ApiCode = 40032
	ApiCodeAccountCanNotBeEmpty               ApiCode = 40033
	ApiCodePriceRulePriceNotBeLessThanMin     ApiCode = 40034
	ApiCodePriceMostReserveTwoDecimal         ApiCode = 40035
	ApiCodeConfigSubAccountPending            ApiCode = 40036
	ApiCodeAccountRepeat                      ApiCode = 40037
	ApiCodeInListMostBeLessThan1000           ApiCode = 40038
	ApiCodePreservedRulesMostBeOne            ApiCode = 40039
	ApiCodeRuleSizeExceedsLimit               ApiCode = 40040
	ApiCodeRuleFormatErr                      ApiCode = 40041
	ApiCodeExceededMaxLength                  ApiCode = 40042
	ApiCodeInvalidCharset                     ApiCode = 40043
	ApiCodeAccountNameErr                     ApiCode = 40044
	ApiCodeAccountLengthMostBeLessThan42      ApiCode = 40045
	ApiCodeAccountCharsetNotSupport           ApiCode = 40046
	ApiCodeAccountExpiringSoon                ApiCode = 40047
	ApiCodeUSDPricingTooLow                   ApiCode = 40048
	ApiCodeUSDPricingBelowMin                 ApiCode = 40049
	ApiCodeAccountRenewNoSupportCustomScript  ApiCode = 40050
	ApiCodeSubAccountRenewing                 ApiCode = 40051
	ApiCodeApprovalAlreadyExist               ApiCode = 40052
	ApiCodeAccountApprovalNotExist            ApiCode = 40053
	ApiCodeAccountApprovalProtected           ApiCode = 40054
	ApiCodeCouponCidNotExist                  ApiCode = 40055
	ApiCodeCouponPaid                         ApiCode = 40056
	ApiCodeCouponUnpaid                       ApiCode = 40057
	ApiCodeUnauthorized                       ApiCode = 40058
	ApiCodeCouponOpenTimeNotArrived           ApiCode = 40059
	ApiCodeCouponExpired                      ApiCode = 40060
	ApiCodeCouponErrAccount                   ApiCode = 40061
	ApiCodeOrderClosed                        ApiCode = 40062
)

sub_account

const (
	ApiCodeHasNoAccessToCreate  ApiCode = 60000
	ApiCodeCreateConfigCellFail ApiCode = 60001
	ApiCodeHasNoAccessToRemove  ApiCode = 60002
)

multi_device

const (
	ApiCodeUnipayOrderNotExist  ApiCode = 600000 //remove
	ApiCodeOrderUnPaid          ApiCode = 600001
	ApiCodePaymentNotExist      ApiCode = 600002
	ApiCodeAmountIsTooLow       ApiCode = 600003
	ApiCodePaymentMethodDisable ApiCode = 600004
)

unipay - 600XXX

const (
	ApiCodeServiceNotActivated    ApiCode = 601000
	ApiCodeAddressStatusNotNormal ApiCode = 601001
	ApiCodeUnsupportedAddrChain   ApiCode = 601002
	ApiCodeUnsupportedSignType    ApiCode = 601003
	ApiCodeIpBlockingAccess       ApiCode = 601004
	ApiCodeKeyDiff                ApiCode = 601005
	ApiCodeWalletAddrNotExist     ApiCode = 601006
)

remote_sign - 601XXX

const (
	ApiCodeUserNotExist               ApiCode = 70001
	ApiCodeGroupNotExist              ApiCode = 70002
	ApiCodePadgeNotExist              ApiCode = 70003
	ApiCodeReceiveNotExist            ApiCode = 70004
	ApiCodeInsufficientIssuance       ApiCode = 70005
	ApiCodeDistributeNotExist         ApiCode = 70006
	ApiCodeDeviceNotExist             ApiCode = 70007
	ApiCodeAlreadyBoundUser           ApiCode = 70008
	ApiCodeNotTheManagerOfDevice      ApiCode = 70009
	ApiCodeDeviceAlreadyUnboundUser   ApiCode = 70010
	ApiCodeAlreadyMinted              ApiCode = 70011
	ApiCodeInsufficientNumOfAI        ApiCode = 70012
	ApiCodeFailedToVerifySignature    ApiCode = 70013
	ApiCodeIssuerAlreadyExist         ApiCode = 70014
	ApiCodeNotTheManagerOfDid         ApiCode = 70015
	ApiCodeIssuerNotExist             ApiCode = 70016
	ApiCodeDidNotExist                ApiCode = 70017
	ApiCodeNotTheManagerOfPadge       ApiCode = 70017
	ApiCodePadgeAlreadyBoundIssuer    ApiCode = 70018
	ApiCodeDeviceAlreadyUnboundPadge  ApiCode = 70019
	ApiCodeDeviceAlreadyBoundPadge    ApiCode = 70020
	ApiCodeIssuanceHasBeenSet         ApiCode = 70021
	ApiCodeDistributeTypeAlreadyExist ApiCode = 70022
	ApiCodeAIFailedToDeduceAINum      ApiCode = 70023
	ApiCodeNumRemainingZero           ApiCode = 70024
	ApiCodeDistributionClosed         ApiCode = 70025
	ApiCodeInsufficientCredit         ApiCode = 70026
	ApiCodeAlreadyReceived            ApiCode = 70027
	ApiCodeNotInReceiveTime           ApiCode = 70028
	ApiCodeDeviceLinkUsed             ApiCode = 70029
	ApiCodeDidAlreadyMinted           ApiCode = 70030
	ApiCodePlatformAlreadyBound       ApiCode = 70031
	ApiCodeDIDRecordInvalid           ApiCode = 70031
	ApiCodeDIDAliasInvalid            ApiCode = 70032
	ApiCodeNotEnoughSlots             ApiCode = 70033
	ApiCodeLoginTimeExpired           ApiCode = 70034
)

padge

type ApiResp

type ApiResp struct {
	ErrNo  ApiCode     `json:"err_no"`
	ErrMsg string      `json:"err_msg"`
	Data   interface{} `json:"data"`
}

func ApiRespErr

func ApiRespErr(errNo ApiCode, errMsg string) ApiResp

func ApiRespOK

func ApiRespOK(data interface{}) ApiResp

func SendReqV2 added in v1.2.0

func SendReqV2(url string, req, data interface{}) (*ApiResp, error)

func (*ApiResp) ApiRespErr

func (a *ApiResp) ApiRespErr(errNo ApiCode, errMsg string)

func (*ApiResp) ApiRespOK

func (a *ApiResp) ApiRespOK(data interface{})

type GormLogger added in v1.2.0

type GormLogger struct {
	Log *mylog.Logger
}

func (*GormLogger) Error added in v1.2.0

func (g *GormLogger) Error(ctx context.Context, msg string, data ...interface{})

func (*GormLogger) Info added in v1.2.0

func (g *GormLogger) Info(ctx context.Context, msg string, data ...interface{})

func (*GormLogger) LogMode added in v1.2.0

func (g *GormLogger) LogMode(level logger.LogLevel) logger.Interface

func (*GormLogger) Trace added in v1.2.0

func (g *GormLogger) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error)

func (*GormLogger) Warn added in v1.2.0

func (g *GormLogger) Warn(ctx context.Context, msg string, data ...interface{})

type JsonRequest

type JsonRequest struct {
	ID      interface{}     `json:"id"`
	JsonRpc string          `json:"jsonrpc"`
	Method  string          `json:"method"`
	Params  json.RawMessage `json:"params"`
}

type JsonResponse

type JsonResponse struct {
	ID      interface{} `json:"id"`
	JsonRpc string      `json:"jsonrpc"`
	Result  interface{} `json:"result"`
}

func (*JsonResponse) ResultData

func (j *JsonResponse) ResultData(data interface{})

type SignInfo

type SignInfo struct {
	SignKey     string               `json:"sign_key"`               // sign tx key
	SignAddress string               `json:"sign_address,omitempty"` // sign address
	SignList    []txbuilder.SignData `json:"sign_list"`              // sign list
	MMJson      *common.MMJsonObj    `json:"mm_json"`                // 712 mmjson
}

func (*SignInfo) SignListString

func (s *SignInfo) SignListString() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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