作者 tangxvhui

Merge branch 'dev' of http://gitlab.fjmaimaimai.com/mmm-go/partnermg into dev

@@ -37,11 +37,11 @@ func (c *DividendsController) Prepare() { @@ -37,11 +37,11 @@ func (c *DividendsController) Prepare() {
37 func (c *DividendsController) Edit() { 37 func (c *DividendsController) Edit() {
38 //用与适配前端定义的数据结构 38 //用与适配前端定义的数据结构
39 type DividendPaymentItem struct { 39 type DividendPaymentItem struct {
40 - PaymentForGoods string `json:"paymentForGoods"`  
41 - StateOfPayment string `json:"stateOfPayment"` 40 + PaymentForGoods float64 `json:"paymentForGoods"`
  41 + StateOfPayment int `json:"stateOfPayment"`
42 } 42 }
43 type Parameter struct { 43 type Parameter struct {
44 - Id int64 `json:"id"` //订单编号 44 + Id string `json:"id"` //订单编号
45 DividendPayment []DividendPaymentItem `json:"dividendPayment"` 45 DividendPayment []DividendPaymentItem `json:"dividendPayment"`
46 } 46 }
47 var ( 47 var (
@@ -53,8 +53,13 @@ func (c *DividendsController) Edit() { @@ -53,8 +53,13 @@ func (c *DividendsController) Edit() {
53 c.ResponseError(errors.New("json数据解析失败")) 53 c.ResponseError(errors.New("json数据解析失败"))
54 return 54 return
55 } 55 }
  56 + if len(param.Id) == 0 {
  57 + c.ResponseError(errors.New("id is empty"))
  58 + return
  59 + }
  60 + orderId, _ := strconv.ParseInt(param.Id, 10, 64)
56 cmd := OrderPaymentCmd.CreateOrderPaymentCommand{ 61 cmd := OrderPaymentCmd.CreateOrderPaymentCommand{
57 - OrderId: param.Id, 62 + OrderId: orderId,
58 DivdendPaymentItem: make([]OrderPaymentCmd.DivdendPyamentItem, 0), 63 DivdendPaymentItem: make([]OrderPaymentCmd.DivdendPyamentItem, 0),
59 } 64 }
60 65
@@ -62,8 +67,8 @@ func (c *DividendsController) Edit() { @@ -62,8 +67,8 @@ func (c *DividendsController) Edit() {
62 for i := range param.DividendPayment { 67 for i := range param.DividendPayment {
63 item := param.DividendPayment[i] 68 item := param.DividendPayment[i]
64 paymentItem := OrderPaymentCmd.DivdendPyamentItem{} 69 paymentItem := OrderPaymentCmd.DivdendPyamentItem{}
65 - paymentItem.PaymentForGoods, _ = strconv.ParseFloat(item.PaymentForGoods, 64)  
66 - paymentItem.StateOfPayment, _ = strconv.Atoi(item.StateOfPayment) 70 + paymentItem.PaymentForGoods = item.PaymentForGoods
  71 + paymentItem.StateOfPayment = item.StateOfPayment
67 paymentItem.PaymentSn = i + 1 72 paymentItem.PaymentSn = i + 1
68 73
69 if paymentItem.StateOfPayment == domain.BonusPaid { 74 if paymentItem.StateOfPayment == domain.BonusPaid {