config

package
v0.0.0-...-312ee99 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProductStatusNormal       = 0 //商品状态正常
	ProductStatusSaleOut      = 1 //商品售罄
	ProductStatusForceSaleOut = 2 //商品强制售罄
)

Variables

View Source
var CoreCtx = &SkAppCtx{}
View Source
var Logger log.Logger
View Source
var SecLayerCtx = &SecLayerContext{
	Read2HandleChan:  make(chan *SecRequest, 1024),
	Handle2WriteChan: make(chan *SecResult, 1024),
	HistoryMap:       make(map[int]*srv_user.UserBuyHistory, 1024),
	ProductCountMgr:  srv_product.NewProductCountMgr(),
}
View Source
var ZipkinTracer *zipkin.Tracer

Functions

This section is empty.

Types

type SecLayerContext

type SecLayerContext struct {
	RWSecProductLock sync.RWMutex

	WaitGroup sync.WaitGroup

	Read2HandleChan  chan *SecRequest
	Handle2WriteChan chan *SecResult

	HistoryMap     map[int]*srv_user.UserBuyHistory
	HistoryMapLock sync.Mutex

	ProductCountMgr *srv_product.ProductCountMgr //商品计数
}

type SecRequest

type SecRequest struct {
	ProductId     int             `json:"product_id"` //商品ID
	Source        string          `json:"source"`
	AuthCode      string          `json:"auth_code"`
	SecTime       int64           `json:"sec_time"`
	Nance         string          `json:"nance"`
	UserId        int             `json:"user_id"`
	UserAuthSign  string          `json:"user_auth_sign"` //用户授权签名
	ClientAddr    string          `json:"client_addr"`
	ClientRefence string          `json:"client_refence"`
	CloseNotify   <-chan bool     `json:"-"`
	ResultChan    chan *SecResult `json:"-"`
}

type SecResult

type SecResult struct {
	ProductId int    `json:"product_id"` //商品ID
	UserId    int    `json:"user_id"`    //用户ID
	Token     string `json:"token"`      //Token
	TokenTime int64  `json:"token_time"` //Token生成时间
	Code      int    `json:"code"`       //状态码
}

type SkAppCtx

type SkAppCtx struct {
	SecReqChan       chan *SecRequest
	SecReqChanSize   int
	RWSecProductLock sync.RWMutex

	UserConnMap     map[string]chan *SecResult
	UserConnMapLock sync.Mutex
}

Jump to

Keyboard shortcuts

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