wangfei 6 lat temu
rodzic
commit
603234b9bd
2 zmienionych plików z 20 dodań i 14 usunięć
  1. 10
    7
      service/card/card.go
  2. 10
    7
      service/coupon/coupon.go

+ 10
- 7
service/card/card.go Wyświetl plik

@@ -14,6 +14,7 @@ import (
14 14
 	"strings"
15 15
 	"time"
16 16
 
17
+	"github.com/astaxie/beego"
17 18
 	"github.com/yl10/kit/guid"
18 19
 )
19 20
 
@@ -493,13 +494,15 @@ func (s *CardServ) ReceiveCard(id, saleid, serialcode string) error {
493 494
 		utils.LogError("领取卡获取销售信息失败:", err)
494 495
 		return errors.New("log-error-领取卡失败!")
495 496
 	}
496
-	caseinfo, err := s.userDao.GetUserBelongCase(saleid)
497
-	if err != nil {
498
-		utils.LogError("领取卡获取销售案场信息失败:", err)
499
-		return errors.New("log-error-领取卡失败!")
500
-	}
501
-	if caseinfo.CaseId != card.CaseId {
502
-		return errors.New("log-error-销售不合法!")
497
+	if saleid != beego.AppConfig.String("defaultShareUserID") {
498
+		caseinfo, err := s.userDao.GetUserBelongCase(saleid)
499
+		if err != nil {
500
+			utils.LogError("领取卡获取销售案场信息失败:", err)
501
+			return errors.New("log-error-领取卡失败!")
502
+		}
503
+		if caseinfo.CaseId != card.CaseId {
504
+			return errors.New("log-error-销售不合法!")
505
+		}
503 506
 	}
504 507
 
505 508
 	// 验证码判断

+ 10
- 7
service/coupon/coupon.go Wyświetl plik

@@ -12,6 +12,7 @@ import (
12 12
 	"strings"
13 13
 	"time"
14 14
 
15
+	"github.com/astaxie/beego"
15 16
 	"github.com/yl10/kit/guid"
16 17
 )
17 18
 
@@ -527,13 +528,15 @@ func (s *CouponServ) ReceiveCoupon(id, saleid, serialcode string) error {
527 528
 		utils.LogError("领取优惠券获取销售信息失败:", err)
528 529
 		return errors.New("log-error-领取优惠券失败!")
529 530
 	}
530
-	caseinfo, err := s.userDao.GetUserBelongCase(saleid)
531
-	if err != nil {
532
-		utils.LogError("领取优惠券获取销售案场信息失败:", err)
533
-		return errors.New("log-error-领取优惠券失败!")
534
-	}
535
-	if caseinfo.CaseId != coupon.CaseId {
536
-		return errors.New("log-error-销售不合法!")
531
+	if saleid != beego.AppConfig.String("defaultShareUserID") {
532
+		caseinfo, err := s.userDao.GetUserBelongCase(saleid)
533
+		if err != nil {
534
+			utils.LogError("领取优惠券获取销售案场信息失败:", err)
535
+			return errors.New("log-error-领取优惠券失败!")
536
+		}
537
+		if caseinfo.CaseId != coupon.CaseId {
538
+			return errors.New("log-error-销售不合法!")
539
+		}
537 540
 	}
538 541
 
539 542
 	// 验证码判断