Merge branch 'develop' of git.ailuowan.com:zzw/lone-services into develop
This commit is contained in:
+1
-1
@@ -6,7 +6,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
RedisKeyQRSession = "qr:session:"
|
RedisKeyQRSession = "ws:session:"
|
||||||
RedisKeyQRShare = "qr:share:"
|
RedisKeyQRShare = "qr:share:"
|
||||||
RedisKeyOssUpload = "oss:upload:task:"
|
RedisKeyOssUpload = "oss:upload:task:"
|
||||||
RedisKeyTaskLights = "task:lights:"
|
RedisKeyTaskLights = "task:lights:"
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ service Percutaneous {
|
|||||||
// 使用指南
|
// 使用指南
|
||||||
rpc setPosition(setPositionRequest) returns (Response) {
|
rpc setPosition(setPositionRequest) returns (Response) {
|
||||||
option (google.api.http) = {
|
option (google.api.http) = {
|
||||||
get: "/api/v3/percutaneous/use/position"
|
post: "/api/v3/percutaneous/use/position"
|
||||||
body: "*"
|
body: "*"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ func (l *ApiMaskStoreUseItemsLogic) ApiMaskStoreUseItems(in *equipment.ApiMaskUs
|
|||||||
var info []dao.MaskUsedInfo
|
var info []dao.MaskUsedInfo
|
||||||
w := modelbase.Params{Eq: map[string]string{
|
w := modelbase.Params{Eq: map[string]string{
|
||||||
"is_use": strconv.Itoa(int(utils.StatusDone)),
|
"is_use": strconv.Itoa(int(utils.StatusDone)),
|
||||||
"store_id": strconv.Itoa(int(adminInfo.ID)),
|
"store_id": strconv.Itoa(int(adminInfo.BizId)),
|
||||||
},
|
},
|
||||||
Order: "id desc"}
|
Order: "id desc"}
|
||||||
if v.FacialMaskId != utils.StringEmpty {
|
if v.FacialMaskId != utils.StringEmpty {
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ func (l *AuthorizationCodeLogic) AuthorizationCode(in *equipment.EmptyRequest) (
|
|||||||
return l.fail(utils.ErrorNoLoginInfo)
|
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)
|
code := utils.RandNumber(utils.NumberSix)
|
||||||
out := utils.GetConfigInt("code.out-time")
|
out := utils.GetConfigInt("code.out-time")
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ func (l *AuthorizationStoreItemsLogic) AuthorizationStoreItems(in *equipment.Emp
|
|||||||
}
|
}
|
||||||
|
|
||||||
w := modelbase.Params{Eq: map[string]string{
|
w := modelbase.Params{Eq: map[string]string{
|
||||||
"store_id": strconv.Itoa(int(adminInfo.ID))}}
|
"store_id": strconv.Itoa(int(adminInfo.BizId))}}
|
||||||
var info []dao.AuthorizationRecordInfo
|
var info []dao.AuthorizationRecordInfo
|
||||||
err := model.AuthorizationRecordModel{}.Init().Items(w, &info)
|
err := model.AuthorizationRecordModel{}.Init().Items(w, &info)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -63,8 +63,8 @@ func (l *AuthorizationStoreItemsLogic) AuthorizationStoreItems(in *equipment.Emp
|
|||||||
userIdItems := make(map[int64]dao.AuthorizationRecordStoreItems)
|
userIdItems := make(map[int64]dao.AuthorizationRecordStoreItems)
|
||||||
for _, val := range userItems {
|
for _, val := range userItems {
|
||||||
ww := modelbase.Params{Eq: map[string]string{
|
ww := modelbase.Params{Eq: map[string]string{
|
||||||
"store_id": strconv.Itoa(int(adminInfo.ID)),
|
"store_id": strconv.Itoa(int(adminInfo.BizId)),
|
||||||
"user_id": strconv.Itoa(int(adminInfo.ID))}}
|
"user_id": strconv.Itoa(int(val.Id))}}
|
||||||
storeNumber, err := model.AuthorizationRecordModel{}.Init().CountNumber(ww)
|
storeNumber, err := model.AuthorizationRecordModel{}.Init().CountNumber(ww)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
l.Logger.Error(err)
|
l.Logger.Error(err)
|
||||||
@@ -74,11 +74,10 @@ func (l *AuthorizationStoreItemsLogic) AuthorizationStoreItems(in *equipment.Emp
|
|||||||
if val.Mobile != utils.StringEmpty {
|
if val.Mobile != utils.StringEmpty {
|
||||||
tmp, phoneErr := utils.DecryptPhone(val.Mobile)
|
tmp, phoneErr := utils.DecryptPhone(val.Mobile)
|
||||||
if phoneErr != nil {
|
if phoneErr != nil {
|
||||||
l.Logger.Error(err)
|
l.Logger.Error(phoneErr)
|
||||||
}
|
}
|
||||||
mobile = tmp
|
mobile = tmp
|
||||||
}
|
}
|
||||||
|
|
||||||
userIdItems[val.Id] = dao.AuthorizationRecordStoreItems{
|
userIdItems[val.Id] = dao.AuthorizationRecordStoreItems{
|
||||||
Username: val.Name,
|
Username: val.Name,
|
||||||
Mobile: mobile,
|
Mobile: mobile,
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ func (p CancelBindValidator) GetMessage() validate.ValidatorMessages {
|
|||||||
|
|
||||||
type ControlBindValidator struct {
|
type ControlBindValidator struct {
|
||||||
StoreId int64 `form:"store_id" json:"store_id" validate:"required"`
|
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 提示消息
|
// GetMessage 提示消息
|
||||||
@@ -36,6 +36,5 @@ func (p ControlBindValidator) GetMessage() validate.ValidatorMessages {
|
|||||||
return validate.ValidatorMessages{
|
return validate.ValidatorMessages{
|
||||||
"StoreId.required": "门店ID不能为空",
|
"StoreId.required": "门店ID不能为空",
|
||||||
"Open.required": "开启展示不能为空",
|
"Open.required": "开启展示不能为空",
|
||||||
"Open.oneof": "开启展示只能是1或2",
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,11 +3,14 @@ package logic
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"lone-services/pkg/redis"
|
||||||
"lone-services/pkg/utils"
|
"lone-services/pkg/utils"
|
||||||
|
pkgws "lone-services/pkg/ws"
|
||||||
"lone-services/rpc/percutaneous/pb"
|
"lone-services/rpc/percutaneous/pb"
|
||||||
"lone-services/services/percutaneous/internal/dao"
|
"lone-services/services/percutaneous/internal/dao"
|
||||||
"lone-services/services/percutaneous/internal/svc"
|
"lone-services/services/percutaneous/internal/svc"
|
||||||
|
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
"github.com/zeromicro/go-zero/core/logx"
|
"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))
|
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)
|
return l.ok(key)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ func (l *SetPositionLogic) SetPosition(in *percutaneous.SetPositionRequest) (*pe
|
|||||||
return l.fail(utils.ErrorQRcodeExp)
|
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 {
|
if err := pkgws.Publish(l.ctx, in.SessionId, pkgws.Success(data)); err != nil {
|
||||||
l.Errorf("qrcode scan publish: %v", err)
|
l.Errorf("qrcode scan publish: %v", err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 {
|
func (l *ConnectLogic) pushSnapshot(c *svc.Client, sess *pkgws.Session) error {
|
||||||
var data interface{}
|
var data interface{}
|
||||||
|
l.Logger.Error(sess.Status)
|
||||||
switch sess.Status {
|
switch sess.Status {
|
||||||
case pkgws.StatusPending:
|
case pkgws.StatusPending:
|
||||||
data = nil
|
data = nil
|
||||||
case pkgws.StatusScanned, pkgws.StatusLogined:
|
case pkgws.StatusScanned, pkgws.StatusLogined:
|
||||||
|
l.Logger.Error("status", sess.Status)
|
||||||
if len(sess.Data) > 0 && string(sess.Data) != "null" {
|
if len(sess.Data) > 0 && string(sess.Data) != "null" {
|
||||||
var parsed any
|
var parsed any
|
||||||
if err := jsoniter.Unmarshal(sess.Data, &parsed); err != nil {
|
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
|
data = nil
|
||||||
}
|
}
|
||||||
case pkgws.StatusUsePosition:
|
case pkgws.StatusUsePosition:
|
||||||
|
l.Logger.Error("use position")
|
||||||
if len(sess.Data) > 0 && string(sess.Data) != "null" {
|
if len(sess.Data) > 0 && string(sess.Data) != "null" {
|
||||||
data = sess.Data
|
data = sess.Data
|
||||||
|
l.Logger.Error("data=", data)
|
||||||
} else {
|
} else {
|
||||||
data = nil
|
data = nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
host = '39.106.171.204'
|
host = '39.106.171.204'
|
||||||
password = 'lLMLcuPpzSj'
|
password = 'lLMLcuPpzSj'
|
||||||
port = 6379
|
port = 6379
|
||||||
db = 0
|
db = 1
|
||||||
|
|
||||||
[log-redis]
|
[log-redis]
|
||||||
host = '39.106.171.204'
|
host = '39.106.171.204'
|
||||||
|
|||||||
Reference in New Issue
Block a user