Merge branch 'develop' of git.ailuowan.com:zzw/lone-services into develop
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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.BizId))}}
|
||||
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)
|
||||
@@ -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,
|
||||
|
||||
@@ -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",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
host = '39.106.171.204'
|
||||
password = 'lLMLcuPpzSj'
|
||||
port = 6379
|
||||
db = 0
|
||||
db = 1
|
||||
|
||||
[log-redis]
|
||||
host = '39.106.171.204'
|
||||
|
||||
Reference in New Issue
Block a user