Merge branch 'develop' of gitee.com:fusenpack/fusenapi into develop
This commit is contained in:
commit
3052c5192b
@ -46,19 +46,16 @@ func (l *CreateOrderLogic) CreateOrder(req *types.CreateOrderReq, userinfo *auth
|
|||||||
return resp.SetStatus(basic.CodeUnAuth)
|
return resp.SetStatus(basic.CodeUnAuth)
|
||||||
}
|
}
|
||||||
|
|
||||||
var lockKey string
|
|
||||||
for _, v := range req.CartIds {
|
for _, v := range req.CartIds {
|
||||||
var vStr = strconv.Itoa(int(v))
|
var lockKey = strconv.Itoa(int(v))
|
||||||
lockKey = lockKey + "|" + vStr
|
// 分布式锁--防止重复下单
|
||||||
}
|
_, ok1 := lockMap.Load(lockKey) //获取锁
|
||||||
// 分布式锁--防止重复下单
|
if ok1 {
|
||||||
_, ok1 := lockMap.Load(lockKey) //获取锁
|
return resp.SetStatusWithMessage(basic.CodeErrOrder, "create order failed, cannot place duplicate order")
|
||||||
|
} else {
|
||||||
if ok1 {
|
lockMap.Store(lockKey, true) //加锁
|
||||||
return resp.SetStatusWithMessage(basic.CodeErrOrder, "create order failed, cannot place duplicate order")
|
defer lockMap.Delete(lockKey) //释放锁
|
||||||
} else {
|
}
|
||||||
lockMap.Store(lockKey, true) //加锁
|
|
||||||
defer lockMap.Delete(lockKey) //释放锁
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tPlus60Days := time.Now().AddDate(0, 0, 60).UTC()
|
tPlus60Days := time.Now().AddDate(0, 0, 60).UTC()
|
||||||
|
@ -4,7 +4,6 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"fusenapi/model/gmodel"
|
"fusenapi/model/gmodel"
|
||||||
"fusenapi/utils/basic"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -111,7 +110,7 @@ func (l *Ldap) VerifyAuthorityGroup(r *http.Request, options ...LdapOptions) boo
|
|||||||
if infoLdapGroup.Metadata != nil {
|
if infoLdapGroup.Metadata != nil {
|
||||||
err := json.Unmarshal(*infoLdapGroup.Metadata, &metadata)
|
err := json.Unmarshal(*infoLdapGroup.Metadata, &metadata)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
basic.CodeServiceErr.Message = "系统出错"
|
logx.Error("系统出错", err)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
getAllApis(metadata, &apiMaps)
|
getAllApis(metadata, &apiMaps)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user