瀏覽代碼

ketBindCard

胡轶钦 6 年之前
父節點
當前提交
ff703905b2

+ 7
- 1
controllers/auth.go 查看文件

49
 
49
 
50
 // CreateNewToken 新 token
50
 // CreateNewToken 新 token
51
 func (c *BaseController) CreateNewToken() {
51
 func (c *BaseController) CreateNewToken() {
52
-	c.Context.Set("token", c.serv.NewToken())
52
+
53
+	batchNo := ""
54
+	if c.Context.Get("token-batch") != nil {
55
+		batchNo = c.Context.Get("token-batch").(string)
56
+	}
57
+
58
+	c.Context.Set("token", c.serv.NewToken(batchNo))
53
 }
59
 }

+ 15
- 0
controllers/course/course.go 查看文件

238
 	}
238
 	}
239
 	c.ResponseJSON(info)
239
 	c.ResponseJSON(info)
240
 }
240
 }
241
+
242
+// GetCourseBySendType 根据类型获取课程信息
243
+func (c *CourseController) GetCourseBySendType() {
244
+	typeval := c.GetString("type")
245
+	caseids := c.GetString("caseid")
246
+	if caseids == "" {
247
+		cases := c.Context.Get("cases").([]model.SysUserCase)
248
+		caseids = c.GetCaseIDs(cases)
249
+	}
250
+	courses, err := c.serv.GetCourseBySendType(typeval, caseids)
251
+	if err != nil {
252
+		c.ResponseError(err)
253
+	}
254
+	c.ResponseJSON(courses)
255
+}

+ 9
- 0
controllers/message/location.go 查看文件

60
 	}
60
 	}
61
 	c.ResponseJSON("操作成功!")
61
 	c.ResponseJSON("操作成功!")
62
 }
62
 }
63
+
64
+// GetLocationInfoList 根据位置信息
65
+func (c *MessageController) GetLocationInfoList() {
66
+	infos, err := c.dao.GetLocationInfoList()
67
+	if err != nil {
68
+		c.ResponseError(err)
69
+	}
70
+	c.ResponseJSON(infos)
71
+}

+ 3
- 0
controllers/user/user.go 查看文件

9
 	"spaceofcheng/services/service"
9
 	"spaceofcheng/services/service"
10
 	"spaceofcheng/services/utils"
10
 	"spaceofcheng/services/utils"
11
 	"time"
11
 	"time"
12
+
13
+	"github.com/yl10/kit/guid"
12
 )
14
 )
13
 
15
 
14
 // UserController 用户
16
 // UserController 用户
185
 
187
 
186
 	// 成功之后, 设置用户
188
 	// 成功之后, 设置用户
187
 	c.Context.Set("user", *user)
189
 	c.Context.Set("user", *user)
190
+	c.Context.Set("token-batch", guid.NewGUIDString())
188
 
191
 
