chore: init bj_power monorepo (dashboard/mes/wms/wms_client/workstation), clear subproject git metadata and align naming to folder names

This commit is contained in:
SunYF
2026-08-27 10:09:54 +08:00
commit 1f0ee844a4
408 changed files with 102201 additions and 0 deletions
+34
View File
@@ -0,0 +1,34 @@
package xhttp
import (
"context"
"encoding/json"
"github.com/zeromicro/go-zero/core/logx"
)
// CtxKeyJwtUserId get uid from ctx
var CtxKeyJwtUserId = "jwtUserId"
// CtxKeyJwtOpenId get openid from ctx
var CtxKeyJwtOpenId = "jwtOpenId"
func GetUidFromCtx(ctx context.Context) int64 {
var uid int64
if jsonUid, ok := ctx.Value(CtxKeyJwtUserId).(json.Number); ok {
if int64Uid, err := jsonUid.Int64(); err == nil {
uid = int64Uid
} else {
logx.WithContext(ctx).Errorf("GetUidFromCtx err : %+v", err)
}
}
return uid
}
func GetOidFromCtx(ctx context.Context) string {
if jsonUid, ok := ctx.Value(CtxKeyJwtOpenId).(string); ok {
return jsonUid
}
logx.WithContext(ctx).Error("GetOidFromCtx failed")
return ""
}