lianbingjie 2 年 前
コミット
c181563686

BIN
src/github.com/baiy/.DS_Store


BIN
src/github.com/baiy/Cadmin-server-go/.DS_Store


+ 8 - 4
src/order/orderManageController.go

@@ -249,6 +249,9 @@ func orderList(context *admin.Context) (interface{}, error) {
 		if t == "23" {
 			str += "  e.product_type = '" + "3A信用认证" + "' and"
 		}
+		if t == "24" {
+			str += "  e.product_type = '" + "权益码" + "' and"
+		}
 	}
 	// 订单状态 0:未支付 1:已支付 -1:逻辑删除 -2:已取消 -3 全额退款 3-已付款 4-待付款 -4-部分退款 -5-未退款
 	if param.OrderStatus != "" {
@@ -516,10 +519,7 @@ func OrderDetails(context *admin.Context) (interface{}, error) {
 			result = BidFileReadOrderDetail(res)
 		} else if param.Type == "剑鱼币" || param.Type == "数据流量包" || param.Type == "省份订阅包" || param.Type == "附件下载包" || param.Type == "采购单位画像包" || param.Type == "数据文件" {
 			result = JyPointsOrderDetail(res)
-		} else if param.Type == "结构化数据" || param.Type == "广告" || param.Type == "历史数据导出" ||
-			param.Type == "线下课程培训" || param.Type == "课程分销" ||
-			param.Type == "标书制作" || param.Type == "打赏" ||
-			param.Type == "ISO体系认证" || param.Type == "3A信用认证" {
+		} else {
 			result = SupplementaryOrder(res)
 		}
 		// 审核轨迹详情
@@ -796,6 +796,10 @@ func ExportOrder(context *admin.Context) (interface{}, error) {
 			product_type = "3A信用认证"
 			str += "  e.product_type = '" + "3A信用认证" + "' and"
 		}
+		if t == "24" {
+			product_type = "权益码"
+			str += "  e.product_type = '" + "权益码" + "' and"
+		}
 	} else {
 		product_type = "全部订单查询"
 	}

+ 3 - 2
src/order/orderManageService.go

@@ -2519,7 +2519,7 @@ func Download(download_type string, data *[]map[string]interface{}) string {
 					}
 					if value["product_type"] == "线下课程培训" || value["product_type"] == "课程分销" || value["product_type"] == "标书制作" ||
 						value["product_type"] == "打赏" || value["product_type"] == "省份订阅包" ||
