Selaa lähdekoodia

删除产品风险等级设置

kobe6258 4 kuukautta sitten
vanhempi
commit
2c91abf7e5
2 muutettua tiedostoa jossa 12 lisäystä ja 32 poistoa
  1. 10 29
      controllers/product.go
  2. 2 3
      models/merchant_product.go

+ 10 - 29
controllers/product.go

@@ -196,16 +196,16 @@ func (this *ProductController) AddProduct() {
 	}
 	switch req.Type {
 	case "report":
-		product.RiskLevel, product.Title, err = services.GetRiskLevel("report", req.SourceId)
+		_, product.Title, err = services.GetRiskLevel("report", req.SourceId)
 		product.IsPermanent = true
 	case "audio":
-		product.RiskLevel, product.Title, err = services.GetRiskLevel("audio", req.SourceId)
+		_, product.Title, err = services.GetRiskLevel("audio", req.SourceId)
 		product.IsPermanent = true
 	case "video":
-		product.RiskLevel, product.Title, err = services.GetRiskLevel("video", req.SourceId)
+		_, product.Title, err = services.GetRiskLevel("video", req.SourceId)
 		product.IsPermanent = true
 	case "package":
-		product.RiskLevel, permissionName, err = services.GetRiskLevel("package", req.SourceId)
+		_, permissionName, err = services.GetRiskLevel("package", req.SourceId)
 	default:
 		br.Msg = "产品类型错误"
 		br.ErrMsg = "获取产品列表失败,Err:产品类型错误"
@@ -222,16 +222,7 @@ func (this *ProductController) AddProduct() {
 		}
 		return
 	}
-	if product.RiskLevel == "" {
-		br.Msg = "新增产品错误"
-		br.ErrMsg = "未获取到风险等级"
-		return
-	}
-	if !checkProductRiskLevel(product.RiskLevel) {
-		br.Msg = "产品风险等级不合法"
-		br.ErrMsg = "产品风险等级不合法:" + product.RiskLevel
-		return
-	}
+
 	if product.Title == "" {
 		br.Msg = "产品名称不能为空"
 		br.ErrMsg = "产品名称不能为空"
@@ -502,7 +493,6 @@ func (this *ProductController) ProductList() {
 			ProductName:   product.Title,
 			ProductType:   CNProductMap[product.Type],
 			PublishedTime: product.CreatedTime.Format(time.DateTime),
-			RiskLevel:     product.RiskLevel,
 			Price:         fmt.Sprintf("¥%s", product.Price),
 			SaleStatus:    CNSaleStatusMap[product.SaleStatus],
 			CoverSrc:      product.CoverSrc,
@@ -621,13 +611,13 @@ func (this *ProductController) EditProduct() {
 	}
 	switch req.Type {
 	case "report":
-		product.RiskLevel, product.Title, err = services.GetRiskLevel("report", req.SourceId)
+		_, product.Title, err = services.GetRiskLevel("report", req.SourceId)
 	case "audio":
-		product.RiskLevel, product.Title, err = services.GetRiskLevel("audio", req.SourceId)
+		_, product.Title, err = services.GetRiskLevel("audio", req.SourceId)
 	case "video":
-		product.RiskLevel, product.Title, err = services.GetRiskLevel("video", req.SourceId)
+		_, product.Title, err = services.GetRiskLevel("video", req.SourceId)
 	case "package":
-		product.RiskLevel, _, err = services.GetRiskLevel("package", req.SourceId)
+		_, _, err = services.GetRiskLevel("package", req.SourceId)
 	default:
 		br.Msg = "产品类型错误"
 		br.ErrMsg = "获取产品列表失败,Err:产品类型错误"
@@ -643,16 +633,7 @@ func (this *ProductController) EditProduct() {
 		}
 		return
 	}
-	if product.RiskLevel == "" {
-		br.Msg = "编辑产品失败"
-		br.ErrMsg = "未获取到风险等级"
-		return
-	}
-	if !checkProductRiskLevel(product.RiskLevel) {
-		br.Msg = "产品风险等级不合法"
-		br.ErrMsg = "产品风险等级不合法:" + product.RiskLevel
-		return
-	}
+
 	if product.Title == "" {
 		br.Msg = "产品名称不能为空"
 		br.ErrMsg = "产品名称不能为空"

+ 2 - 3
models/merchant_product.go

@@ -25,7 +25,6 @@ type MerchantProduct struct {
 	CoverSrc    string              `description:"column:cover_src;type:varchar(255);comment:封面图片"`
 	Description string              `description:"column:description;type:varchar(255);comment:描述"`
 	Price       string              `description:"column:price;type:decimal(10,2);comment:价格"`
-	RiskLevel   string              `description:"column:risk_level;type:varchar(255);not null;comment:风险等级"`
 	Type        MerchantProductType `description:"column:type;type:enum('report','video','audio','package');not null;comment:类型"`
 	IsPermanent bool                `description:"column:is_permanent;type:int(1);not null;default:0;comment:是否永久"`
 	ValidDays   int                 `description:"column:valid_days;type:int(11);comment:有效期天数"`
@@ -85,9 +84,9 @@ func (mp *MerchantProduct) EditProduct() (err error) {
 	o := orm.NewOrm()
 	mp.UpdatedTime = time.Now()
 	if mp.Type == ProductPackage {
-		_, err = o.Update(mp, "updated_time", "risk_level", "price", "cover_src", "description", "valid_days", "title")
+		_, err = o.Update(mp, "updated_time", "price", "cover_src", "description", "valid_days", "title")
 	} else {
-		_, err = o.Update(mp, "updated_time", "risk_level", "price")
+		_, err = o.Update(mp, "updated_time", "price")
 	}
 
 	return