@@ -5,6 +5,7 @@ import (
"jyBXCore/rpc/internal/svc"
"jyBXCore/rpc/service"
"jyBXCore/rpc/type/bxcore"
+ "jyBXCore/rpc/util"
"github.com/zeromicro/go-zero/core/logx"
)
@@ -28,7 +29,11 @@ func (l *ParticipateActionLogic) ParticipateAction(in *bxcore.ParticipateActionR
var res = &bxcore.ParticipateActionRes{
Data: true,
}
- if err := service.ParticipateDo(in); err != nil {
+ if msg := util.IsAllowedAccess(in.ActionType); msg != "" {
+ res.ErrCode = -1
+ res.ErrMsg = msg
+ res.Data = false
+ } else if err := service.ParticipateDo(in); err != nil {
res.ErrCode = -1
res.ErrMsg = err.Error()
res.Data = false
@@ -3,6 +3,7 @@ package logic
import (
"context"
@@ -24,7 +25,14 @@ func NewParticipateSetUpInfoLogic(ctx context.Context, svcCtx *svc.ServiceContex
-// 参标设置信息
+// 参标设置信息
func (l *ParticipateSetUpInfoLogic) ParticipateSetUpInfo(in *bxcore.ParticipateSetUpInfoReq) (*bxcore.ParticipateSetUpInfoRes, error) {
+ if msg := util.IsAllowedAccess("setup"); msg != "" {
+ return &bxcore.ParticipateSetUpInfoRes{
+ ErrCode: -1,
+ ErrMsg: msg,
+ Data: nil,
+ }, nil
+ }
return service.GetParticipateSetInfo(in)
@@ -33,6 +33,10 @@ func (l *UpdateBidStatusLogic) UpdateBidStatus(in *bxcore.UpdateBidStatusReq) (*
result := &bxcore.UpdateBidStatusRes{
ErrCode: -1,
+ if msg := util.IsAllowedAccess("updatebidstatus"); msg != "" {
+ result.ErrMsg = msg
+ return result, nil
b, entRoleId := util.IsAllowedParticipate(in.AppId, in.UserId, in.NewUserId, in.AccountId, in.EntAccountId, in.EntId, in.EntUserId, in.PositionId, in.PositionType)
// 不是超级订阅 也不是大会员
if !b {
@@ -156,7 +156,7 @@ func GetParticipateSetInfo(in *bxcore.ParticipateSetUpInfoReq) (*bxcore.Particip
RemindRule: nil,
}}
- if !b || entRoleId == 0 || entRoleId == 2 { //只有企业管理员有权限
+ if !b {
res.ErrMsg = "没有权限"
res.Data = nil
res.ErrCode = 0
@@ -164,7 +164,7 @@ func GetParticipateSetInfo(in *bxcore.ParticipateSetUpInfoReq) (*bxcore.Particip
switch in.SetAction {
case "U": //update 更新设置信息
- if entRoleId == 0 {
+ if entRoleId == 0 || entRoleId == 2 { //只有企业管理员有权限
res.ErrMsg = "当前企业身份无权限"
@@ -1,6 +1,8 @@
package util
+ "app.yhyue.com/moapp/jybase/redis"
+ "fmt"
IC "jyBXCore/rpc/init"
"sync"
@@ -49,3 +51,13 @@ func IsAllowedParticipate(appId, userId string, newUserId, accountId, entAccount
return
+
+// 5秒内防止重复提交
+func IsAllowedAccess(key string) string {
+ redisKey := fmt.Sprintf("participate_isAllowed_%s", key)
+ if b, err := redis.Exists("other", redisKey); err != nil && b {
+ return "访问频次过快,请稍后再试"
+ redis.Put("other", redisKey, key, 5)
+ return ""
+}