helper

package
v0.0.0-...-ae394c8 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ValidateSignatureError int = -40001
	ParseXmlError          int = -40002
	ComputeSignatureError  int = -40003
	IllegalAesKey          int = -40004
	ValidateCorpidError    int = -40005
	EncryptAESError        int = -40006
	DecryptAESError        int = -40007
	IllegalBuffer          int = -40008
	EncodeBase64Error      int = -40009
	DecodeBase64Error      int = -40010
	GenXmlError            int = -40010
	ParseJsonError         int = -40012
	GenJsonError           int = -40013
	IllegalProtocolType    int = -40014
)
View Source
const (
	Permission int64 = iota
	PermissionGroupPermission
	PermissionGroup
	RolePermission
	Role
	RoleGroup
	RoleGroupPermission
	UserPermission
	Enterprise
	UserT
	FilesT
	MinioUrlFileName
	Department
	UserCredentials
	Member
	UserProfession
	Position
	ApplicationRecord
	PageResource
	InterfaceResource
	PageInterface
	MenuResource
	User
	UserClient
	Sms
	Project
	ProjectEnterpriseRelation
	ProjectMember
	ProjectPost
	UserEntry
	EnterpriseUser

	UserRealNameAuthenticationLog

	EnterpriseAreaPermission

	EnterpriseUserAttachment

	TurnoverRecord

	TemporaryWorker
	LogisticsPurchase

	LogisticsWarehousing
	LogisticsDelivery
	WorkSchedule
	WorkSchedulePost

	PatrolPoint

	PatrolRoute

	PatrolRoutePoint
	PatrolRouteRecord
	PatrolRouteRecordPoint
	InspectionPoint
	InspectionPlan
	InspectionPlanUser
	InspectionPlanPoint
)

Variables

This section is empty.

Functions

func Config

func Config()

Config 从 config.yaml 文件中读取配置信息,并将这些信息设置为环境变量

func Daemon

func Daemon()

Daemon 守护进程

func GetRedSyncMutex

func GetRedSyncMutex(key string, pool *redis.Pool, options ...redsync.Option) (*redsync.Mutex, error)

GetRedSyncMutex 配置超时参数"redsync.WithTries(1000), redsync.WithExpiry(time.Second*20)"

func GetRid

func GetRid(table int64) int64

func Rid

func Rid(table int64) string

func UnlockRedSyncMutex

func UnlockRedSyncMutex(in *redsync.Mutex)

Types

type Business

type Business struct {
	// contains filtered or unexported fields
}

type CDATA

type CDATA struct {
	Value string `xml:",cdata"`
}

type CryptError

type CryptError struct {
	ErrCode int
	ErrMsg  string
}

func NewCryptError

func NewCryptError(err_code int, err_msg string) *CryptError

type DingTalkCrypto

type DingTalkCrypto struct {
	Token          string
	EncodingAESKey string
	SuiteKey       string
	BKey           []byte
	Block          cipher.Block
}

func NewDingTalkCrypto

func NewDingTalkCrypto(token, encodingAESKey, suiteKey string) *DingTalkCrypto

func (*DingTalkCrypto) GetDecryptMsg

func (c *DingTalkCrypto) GetDecryptMsg(signature, timestamp, nonce, secretMsg string) (string, error)

func (*DingTalkCrypto) GetEncryptMsg

func (c *DingTalkCrypto) GetEncryptMsg(msg, timestamp, nonce string) (string, string, error)

type GormDb

type GormDb struct {
	DataSource string
	Db         *gorm.DB
}

func InitGormDbByDataSourceName

func InitGormDbByDataSourceName(dbName string) GormDb

func RegisterGormMysql

func RegisterGormMysql() GormDb

type LarkCrypto

type LarkCrypto struct {
	Token          string
	EncodingAESKey string
	BKey           []byte
	Block          cipher.Block
}

func NewLarkCrypto

func NewLarkCrypto() *LarkCrypto

func (*LarkCrypto) GetDecryptMsg

func (self *LarkCrypto) GetDecryptMsg(signature, timestamp, nonce string, msg []byte) (string, error)

type ProtocolProcessor

type ProtocolProcessor interface {
	// contains filtered or unexported methods
}

type ProtocolType

type ProtocolType int
const (
	XmlType ProtocolType = 1
)

type Redis

type Redis struct {
	Url         string
	MaxIdle     int
	IdleTimeout time.Duration
	MaxActive   int
	Pool        *redis.Pool
	Wait        bool
	Password    string
}
var RS *Redis

func RegisterRedis

func RegisterRedis() *Redis

func (*Redis) CloseRedis

func (r *Redis) CloseRedis()

func (*Redis) CloseRedisConn

func (r *Redis) CloseRedisConn(c redis.Conn)

func (*Redis) Del