189
 	if token == "" && doRemember != 0 {
192
 	if token == "" && doRemember != 0 {
190
 		var err error
193
 		var err error

+ 4
- 4
models/card/card.go 查看文件

229
 // GetCaseUsableCard 获取案场可用卡信息
229
 // GetCaseUsableCard 获取案场可用卡信息
230
 func (m *CardDAO) GetCaseUsableCard(caseid, userid string, page, pageSize int) ([]CaseUsableCard, error) {
230
 func (m *CardDAO) GetCaseUsableCard(caseid, userid string, page, pageSize int) ([]CaseUsableCard, error) {
231
 	var cards []CaseUsableCard
231
 	var cards []CaseUsableCard
232
-	sql := `select * from ta_coupon_card where case_id=? and status=? and end_date>now() order by create_date limit ` + strconv.Itoa((page-1)*pageSize) + `, ` + strconv.Itoa(pageSize)
233
-	err := m.db.Sql(sql, caseid, models.STATUS_NORMAL).Find(&cards)
232
+	sql := `select * from ta_coupon_card where case_id=? and status=? and end_date>now() and send_type=? order by create_date limit ` + strconv.Itoa((page-1)*pageSize) + `, ` + strconv.Itoa(pageSize)
233
+	err := m.db.Sql(sql, caseid, models.STATUS_NORMAL, models.GIVE_TYPE_CASE).Find(&cards)
234
 	for inx, card := range cards {
234
 	for inx, card := range cards {
235
 		if userid != "" {
235
 		if userid != "" {
236
 			cCards, err := m.GetCustomerCardByCardAndUser(card.CardId, userid)
236
 			cCards, err := m.GetCustomerCardByCardAndUser(card.CardId, userid)
251
 // GetCaseUsableCardCount 获取案场可用卡数量
251
 // GetCaseUsableCardCount 获取案场可用卡数量
252
 func (m *CardDAO) GetCaseUsableCardCount(caseid, userid string) (int, error) {
252
 func (m *CardDAO) GetCaseUsableCardCount(caseid, userid string) (int, error) {
253
 	var Coupons []CaseUsableCard
253
 	var Coupons []CaseUsableCard
254
-	sql := `select * from ta_coupon_card where case_id=? and status=? and end_date>now()`
255
-	err := m.db.Sql(sql, caseid, models.STATUS_NORMAL).Find(&Coupons)
254
+	sql := `select * from ta_coupon_card where case_id=? and status=? and end_date>now() and send_type=?`
255
+	err := m.db.Sql(sql, caseid, models.STATUS_NORMAL, models.GIVE_TYPE_CASE).Find(&Coupons)
256
 	return len(Coupons), err
256
 	return len(Coupons), err
257
 }
257
 }
258
 
258
 

+ 4
- 4
models/coupon/coupon.go 查看文件

291
 // GetCaseUsableCoupon 获取案场可用优惠券信息
291
 // GetCaseUsableCoupon 获取案场可用优惠券信息
292
 func (m *CouponDAO) GetCaseUsableCoupon(caseid, userid string, page, pageSize int) ([]CaseCouponDetail, error) {
292
 func (m *CouponDAO) GetCaseUsableCoupon(caseid, userid string, page, pageSize int) ([]CaseCouponDetail, error) {
293
 	var Coupons []CaseCouponDetail
293
 	var Coupons []CaseCouponDetail
294
-	sql := `select * from ta_coupon where case_id=? and status=? and end_date>now() order by create_date limit ` + strconv.Itoa((page-1)*pageSize) + `, ` + strconv.Itoa(pageSize)
295
-	err := m.db.Sql(sql, caseid, models.STATUS_NORMAL).Find(&Coupons)
294
+	sql := `select * from ta_coupon where case_id=? and status=? and end_date>now() and send_type=? order by create_date limit ` + strconv.Itoa((page-1)*pageSize) + `, ` + strconv.Itoa(pageSize)
295
+	err := m.db.Sql(sql, caseid, models.STATUS_NORMAL, models.GIVE_TYPE_CASE).Find(&Coupons)
296
 	for inx, coupon := range Coupons {
296
 	for inx, coupon := range Coupons {
297
 		if userid != "" {
297
 		if userid != "" {
298
 			cCoupons, err := m.GetCustomerCouponByCouponAndUser(coupon.CouponId, userid)
298
 			cCoupons, err := m.GetCustomerCouponByCouponAndUser(coupon.CouponId, userid)
320
 // GetCaseUsableCouponCount 获取案场可用优惠券数量
320
 // GetCaseUsableCouponCount 获取案场可用优惠券数量
321
 func (m *CouponDAO) GetCaseUsableCouponCount(caseid, userid string) (int, error) {
321
 func (m *CouponDAO) GetCaseUsableCouponCount(caseid, userid string) (int, error) {
322
 	var Coupons []CaseCouponDetail
322
 	var Coupons []CaseCouponDetail
323
-	sql := `select * from ta_coupon where case_id=? and status=? and end_date>now()`
324
-	err := m.db.Sql(sql, caseid, models.STATUS_NORMAL).Find(&Coupons)
323
+	sql := `select * from ta_coupon where case_id=? and status=? and end_date>now() and send_type=?`
324
+	err := m.db.Sql(sql, caseid, models.STATUS_NORMAL, models.GIVE_TYPE_CASE).Find(&Coupons)
325
 
325
 
326
 	return len(Coupons), err
326
 	return len(Coupons), err
327
 }
327
 }

+ 38
- 0
models/course/course.go 查看文件

567
 
567
 
568
 	return nil, nil
568
 	return nil, nil
569
 }
569
 }
570
+
571
+// GetCourseBySendType 根据发送类型获取案场信息
572
+func (m *CourseDAO) GetCourseBySendType(typeval, caseids string) ([]model.TaCourse, error) {
573
+	var courses []model.TaCourse
574
+	err := m.db.Where("status=?", models.STATUS_NORMAL).And("case_id in ('" + strings.Replace(caseids, ",", "','", -1) + "')").Find(&courses)
575
+	return courses, err
576
+}
577
+
578
+// CourseWithCase 课程with案场
579
+type CourseWithCase struct {
580
+	model.TaCourse `xorm:"extends"`
581
+	CaseName       string
582
+	CaseAddress    string
583
+}
584
+
585
+// GetSelectCourseWithCaseList 获取精选课程
586
+func (m *CourseDAO) GetSelectCourseWithCaseList(orgid string) ([]CourseWithCase, error) {
587
+	var courses []CourseWithCase
588
+	sql := `select a.*,b.case_name,b.case_address from ta_course a inner join sys_case b on a.case_id=b.case_id where a.is_select=` + strconv.Itoa(IS_SELECT) + ` 
589
+	and a.status=` + strconv.Itoa(models.STATUS_NORMAL) + ` and a.org_id='` + orgid + `'
590
+	and a.course_id NOT in (
591
+		select course_id from ta_course_detail where begin_date<=NOW()
592
+	)`
593
+	err := m.db.Sql(sql).Find(&courses)
594
+	return courses, err
595
+}
596
+
597
+// GetCourseWithCaseByLocation 根据位置获取课程信息
598
+func (m *CourseDAO) GetCourseWithCaseByLocation(orgid, locationid string) ([]CourseWithCase, error) {
599
+	var courses []CourseWithCase
600
+	sql := `select a.*,b.case_name,b.case_address from ta_course a inner join sys_case b on a.case_id=b.case_id where a.status=` + strconv.Itoa(models.STATUS_NORMAL) + ` 
601
+	and a.org_id='` + orgid + `' and a.location_id ='` + locationid + `' 
602
+	and a.course_id NOT in (
603
+		select course_id from ta_course_detail where begin_date<=NOW()
604
+	)`
605
+	err := m.db.Sql(sql).Find(&courses)
606
+	return courses, err
607
+}

+ 20
- 0
models/message/location.go 查看文件

2
 
2
 
3
 import (
3
 import (
4
 	"spaceofcheng/services/models"
4
 	"spaceofcheng/services/models"
5
+	"spaceofcheng/services/models/course"
5
 	"spaceofcheng/services/models/model"
6
 	"spaceofcheng/services/models/model"
6
 	"spaceofcheng/services/utils"
7
 	"spaceofcheng/services/utils"
7
 	"strconv"
8
 	"strconv"
110
 	_, err := m.db.Exec(sql)
111
 	_, err := m.db.Exec(sql)
111
 	return err
112
 	return err
112
 }
113
 }
114
+
115
+// LocationInfo 详情
116
+type LocationInfo struct {
117
+	model.TdCmsImageLocation `xorm:"extends"`
118
+	Banners                  []model.TaCmsImages
119
+	News                     []model.TaCmsNews
120
+	Courses                  []course.CourseWithCase
121
+}
122
+
123
+// GetLocationInfoList 获取列表
124
+func (m *MessageDAO) GetLocationInfoList(orgid string) ([]LocationInfo, error) {
125
+	var locations []LocationInfo
126
+	sql := `select * from td_cms_image_location where status>? and location_id<>'index' and org_id=? order by order_no asc`
127
+	err := m.db.Sql(sql, models.STATUS_DEL, orgid).Find(&locations)
128
+	if err != nil {
129
+		return nil, err
130
+	}
131
+	return locations, nil
132
+}

+ 2
- 0
models/model/sys_token_log.go 查看文件

8
 	Uid        string    `xorm:"VARCHAR(64)"`
8
 	Uid        string    `xorm:"VARCHAR(64)"`
9
 	Status     int       `xorm:"SMALLINT(6)"`
9
 	Status     int       `xorm:"SMALLINT(6)"`
10
 	CreateDate time.Time `xorm:"DATETIME"`
10
 	CreateDate time.Time `xorm:"DATETIME"`
11
+	ExpireDate time.Time `xorm:"DATETIME"`
12
+	BatchNo    string    `xorm:"VARCHAR(64)"`
11
 }
13
 }

+ 33
- 1
models/sys.go 查看文件

3
 import (
3
 import (
4
 	"errors"
4
 	"errors"
5
 	"spaceofcheng/services/models/model"
5
 	"spaceofcheng/services/models/model"
6
+	"strings"
6
 	"time"
7
 	"time"
7
 
8
 
8
 	"github.com/yl10/kit/guid"
9
 	"github.com/yl10/kit/guid"
136
 }
137
 }
137
 
138
 
138
 // InsertToken 插入 token 生成记录
139
 // InsertToken 插入 token 生成记录
139
-func InsertToken(token, uid string) error {
140
+func InsertToken(token, uid, batchNo string, expire time.Time) error {
140
 	tk := model.SysTokenLog{
141
 	tk := model.SysTokenLog{
141
 		Token:      token,
142
 		Token:      token,
142
 		Uid:        uid,
143
 		Uid:        uid,
144
+		BatchNo:    batchNo,
145
+		ExpireDate: expire,
143
 		Status:     STATUS_NORMAL,
146
 		Status:     STATUS_NORMAL,
144
 		CreateDate: time.Now().Local(),
147
 		CreateDate: time.Now().Local(),
145
 	}
148
 	}
157
 		Status: STATUS_DEL,
160
 		Status: STATUS_DEL,
158
 	}
161
 	}
159
 
162
 
163
+	// 检索相同批次
164
+	var tkLogs []model.SysTokenLog
165
+	if err := DBEngine.Where("token=?", token).Find(&tkLogs); err != nil {
166
+		return err
167
+	}
168
+
169
+	// 如果有相同批次的, 则更新本批次为失效
170
+	if tkLogs != nil && len(tkLogs) > 0 {
171
+		batchNo := []string{}
172
+
173
+		for _, t := range tkLogs {
174
+			if t.BatchNo != "" {
175
+				batchNo = append(batchNo, t.BatchNo)
176
+			}
177
+		}
178
+
179
+		if len(batchNo) > 0 {
180
+
181
+			if _, err := DBEngine.Cols("status").
182
+				Where("token=?", token).
183
+				Or("batch_no in ('" + strings.Join(batchNo, "','") + "'").
184
+				Update(&tk); err != nil {
185
+				return err
186
+			}
187
+
188
+			return nil
189
+		}
190
+	}
191
+
160
 	if _, err := DBEngine.Cols("status").Where("token=?", token).Or("uid=?", uid).Update(&tk); err != nil {
192
 	if _, err := DBEngine.Cols("status").Where("token=?", token).Or("uid=?", uid).Update(&tk); err != nil {
161
 		return err
193
 		return err
162
 	}
194
 	}

+ 1
- 0
routers/common.go 查看文件

212
 		// beego.NSRouter("/coursetag", &course.CourseController{}, "get:GetCourseTags"),
212
 		// beego.NSRouter("/coursetag", &course.CourseController{}, "get:GetCourseTags"),
213
 
213
 
214
 		beego.NSRouter("/course", &course.CourseController{}, "get:GetCourseList"),
214
 		beego.NSRouter("/course", &course.CourseController{}, "get:GetCourseList"),
215
+		beego.NSRouter("/course/sendtype/:type", &course.CourseController{}, "get:GetCourseBySendType"),
215
 		beego.NSRouter("/course/:courseid", &course.CourseController{}, "get:GetCourseByID"),
216
 		beego.NSRouter("/course/:courseid", &course.CourseController{}, "get:GetCourseByID"),
216
 		beego.NSRouter("/course", &course.CourseController{}, "post:SaveCourse"),
217
 		beego.NSRouter("/course", &course.CourseController{}, "post:SaveCourse"),
217
 		beego.NSRouter("/course", &course.CourseController{}, "put:SaveCourse"),
218
 		beego.NSRouter("/course", &course.CourseController{}, "put:SaveCourse"),

+ 1
- 0
routers/guest.go 查看文件

23
 		beego.NSRouter("/cms/news", &message.MessageController{}, "get:GetNewsByLocation"),
23
 		beego.NSRouter("/cms/news", &message.MessageController{}, "get:GetNewsByLocation"),
24
 		beego.NSRouter("/cms/case", &message.MessageController{}, "get:GetCmsCaseList"),
24
 		beego.NSRouter("/cms/case", &message.MessageController{}, "get:GetCmsCaseList"),
25
 		beego.NSRouter("/cms/location", &message.MessageController{}, "get:GetLocations"),
25
 		beego.NSRouter("/cms/location", &message.MessageController{}, "get:GetLocations"),
26
+		beego.NSRouter("/cms/location/detail", &message.MessageController{}, "get:GetLocationInfoList"),
26
 		beego.NSRouter("/cms/course", &course.CourseController{}, "get:GetCourseByLocation"),
27
 		beego.NSRouter("/cms/course", &course.CourseController{}, "get:GetCourseByLocation"),
27
 		beego.NSRouter("/cms/case/:cmscaseid", &message.MessageController{}, "get:GetCmsCaseByID"),
28
 		beego.NSRouter("/cms/case/:cmscaseid", &message.MessageController{}, "get:GetCmsCaseByID"),
28
 
29
 

+ 9
- 1
service/cases/area.go 查看文件

62
 
62
 
63
 // DelCaseArea 删除区域
63
 // DelCaseArea 删除区域
64
 func (s *CaseServ) DelCaseArea(areaid string) error {
64
 func (s *CaseServ) DelCaseArea(areaid string) error {
65
-	err := s.dao.DelCaseArea(areaid)
65
+	areas, err := s.dao.GetCaseTableByAreaID(areaid)
66
+	if err != nil {
67
+		utils.LogError("获取区域失败: " + err.Error())
68
+		return errors.New("获取区域失败")
69
+	}
70
+	if len(areas) > 0 {
71
+		return errors.New("区域下存在桌位信息,不允许删除!")
72
+	}
73
+	err = s.dao.DelCaseArea(areaid)
66
 	if err != nil {
74
 	if err != nil {
67
 		utils.LogError("删除案场区域失败: " + err.Error())
75
 		utils.LogError("删除案场区域失败: " + err.Error())
68
 		return errors.New("删除案场区域失败")
76
 		return errors.New("删除案场区域失败")

+ 10
- 0
service/course/course.go 查看文件

552
 	}
552
 	}
553
 	return info, err
553
 	return info, err
554
 }
554
 }
555
+
556
+// GetCourseBySendType 根据类型获取课程
557
+func (s *CourseServ) GetCourseBySendType(typeval, caseids string) ([]model.TaCourse, error) {
558
+	courses, err := s.dao.GetCourseBySendType(typeval, caseids)
559
+	if err != nil {
560
+		utils.LogError("获取课程信息失败: " + err.Error())
561
+		return nil, errors.New("获取课程信息失败")
562
+	}
563
+	return courses, err
564
+}

+ 5
- 0
service/message/image.go 查看文件

71
 	if imginfo.ForwardType == ForwardTypeUrl && imginfo.ForwardUrl == "" {
71
 	if imginfo.ForwardType == ForwardTypeUrl && imginfo.ForwardUrl == "" {
72
 		return nil, errors.New("跳转地址不允许为空!")
72
 		return nil, errors.New("跳转地址不允许为空!")
73
 	}
73
 	}
74
+<<<<<<< HEAD
74
 	if imginfo.ForwardType == ForwardTypeCourse && imginfo.CaseId == "" {
75
 	if imginfo.ForwardType == ForwardTypeCourse && imginfo.CaseId == "" {
76
+=======
77
+
78
+	if imginfo.ForwardType == ForwardTypeCourse && imginfo.ForwardResourceId == "" {
79
+>>>>>>> 25b458f1a666b753f4338f1649fcaeaa37b61fd4
75
 		return nil, errors.New("跳转资源不允许为空!")
80
 		return nil, errors.New("跳转资源不允许为空!")
76
 	}
81
 	}
77
 
82
 

+ 43
- 0
service/message/location.go 查看文件

2
 
2
 
3
 import (
3
 import (
4
 	"errors"
4
 	"errors"
5
+	"spaceofcheng/services/models/message"
5
 	"spaceofcheng/services/models/model"
6
 	"spaceofcheng/services/models/model"
6
 	"spaceofcheng/services/utils"
7
 	"spaceofcheng/services/utils"
7
 	"strings"
8
 	"strings"
86
 	}
87
 	}
87
 	return nil
88
 	return nil
88
 }
89
 }
90
+
91
+// GetLocationInfoList 获取详情
92
+func (s *MessageServ) GetLocationInfoList() ([]message.LocationInfo, error) {
93
+	var org = s.ctx.Get("org").(model.SysOrg)
94
+	locations, err := s.dao.GetLocationInfoList(org.OrgId)
95
+	if err != nil {
96
+		utils.LogError("获取Location失败: " + err.Error())
97
+		return nil, errors.New("获取失败")
98
+	}
99
+	for inx, l := range locations {
100
+		news, err := s.dao.GetNewsByLocation(l.LocationId, org.OrgId)
101
+		if err != nil {
102
+			utils.LogError("获取新闻信息失败: " + err.Error())
103
+			return nil, errors.New("获取新闻信息失败")
104
+		}
105
+		locations[inx].News = news
106
+
107
+		imgs, err := s.dao.GetImgByLocation(l.LocationId, org.OrgId)
108
+		if err != nil {
109
+			utils.LogError("获取图片信息失败: " + err.Error())
110
+			return nil, errors.New("获取图片信息失败")
111
+		}
112
+		locations[inx].Banners = imgs
113
+		if l.LocationId == "selected" {
114
+			courses, err := s.coursedao.GetSelectCourseWithCaseList(org.OrgId)
115
+			if err != nil {
116
+				utils.LogError("获取课程信息失败: " + err.Error())
117
+				return nil, errors.New("获取课程信息失败")
118
+			}
119
+			locations[inx].Courses = courses
120
+		} else {
121
+			courses, err := s.coursedao.GetCourseWithCaseByLocation(org.OrgId, l.LocationId)
122
+			if err != nil {
123
+				utils.LogError("获取课程信息失败: " + err.Error())
124
+				return nil, errors.New("获取课程信息失败")
125
+			}
126
+			locations[inx].Courses = courses
127
+		}
128
+	}
129
+
130
+	return locations, nil
131
+}

+ 11
- 8
service/sys.go 查看文件

76
 
76
 
77
 // NewToken 设置 TOKEN
77
 // NewToken 设置 TOKEN
78
 // 15 分钟后过期
78
 // 15 分钟后过期
79
-func (s *SysServ) NewToken() string {
79
+func (s *SysServ) NewToken(batch string) string {
80
 	var token *utils.JWTToken
80
 	var token *utils.JWTToken
81
 	exp := time.Now().Local().Add(15 * time.Second)
81
 	exp := time.Now().Local().Add(15 * time.Second)
82
 
82
 
84
 		userMap := s.ctx.Get("userMap").(model.TaUserMapping)
84
 		userMap := s.ctx.Get("userMap").(model.TaUserMapping)
85
 
85
 
86
 		token = &utils.JWTToken{
86
 		token = &utils.JWTToken{
87
-			Guest:  false,
88
-			ID:     userMap.Openid,
89
-			Expire: exp,
87
+			Guest:   false,
88
+			ID:      userMap.Openid,
89
+			Expire:  exp,
90
+			BatchNo: batch,
90
 		}
91
 		}
91
 	} else if s.ctx.Get("user") != nil {
92
 	} else if s.ctx.Get("user") != nil {
92
 		user := s.ctx.Get("user").(model.SysUser)
93
 		user := s.ctx.Get("user").(model.SysUser)
93
 
94
 
94
 		token = &utils.JWTToken{
95
 		token = &utils.JWTToken{
95
-			Guest:  false,
96
-			ID:     user.UserId,
97
-			Expire: exp,
96
+			Guest:   false,
97
+			ID:      user.UserId,
98
+			Expire:  exp,
99
+			BatchNo: batch,
98
 		}
100
 		}
99
 	} else {
101
 	} else {
100
 		token = &utils.JWTToken{
102
 		token = &utils.JWTToken{
111
 
113
 
112
 	// 入库
114
 	// 入库
113
 	if !token.Guest {
115
 	if !token.Guest {
114
-		if err := models.InsertToken(tokenEncodeStr, token.ID); err != nil {
116
+		if err := models.InsertToken(tokenEncodeStr, token.ID, batch, exp); err != nil {
115
 			utils.LogError("入库 Token 失败: " + err.Error())
117
 			utils.LogError("入库 Token 失败: " + err.Error())
116
 			return tokenEncodeStr
118
 			return tokenEncodeStr
117
 		}
119
 		}
384
 		return nil, errors.New("超时 或者 Token 已过期")
386
 		return nil, errors.New("超时 或者 Token 已过期")
385
 	}
387
 	}
386
 
388
 
389
+	s.ctx.Set("token-batch", tk.BatchNo)
387
 	return utils.MapToJWTToken(token), nil
390
 	return utils.MapToJWTToken(token), nil
388
 }
391
 }
389
 
392
 

+ 4
- 0
service/verify/verify.go 查看文件

78
 		return nil, errors.New("获取课程列表失败")
78
 		return nil, errors.New("获取课程列表失败")
79
 	}
79
 	}
80
 	if len(customerDetail) == 0 {
80
 	if len(customerDetail) == 0 {
81
+<<<<<<< HEAD
81
 		return nil, errors.New("今日无可核销课程")
82
 		return nil, errors.New("今日无可核销课程")
83
+=======
84
+		return nil, nil
85
+>>>>>>> 25b458f1a666b753f4338f1649fcaeaa37b61fd4
82
 	}
86
 	}
83
 	customerID := customerDetail[0].CustomerId
87
 	customerID := customerDetail[0].CustomerId
84
 	total, err := s.dao.GetCustomerCourseListByTelCount(tel, caseids)
88
 	total, err := s.dao.GetCustomerCourseListByTelCount(tel, caseids)

+ 6
- 0
utils/jwt.go 查看文件

44
 	Guest    bool
44
 	Guest    bool
45
 	ID       string
45
 	ID       string
46
 	Password string
46
 	Password string
47
+	BatchNo  string
47
 	Expire   time.Time
48
 	Expire   time.Time
48
 }
49
 }
49
 
50
 
53
 		"guest":    t.Guest,
54
 		"guest":    t.Guest,
54
 		"user":     t.ID,
55
 		"user":     t.ID,
55
 		"password": t.Password,
56
 		"password": t.Password,
57
+		"batchno":  t.BatchNo,
56
 		"exp":      t.Expire.Format("2006-01-02 15:04:05"),
58
 		"exp":      t.Expire.Format("2006-01-02 15:04:05"),
57
 	}
59
 	}
58
 }
60
 }
73
 		token.Password = data["password"].(string)
75
 		token.Password = data["password"].(string)
74
 	}
76
 	}
75
 
77
 
78
+	if data["batchno"] != nil {
79
+		token.BatchNo = data["batchno"].(string)
80
+	}
81
+
76
 	if data["exp"] != nil {
82
 	if data["exp"] != nil {
77
 		exp, _ := time.Parse("2006-01-02 15:04:05", data["exp"].(string))
83
 		exp, _ := time.Parse("2006-01-02 15:04:05", data["exp"].(string))
78
 		token.Expire = exp
84
 		token.Expire = exp