abiao лет назад: 5
Родитель
Сommit
9d87acbf18

+ 17 - 11
go/gopath/src/fohow.com/apps/controllers/railsadmin_controller/update_shop_application.go

@@ -46,26 +46,32 @@ func (self *RailsadminController) UpdateShopApplication() {
 }
 
 func ApplySuccessInviterBenefit(wxUser *user_model.WxUser, shopId int64, source string) {
-
-	//本人充值4200代金券
+	shopApply := user_model.GetShopApplicationById(shopId)
+	if shopApply == nil {
+		return
+	}
+	//本人充值16800--发放4200代金券
 	rId := fmt.Sprintf("shop-apply-%d", shopId)
 	c := balance_model.BALANCE_UPGRADE
-	item := balance_model.GetBalanceBySourceAndRId(source, rId)
-	if item != nil {
-		return
+	if shopApply.Total == user_model.TOTAL_RANK1 {
+		c = int64(0)
 	}
-	b := new(balance_model.Balance).Create(wxUser.Id, wxUser.UserId, c, source, rId, fmt.Sprintf("¥%0.2f", float64(c)/100))
 	benefitWxUser := GetInviter(wxUser)
-	if b == nil || benefitWxUser == nil || benefitWxUser.Id == int64(1) {
+	if benefitWxUser == nil || benefitWxUser.Id == int64(1) {
 		return
 	}
+	if c > 0 {
+		item := balance_model.GetBalanceBySourceAndRId(source, rId)
+		if item != nil {
+			return
+		}
+		new(balance_model.Balance).Create(wxUser.Id, wxUser.UserId, c, source, rId, fmt.Sprintf("¥%0.2f", float64(c)/100))
+	}
+
 	//充值成功发放佣金
 	beego.BeeLogger.Warn("shop-apply_benefitWxUser: %s", benefitWxUser)
 	beego.BeeLogger.Warn("shop-apply_newSendInviterBenefit:%v,%v,%s", wxUser, benefitWxUser, shopId)
-	shopApply := user_model.GetShopApplicationById(shopId)
-	if shopApply == nil {
-		return
-	}
+
 	//发放佣金  13800-4500 16800-5000
 	count := int64(0)
 	if shopApply.Total == user_model.TOTAL_RANK1 {