Compare commits
No commits in common. "master" and "v1.0.8" have entirely different histories.
|
@ -1,30 +0,0 @@
|
||||||
package sql
|
|
||||||
|
|
||||||
import "strings"
|
|
||||||
|
|
||||||
// key,value To like sql
|
|
||||||
func Like(key, val string) string {
|
|
||||||
if val == "" {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
key = strings.TrimSpace(key)
|
|
||||||
val = strings.TrimSpace(val)
|
|
||||||
return key + " LIKE '%" + val + "%'"
|
|
||||||
}
|
|
||||||
|
|
||||||
// map strings to like sqls
|
|
||||||
func Likes(in map[string]string) string {
|
|
||||||
var ar []string
|
|
||||||
for key, val := range in {
|
|
||||||
sql := Like(key, val)
|
|
||||||
if sql != "" {
|
|
||||||
ar = append(ar, sql)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(ar) == 0 {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
return strings.Join(ar, " AND ")
|
|
||||||
}
|
|
|
@ -24,15 +24,14 @@ func NewPostgreSql(dsn string, options *types.SqlOptions) (*gorm.DB, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//控制台和文件同时输出日志
|
//控制台和文件同时输出日志
|
||||||
//var newLogger = setLogger(vars.ServiceKey, options.LogStdout)
|
var newLogger = setLogger(vars.ServiceKey, options.LogStdout)
|
||||||
|
|
||||||
gormDb, err := gorm.Open(postgres.New(postgres.Config{
|
gormDb, err := gorm.Open(postgres.New(postgres.Config{
|
||||||
DSN: dsn,
|
DSN: dsn,
|
||||||
// PreferSimpleProtocol: true, disables implicit prepared statement usage
|
// PreferSimpleProtocol: true, disables implicit prepared statement usage
|
||||||
|
|
||||||
}), &gorm.Config{
|
}), &gorm.Config{
|
||||||
//Logger:newLogger,
|
Logger: newLogger,
|
||||||
DisableForeignKeyConstraintWhenMigrating: true,
|
|
||||||
NamingStrategy: schema.NamingStrategy{
|
NamingStrategy: schema.NamingStrategy{
|
||||||
SingularTable: true, // 使用单数表名,启用该选项,此时,`User` 的表名应该是 `t_user`
|
SingularTable: true, // 使用单数表名,启用该选项,此时,`User` 的表名应该是 `t_user`
|
||||||
}})
|
}})
|
||||||
|
|
|
@ -21,12 +21,12 @@ var (
|
||||||
JwtSecretLen int
|
JwtSecretLen int
|
||||||
)
|
)
|
||||||
|
|
||||||
func New(token string) {
|
func New() {
|
||||||
JwtSecret = []byte(token)
|
JwtSecret = []byte(env.MeshEnv.JwtSecretKey)
|
||||||
JwtSecretLen = len(env.MeshEnv.JwtSecretKey)
|
JwtSecretLen = len(env.MeshEnv.JwtSecretKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GenerateTokenAes(id uint, identity, client, role string, owner any, extend map[string]string) (string, error) {
|
func GenerateTokenAes(id uint, identity, client, role string, extend map[string]string) (string, error) {
|
||||||
if (JwtSecretLen == 16 || JwtSecretLen == 24 || JwtSecretLen == 32) == false {
|
if (JwtSecretLen == 16 || JwtSecretLen == 24 || JwtSecretLen == 32) == false {
|
||||||
return "", exception.ErrAuthSecret
|
return "", exception.ErrAuthSecret
|
||||||
}
|
}
|
||||||
|
@ -34,9 +34,8 @@ func GenerateTokenAes(id uint, identity, client, role string, owner any, extend
|
||||||
claims := types.JwtClaims{
|
claims := types.JwtClaims{
|
||||||
ID: id,
|
ID: id,
|
||||||
Identity: identity,
|
Identity: identity,
|
||||||
Client: client,
|
|
||||||
Extend: extend,
|
Extend: extend,
|
||||||
Owner: owner,
|
Client: client,
|
||||||
Role: role,
|
Role: role,
|
||||||
ExpiresAt: expireTime.Unix(),
|
ExpiresAt: expireTime.Unix(),
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,32 +14,11 @@ var MeshEnv *types.MeshEnv = nil
|
||||||
func NewEnv() *types.MeshEnv {
|
func NewEnv() *types.MeshEnv {
|
||||||
if MeshEnv == nil {
|
if MeshEnv == nil {
|
||||||
MeshEnv = &types.MeshEnv{
|
MeshEnv = &types.MeshEnv{
|
||||||
Workspace: GetEnvDefault("BlocksMesh_Workspace", "def"),
|
Workspace: GetEnvDefault("BlocksMesh_Workspace", "bsm"),
|
||||||
|
Prefix: GetEnvDefault("BlocksMesh_Prefix", utils.GetCurrentPath()),
|
||||||
JwtSecretKey: GetEnvDefault("BlocksMesh_JwtSecretKey", "Cblocksmesh2022C"),
|
JwtSecretKey: GetEnvDefault("BlocksMesh_JwtSecretKey", "Cblocksmesh2022C"),
|
||||||
RuntimeMode: strings.ToLower(GetEnvDefault("BlocksMesh_RuntimeMode", "dev")),
|
RuntimeMode: strings.ToLower(GetEnvDefault("BlocksMesh_RuntimeMode", "dev")),
|
||||||
}
|
}
|
||||||
|
|
||||||
if MeshEnv.RuntimeMode == "dev" {
|
|
||||||
MeshEnv.Prefix = GetEnvDefault("BlocksMesh_Prefix", utils.GetCurrentPath())
|
|
||||||
} else {
|
|
||||||
MeshEnv.Prefix = GetEnvDefault("BlocksMesh_Prefix", "/usr/local/bsm")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return MeshEnv
|
|
||||||
}
|
|
||||||
|
|
||||||
// get system base env.
|
|
||||||
func NewBaseEnv() *types.MeshEnv {
|
|
||||||
if MeshEnv == nil {
|
|
||||||
MeshEnv = &types.MeshEnv{
|
|
||||||
RuntimeMode: strings.ToLower(GetEnvDefault("BlocksMesh_RuntimeMode", "dev")),
|
|
||||||
}
|
|
||||||
|
|
||||||
if MeshEnv.RuntimeMode == "dev" {
|
|
||||||
MeshEnv.Prefix = GetEnvDefault("BlocksMesh_Prefix", utils.GetCurrentPath())
|
|
||||||
} else {
|
|
||||||
MeshEnv.Prefix = GetEnvDefault("BlocksMesh_Prefix", "/usr/local/bsm")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return MeshEnv
|
return MeshEnv
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,5 +14,4 @@ var (
|
||||||
ErrAuthClient = Errorf(209, "Auth Token Client Not Passed")
|
ErrAuthClient = Errorf(209, "Auth Token Client Not Passed")
|
||||||
ErrJsonDecode = Errorf(210, "Auth JSON Decode Error")
|
ErrJsonDecode = Errorf(210, "Auth JSON Decode Error")
|
||||||
ErrJsonEncode = Errorf(211, "Auth JSON Encode Error")
|
ErrJsonEncode = Errorf(211, "Auth JSON Encode Error")
|
||||||
ErrAccountNotFound = Errorf(202, "Account Not Found")
|
|
||||||
)
|
)
|
||||||
|
|
|
@ -31,8 +31,6 @@ var (
|
||||||
ErrPasswd = Errorf(19, "Password Error")
|
ErrPasswd = Errorf(19, "Password Error")
|
||||||
|
|
||||||
ErrSmsCode = Errorf(20, "SMS Code Invalid")
|
ErrSmsCode = Errorf(20, "SMS Code Invalid")
|
||||||
ErrIdArgument = Errorf(30, "ID Invalid Argument")
|
|
||||||
ErrIdentityArgument = Errorf(31, "Identity Invalid Argument")
|
|
||||||
|
|
||||||
// coustom error status
|
// coustom error status
|
||||||
)
|
)
|
||||||
|
|
2
go.mod
2
go.mod
|
@ -1,3 +1,3 @@
|
||||||
module git.apinb.com/bsm-sdk/engine
|
module git.apinb.com/bsm-sdk/engine
|
||||||
|
|
||||||
go 1.23.3
|
go 1.22
|
|
@ -2,11 +2,12 @@ package service
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"git.apinb.com/bsm-sdk/engine/encipher"
|
||||||
"git.apinb.com/bsm-sdk/engine/exception"
|
"git.apinb.com/bsm-sdk/engine/exception"
|
||||||
"git.apinb.com/bsm-sdk/engine/types"
|
"git.apinb.com/bsm-sdk/engine/types"
|
||||||
|
"git.apinb.com/bsm-sdk/engine/utils"
|
||||||
"google.golang.org/grpc/metadata"
|
"google.golang.org/grpc/metadata"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -23,23 +24,27 @@ func ParseMetaCtx(ctx context.Context, opts *ParseOptions) (*types.JwtClaims, er
|
||||||
return nil, exception.ErrAuthNotFound
|
return nil, exception.ErrAuthNotFound
|
||||||
}
|
}
|
||||||
|
|
||||||
var Authorizations []string = md.Get("authorization_claims")
|
var Authorizations []string = md.Get("authorization")
|
||||||
if len(Authorizations) == 0 || Authorizations[0] == "" {
|
if len(Authorizations) == 0 || Authorizations[0] == "" {
|
||||||
return nil, exception.ErrAuthNotFound
|
return nil, exception.ErrAuthNotFound
|
||||||
}
|
}
|
||||||
|
|
||||||
var claims types.JwtClaims
|
claims, err := encipher.ParseTokenAes(Authorizations[0])
|
||||||
err := json.Unmarshal([]byte(Authorizations[0]), &claims)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, exception.ErrAuthParseFail
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if opts != nil {
|
if opts != nil {
|
||||||
if !strings.Contains(claims.Role, opts.RoleValue) {
|
if !strings.Contains(claims.Role, opts.RoleValue) {
|
||||||
return nil, exception.ErrPermissionDenied
|
return nil, exception.ErrPermissionDenied
|
||||||
}
|
}
|
||||||
|
if opts.MustPrivateAllow {
|
||||||
|
if utils.IsPublicIP(claims.Client) {
|
||||||
|
return nil, exception.ErrPermissionDenied
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return &claims, nil
|
return claims, nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import (
|
||||||
|
|
||||||
"git.apinb.com/bsm-sdk/engine/cmd"
|
"git.apinb.com/bsm-sdk/engine/cmd"
|
||||||
"git.apinb.com/bsm-sdk/engine/configure"
|
"git.apinb.com/bsm-sdk/engine/configure"
|
||||||
|
"git.apinb.com/bsm-sdk/engine/encipher"
|
||||||
"git.apinb.com/bsm-sdk/engine/env"
|
"git.apinb.com/bsm-sdk/engine/env"
|
||||||
"git.apinb.com/bsm-sdk/engine/print"
|
"git.apinb.com/bsm-sdk/engine/print"
|
||||||
"git.apinb.com/bsm-sdk/engine/vars"
|
"git.apinb.com/bsm-sdk/engine/vars"
|
||||||
|
@ -22,6 +23,8 @@ func Register(srvKey string, cfg any) {
|
||||||
// open side cmd.
|
// open side cmd.
|
||||||
cmd.NewCmd()
|
cmd.NewCmd()
|
||||||
|
|
||||||
|
encipher.New()
|
||||||
|
|
||||||
print.Info("[Blocks Service] %s Starting...", vars.ServiceKey)
|
print.Info("[Blocks Service] %s Starting...", vars.ServiceKey)
|
||||||
|
|
||||||
// set config args.
|
// set config args.
|
||||||
|
@ -34,7 +37,7 @@ func Register(srvKey string, cfg any) {
|
||||||
// get config file.
|
// get config file.
|
||||||
cf := fmt.Sprintf("%s_%s.yaml", srvKey, env.MeshEnv.RuntimeMode)
|
cf := fmt.Sprintf("%s_%s.yaml", srvKey, env.MeshEnv.RuntimeMode)
|
||||||
cf = filepath.Join(env.MeshEnv.Prefix, "etc", cf)
|
cf = filepath.Join(env.MeshEnv.Prefix, "etc", cf)
|
||||||
print.Info("[Blocks Service] %s Config File: %s", vars.ServiceKey, cf)
|
|
||||||
configure.LoadYamlFile(cf, args, cfg)
|
configure.LoadYamlFile(cf, args, cfg)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
40
types/db.go
40
types/db.go
|
@ -18,54 +18,48 @@ type (
|
||||||
Debug bool
|
Debug bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// standard ID,Identity definition.
|
|
||||||
Std_IDIdentity struct {
|
|
||||||
ID uint `gorm:"primarykey;" json:"id"`
|
|
||||||
Identity string `gorm:"column:identity;type:varchar(36);uniqueIndex;" json:"identity"` // 唯一标识,24位NanoID,36位为ULID
|
|
||||||
}
|
|
||||||
|
|
||||||
// standard ID,Created,Updated,Deleted definition.
|
// standard ID,Created,Updated,Deleted definition.
|
||||||
Std_IICUDS struct {
|
Std_IICUDS struct {
|
||||||
ID uint `gorm:"primarykey;" json:"id"`
|
ID uint `gorm:"primarykey;"`
|
||||||
Identity string `gorm:"column:identity;type:varchar(36);uniqueIndex;" json:"identity"` // 唯一标识,24位NanoID,36位为ULID
|
Identity string `gorm:"column:identity;type:varchar(36);uniqueIndex;"` // 唯一标识,24位NanoID,36位为UUID
|
||||||
CreatedAt time.Time `json:"created_at"`
|
CreatedAt time.Time
|
||||||
UpdatedAt time.Time `json:"updated_at"`
|
UpdatedAt time.Time
|
||||||
DeletedAt gorm.DeletedAt `gorm:"index;" json:"deleted_at"`
|
DeletedAt gorm.DeletedAt `gorm:"index";`
|
||||||
Status int8 `gorm:"default:0;index;" json:"status"` // 状态:默认为0,-1禁止,1为正常
|
Status int8 `gorm:"default:0;index;"` // 状态:默认为0,-1禁止,1为正常
|
||||||
}
|
}
|
||||||
|
|
||||||
// standard ID,Identity,Created,Updated,Deleted,Status definition.
|
// standard ID,Identity,Created,Updated,Deleted,Status definition.
|
||||||
Std_ICUD struct {
|
Std_ICUD struct {
|
||||||
ID uint `gorm:"primarykey;" json:"id"`
|
ID uint `gorm:"primarykey;"`
|
||||||
CreatedAt time.Time `json:"created_at"`
|
CreatedAt time.Time
|
||||||
UpdatedAt time.Time `json:"updated_at"`
|
UpdatedAt time.Time
|
||||||
DeletedAt gorm.DeletedAt `gorm:"index;" json:"deleted_at"`
|
DeletedAt gorm.DeletedAt `gorm:"index"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// standard ID,Created definition.
|
// standard ID,Created definition.
|
||||||
Std_IdCreated struct {
|
Std_IdCreated struct {
|
||||||
ID uint `gorm:"primarykey;" json:"id"`
|
ID uint `gorm:"primarykey;"`
|
||||||
CreatedAt time.Time `json:"created_at"`
|
CreatedAt time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
// standard PassportID,PassportIdentity definition.
|
// standard PassportID,PassportIdentity definition.
|
||||||
Std_Passport struct {
|
Std_Passport struct {
|
||||||
PassportID uint `gorm:"column:passport_id;Index;" json:"passport_id"`
|
PassportID uint `gorm:"column:passport_id;Index;"`
|
||||||
PassportIdentity string `gorm:"column:passport_identity;type:varchar(36);Index;" json:"passport_identity"` // 用户唯一标识,24位NanoID,36位为ULID
|
PassportIdentity string `gorm:"column:passport_identity;type:varchar(36);Index;"` // 用户唯一标识,24位NanoID,36位为UUID
|
||||||
}
|
}
|
||||||
|
|
||||||
// standard ID definition.
|
// standard ID definition.
|
||||||
Std_ID struct {
|
Std_ID struct {
|
||||||
ID uint `gorm:"primarykey;" json:"id"`
|
ID uint `gorm:"primarykey;"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// standard Identity definition.
|
// standard Identity definition.
|
||||||
Std_Identity struct {
|
Std_Identity struct {
|
||||||
Identity string `gorm:"column:identity;type:varchar(36);uniqueIndex;" json:"identity"` // 唯一标识,24位NanoID,36位为ULID
|
Identity string `gorm:"column:identity;type:varchar(36);uniqueIndex;"` // 唯一标识,24位NanoID,36位为UUID
|
||||||
}
|
}
|
||||||
|
|
||||||
// standard Status definition.
|
// standard Status definition.
|
||||||
Std_Status struct {
|
Std_Status struct {
|
||||||
Status int8 `gorm:"default:0;index;" json:"status"` // 状态:默认为0,-1禁止,1为正常
|
Status int8 `gorm:"default:0;index;"` // 状态:默认为0,-1禁止,1为正常
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
@ -9,8 +9,7 @@ type JwtClaims struct {
|
||||||
ID uint `json:"id"`
|
ID uint `json:"id"`
|
||||||
Identity string `json:"identity"`
|
Identity string `json:"identity"`
|
||||||
Extend map[string]string `json:"extend"`
|
Extend map[string]string `json:"extend"`
|
||||||
Client string `json:"client"`
|
OwnerIdentity any `json:"owner_identity"`
|
||||||
Owner any `json:"owner"`
|
|
||||||
Role string `json:"role"`
|
Role string `json:"role"`
|
||||||
ExpiresAt int64 `json:"exp"`
|
ExpiresAt int64 `json:"exp"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
package types
|
package types
|
||||||
|
|
||||||
type Etcd struct {
|
type Etcd struct {
|
||||||
Endpoints []string `json:"Endpoints"`
|
Endpoints []string `json:"endpoints"`
|
||||||
Tls EtcdTls `json:"Tls,optional"`
|
Tls EtcdTls `json:",optional"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type EtcdTls struct {
|
type EtcdTls struct {
|
||||||
Ca string `json:"Ca,optional"`
|
Ca string `json:"ca,optional"`
|
||||||
Cert string `json:"Cert,optional"`
|
Cert string `json:"cert,optional"`
|
||||||
CertKey string `json:"CertKey,optional" `
|
CertKey string `json:"cert_key,optional" `
|
||||||
}
|
}
|
||||||
|
|
56
types/mcs.go
56
types/mcs.go
|
@ -1,56 +0,0 @@
|
||||||
package types
|
|
||||||
|
|
||||||
type Message struct {
|
|
||||||
TimeSequence int64 //消息创建的时间戳
|
|
||||||
SessionIdent string // 会话唯一标识
|
|
||||||
SenderId int64
|
|
||||||
SenderIdentity string
|
|
||||||
TargetId int64
|
|
||||||
TargetIdentity string
|
|
||||||
GroupId int64 //群组唯一ID,在群聊消息的时候使用到。不使用时则为空
|
|
||||||
GroupIdentity string //群组唯一码,在群聊消息的时候使用到。不使用时则为空
|
|
||||||
MsgType int32 //0异常提示,1单聊,2群聊,3系统
|
|
||||||
BodyType int32 //正文类型:0文本,1图片,2,视频,3.....
|
|
||||||
Body string
|
|
||||||
Status int32 //消息状态:0待续,1存储成功,2送达确认,3已读确认,-1撤回
|
|
||||||
}
|
|
||||||
|
|
||||||
type ChatMessage struct {
|
|
||||||
TimeSequence int64 //消息创建的时间戳
|
|
||||||
SessionIdent string // 会话唯一标识
|
|
||||||
SenderId int64
|
|
||||||
SenderIdentity string
|
|
||||||
TargetId int64
|
|
||||||
TargetIdentity string
|
|
||||||
BodyType int32 //正文类型:0文本,1图片,2,视频,3.....
|
|
||||||
Body string
|
|
||||||
Status int32 //消息状态:0待续,1存储成功,2送达确认,3已读确认,-1撤回
|
|
||||||
}
|
|
||||||
|
|
||||||
type GroupMessage struct {
|
|
||||||
TimeSequence int64 //消息创建的时间戳
|
|
||||||
GroupId int64 //群组唯一ID,在群聊消息的时候使用到。不使用时则为空
|
|
||||||
GroupIdentity string //群组唯一标识,在群聊消息的时候使用到。不使用时则为空
|
|
||||||
SenderId int64
|
|
||||||
SenderIdentity string
|
|
||||||
BodyType int32 //正文类型:0文本,1图片,2,视频,3.....
|
|
||||||
Body string
|
|
||||||
Status int32 //消息状态:0待续,1存储成功,2送达确认,3已读确认,-1撤回
|
|
||||||
}
|
|
||||||
|
|
||||||
type SystemMessage struct {
|
|
||||||
TimeSequence int64 //消息创建的时间戳
|
|
||||||
TargetId int64
|
|
||||||
TargetIdentity string
|
|
||||||
BodyType int32 //正文类型:0文本,1图片,2,视频,3.....
|
|
||||||
Body string
|
|
||||||
Status int32 //消息状态:0待续,1存储成功,2送达确认,3已读确认,-1撤回
|
|
||||||
}
|
|
||||||
|
|
||||||
type EventMessage struct {
|
|
||||||
TimeSequence int64 //消息创建的时间戳
|
|
||||||
TargetId int64
|
|
||||||
TargetIdentity string
|
|
||||||
EventType int32 //事件类型:0 正在输入,已送达...
|
|
||||||
Status int32 //消息状态:0待续,1存储成功,2送达确认,3已读确认,-1撤回
|
|
||||||
}
|
|
|
@ -1,10 +1,26 @@
|
||||||
package utils
|
package utils
|
||||||
|
|
||||||
import (
|
import (
|
||||||
ulid "github.com/oklog/ulid/v2"
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/google/uuid"
|
||||||
|
"github.com/jaevor/go-nanoid"
|
||||||
)
|
)
|
||||||
|
|
||||||
// remove nanoid,uuid,replace to ulid
|
func NanoID() string {
|
||||||
func ULID() string {
|
nanoid, _ := nanoid.CustomASCII("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", 21)
|
||||||
return ulid.Make().String()
|
return nanoid()
|
||||||
|
}
|
||||||
|
|
||||||
|
func NanoIDInt() (id int64, err error) {
|
||||||
|
decenaryID, err := nanoid.CustomASCII("0123456789", 20)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
id, err = strconv.ParseInt(decenaryID(), 10, 64)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func UUID() string {
|
||||||
|
return uuid.NewString()
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,7 @@ func HttpPost(url string, header map[string]string, data []byte) ([]byte, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
request.Header.Set("Content-Type", "application/json;charset=UTF-8")
|
request.Header.Set("Content-Type", "application/json;charset=UTF-8")
|
||||||
request.Header.Set("Request-Id", ULID())
|
request.Header.Set("Request-Id", NanoID())
|
||||||
|
|
||||||
for key, val := range header {
|
for key, val := range header {
|
||||||
request.Header.Set(key, val)
|
request.Header.Set(key, val)
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
package vars
|
|
||||||
|
|
||||||
const (
|
|
||||||
// NormalStatus .
|
|
||||||
NormalStatus = 1
|
|
||||||
// DisabledStatus .
|
|
||||||
DisabledStatus = -1
|
|
||||||
)
|
|
Loading…
Reference in New Issue