zjxpcyc 6 lat temu
rodzic
commit
c9c18a8641
3 zmienionych plików z 31 dodań i 3 usunięć
  1. 1
    0
      models/vipcard/vipcard.go
  2. 1
    0
      service/goods/goods.go
  3. 29
    3
      tests/goodsorder_test.go

+ 1
- 0
models/vipcard/vipcard.go Wyświetl plik

@@ -214,6 +214,7 @@ func (m *VipcardDAO) InsertCustomerVipChange(change model.TaCustomerVipChange) e
214 214
 	change.ChangeId = utils.GetGUID()
215 215
 	change.Status = models.STATUS_NORMAL
216 216
 	change.CreateDate = time.Now()
217
+
217 218
 	_, err := m.db.Insert(change)
218 219
 	return err
219 220
 }

+ 1
- 0
service/goods/goods.go Wyświetl plik

@@ -34,6 +34,7 @@ func NewGoodsServ(ctx *utils.Context) *GoodsServ {
34 34
 		custDAO:   customer.NewCustomerDAO(ctx),
35 35
 		userDAO:   system.NewUserDAO(ctx),
36 36
 		couponDAO: coupon.NewCouponDAO(ctx),
37
+		vipDAO:    vipcard.NewVipcardDAO(ctx),
37 38
 	}
38 39
 }
39 40
 

+ 29
- 3
tests/goodsorder_test.go Wyświetl plik

@@ -8,12 +8,12 @@ import (
8 8
 	"testing"
9 9
 	"time"
10 10
 
11
-	"github.com/astaxie/beego"
12 11
 	. "github.com/smartystreets/goconvey/convey"
13 12
 )
14 13
 
15 14
 func TestPreGoodsOrder(t *testing.T) {
16 15
 	Convey("商品下单", t, func() {
16
+
17 17
 		Convey("正常下单", func() {
18 18
 			params := url.Values{}
19 19
 			params.Add("info", `{"CaseId":"1","AreaId":"12","AreaName":"吧台","TableId":"28","TableNo":"城咖啡水吧台","Amount":"23","OrdersNum":1,"Remark":"","OrgId":"1","UserName":"奥利奥","PayType":"coupon"}`)
@@ -37,11 +37,37 @@ func TestPreGoodsOrder(t *testing.T) {
37 37
 			So(code, ShouldEqual, http.StatusOK)
38 38
 			So(err, ShouldBeNil)
39 39
 
40
-			beego.Trace(result)
41
-
42 40
 			// 业务返回判断
43 41
 			So(result.Code, ShouldEqual, http.StatusOK)
44 42
 			So(result.Result, ShouldNotBeEmpty)
45 43
 		})
46 44
 	})
47 45
 }
46
+
47
+func TestConfirmOrders(t *testing.T) {
48
+	orderID := "cc84338e-488e-463b-a33e-7dc7f2cd10b6"
49
+
50
+	Convey("下单确认", t, func() {
51
+		result := &controllers.JSONMessage{}
52
+		api := "/api/wechat/MQ/order/goods/" + orderID
53
+
54
+		token := &utils.JWTToken{
55
+			Guest:   false,
56
+			ID:      "oMOpz0kgTrasoAA3G70R7phomn1g", // openid
57
+			Expire:  time.Now().Local().Add(24 * 30 * time.Hour),
58
+			BatchNo: "",
59
+		}
60
+
61
+		code, _, err := NewRequestMock().
62
+			AddToken(token.ToMap()).
63
+			AddWechatUA().
64
+			Request(http.MethodPut, api, nil, result)
65
+
66
+		So(code, ShouldEqual, http.StatusOK)
67
+		So(err, ShouldBeNil)
68
+
69
+		// 业务返回判断
70
+		So(result.Code, ShouldEqual, http.StatusOK)
71
+	})
72
+
73
+}