-						value["product_type"] == "ISO体系认证" || value["product_type"] == "3A信用认证" {
+						value["product_type"] == "ISO体系认证" || value["product_type"] == "3A信用认证" || value["product_type"] == "权益码" {
 						if v == "pay_time" {
 							cell = value_cell.AddCell()
 							cell.SetValue(value["create_time"])
@@ -2678,6 +2678,7 @@ func DownloadAll(rdata *[]map[string]interface{}) string {
 		"标书制作":    13,
 		"ISO体系认证": 20,
 		"3A信用认证":  21,
+		"权益码":     22,
 	}
 	if len(*rdata) > 0 && rdata != nil {
 		xf, err := xlsx.OpenFile("web/static/alltype.xlsx")
@@ -3257,7 +3258,7 @@ func DownloadAll(rdata *[]map[string]interface{}) string {
 
 			} else if data["product_type"] == "线下课程培训" || data["product_type"] == "课程分销" || data["product_type"] == "标书制作" ||
 				data["product_type"] == "打赏" || data["product_type"] == "数据文件" ||
-				data["product_type"] == "ISO体系认证" || data["product_type"] == "3A信用认证" {
+				data["product_type"] == "ISO体系认证" || data["product_type"] == "3A信用认证" || data["product_type"] == "权益码" {
 				sheetIndex := sheetMap[qutil.ObjToString(data["product_type"])]
 				sh := xf.Sheets[sheetIndex]
 				row := sh.AddRow()

+ 10 - 89
src/order/otherOrderController.go

@@ -178,35 +178,10 @@ func CreateOtherOrder(context *admin.Context) (interface{}, error) {
 	if param.ContractMoney != 0 { // 如果合同金额不为0 则计费模式为收费
 		param.ChargeMode = 1
 	}
-	if param.ProductType == "1" {
-		param.ProductType = "广告"
-		if _, ok := AdSourceMap[param.AdSource]; !ok {
-			return nil, errors.New("广告来源有误")
-		}
-	} else if param.ProductType == "2" {
-		param.ProductType = "结构化数据"
-	} else if param.ProductType == "3" {
-		param.ProductType = "企业商机管理"
-	} else if param.ProductType == "4" {
-		param.ProductType = "历史数据"
-	} else if param.ProductType == "5" {
-		param.ProductType = "VIP订阅"
-	} else if param.ProductType == "6" {
-		param.ProductType = "线下课程培训"
-	} else if param.ProductType == "7" {
-		param.ProductType = "课程分销"
-	} else if param.ProductType == "8" {
-		param.ProductType = "标书制作"
-	} else if param.ProductType == "9" {
-		param.ProductType = "打赏"
-	} else if param.ProductType == "10" {
-		param.ProductType = "数据流量包"
-	} else if param.ProductType == "11" {
-		param.ProductType = "数据文件"
-	} else if param.ProductType == "12" {
-		param.ProductType = "ISO体系认证"
-	} else if param.ProductType == "13" {
-		param.ProductType = "3A信用认证"
+	// 根据前端传过来的序号拿产品类型
+	param.ProductType, err = GetProductTypeByIndex(param.ProductType, param.AdSource)
+	if err != nil {
+		return nil, err
 	}
 	param.CreatePerson = context.User.Username
 	code := fmt.Sprintf("%s%s", time.Now().Format("150405"), qutil.GetRandom(6))
@@ -297,36 +272,9 @@ func UpdateOtherOrder(context *admin.Context) (interface{}, error) {
 			return nil, errors.New("缺少公司名称")
 		}
 	}
-	if param.ProductType == "1" {
-		param.ProductType = "广告"
-		if _, ok := AdSourceMap[param.AdSource]; !ok {
-			return nil, errors.New("广告来源有误")
-		}
-		log.Println(param.AdSource)
-	} else if param.ProductType == "2" {
-		param.ProductType = "结构化数据"
-	} else if param.ProductType == "3" {
-		param.ProductType = "企业商机管理"
-	} else if param.ProductType == "4" {
-		param.ProductType = "历史数据"
-	} else if param.ProductType == "5" {
-		param.ProductType = "VIP订阅"
-	} else if param.ProductType == "6" {
-		param.ProductType = "线下课程培训"
-	} else if param.ProductType == "7" {
-		param.ProductType = "课程分销"
-	} else if param.ProductType == "8" {
-		param.ProductType = "标书制作"
-	} else if param.ProductType == "9" {
-		param.ProductType = "打赏"
-	} else if param.ProductType == "10" {
-		param.ProductType = "数据流量包"
-	} else if param.ProductType == "11" {
-		param.ProductType = "数据文件"
-	} else if param.ProductType == "12" {
-		param.ProductType = "ISO体系认证"
-	} else if param.ProductType == "13" {
-		param.ProductType = "3A信用认证"
+	param.ProductType, err = GetProductTypeByIndex(param.ProductType, param.AdSource)
+	if err != nil {
+		return nil, err
 	}
 	if param.ContractMoney != 0 { // 如果合同金额不为0 则计费模式为收费
 		param.ChargeMode = 1
@@ -505,36 +453,9 @@ func MyUpdateOtherOrder(context *admin.Context) (interface{}, error) {
 			return nil, errors.New("缺少公司名称")
 		}
 	}
-	if param.ProductType == "1" {
-		param.ProductType = "广告"
-		if _, ok := AdSourceMap[param.AdSource]; !ok {
-			return nil, errors.New("广告来源有误")
-		}
-		log.Println(param.AdSource)
-	} else if param.ProductType == "2" {
-		param.ProductType = "结构化数据"
-	} else if param.ProductType == "3" {
-		param.ProductType = "企业商机管理"
-	} else if param.ProductType == "4" {
-		param.ProductType = "历史数据"
-	} else if param.ProductType == "5" {
-		param.ProductType = "VIP订阅"
-	} else if param.ProductType == "6" {
-		param.ProductType = "线下课程培训"
-	} else if param.ProductType == "7" {
-		param.ProductType = "课程分销"
-	} else if param.ProductType == "8" {
-		param.ProductType = "标书制作"
-	} else if param.ProductType == "9" {
-		param.ProductType = "打赏"
-	} else if param.ProductType == "10" {
-		param.ProductType = "数据流量包"
-	} else if param.ProductType == "11" {
-		param.ProductType = "数据文件"
-	} else if param.ProductType == "12" {
-		param.ProductType = "ISO体系认证"
-	} else if param.ProductType == "13" {
-		param.ProductType = "3A信用认证"
+	param.ProductType, err = GetProductTypeByIndex(param.ProductType, param.AdSource)
+	if err != nil {
+		return nil, err
 	}
 	if param.ContractMoney != 0 { // 如果合同金额不为0 则计费模式为收费
 		param.ChargeMode = 1

+ 33 - 2
src/order/otherOrderService.go

@@ -4,6 +4,7 @@ import (
 	"config"
 	"database/sql"
 	"encoding/json"
+	"errors"
 	"fmt"
 	"log"
 	"math"
@@ -175,7 +176,7 @@ func createOtherOrder(param *CreateOtherOrderParams, code string) bool {
 		}
 		if param.ProductType == "广告" || param.ProductType == "线下课程培训" ||
 			param.ProductType == "课程分销" || param.ProductType == "标书制作" || param.ProductType == "打赏" ||
-			param.ProductType == "ISO体系认证" || param.ProductType == "3A信用认证" {
+			param.ProductType == "ISO体系认证" || param.ProductType == "3A信用认证" || param.ProductType == "权益码" {
 			delete(insertData, "data_count")
 			delete(insertData, "data_spec")
 
@@ -444,7 +445,7 @@ func updateOtherOrder(param *CreateOtherOrderParams, code string, returnStatus i
 
 		if param.ProductType == "广告" || param.ProductType == "线下课程培训" || param.ProductType == "课程分销" ||
 			param.ProductType == "标书制作" || param.ProductType == "打赏" ||
-			param.ProductType == "ISO体系认证" || param.ProductType == "3A信用认证" {
+			param.ProductType == "ISO体系认证" || param.ProductType == "3A信用认证" || param.ProductType == "权益码" {
 			delete(insertData, "data_count")
 			delete(insertData, "data_spec")
 		}
@@ -1794,3 +1795,33 @@ func GetNameList(name string) (rs *[]map[string]interface{}) {
 	return rs
 
 }
+
+var productMap = map[string]interface{}{
+	"1":  "广告",
+	"2":  "结构化数据",
+	"3":  "企业商机管理",
+	"4":  "历史数据",
+	"5":  "VIP订阅",
+	"6":  "线下课程培训",
+	"7":  "课程分销",
+	"8":  "标书制作",
+	"9":  "打赏",
+	"10": "数据流量包",
+	"11": "数据文件",
+	"12": "ISO体系认证",
+	"13": "3A信用认证",
+	"14": "权益码",
+}
+
+// GetProductTypeByIndex  创建其他订单获取对应产品类型
+func GetProductTypeByIndex(pIndex string, adSource int) (productType string, err error) {
+	if pIndex == "1" {
+		if _, ok := AdSourceMap[adSource]; !ok {
+			return "", errors.New("广告来源有误")
+		}
+	}
+	if productType, ok := productMap[pIndex]; ok {
+		return qutil.InterfaceToStr(productType), nil
+	}
+	return "", errors.New("产品类型有误")
+}

BIN
src/web/static/alltype.xlsx