rest

package
v0.0.0-...-3311072 Latest Latest
Warning

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

Go to latest
Published: May 24, 2020 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeaderAccept          = "Accept"
	HeaderContentType     = "Content-Type"
	HeaderApplicationJSON = "application/json"
)

comm http header

View Source
const (
	SourceWechat = "wx"
	SourceApp    = "app"
	SourceWeb    = "web"
)

user source

View Source
const (
	UserTypeNormal     = "normal"  // normal user
	UserTypeOrg        = "org"     // organization
	UserTypeAdmin      = "admin"   // admin
	UserTypeOrgCharity = "charity" // charity
)

user type

View Source
const (
	PubTypeDonate     = "donate"     // donation by aid user
	PubTypeReceive    = "receive"    // receive by aided user
	PubTypeDistribute = "distribute" // distribute by third part user
)

publicity type

View Source
const (
	PayTypeOffline    = "offline"    // offline payment
	PayTypeWeChat     = "wechat"     // wechat payment
	PayTypeAliPay     = "alipay"     // alipay
	PayTypeUnionPay   = "unionpay"   // unionpay
	PayTypeCreditCard = "creditcard" // creditcard
)

pay type

View Source
const (
	PageLimit      = 10                // default page limit
	PageNum        = 1                 // default page number
	TenDayBySecond = 10 * 24 * 60 * 60 // seconds of ten days
)

query page default value

View Source
const (
	AddrReg      = "reg"      // user register address
	AddrShipping = "shipping" // user shipping address
	AddrBilling  = "billing"  // user billing address
)

the type of addresses

View Source
const (
	ImageAvatar     = "avatar" // avatar image of user
	ImageProof      = "proof"  // proof image of donation
	ImageIDCardHead = "head"   // front image of id card
	ImageIDCardBack = "back"   // back image of id card
)

the type of image

View Source
const (
	DonatedTypeFunds    = "funds"    // funds of donation
	DonatedTypeSupplies = "supplies" // supplies of donation
)

the type of items donated

View Source
const (
	Prove = "prove" // donation prove of share
	Home  = "home"  // home of share
)

the type of share

View Source
const (
	DrawTitle           = "众行公益链"                     // title of draw
	DrawIcon            = "csiabb.png"                // icon url of draw
	DrawImageURL        = "home_share.png"            // home image url of draw
	DrawHomeContent     = "体验区块链技术!众行公益链邀请您一起,见证爱心行动" // home content of draw
	DrawDonationContent = "你的爱心行动被永久登记到区块链啦~你也来试试吧"   // donation content of draw
)

define default info of share

View Source
const (
	Width     = 750 // width of donation prove image
	SubWidth  = 655 // subWith of donation prove image
	SubHeight = 597 // subHeight of donation prove image
)

define length and width of donation image

View Source
const (
	QrCodeSize = 120       // qr code size
	QRContent  = "长按识别二维码" // qr code content
)

define information of qr

View Source
const (
	RedisSet      = "SET"
	RedisGet      = "GET"
	RedisExpireAt = "EXPIREAT"
)

define redis cmd

View Source
const (
	SuccCode                  = 0    // succeed
	InvalidParamsErrCode      = 1000 // params invalid
	MissingParamsErrCode      = 1001 // missing params
	ParseRequestParamsError   = 1002 // parse request params error
	DatabaseOperationFailed   = 1003 // database operate failed
	SerializeDataFail         = 1004 // serialize data fail
	DeserializeDataFail       = 1005 // deserialize data fail
	DatabaseUnavailable       = 1007 // database not available
	DatabaseDisabled          = 1008 // database disabled
	PermissionDenied          = 1009 // permission denied
	InternalServerFailure     = 1012 // internal server failure
	RepeatRegistration        = 1013 // repeat registration
	PubToBlockChainFailure    = 1014 // publicity to block chain failure
	BlockChainCallBackTimeout = 1015 // block chain call back timeout
)

common error code

View Source
const (
	WXLoginFailed     = 2100 // server login failed
	WXUnboundDID      = 2101 // wechat account not bind, not auth
	WXAlreadyboundDID = 2102 // wechat account not bind, auth fine
	WhitelistNotExist = 2103 // user not in white list
)

wechat error code

Variables

This section is empty.

Functions

This section is empty.

Types

type CommonResponse

type CommonResponse struct {
	Code int         `json:"code"`
	Msg  string      `json:"msg"`
	Data interface{} `json:"data"`
}

CommonResponse common rest response

func ErrorResponse

func ErrorResponse(errCode int, msg string) *CommonResponse

ErrorResponse generate error response Param code: error code Param msg: additional messages for the error, can be nil

func SuccessResponse

func SuccessResponse(data interface{}) *CommonResponse

SuccessResponse generate success response

Jump to

Keyboard shortcuts

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