func (r *Redis) Del(key string) (interface{}, error)

func (*Redis) DeleteBatchByKey

func (r *Redis) DeleteBatchByKey(delKeys []string) error

DeleteBatchByKey 批量删除key

func (*Redis) Expire

func (r *Redis) Expire(key string, seconds int) error

func (*Redis) Get

func (r *Redis) Get(key string) (interface{}, error)

func (*Redis) GetListLen

func (r *Redis) GetListLen(key string) (interface{}, error)

func (*Redis) GetString

func (r *Redis) GetString(key string) (string, error)

func (*Redis) HDel

func (r *Redis) HDel(name, key string) (interface{}, error)

func (*Redis) HGet

func (r *Redis) HGet(name, key string) (interface{}, error)

func (*Redis) HGetAll

func (r *Redis) HGetAll(name string) (map[string]string, error)

func (*Redis) HIncrby

func (r *Redis) HIncrby(name, key string) (interface{}, error)

func (*Redis) HIncrbyIncrement

func (r *Redis) HIncrbyIncrement(name, key string, increment int) (interface{}, error)

func (*Redis) HMSet

func (r *Redis) HMSet(key string, value interface{}) error

func (*Redis) HSet

func (r *Redis) HSet(name, key string, value interface{}) error

func (*Redis) LPush

func (r *Redis) LPush(name, key string) error

func (*Redis) LREM

func (r *Redis) LREM(key string, value string, count int) (interface{}, error)

func (*Redis) LRange

func (r *Redis) LRange(key string, start, end int) (interface{}, error)

func (*Redis) MGet

func (r *Redis) MGet(key string) (interface{}, error)

func (*Redis) RPop

func (r *Redis) RPop(key string) (interface{}, error)

func (*Redis) SAdd

func (r *Redis) SAdd(key string, value string) (interface{}, error)

func (*Redis) SIsmembers

func (r *Redis) SIsmembers(key string, value string) (interface{}, error)

func (*Redis) SMembers

func (r *Redis) SMembers(key string) (interface{}, error)

func (*Redis) Set

func (r *Redis) Set(key, value string) error

func (*Redis) SetEx

func (r *Redis) SetEx(key string, seconds int, value string) error

func (*Redis) ZAdd

func (r *Redis) ZAdd(key string, score int64, value string) (interface{}, error)

func (*Redis) ZMaxWithScore

func (r *Redis) ZMaxWithScore(key string, max int64) (interface{}, error)

func (*Redis) ZMinWithScore

func (r *Redis) ZMinWithScore(key string, min int64) (interface{}, error)

func (*Redis) ZRang

func (r *Redis) ZRang(key string, min int64, max int64) (interface{}, error)

func (*Redis) ZRangWithScore

func (r *Redis) ZRangWithScore(key string, min int64, max int64) (interface{}, error)

type SMap

type SMap struct {
	sync.RWMutex
	Map map[int64]*Business
}

type WXBizMsg4Recv

type WXBizMsg4Recv struct {
	Tousername string `xml:"ToUserName"`
	Encrypt    string `xml:"Encrypt"`
	Agentid    string `xml:"AgentID"`
}

type WXBizMsg4Send

type WXBizMsg4Send struct {
	XMLName   xml.Name `xml:"xml"`
	Encrypt   CDATA    `xml:"Encrypt"`
	Signature CDATA    `xml:"MsgSignature"`
	Timestamp string   `xml:"TimeStamp"`
	Nonce     CDATA    `xml:"Nonce"`
}

func NewWXBizMsg4Send

func NewWXBizMsg4Send(encrypt, signature, timestamp, nonce string) *WXBizMsg4Send

type WXBizMsgCrypt

type WXBizMsgCrypt struct {
	// contains filtered or unexported fields
}

func NewWXBizMsgCrypt

func NewWXBizMsgCrypt(receiver_id string) *WXBizMsgCrypt

func (*WXBizMsgCrypt) DecryptMsg

func (self *WXBizMsgCrypt) DecryptMsg(msg_signature, timestamp, nonce string, post_data []byte) ([]byte, string, *CryptError)

func (*WXBizMsgCrypt) EncryptMsg

func (self *WXBizMsgCrypt) EncryptMsg(reply_msg, timestamp, nonce string) ([]byte, *CryptError)

func (*WXBizMsgCrypt) ParsePlainText

func (self *WXBizMsgCrypt) ParsePlainText(plaintext []byte) ([]byte, uint32, []byte, []byte, *CryptError)

func (*WXBizMsgCrypt) VerifyURL

func (self *WXBizMsgCrypt) VerifyURL(msg_signature, timestamp, nonce, echostr string) ([]byte, string, *CryptError)

type XmlProcessor

type XmlProcessor struct {
}

Jump to

Keyboard shortcuts

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