From 94802477c40caea16451dc90bc1aed55bb826b40 Mon Sep 17 00:00:00 2001 From: gjs Date: Thu, 22 Oct 2026 11:28:57 +0800 Subject: [PATCH 1/6] fix --- services/equipment/internal/logic/authorizationCodeLogic.go | 2 +- .../internal/logic/authorizationStoreItemsLogic.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/services/equipment/internal/logic/authorizationCodeLogic.go b/services/equipment/internal/logic/authorizationCodeLogic.go index 3c86599..353d7b4 100644 --- a/services/equipment/internal/logic/authorizationCodeLogic.go +++ b/services/equipment/internal/logic/authorizationCodeLogic.go @@ -35,7 +35,7 @@ func (l *AuthorizationCodeLogic) AuthorizationCode(in *equipment.EmptyRequest) ( return l.fail(utils.ErrorNoLoginInfo) } - key := dao.CodeName + strconv.FormatInt(adminInfo.StoreId, utils.NumberTen) + key := dao.CodeName + strconv.FormatInt(adminInfo.BizId, utils.NumberTen) code := utils.RandNumber(utils.NumberSix) out := utils.GetConfigInt("code.out-time") diff --git a/services/equipment/internal/logic/authorizationStoreItemsLogic.go b/services/equipment/internal/logic/authorizationStoreItemsLogic.go index 7544eb0..5c0b112 100644 --- a/services/equipment/internal/logic/authorizationStoreItemsLogic.go +++ b/services/equipment/internal/logic/authorizationStoreItemsLogic.go @@ -37,7 +37,7 @@ func (l *AuthorizationStoreItemsLogic) AuthorizationStoreItems(in *equipment.Emp } w := modelbase.Params{Eq: map[string]string{ - "store_id": strconv.Itoa(int(adminInfo.ID))}} + "store_id": strconv.Itoa(int(adminInfo.StoreId))}} var info []dao.AuthorizationRecordInfo err := model.AuthorizationRecordModel{}.Init().Items(w, &info) if err != nil { @@ -63,8 +63,8 @@ func (l *AuthorizationStoreItemsLogic) AuthorizationStoreItems(in *equipment.Emp userIdItems := make(map[int64]dao.AuthorizationRecordStoreItems) for _, val := range userItems { ww := modelbase.Params{Eq: map[string]string{ - "store_id": strconv.Itoa(int(adminInfo.ID)), - "user_id": strconv.Itoa(int(adminInfo.ID))}} + "store_id": strconv.Itoa(int(adminInfo.BizId)), + "user_id": strconv.Itoa(int(val.Id))}} storeNumber, err := model.AuthorizationRecordModel{}.Init().CountNumber(ww) if err != nil { l.Logger.Error(err) From 7c650985ceb175d2c36b506a3b51119e79c138f7 Mon Sep 17 00:00:00 2001 From: gjs Date: Thu, 22 Oct 2026 11:48:01 +0800 Subject: [PATCH 2/6] fix --- services/equipment/internal/logic/apiMaskStoreUseItemsLogic.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/equipment/internal/logic/apiMaskStoreUseItemsLogic.go b/services/equipment/internal/logic/apiMaskStoreUseItemsLogic.go index e731143..b01466e 100644 --- a/services/equipment/internal/logic/apiMaskStoreUseItemsLogic.go +++ b/services/equipment/internal/logic/apiMaskStoreUseItemsLogic.go @@ -44,7 +44,7 @@ func (l *ApiMaskStoreUseItemsLogic) ApiMaskStoreUseItems(in *equipment.ApiMaskUs var info []dao.MaskUsedInfo w := modelbase.Params{Eq: map[string]string{ "is_use": strconv.Itoa(int(utils.StatusDone)), - "store_id": strconv.Itoa(int(adminInfo.ID)), + "store_id": strconv.Itoa(int(adminInfo.BizId)), }, Order: "id desc"} if v.FacialMaskId != utils.StringEmpty { From d8756ced1b3bfcb59ee311714a4acf99e5ab3409 Mon Sep 17 00:00:00 2001 From: gjs Date: Thu, 22 Oct 2026 13:09:59 +0800 Subject: [PATCH 3/6] fix --- .../equipment/internal/logic/authorizationStoreItemsLogic.go | 2 +- services/equipment/validator/codeBind.go | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/services/equipment/internal/logic/authorizationStoreItemsLogic.go b/services/equipment/internal/logic/authorizationStoreItemsLogic.go index 5c0b112..81fc8af 100644 --- a/services/equipment/internal/logic/authorizationStoreItemsLogic.go +++ b/services/equipment/internal/logic/authorizationStoreItemsLogic.go @@ -37,7 +37,7 @@ func (l *AuthorizationStoreItemsLogic) AuthorizationStoreItems(in *equipment.Emp } w := modelbase.Params{Eq: map[string]string{ - "store_id": strconv.Itoa(int(adminInfo.StoreId))}} + "store_id": strconv.Itoa(int(adminInfo.BizId))}} var info []dao.AuthorizationRecordInfo err := model.AuthorizationRecordModel{}.Init().Items(w, &info) if err != nil { diff --git a/services/equipment/validator/codeBind.go b/services/equipment/validator/codeBind.go index 142dbbd..1f7188d 100644 --- a/services/equipment/validator/codeBind.go +++ b/services/equipment/validator/codeBind.go @@ -28,7 +28,7 @@ func (p CancelBindValidator) GetMessage() validate.ValidatorMessages { type ControlBindValidator struct { StoreId int64 `form:"store_id" json:"store_id" validate:"required"` - Open int32 `form:"open" json:"open" validate:"required,oneof:1 2"` + Open int32 `form:"open" json:"open" validate:"required"` } // GetMessage 提示消息 @@ -36,6 +36,5 @@ func (p ControlBindValidator) GetMessage() validate.ValidatorMessages { return validate.ValidatorMessages{ "StoreId.required": "门店ID不能为空", "Open.required": "开启展示不能为空", - "Open.oneof": "开启展示只能是1或2", } } From a7427c27667d65147431c003c63da292d257d2b1 Mon Sep 17 00:00:00 2001 From: gjs Date: Thu, 22 Oct 2026 13:38:26 +0800 Subject: [PATCH 4/6] fix --- .../equipment/internal/logic/authorizationStoreItemsLogic.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/services/equipment/internal/logic/authorizationStoreItemsLogic.go b/services/equipment/internal/logic/authorizationStoreItemsLogic.go index 81fc8af..ccff346 100644 --- a/services/equipment/internal/logic/authorizationStoreItemsLogic.go +++ b/services/equipment/internal/logic/authorizationStoreItemsLogic.go @@ -74,11 +74,10 @@ func (l *AuthorizationStoreItemsLogic) AuthorizationStoreItems(in *equipment.Emp if val.Mobile != utils.StringEmpty { tmp, phoneErr := utils.DecryptPhone(val.Mobile) if phoneErr != nil { - l.Logger.Error(err) + l.Logger.Error(phoneErr) } mobile = tmp } - userIdItems[val.Id] = dao.AuthorizationRecordStoreItems{ Username: val.Name, Mobile: mobile, From a77fa231975381c057ace1c4ecd9caf5d42a36db Mon Sep 17 00:00:00 2001 From: gjs Date: Thu, 22 Oct 2026 14:30:18 +0800 Subject: [PATCH 5/6] fix --- pkg/ws/types.go | 2 +- .../percutaneous/internal/logic/getWsCodeLogic.go | 14 ++++++++++++++ .../internal/logic/setPositionLogic.go | 2 +- services/ws/internal/logic/connectLogic.go | 4 ++++ services/ws/run.toml | 2 +- 5 files changed, 21 insertions(+), 3 deletions(-) diff --git a/pkg/ws/types.go b/pkg/ws/types.go index b030aa6..aea2e17 100644 --- a/pkg/ws/types.go +++ b/pkg/ws/types.go @@ -6,7 +6,7 @@ import ( ) const ( - RedisKeyQRSession = "qr:session:" + RedisKeyQRSession = "ws:session:" RedisKeyQRShare = "qr:share:" RedisKeyOssUpload = "oss:upload:task:" RedisKeyTaskLights = "task:lights:" diff --git a/services/percutaneous/internal/logic/getWsCodeLogic.go b/services/percutaneous/internal/logic/getWsCodeLogic.go index d76217b..da3c9d9 100644 --- a/services/percutaneous/internal/logic/getWsCodeLogic.go +++ b/services/percutaneous/internal/logic/getWsCodeLogic.go @@ -3,11 +3,14 @@ package logic import ( "context" "fmt" + "lone-services/pkg/redis" "lone-services/pkg/utils" + pkgws "lone-services/pkg/ws" "lone-services/rpc/percutaneous/pb" "lone-services/services/percutaneous/internal/dao" "lone-services/services/percutaneous/internal/svc" + jsoniter "github.com/json-iterator/go" "github.com/zeromicro/go-zero/core/logx" ) @@ -38,6 +41,17 @@ func (l *GetWsCodeLogic) GetWsCode(in *percutaneous.GetWsCodeRequest) (*percutan } key := utils.MD5Encrypt(fmt.Sprintf("%d%s%s", adminInfo.ID, dao.WsCode, Type)) + redisKey := pkgws.RedisKeyQRSession + key + payload, err := jsoniter.MarshalToString(pkgws.Session{ + Status: pkgws.StatusUsePosition, + ClientCode: key, + }) + if err != nil { + return l.fail(utils.Fail) + } + if err := redis.Client.Set(l.ctx, redisKey, payload, pkgws.SessionTTL).Err(); err != nil { + return l.fail(utils.Fail) + } return l.ok(key) } diff --git a/services/percutaneous/internal/logic/setPositionLogic.go b/services/percutaneous/internal/logic/setPositionLogic.go index f13f8b4..ea2fddf 100644 --- a/services/percutaneous/internal/logic/setPositionLogic.go +++ b/services/percutaneous/internal/logic/setPositionLogic.go @@ -38,7 +38,7 @@ func (l *SetPositionLogic) SetPosition(in *percutaneous.SetPositionRequest) (*pe return l.fail(utils.ErrorQRcodeExp) } - data := map[string]int{"ws_type": pkgws.WsTypeScan} + data := in.Position if err := pkgws.Publish(l.ctx, in.SessionId, pkgws.Success(data)); err != nil { l.Errorf("qrcode scan publish: %v", err) } diff --git a/services/ws/internal/logic/connectLogic.go b/services/ws/internal/logic/connectLogic.go index 9755f0f..ea80fde 100644 --- a/services/ws/internal/logic/connectLogic.go +++ b/services/ws/internal/logic/connectLogic.go @@ -75,10 +75,12 @@ func (l *ConnectLogic) Connect(w http.ResponseWriter, r *http.Request, req *type func (l *ConnectLogic) pushSnapshot(c *svc.Client, sess *pkgws.Session) error { var data interface{} + l.Logger.Error(sess.Status) switch sess.Status { case pkgws.StatusPending: data = nil case pkgws.StatusScanned, pkgws.StatusLogined: + l.Logger.Error("status", sess.Status) if len(sess.Data) > 0 && string(sess.Data) != "null" { var parsed any if err := jsoniter.Unmarshal(sess.Data, &parsed); err != nil { @@ -92,8 +94,10 @@ func (l *ConnectLogic) pushSnapshot(c *svc.Client, sess *pkgws.Session) error { data = nil } case pkgws.StatusUsePosition: + l.Logger.Error("use position") if len(sess.Data) > 0 && string(sess.Data) != "null" { data = sess.Data + l.Logger.Error("data=", data) } else { data = nil } diff --git a/services/ws/run.toml b/services/ws/run.toml index 6069829..24adb45 100644 --- a/services/ws/run.toml +++ b/services/ws/run.toml @@ -18,7 +18,7 @@ host = '39.106.171.204' password = 'lLMLcuPpzSj' port = 6379 - db = 0 + db = 1 [log-redis] host = '39.106.171.204' From a71cf97444cb1226f2925649137fa408ee814a79 Mon Sep 17 00:00:00 2001 From: gjs Date: Thu, 22 Oct 2026 14:31:54 +0800 Subject: [PATCH 6/6] fix --- rpc/percutaneous/percutaneous.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpc/percutaneous/percutaneous.proto b/rpc/percutaneous/percutaneous.proto index ddd2cf3..9b8a45d 100644 --- a/rpc/percutaneous/percutaneous.proto +++ b/rpc/percutaneous/percutaneous.proto @@ -112,7 +112,7 @@ service Percutaneous { // 使用指南 rpc setPosition(setPositionRequest) returns (Response) { option (google.api.http) = { - get: "/api/v3/percutaneous/use/position" + post: "/api/v3/percutaneous/use/position" body: "*" }; }