|
@@ -24,14 +24,19 @@ func Check(appID string, productID int, context *gin.Context, getData func() ([]
|
|
|
userProduct := &model.UserProduct{}
|
|
|
db.GetSFISDB().First(userProduct, &model.UserProduct{AppID: appID, ProductID: productID})
|
|
|
//userLock.Unlock()
|
|
|
- if userProduct.InterfaceStatus != 0 {
|
|
|
+ if userProduct.ID == 0 {
|
|
|
+ response.FailWithDetailed(response.InterfaceDeleted, nil, "该用户接口未购买", context)
|
|
|
+ return
|
|
|
+ }else if userProduct.InterfaceStatus != 0 {
|
|
|
response.FailWithDetailed(response.InterfaceDeleted, nil, "该用户接口暂不提供服务", context)
|
|
|
+ return
|
|
|
}
|
|
|
//2.2 取用户(产品余量|钱包账户余额)校验-必须加锁
|
|
|
costModel := userProduct.CostModel //扣费模式 0扣余量,1-扣余额
|
|
|
product := GetProductByID(productID)
|
|
|
userLock.Lock()
|
|
|
log.Println(param + "锁住......")
|
|
|
+
|
|
|
db.GetSFISDB().First(userProduct, &model.UserProduct{AppID: appID, ProductID: productID})
|
|
|
// costModel = 0
|
|
|
switch costModel {
|