ソースを参照

Merge branch '2.0.1' of http://git.ycjcjy.com/SpaceOfCheng/services into 2.0.1

胡轶钦 6 年 前
コミット
77d07aaba9
共有2 個のファイルを変更した11 個の追加3 個の削除を含む
  1. 7
    1
      controllers/goods/order.go
  2. 4
    2
      service/goods/orders.go

+ 7
- 1
controllers/goods/order.go ファイルの表示

@@ -93,6 +93,8 @@ func (c *GoodsController) PostOrder() {
93 93
 	mtx.Lock()
94 94
 	defer mtx.Unlock()
95 95
 
96
+	innerUser := c.GetString("from")
97
+
96 98
 	// 订单主信息
97 99
 	info := c.GetString("info")
98 100
 	if info == "" {
@@ -107,6 +109,10 @@ func (c *GoodsController) PostOrder() {
107 109
 
108 110
 	// 订单优惠券
109 111
 	customercouponid := c.GetString("customercouponid")
112
+	if customercouponid == "undefined" {
113
+		customercouponid = ""
114
+	}
115
+
110 116
 	//
111 117
 	var orderInfo model.TaGoodsOrders
112 118
 	var orderDetail []model.TaGoodsOrdersDetail
@@ -134,7 +140,7 @@ func (c *GoodsController) PostOrder() {
134 140
 		)
135 141
 	}
136 142
 
137
-	if err := c.serv.Orders(&orderInfo, orderDetail, customercouponid); err != nil {
143
+	if err := c.serv.Orders(&orderInfo, orderDetail, customercouponid, innerUser); err != nil {
138 144
 		c.ResponseError(err)
139 145
 	}
140 146
 

+ 4
- 2
service/goods/orders.go ファイルの表示

@@ -20,7 +20,8 @@ import (
20 20
 func (s *GoodsServ) Orders(
21 21
 	info *model.TaGoodsOrders,
22 22
 	details []model.TaGoodsOrdersDetail,
23
-	customercouponid string) error {
23
+	customercouponid,
24
+	innerUser string) error {
24 25
 	// org := s.ctx.Get("org").(model.SysOrg)
25 26
 	cust := s.ctx.Get("customer").(model.TaCustomer)
26 27
 
@@ -51,7 +52,8 @@ func (s *GoodsServ) Orders(
51 52
 		return err
52 53
 	}
53 54
 
54
-	if info.PayType == models.CONSUME_INNER {
55
+	if innerUser == "sales" {
56
+		info.PayType = models.CONSUME_INNER
55 57
 		// 内部人员, 可以直接购买
56 58
 		// TODO
57 59
 	} else {