Bladeren bron

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

胡轶钦 6 jaren geleden
bovenliggende
commit
992a11725c
5 gewijzigde bestanden met toevoegingen van 64 en 26 verwijderingen
  1. 4
    16
      controllers/luckdraw/luckdraw.go
  2. 48
    0
      log/common.log
  3. 8
    7
      routers/wechat.go
  4. 3
    2
      service/coupon/coupon.go
  5. 1
    1
      service/message/news.go

+ 4
- 16
controllers/luckdraw/luckdraw.go Bestand weergeven

@@ -1,14 +1,12 @@
1 1
 package luckdraw
2 2
 
3 3
 import (
4
-	"cdkj-check/helper"
5 4
 	"errors"
6 5
 	"net/http"
7 6
 	"spaceofcheng/services/controllers"
8 7
 	"spaceofcheng/services/models/model"
9 8
 	"spaceofcheng/services/service/luckdraw"
10 9
 	"spaceofcheng/services/utils"
11
-	"strconv"
12 10
 )
13 11
 
14 12
 // LuckdrawController 应用
@@ -27,23 +25,13 @@ func (c *LuckdrawController) Constructor() {
27 25
 
28 26
 // GetUserByCode 根据code获取用户信息
29 27
 func (c *LuckDrawController) GetUserByCode() {
30
-	custID := 0
31
-	encodeUser, _ := c.GetInt("from")
32
-	if encodeUser != 0 {
33
-		encodeUser = helper.IntXOR(encodeUser, 97)
34
-		enStr := strconv.Itoa(encodeUser)
35
-		enStr = enStr[:len(enStr)-3]
36
-
37
-		custID, _ = strconv.Atoi(enStr)
38
-	}
39
-
40 28
 	userRaw := c.Context.Get("customer")
41 29
 	if userRaw == nil {
42 30
 		c.ResponseError(errors.New("系统内部错误"), http.StatusInternalServerError)
43 31
 	}
44 32
 
45 33
 	user := userRaw.(model.TaCustomer)
46
-	luckdrawid, _ := c.GetInt("luckdrawid")
34
+	luckdrawid := c.GetString(":id")
47 35
 	record, err := c.dao.GetUserLuckDrawByLuckDraw(user.Id, luckdrawid)
48 36
 	if err != nil {
49 37
 		utils.LogError("获取用户抽奖信息失败: " + err.Error())
@@ -67,7 +55,7 @@ func (c *LuckDrawController) GetUserByCode() {
67 55
 
68 56
 // GetLuckDraw 获取抽奖信息
69 57
 func (c *LuckDrawController) GetLuckDraw() {
70
-	id, _ := c.GetInt(":id")
58
+	id := c.GetString(":id")
71 59
 	luckdraw, err := c.dao.GetLuckDraw(id)
72 60
 	if err != nil {
73 61
 		utils.LogError("获取抽奖信息失败: " + err.Error())
@@ -78,7 +66,7 @@ func (c *LuckDrawController) GetLuckDraw() {
78 66
 
79 67
 // LuckDraw 抽奖
80 68
 func (c *LuckDrawController) LuckDraw() {
81
-	id, _ := c.GetInt(":id")
69
+	id := c.GetString(":id")
82 70
 	userRaw := c.Context.Get("customer")
83 71
 	if userRaw == nil {
84 72
 		c.ResponseError(errors.New("系统内部错误"), http.StatusInternalServerError)
@@ -120,7 +108,7 @@ func (c *LuckDrawController) GetUserLuckDraw() {
120 108
 
121 109
 // GetRecordByID 根据ID获取中奖记录信息
122 110
 func (c *LuckDrawController) GetRecordByID() {
123
-	id, _ := c.GetInt(":id")
111
+	id := c.GetString(":id")
124 112
 	record, err := c.dao.GetRecordByID(id)
125 113
 	if err != nil {
126 114
 		utils.LogError("获取中奖记录失败: " + err.Error())

+ 48
- 0
log/common.log Bestand weergeven

@@ -142,3 +142,51 @@
142 142
 2018/09/21 03:22:13 [E] 用户没有设置默认案场
143 143
 2018/09/21 03:22:13 [E] 用户没有设置默认案场
144 144
 2018/09/21 03:22:16 [E] 用户没有设置默认案场
145
+2018/09/25 09:32:27 [E] 用户没有设置默认案场
146
+2018/09/25 09:32:27 [E] 用户没有设置默认案场
147
+2018/09/25 09:32:27 [E] 统计会员总数失败: Error 1370: execute command denied to user 'spaceofcheng'@'localhost' for routine 'cdkj.fun_total_customer'
148
+2018/09/25 09:32:28 [E] 用户没有设置默认案场
149
+2018/09/25 09:59:43 [E] 用户没有设置默认案场
150
+2018/09/25 09:59:43 [E] 用户没有设置默认案场
151
+2018/09/25 09:59:43 [E] 统计会员总数失败: Error 1370: execute command denied to user 'spaceofcheng'@'localhost' for routine 'cdkj.fun_total_customer'
152
+2018/09/25 09:59:43 [E] 用户没有设置默认案场
153
+2018/09/25 10:00:36 [E] 用户没有设置默认案场
154
+2018/09/25 10:00:53 [E] 用户没有设置默认案场
155
+2018/09/25 10:00:53 [E] 用户没有设置默认案场
156
+2018/09/25 10:01:04 [E] 用户没有设置默认案场
157
+2018/09/25 10:01:12 [E] 用户没有设置默认案场
158
+2018/09/25 10:01:34 [E] 用户没有设置默认案场
159
+2018/09/25 10:01:36 [E] 用户没有设置默认案场
160
+2018/09/25 10:01:37 [E] 用户没有设置默认案场
161
+2018/09/25 10:01:38 [E] 用户没有设置默认案场
162
+2018/09/25 10:01:39 [E] 用户没有设置默认案场
163
+2018/09/25 10:01:40 [E] 用户没有设置默认案场
164
+2018/09/25 10:01:41 [E] 用户没有设置默认案场
165
+2018/09/25 10:02:06 [E] 用户没有设置默认案场
166
+2018/09/25 10:02:07 [E] 用户没有设置默认案场
167
+2018/09/25 10:33:31 [E] 用户没有设置默认案场
168
+2018/09/25 10:33:31 [E] 用户没有设置默认案场
169
+2018/09/25 10:34:18 [E] 用户没有设置默认案场
170
+2018/09/25 10:34:18 [E] 用户没有设置默认案场
171
+2018/09/25 10:34:18 [E] 用户没有设置默认案场
172
+2018/09/25 10:34:19 [E] 用户没有设置默认案场
173
+2018/09/25 10:34:20 [E] 用户没有设置默认案场
174
+2018/09/25 10:34:26 [E] 用户没有设置默认案场
175
+2018/09/25 10:34:34 [E] 用户没有设置默认案场
176
+2018/09/25 10:36:05 [E] 用户没有设置默认案场
177
+2018/09/25 10:36:06 [E] 用户没有设置默认案场
178
+2018/09/25 10:36:12 [E] 用户没有设置默认案场
179
+2018/09/25 10:37:32 [E] 用户没有设置默认案场
180
+2018/09/25 10:37:33 [E] 用户没有设置默认案场
181
+2018/09/25 10:37:34 [E] 用户没有设置默认案场
182
+2018/09/25 10:37:36 [E] 用户没有设置默认案场
183
+2018/09/25 10:39:44 [E] 用户没有设置默认案场
184
+2018/09/25 10:39:45 [E] 用户没有设置默认案场
185
+2018/09/25 10:39:46 [E] 用户没有设置默认案场
186
+2018/09/25 10:49:52 [E] 用户没有设置默认案场
187
+2018/09/25 10:49:56 [E] 用户没有设置默认案场
188
+2018/09/25 10:50:04 [E] 用户没有设置默认案场
189
+2018/09/25 10:52:56 [E] 用户没有设置默认案场
190
+2018/09/25 10:52:58 [E] 用户没有设置默认案场
191
+2018/09/25 10:53:02 [E] 用户没有设置默认案场
192
+2018/09/25 11:03:32 [E] 用户没有设置默认案场

+ 8
- 7
routers/wechat.go Bestand weergeven

@@ -1,6 +1,7 @@
1 1
 package routers
2 2
 
3 3
 import (
4
+	"cdkj-check/controllers/luckdraw"
4 5
 	"spaceofcheng/services/controllers/bodycheck"
5 6
 	"spaceofcheng/services/controllers/card"
6 7
 	"spaceofcheng/services/controllers/cases"
@@ -82,12 +83,12 @@ func getWechatRoutes() beego.LinkNamespace {
82 83
 		beego.NSRouter("/case/conf/:caseid", &cases.CaseController{}, "get:GetCaseConf"),
83 84
 
84 85
 		// 抽奖
85
-		// beego.NSRouter("/user", &luckdraw.LuckDrawController{}, "get:GetUserByCode"),
86
-		// beego.NSRouter("/luckdraw/:id", &luckdraw.LuckDrawController{}, "get:GetLuckDraw"),
87
-		// beego.NSRouter("/luckdraw/:id", &luckdraw.LuckDrawController{}, "post:LuckDraw"),
88
-		// beego.NSRouter("/luckdraw/:id/share", &luckdraw.LuckDrawController{}, "post:SaveShareRecord"),
89
-		// beego.NSRouter("/record", &luckdraw.LuckDrawController{}, "get:GetRecordByLuckDraw"),
90
-		// beego.NSRouter("/user/record", &luckdraw.LuckDrawController{}, "get:GetUserLuckDraw"),
91
-		// beego.NSRouter("/user/record/:id", &luckdraw.LuckDrawController{}, "get:GetRecordByID"),
86
+		beego.NSRouter("/luckdraw/user/:id", &luckdraw.LuckDrawController{}, "get:GetUserByCode"),
87
+		beego.NSRouter("/luckdraw/:id", &luckdraw.LuckDrawController{}, "get:GetLuckDraw"),
88
+		beego.NSRouter("/luckdraw/:id", &luckdraw.LuckDrawController{}, "post:LuckDraw"),
89
+		beego.NSRouter("/luckdraw/:id/share", &luckdraw.LuckDrawController{}, "post:SaveShareRecord"),
90
+		beego.NSRouter("/luckdraw/record", &luckdraw.LuckDrawController{}, "get:GetRecordByLuckDraw"),
91
+		beego.NSRouter("/user/luckdraw/record", &luckdraw.LuckDrawController{}, "get:GetUserLuckDraw"),
92
+		beego.NSRouter("/user/luckdraw/record/:id", &luckdraw.LuckDrawController{}, "get:GetRecordByID"),
92 93
 	)
93 94
 }

+ 3
- 2
service/coupon/coupon.go Bestand weergeven

@@ -515,7 +515,7 @@ func (s *CouponServ) ReceiveCoupon(id, saleid, serialcode string) error {
515 515
 	if coupon.TotalCount <= coupon.SentCount && coupon.IsOver == 0 {
516 516
 		return errors.New("log-error-优惠券已领完!")
517 517
 	}
518
-	if coupon.EndDate.Before(time.Now()) {
518
+	if coupon.ValidDays <= 0 && coupon.EndDate.Before(time.Now()) {
519 519
 		return errors.New("log-error-优惠券已过期")
520 520
 	}
521 521
 
@@ -606,7 +606,8 @@ func (s *CouponServ) ChannelReceiveCoupon(id string) error {
606 606
 	if coupon.TotalCount <= coupon.SentCount && coupon.IsOver == 0 {
607 607
 		return errors.New("log-error-优惠券已领完!")
608 608
 	}
609
-	if coupon.EndDate.Before(time.Now()) {
609
+
610
+	if coupon.ValidDays <= 0 && coupon.EndDate.Before(time.Now()) {
610 611
 		return errors.New("log-error-优惠券已过期")
611 612
 	}
612 613
 

+ 1
- 1
service/message/news.go Bestand weergeven

@@ -37,7 +37,7 @@ func (s *MessageServ) GetNewsList(locationid, title, orgid string, page int, pag
37 37
 
38 38
 // GetNewsByLocation 根据位置id获取咨询信息
39 39
 func (s *MessageServ) GetNewsByLocation(locationid, orgid string) ([]model.TaCmsNews, error) {
40
-	news, err := s.dao.GetNewsByLocation(locationid, orgid)
40
+	news, err := s.dao.GetNewsByLocationShow(locationid, orgid)
41 41
 	if err != nil {
42 42
 		utils.LogError("获取列表失败: " + err.Error())
43 43
 		return nil, errors.New("获取列表失败")