Browse Source

Merge branch 'cygx/mfyx_2.0' of http://8.136.199.33:3000/hongze/hz_crm_api into debug

xingzai 10 months ago
parent
commit
8d2256b40b
2 changed files with 59 additions and 3 deletions
  1. 55 2
      controllers/cygx/order.go
  2. 4 1
      models/cygx/orde.go

+ 55 - 2
controllers/cygx/order.go

@@ -24,6 +24,8 @@ type OrderController struct {
 // @Param   StartDate   query   string  false       "开始时间 ,列如2021-03-06 "
 // @Param   EndDate   query   string  false       "结束时间,列如2021-03-06 "
 // @Param   AdminId   query   string  false       "销售ID "
+// @Param   ShareId   query   string  false       "推荐人ID "
+// @Param   PaymentType   query   string  false       "支付渠道  取值范围:1微信小程序,2微信扫码支付,3微信H5支付。 "
 // @Param   OrderType   query   int  false       "订单类型 1:畅读卡订单,2:单场付费订单"
 // @Param   OrderStatus   query   int  false       "订单状态,0:已取消、1:待支付、2:已支付、3:退款成功、4:退款处理中、5:退款异常、6:退款关闭"
 // @Param   PaymentProject   query   string  false       "付款项目"
@@ -52,6 +54,8 @@ func (this *OrderController) OrderList() {
 	startDate := this.GetString("StartDate")
 	endDate := this.GetString("EndDate")
 	adminId := this.GetString("AdminId")
+	shareId := this.GetString("ShareId")
+	paymentType, _ := this.GetInt("PaymentType")
 	orderCode := this.GetString("OrderCode")
 	keyWord := this.GetString("KeyWord")
 	paymentProject := this.GetString("PaymentProject")
@@ -79,6 +83,15 @@ func (this *OrderController) OrderList() {
 		condition += ` 	AND seller_id IN (` + adminId + `) `
 	}
 
+	if shareId != "" { //推荐人ID
+		condition += ` 	AND share_id IN (` + shareId + `) `
+	}
+
+	if paymentType > 0 { // 支付渠道
+		condition += ` 	AND payment_type  = ?  `
+		pars = append(pars, paymentType)
+	}
+
 	if orderStatus > -1 { //订单状态
 		condition += ` 	AND order_status  = ?  `
 		pars = append(pars, orderStatus)
@@ -151,6 +164,16 @@ func (this *OrderController) OrderList() {
 		case 6:
 			item.OrderStatusText = "退款关闭"
 		}
+
+		switch v.PaymentType {
+		case 1:
+			item.PaymentTypeText = "小程序"
+		case 2:
+			item.PaymentTypeText = "PC"
+		case 3:
+			item.PaymentTypeText = "H5"
+		}
+
 		item.UserId = v.UserId
 		item.RealName = v.RealName
 		item.Mobile = v.Mobile
@@ -158,7 +181,11 @@ func (this *OrderController) OrderList() {
 		item.CompanyId = v.CompanyId
 		item.CompanyName = v.CompanyName
 		item.SellerName = v.SellerName
-		item.InviteName = inviteNameMap[v.Mobile]
+		if v.ShareName != "" {
+			item.InviteName = v.ShareName
+		} else {
+			item.InviteName = inviteNameMap[v.Mobile]
+		}
 		item.PaymentProject = v.GoodsName
 
 		if v.OrderStatus != 0 && v.OrderStatus != 1 {
@@ -263,6 +290,8 @@ func (this *UserController) OrderRefund() {
 // @Param   StartDate   query   string  false       "开始时间 ,列如2021-03-06 "
 // @Param   EndDate   query   string  false       "结束时间,列如2021-03-06 "
 // @Param   AdminId   query   string  false       "销售ID "
+// @Param   ShareId   query   string  false       "推荐人ID "
+// @Param   PaymentType   query   string  false       "支付渠道  取值范围:1微信小程序,2微信扫码支付,3微信H5支付。 "
 // @Param   OrderType   query   int  false       "订单类型 1:畅读卡订单,2:单场付费订单"
 // @Param   OrderStatus   query   int  false       "订单状态,0:已取消、1:待支付、2:已支付、3:退款成功、4:退款处理中、5:退款异常、6:退款关闭"
 // @Param   PaymentProject   query   string  false       "付款项目"
@@ -291,6 +320,8 @@ func (this *OrderController) OrderRefundList() {
 	startDate := this.GetString("StartDate")
 	endDate := this.GetString("EndDate")
 	adminId := this.GetString("AdminId")
+	shareId := this.GetString("ShareId")
+	paymentType, _ := this.GetInt("PaymentType")
 	orderCode := this.GetString("OrderCode")
 	keyWord := this.GetString("KeyWord")
 	paymentProject := this.GetString("PaymentProject")
@@ -319,6 +350,15 @@ func (this *OrderController) OrderRefundList() {
 		condition += ` 	AND seller_id IN (` + adminId + `) `
 	}
 
+	if shareId != "" { //推荐人ID
+		condition += ` 	AND share_id IN (` + shareId + `) `
+	}
+
+	if paymentType > 0 { // 支付渠道
+		condition += ` 	AND payment_type  = ?  `
+		pars = append(pars, paymentType)
+	}
+
 	if orderStatus > -1 { //订单状态
 		condition += ` 	AND order_status  = ?  `
 		pars = append(pars, orderStatus)
@@ -384,6 +424,15 @@ func (this *OrderController) OrderRefundList() {
 		case 6:
 			item.OrderStatusText = "退款关闭"
 		}
+
+		switch v.PaymentType {
+		case 1:
+			item.PaymentTypeText = "小程序"
+		case 2:
+			item.PaymentTypeText = "PC"
+		case 3:
+			item.PaymentTypeText = "H5"
+		}
 		item.UserId = v.UserId
 		item.RealName = v.RealName
 		item.Mobile = v.Mobile
@@ -391,7 +440,11 @@ func (this *OrderController) OrderRefundList() {
 		item.CompanyId = v.CompanyId
 		item.CompanyName = v.CompanyName
 		item.SellerName = v.SellerName
-		item.InviteName = inviteNameMap[v.Mobile]
+		if v.ShareName != "" {
+			item.InviteName = v.ShareName
+		} else {
+			item.InviteName = inviteNameMap[v.Mobile]
+		}
 		item.PaymentProject = v.GoodsName
 		item.RefundTime = v.RefundTime.Format(utils.FormatDateTime)
 		item.RefundRemark = v.RefundRemark

+ 4 - 1
models/cygx/orde.go

@@ -10,7 +10,7 @@ type CygxOrder struct {
 	OrderId          int       `orm:"column(order_id);pk";comment:"订单id"`
 	OrderCode        string    `comment:"订单编号"`
 	OutTradeCode     string    `comment:"外部交易号"`
-	PaymentType      int       `comment:"支付类型。取值范围:1微信支付,2支付宝支付。"`
+	PaymentType      int       `comment:"支付类型。支付类型。取值范围:1微信小程序,2微信扫码支付,3微信H5支付。"`
 	GoodsName        string    `comment:"商品名称"`
 	GoodsId          int       `comment:"商品ID"`
 	BuyerInvoice     string    `comment:"买家发票信息"`
@@ -72,6 +72,8 @@ type CygxOrderResp struct {
 	CreateTime       time.Time `comment:"创建时间"`
 	ModifyTime       time.Time `comment:"修改时间"`
 	RegisterPlatform int       `comment:"来源 1小程序,2:网页"`
+	ShareId          int       `comment:"分享人ID"`
+	ShareName        string    `comment:"分享人姓名"`
 }
 
 func GetCygxOrderList(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxOrderResp, err error) {
@@ -117,6 +119,7 @@ type OrderListResp struct {
 	SourceTitle     string  `comment:"来源名称,活动或者报告标题"`
 	OrderStatus     int     `comment:"订单状态码"`
 	OrderStatusText string  `comment:"订单状态描述"`
+	PaymentTypeText string  `comment:"支付类型。取值范围:1微信小程序,2微信扫码支付,3微信H5支付。"`
 	StartDate       string  `comment:"开始日期"`
 	EndDate         string  `comment:"结束日期"`
 	InviteName      string  `description:"邀请人"`