Explorar el Código

add base config funciton

abiao hace 5 años
padre
commit
03d39c2f20

+ 10 - 13
go/gopath/src/fohow.com/apps/controllers/order_controller/order_controller.go

@@ -2,6 +2,7 @@ package order_controller
 
 import (
 	"fmt"
+	"fohow.com/apps/models/base_config"
 	"fohow.com/libs/lib_redis"
 	// "fmt"
 	"strconv"
@@ -81,8 +82,8 @@ func (self *OrderController) Create() {
 	if wxUId == 76 {
 		totalPrice = 1
 	}
-	freight := order_model.FREIGHT
-	if totalPrice >= order_model.FREIGHT_LIMIT || beego.AppConfig.String("RunMode") == "dev" {
+	freight := base_config.GetFreight()
+	if totalPrice >= base_config.GetOrderLimit() {
 		freight = int64(0)
 	}
 
@@ -164,8 +165,8 @@ func (self *OrderController) MultipleCreate() {
 		totalPrice += product.Price * cNums
 		CreateOrderDetails(product, order, cNums)
 	}
-	freight := order_model.FREIGHT
-	if totalPrice >= order_model.FREIGHT_LIMIT || beego.AppConfig.String("RunMode") == "dev" {
+	freight := base_config.GetFreight()
+	if totalPrice >= base_config.GetOrderLimit() {
 		freight = int64(0)
 	}
 	order.TotalPrice = totalPrice
@@ -223,8 +224,8 @@ func (self *OrderController) MultShopCreate() {
 		totalPrice += product.Price * cNums
 		CreateOrderDetails(product, order, cNums)
 	}
-	freight := order_model.FREIGHT
-	if totalPrice >= order_model.FREIGHT_LIMIT || beego.AppConfig.String("RunMode") == "dev" {
+	freight := base_config.GetFreight()
+	if totalPrice >= base_config.GetOrderLimit() {
 		freight = int64(0)
 	}
 	order.TotalPrice = totalPrice
@@ -281,13 +282,9 @@ func (self *OrderController) MultCentCreate() {
 		totalPrice += product.Price * cNums
 		CreateOrderDetails(product, order, cNums)
 	}
-	freight := order_model.FREIGHT
-	if totalPrice < order_model.CENT_LIMIT {
-		self.ReturnError(403, []string{apps.OrderNotEnough[0], fmt.Sprintf("订单最低金额%d", order_model.CENT_LIMIT)}, "", nil)
-	}
-
-	if totalPrice < order_model.CENT_LIMIT || beego.AppConfig.String("RunMode") == "dev" {
-		freight = int64(0)
+	freight := base_config.GetFreight()
+	if totalPrice < base_config.GetOrderLimit() {
+		self.ReturnError(403, []string{apps.OrderNotEnough[0], fmt.Sprintf("订单最低金额%d", base_config.GetOrderLimit())}, "", nil)
 	}
 	order.TotalPrice = totalPrice
 	order.Freight = freight

+ 4 - 3
go/gopath/src/fohow.com/apps/controllers/pay_controller/after_pay_controller.go

@@ -8,6 +8,7 @@ import (
 
 	"fohow.com/apps"
 	"fohow.com/apps/helpers"
+	"fohow.com/apps/models/base_config"
 	"fohow.com/libs/lib_redis"
 	"math"
 
@@ -125,7 +126,7 @@ func (self *PayController) wxPayBalanceAsync() {
 	if wxUser != nil {
 		newSendInviterBenefit(wxUser, order.OrderId, user_model.BALANCE_BENEFIT)
 	}
-	if totalFee >= balance_model.BALANCE_PAIED && wxUser.ShowInviteMode != 1 {
+	if totalFee >= base_config.GetBuyCash() && wxUser.ShowInviteMode != 1 {
 		//升级群主
 		UpdateIntroUser(wxUser)
 	}
@@ -230,8 +231,8 @@ func newSendInviterBenefit(wxUser *user_model.WxUser, orderId, source string) {
 		if benefitWxUser != nil {
 			count := int64(0)
 			//发放一级收益, 上级群主返利540
-			if balanceOrder.PaiedPrice == balance_model.BALANCE_PAIED {
-				count = balance_model.AWARD_UPGRADE
+			if balanceOrder.PaiedPrice == base_config.GetBuyCash() {
+				count = base_config.GetCashAward()
 			}
 			if count > 0 {
 				inviteOrder := new(user_model.InviteOrder).Create(benefitWxUser.Id, wxUser.Id, wxUser.Id, count, balanceOrder.TotalPrice, user_model.BALANCE_BENEFIT, balanceOrder.OrderId)

+ 7 - 6
go/gopath/src/fohow.com/apps/controllers/pay_controller/pay_exchange_controller.go

@@ -2,6 +2,7 @@ package pay_controller
 
 import (
 	"fmt"
+	"fohow.com/apps/models/base_config"
 	"fohow.com/apps/models/cent_model"
 	"fohow.com/libs/lib_redis"
 
@@ -117,8 +118,8 @@ func (self *PayController) payExchange(oId, payWay, tradPwd, returnUrl, source s
 		totalCoupon := int64(0)
 		userLeftBalanceCount := balance_model.GetUserTotalBalance(wxUId)
 		tp := order.TotalPrice
-		freight := order_model.FREIGHT
-		if tp >= order_model.FREIGHT_LIMIT || beego.AppConfig.String("RunMode") == "dev" {
+		freight := base_config.GetFreight()
+		if tp >= base_config.GetOrderLimit() {
 			freight = int64(0)
 		}
 		tp += freight
@@ -169,8 +170,8 @@ func (self *PayController) payExchange(oId, payWay, tradPwd, returnUrl, source s
 			order.Source = source
 			order.Save()
 			if order.Source == order_model.SOURCE_XCX { //小程序微信支付
-				freight := order_model.FREIGHT
-				if order.TotalPrice >= order_model.FREIGHT_LIMIT || beego.AppConfig.String("RunMode") == "dev" {
+				freight := base_config.GetFreight()
+				if order.TotalPrice >= base_config.GetOrderLimit() {
 					freight = int64(0)
 				}
 				order.TotalPrice += freight
@@ -312,8 +313,8 @@ func (self *PayController) payCentExchange(oId, returnUrl, source string) {
 	//直接抵扣积分,积分不够则报错
 	userLeftCent := cent_model.GetCentTotalBalance(wxUId)
 	tp := order.TotalPrice
-	freight := order_model.FREIGHT
-	if tp >= order_model.FREIGHT_LIMIT || beego.AppConfig.String("RunMode") == "dev" {
+	freight := base_config.GetFreight()
+	if tp >= base_config.GetOrderLimit() {
 		freight = int64(0)
 	}
 	tp += freight

+ 4 - 3
go/gopath/src/fohow.com/apps/controllers/pay_controller/recharge_controller.go

@@ -4,6 +4,7 @@ import (
 	"fmt"
 	"fohow.com/apps"
 	"fohow.com/apps/models/balance_model"
+	"fohow.com/apps/models/base_config"
 	"github.com/astaxie/beego"
 	"strings"
 )
@@ -13,7 +14,7 @@ func (self *PayController) CreateBalanceOrder() {
 
 	//校验兑换代金券数量,为正整数
 	//count, _ := self.GetInt64("count") //兑换数量
-	count := balance_model.BALANCE_PAIED
+	count := base_config.GetBuyCash()
 
 	if count <= 0 {
 		self.ReturnError(403, apps.RechargeCountWrong, "", nil)
@@ -36,8 +37,8 @@ func (self *PayController) CreateBalanceOrder() {
 		self.ReturnError(403, apps.PayWayNoMatch, "", nil)
 	}
 	tp := int64(0)
-	if count == balance_model.BALANCE_PAIED {
-		tp = balance_model.BALANCE_UPGRADE
+	if count == base_config.GetBuyCash() {
+		tp = base_config.GetSendCash()
 	} else {
 		tp = count
 	}

+ 6 - 5
go/gopath/src/fohow.com/apps/controllers/railsadmin_controller/update_shop_application.go

@@ -4,6 +4,7 @@ import (
 	"fmt"
 	"fohow.com/apps"
 	"fohow.com/apps/models/balance_model"
+	"fohow.com/apps/models/base_config"
 	"fohow.com/apps/models/user_model"
 	"fohow.com/cache"
 	"github.com/astaxie/beego"
@@ -59,8 +60,8 @@ func ApplySuccessInviterBenefit(wxUser *user_model.WxUser, shopId int64, source
 	}
 	//本人充值16800--发放4200代金券
 	rId := fmt.Sprintf("shop-apply-%d", shopId)
-	c := balance_model.BALANCE_UPGRADE
-	if shopApply.Total == user_model.TOTAL_RANK1 {
+	c := base_config.GetSendCash()
+	if shopApply.Total == base_config.GetUserApply() {
 		c = int64(0)
 	}
 	benefitWxUser := GetInviter(wxUser)
@@ -81,10 +82,10 @@ func ApplySuccessInviterBenefit(wxUser *user_model.WxUser, shopId int64, source
 
 	//发放佣金  13800-4500 16800-5000
 	count := int64(0)
-	if shopApply.Total == user_model.TOTAL_RANK1 {
-		count = user_model.PROUD_RANK1
+	if shopApply.Total == base_config.GetUserApply() {
+		count = base_config.GetUserAward()
 	} else {
-		count = user_model.PROUD_RANK2
+		count = base_config.GetAgentAward()
 	}
 
 	remark := fmt.Sprintf("%s%s", wxUser.Nickname, "店长申请成功")

+ 4 - 3
go/gopath/src/fohow.com/apps/controllers/user_controller/user_controller.go

@@ -2,6 +2,7 @@ package user_controller
 
 import (
 	"fmt"
+	"fohow.com/apps/models/base_config"
 	"strconv"
 
 	// "strconv"
@@ -380,7 +381,7 @@ func getAgeByIdCardNo(idCardNo string) (int64, error) {
 	return age, nil
 }
 
-//修改交易密码
+//申请店长
 func (self *UserController) ShopApplication() {
 	code := self.GetString("code")
 	mobile := self.GetString("mobile")
@@ -409,9 +410,9 @@ func (self *UserController) ShopApplication() {
 	if wxUser.Rank > user_model.WX_USER_RANK_ONE {
 		self.ReturnError(403, apps.AlreadyShop, "", nil)
 	}
-	total := user_model.TOTAL_RANK2
+	total := base_config.GetUserApply()
 	if wxUser.Rank == user_model.WX_USER_RANK_ONE {
-		total = user_model.TOTAL_RANK1
+		total = base_config.GetAgentApply()
 	}
 	k := fmt.Sprintf("%s%s", sms_model.SHOP_APPLICATION, mobile)
 	if cacheCode, ok := cache.Cache.Get(k).(string); ok {