Explorar o código

Merge branch 'master' into fix_chart_visit

hsun %!s(int64=3) %!d(string=hai) anos
pai
achega
95bde9313b
Modificáronse 8 ficheiros con 114 adicións e 4 borrados
  1. 21 0
      routers/activity.go
  2. 17 0
      routers/chart.go
  3. 11 0
      routers/public.go
  4. 11 0
      routers/research_report.go
  5. 9 0
      routers/test.go
  6. 20 0
      routers/user.go
  7. 20 0
      routers/wechat.go
  8. 5 4
      services/user/user.go

+ 21 - 0
routers/activity.go

@@ -23,4 +23,25 @@ func InitActivity(r *gin.Engine) {
 	{
 		rGroup2.GET("/getActivityShareImg", activity.GetActivityShareImg)
 	}
+
+	initActivity(r)
+}
+
+func initActivity(r *gin.Engine) {
+	// 需要Token
+	rGroup := r.Group("api/activity").Use(middleware.Token())
+	{
+		rGroup.GET("/getPageList", activity.GetPageList)
+		rGroup.GET("/getActivityDetail", activity.GetActivityDetail)
+		rGroup.GET("/getActivityVoices", activity.GetActivityVoices)
+		rGroup.POST("/addRemind", activity.AddRemind)
+		rGroup.POST("/cancelRemind", activity.CancelRemind)
+		rGroup.POST("/registerActivity", activity.RegisterActivity)
+		rGroup.POST("/cancelRegister", activity.CancelRegister)
+	}
+	// 不需要Token
+	rGroup2 := r.Group("api/activity")
+	{
+		rGroup2.GET("/getActivityShareImg", activity.GetActivityShareImg)
+	}
 }

+ 17 - 0
routers/chart.go

@@ -18,4 +18,21 @@ func InitChart(r *gin.Engine) {
 		rGroup.POST("/refreshChartInfo", chart.RefreshChartInfo)
 		rGroup.GET("/getChartBeforeAndNext", chart.GetChartBeforeAndNext)
 	}
+
+	initChart(r)
+}
+
+// initChart
+func initChart(r *gin.Engine) {
+	rGroup := r.Group("api/my_chart").Use(middleware.Token(), middleware.CheckChartAuth())
+	{
+		rGroup.GET("/getChartChassify", chart.GetMyChartChassify)
+		rGroup.GET("/getChartList", chart.GetMyChartList)
+		rGroup.POST("/moveMyChart", chart.MoveMyChart)
+		rGroup.POST("/moveMyChartClassify", chart.MoveMyChartClassify)
+		rGroup.GET("/getChartDetail", chart.GetChartInfoDetail)
+		rGroup.POST("/editChartInfo", chart.EditChartInfo)
+		rGroup.POST("/refreshChartInfo", chart.RefreshChartInfo)
+		rGroup.GET("/getChartBeforeAndNext", chart.GetChartBeforeAndNext)
+	}
 }

+ 11 - 0
routers/public.go

@@ -13,4 +13,15 @@ func InitPublic(r *gin.Engine) {
 		rGroup.GET("/get_apply_variety_list", controller.GetApplyVarietyList)
 		rGroup.POST("/upload", controller.Upload)
 	}
+
+	initPublic(r)
+}
+
+func initPublic(r *gin.Engine) {
+	rGroup := r.Group("api/public").Use(middleware.Token())
+
+	{
+		rGroup.GET("/get_apply_variety_list", controller.GetApplyVarietyList)
+		rGroup.POST("/upload", controller.Upload)
+	}
 }

+ 11 - 0
routers/research_report.go

@@ -13,4 +13,15 @@ func InitResearchReport(r *gin.Engine) {
 		rGroup.GET("/research_report", report.GetResearchReportInfo)
 		rGroup.GET("/research_report_chapter", report.GetResearchReportChapter)
 	}
+
+	initResearchReport(r)
+}
+
+// initResearchReport 初始化报告
+func initResearchReport(r *gin.Engine) {
+	rGroup := r.Group("api/report").Use(middleware.Token())
+	{
+		rGroup.GET("/research_report", report.GetResearchReportInfo)
+		rGroup.GET("/research_report_chapter", report.GetResearchReportChapter)
+	}
 }

+ 9 - 0
routers/test.go

@@ -10,4 +10,13 @@ func InitTest(r *gin.Engine) {
 
 	rGroup.GET("/test", controller.Test)
 	rGroup.GET("/test2", controller.Test2)
+
+	initTest(r)
+}
+
+func initTest(r *gin.Engine) {
+	rGroup := r.Group("api/test")
+
+	rGroup.GET("/test", controller.Test)
+	rGroup.GET("/test2", controller.Test2)
 }

+ 20 - 0
routers/user.go

@@ -23,4 +23,24 @@ func InitUser(r *gin.Engine) {
 		rGroup2.GET("/get_tab_bar", user.GetTabBar)
 	}
 
+	initUser(r)
+}
+
+func initUser(r *gin.Engine) {
+	rGroup := r.Group("api/user").Use(middleware.TokenNoLogin())
+
+	{
+		rGroup.POST("/login", user.Login)
+		rGroup.GET("/get_sms_code", user.GetSmsCode)
+		rGroup.GET("/get_email_code", user.GetEmailCode)
+	}
+
+	rGroup2 := r.Group("api/user").Use(middleware.Token())
+	{
+		rGroup2.GET("/info", user.Info)
+		rGroup2.GET("/get_last_apply_record", user.GetLastApplyRecord)
+		rGroup2.POST("/apply", user.Apply)
+		rGroup2.GET("/get_tab_bar", user.GetTabBar)
+	}
+
 }

+ 20 - 0
routers/wechat.go

@@ -22,4 +22,24 @@ func InitWechat(r *gin.Engine) {
 		rGroup2.POST("/getEncryptInfo", wechat.GetEncryptInfo)
 		rGroup2.GET("/getWxJsConf", wechat.GetWxJsConf)
 	}
+
+	initWechat(r)
+}
+
+func initWechat(r *gin.Engine) {
+	rGroup := r.Group("api/wechat")
+
+	{
+		rGroup.GET("/qrCode", wechat.GetQrCode)
+		rGroup.GET("/userInfo", wechat.GetUserInfo)
+		rGroup.GET("/session", wechat.GetUserSession)
+		rGroup.GET("/login", wechat.Login)
+
+	}
+
+	rGroup2 := r.Group("api/wechat").Use(middleware.TokenNoLogin())
+	{
+		rGroup2.POST("/getEncryptInfo", wechat.GetEncryptInfo)
+		rGroup2.GET("/getWxJsConf", wechat.GetWxJsConf)
+	}
 }

+ 5 - 4
services/user/user.go

@@ -359,9 +359,10 @@ QUERY_WX_USER:
 		//if userId > 0 && tokenItem.UserID != int64(userId) {
 		//	_ = tokenItem.UpdateSession(int64(userId), time.Now().AddDate(0, 1, 0))
 		//}
-		if userId > 0 {
-			_ = tokenItem.UpdateSession(int64(userId), time.Now().AddDate(0, 1, 0))
-		}
+
+		//if userId > 0 {
+		//}
+		_ = tokenItem.UpdateSession(int64(userId), time.Now().AddDate(0, 1, 0))
 	}
 
 	//新增登录日志
@@ -435,4 +436,4 @@ func GetAdminByUserInfo(userInfo UserInfo) (ok bool, adminInfo *admin2.Admin, er
 	ok = true
 
 	return
-}
+}