陈少旭 7 months ago
parent
commit
b32651d36b

+ 4 - 4
conf/app.conf View File

1
 appname = 血透
1
 appname = 血透
2
-httpport = 9588
2
+httpport = 9788
3
 runmode = dev
3
 runmode = dev
4
 
4
 
5
 copyrequestbody = true
5
 copyrequestbody = true
6
-sessionon = true
7
-sessiongcmaxlifetime = 64800
6
+
8
 
7
 
9
 tokencookiemaxlifetime = 7200
8
 tokencookiemaxlifetime = 7200
10
 
9
 
44
 [prod]
43
 [prod]
45
 httpdomain = http://api.szjkhd.com
44
 httpdomain = http://api.szjkhd.com
46
 
45
 
47
-
46
+sessionon = true
47
+sessiongcmaxlifetime = 64800
48
 readmysqlhost = shengws1.mysql.rds.aliyuncs.com
48
 readmysqlhost = shengws1.mysql.rds.aliyuncs.com
49
 readmysqlport = 3306
49
 readmysqlport = 3306
50
 readmysqluser = syh
50
 readmysqluser = syh

+ 18 - 6
controllers/admin_api_controllers/admin_api_base_controller.go View File

4
 	"XT_Admin_Api/controllers"
4
 	"XT_Admin_Api/controllers"
5
 	"XT_Admin_Api/enums"
5
 	"XT_Admin_Api/enums"
6
 	"XT_Admin_Api/models/admin_models"
6
 	"XT_Admin_Api/models/admin_models"
7
+	"XT_Admin_Api/service"
7
 	"fmt"
8
 	"fmt"
8
 )
9
 )
9
 
10
 
31
 	//beego.Trace(fmt.Sprintf("[管理员后台] %v", fmt.Sprintf(format, a...)))
32
 	//beego.Trace(fmt.Sprintf("[管理员后台] %v", fmt.Sprintf(format, a...)))
32
 }
33
 }
33
 
34
 
34
-func (this *AdminBaseAPIController) GetAdminInfo() *AdminInfo {
35
-	userInfo := this.GetSession("admin_info")
36
-	fmt.Println(userInfo)
35
+func (this *AdminBaseAPIAuthController) GetAdminInfo() *admin_models.AdminAccount {
36
+	mobile := this.GetString("account")
37
+	password := this.GetString("password")
38
+	//adminInfo :=GetAdminInfo(mobile,password)
39
+	admin, getAdminErr := service.GetAdminAccount(mobile, password)
40
+	if getAdminErr != nil {
41
+		this.ErrorLog("获取管理员信息失败:%v", getAdminErr)
42
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
43
+		return nil
44
+	} else if admin == nil {
45
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
37
 
46
 
38
-	if userInfo == nil {
47
+		//this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAccountOrPasswordWrong)
39
 		return nil
48
 		return nil
40
-	} else {
41
-		return userInfo.(*AdminInfo)
42
 	}
49
 	}
50
+	var ads AdminInfo
51
+	ads.Admin = admin
52
+	return admin
53
+
43
 }
54
 }
44
 
55
 
45
 type AdminInfo struct {
56
 type AdminInfo struct {
52
 
63
 
53
 func (this *AdminBaseAPIAuthController) Prepare() {
64
 func (this *AdminBaseAPIAuthController) Prepare() {
54
 	this.AdminBaseAPIController.Prepare()
65
 	this.AdminBaseAPIController.Prepare()
66
+	//name := this.GetString("name")
55
 	adminInfo := this.GetAdminInfo()
67
 	adminInfo := this.GetAdminInfo()
56
 	fmt.Println(adminInfo)
68
 	fmt.Println(adminInfo)
57
 	if adminInfo == nil {
69
 	if adminInfo == nil {

+ 2 - 2
controllers/admin_api_controllers/custom_api_controller.go View File

8
 )
8
 )
9
 
9
 
10
 type CustomAPIController struct {
10
 type CustomAPIController struct {
11
-	AdminBaseAPIController
11
+	AdminBaseAPIAuthController
12
 }
12
 }
13
 
13
 
14
 func (this *CustomAPIController) CreateCustom() {
14
 func (this *CustomAPIController) CreateCustom() {
721
 	follow := models.KyyChargeFollow{
721
 	follow := models.KyyChargeFollow{
722
 		Ctime:    ctime,
722
 		Ctime:    ctime,
723
 		Mtime:    mtime,
723
 		Mtime:    mtime,
724
-		Creator:  this.GetAdminInfo().Admin.ID,
724
+		Creator:  this.GetAdminInfo().ID,
725
 		CustomId: customID,
725
 		CustomId: customID,
726
 		Desc:     desc,
726
 		Desc:     desc,
727
 		Status:   1,
727
 		Status:   1,

+ 0 - 6
controllers/admin_api_controllers/login_api_controller.go View File

3
 import (
3
 import (
4
 	"XT_Admin_Api/enums"
4
 	"XT_Admin_Api/enums"
5
 	"XT_Admin_Api/service"
5
 	"XT_Admin_Api/service"
6
-	"fmt"
7
 )
6
 )
8
 
7
 
9
 type LoginAPIController struct {
8
 type LoginAPIController struct {
27
 		return
26
 		return
28
 	}
27
 	}
29
 
28
 
30
-	this.SetSession("admin_info", &AdminInfo{
31
-		Admin: admin,
32
-	})
33
-	//userInfo := this.GetSession("admin_info")
34
-	fmt.Println(this.GetSession("admin_info"))
35
 	this.ServeSuccessJSON(map[string]interface{}{
29
 	this.ServeSuccessJSON(map[string]interface{}{
36
 		"admin": admin,
30
 		"admin": admin,
37
 	})
31
 	})

+ 1 - 1
controllers/admin_api_controllers/org_api_controller.go View File

55
 		endTime = theTime.Unix()
55
 		endTime = theTime.Unix()
56
 	}
56
 	}
57
 
57
 
58
-	list, err, total := service.GetAllOrgList(active_status, depth_active_status, startTime, endTime, province, city, district, follow, keyword, page, limit, this.GetAdminInfo().Admin.IsAdmin)
58
+	list, err, total := service.GetAllOrgList(active_status, depth_active_status, startTime, endTime, province, city, district, follow, keyword, page, limit, this.GetAdminInfo().IsAdmin)
59
 	if err != nil {
59
 	if err != nil {
60
 
60
 
61
 	} else {
61
 	} else {

+ 0 - 2
controllers/admin_api_controllers/system_api_controller.go View File

4
 	"XT_Admin_Api/enums"
4
 	"XT_Admin_Api/enums"
5
 	"XT_Admin_Api/models/admin_models"
5
 	"XT_Admin_Api/models/admin_models"
6
 	"XT_Admin_Api/service"
6
 	"XT_Admin_Api/service"
7
-	"fmt"
8
 	"time"
7
 	"time"
9
 )
8
 )
10
 
9
 
28
 }
27
 }
29
 
28
 
30
 func (this *SystemApiController) GetUserList() {
29
 func (this *SystemApiController) GetUserList() {
31
-	fmt.Println(this.GetAdminInfo().Admin)
32
 	list, _ := service.GetAllAdmin()
30
 	list, _ := service.GetAllAdmin()
33
 	this.ServeSuccessJSON(map[string]interface{}{
31
 	this.ServeSuccessJSON(map[string]interface{}{
34
 		"list": list,
32
 		"list": list,

File diff suppressed because it is too large
+ 0 - 3808
controllers/function_api_controllers/function_api_base_controller.go


+ 0 - 97
controllers/function_api_controllers/function_api_router_register.go View File

1
-package function_api_controllers
2
-
3
-import (
4
-	"github.com/astaxie/beego"
5
-	"fmt"
6
-)
7
-
8
-func FunctionAPIControllersRegisterRouters() {
9
-	fmt.Println("开始吧")
10
-	beego.Router("/api/function/gettodayinfo",&FunctionBaseAPIController{},"Get:GetTodayInfo")
11
-	beego.Router("/api/function/getyestodayinfo",&FunctionBaseAPIController{},"Get:GetYestodayInfo")
12
-	beego.Router("/api/function/getweekinfo",&FunctionBaseAPIController{},"Get:GetWeekInfo")
13
-	beego.Router("/api/function/getmonthinfo",&FunctionBaseAPIController{},"Get:GetMonthInfo")
14
-	beego.Router("/api/function/getthreemonthinfo",&FunctionBaseAPIController{},"Get:GetThreeMonthInfo")
15
-	beego.Router("/admin/function/gethalfyearinfo",&FunctionBaseAPIController{},"Get:GetHalfYearInfo")
16
-	beego.Router("/admin/function/getyearinfo",&FunctionBaseAPIController{},"Get:GetYearInfo")
17
-	beego.Router("/admin/function/gettodaydialysisinfo",&FunctionBaseAPIController{},"Get:GetTodayDialysisInfo")
18
-	beego.Router("/api/function/getYesterdayDialysisinfo",&FunctionBaseAPIController{},"Get:GetYesterTodayDialysisInfo")
19
-	beego.Router("/api/function/getweekdialysisinfo",&FunctionBaseAPIController{},"Get:GetWeekDialysisinfo")
20
-	beego.Router("/api/function/getmonthdailysisinfo",&FunctionBaseAPIController{},"Get:GetMonthDailysisInfo")
21
-	beego.Router("/api/function/getthreedialysisinfo",&FunctionBaseAPIController{},"Get:GetThreeMonthDailysisInfo")
22
-	beego.Router("/api/function/gethalfyeardialysisinfo",&FunctionBaseAPIController{},"Get:GetHalfYearDailysisInfo")
23
-	beego.Router("/api/function/getyeardialysisinfo",&FunctionBaseAPIController{},"Get:GetYearDailysisInfo")
24
-	beego.Router("/api/function/gettodayreceiveinfo",&FunctionBaseAPIController{},"Get:GetReceiveinfo")
25
-	beego.Router("/api/function/getReceiveyesterdayinfo",&FunctionBaseAPIController{},"Get:GetYesTodayReceiveinfo")
26
-	beego.Router("/api/function/getweekreceiveinfo",&FunctionBaseAPIController{},"Get:GetWeekReceiveinfo")
27
-	beego.Router("/api/function/getMonthreceiveinfo",&FunctionBaseAPIController{},"Get:GetMonthReceiveinfo")
28
-	beego.Router("/api/function/getMonthreereceiveinfo",&FunctionBaseAPIController{},"Get:GetThreeMonthReceiveinfo")
29
-	beego.Router("/api/function/getMonhalfyearreceiveinfo",&FunctionBaseAPIController{},"Get:GetHalfYearReceiveinfo")
30
-	beego.Router("/api/function/getMonyearreceiveinfo",&FunctionBaseAPIController{},"Get:GetYearReceiveinfo")
31
-	beego.Router("/api/function/getBeforDislysis",&FunctionBaseAPIController{},"Get:GetTodayBeforDislysisInfo")
32
-	beego.Router("/api/function/getyesterdayBeforDislysis",&FunctionBaseAPIController{},"Get:GetYesterTodayBeforDislysisInfo")
33
-	beego.Router("/api/function/getmonthBeforDislysis",&FunctionBaseAPIController{},"Get:GetMonthBeforDislysisInfo")
34
-	beego.Router("/api/function/getweekBeforDislysis",&FunctionBaseAPIController{},"Get:GetWeekBeforDislysisInfo")
35
-	beego.Router("/api/function/getThreeMonthBeforDislysis",&FunctionBaseAPIController{},"Get:GetThreeMonthBeforDislysisInfo")
36
-	beego.Router("/api/function/getHalfYearBeforDislysis",&FunctionBaseAPIController{},"Get:GetHalfYearBeforDislysisInfo")
37
-	beego.Router("/api/function/getYearbefordialysisinfo",&FunctionBaseAPIController{},"Get:GetYearBeforDislysisInfo")
38
-	beego.Router("/api/function/gettodayDoctorsOrderInfo",&FunctionBaseAPIController{},"Get:GetTodayDoctorsOrderInfo")
39
-	beego.Router("/api/function/getyearstodayDoctorOrder",&FunctionBaseAPIController{},"Get:GetYesterDayDoctorsOrderInfo")
40
-	beego.Router("/api/function/getWeekDoctorOrder",&FunctionBaseAPIController{},"Get:GetWeekDoctorOrder")
41
-	beego.Router("/api/function/getMonthDoctorOrder",&FunctionBaseAPIController{},"Get:GetMonthDoctorOrder")
42
-	beego.Router("/api/function/getThreeMonthDoctorOrder",&FunctionBaseAPIController{},"Get:GetThreeMonthDoctorOrder")
43
-	beego.Router("/api/function/getHalfYearDoctorOrder",&FunctionBaseAPIController{},"Get:GetHalfYearDoctorOrder")
44
-	beego.Router("/api/function/getYearDoctorOrder",&FunctionBaseAPIController{},"Get:GetYearDoctorOrder")
45
-	beego.Router("/api/function/getTodayDoubleCheckInfo",&FunctionBaseAPIController{},"Get:GetTodayDoubleCheckInfo")
46
-	beego.Router("/api/function/getYesTodayDoubleCheckInfo",&FunctionBaseAPIController{},"Get:GetYesTodayDoubleCheckInfo")
47
-	beego.Router("/api/function/getweekDoubleCheckInfo",&FunctionBaseAPIController{},"Get:GetWeekDoubleCheckInfo")
48
-	beego.Router("/api/function/getMonthDoubleCheckInfo",&FunctionBaseAPIController{},"Get:GetMonthDoubleCheckInfo")
49
-	beego.Router("/api/function/getThreeMonthDoubleCheckInfo",&FunctionBaseAPIController{},"Get:GetThreeMonthDoubleCheckInfo")
50
-	beego.Router("/api/function/getHalfYearDoubleCheckInfo",&FunctionBaseAPIController{},"Get:GetHalfYearDoubleCheckInfo")
51
-	beego.Router("/api/function/getyeardoublecheck",&FunctionBaseAPIController{},"Get:GetYearDoubleCheckInfo")
52
-	beego.Router("/api/function/getDialysisMachine",&FunctionBaseAPIController{},"Get:GetTodayDialysisMachinek")
53
-	beego.Router("/api/function/getyesterdayDialysisMachine",&FunctionBaseAPIController{},"Get:GetYesterTodayDialysisMachinek")
54
-	beego.Router("/api/function/getweekdialysismachaine",&FunctionBaseAPIController{},"Get:GetWeekDialsysImachaine")
55
-	beego.Router("/api/function/getmonthDialysisMachine",&FunctionBaseAPIController{},"Get:GetMonthDialsysImachaine")
56
-	beego.Router("/api/function/getthreeMonthDialysismachine",&FunctionBaseAPIController{},"Get:GetThreeMonthDialsysImachaine")
57
-	beego.Router("/api/function/gethalfyeardialysismachine",&FunctionBaseAPIController{},"Get:GetHalfYearDialysisMachine")
58
-	beego.Router("/api/function/getyeardialysismachine",&FunctionBaseAPIController{},"Get:GetYearDialysisMachine")
59
-	beego.Router("/api/function/gettodaydialysisexamination",&FunctionBaseAPIController{},"Get:GetTodayDialysisExamination")
60
-	beego.Router("/api/function/getyesterdayDialysisexamination",&FunctionBaseAPIController{},"Get:GetYesTodayDialysisExamination")
61
-	beego.Router("/api/function/getweekdialysisexamination",&FunctionBaseAPIController{},"Get:GetWeekDialysisExamination")
62
-	beego.Router("/api/function/getmonthdialysisexamination",&FunctionBaseAPIController{},"Get:GetMonthDialysisExamination")
63
-	beego.Router("/api/function/getthreeMonthDialysisExamination",&FunctionBaseAPIController{},"Get:GetThreeMonthDialysisExamination")
64
-	beego.Router("/api/function/getHalfYearDialysisExamination",&FunctionBaseAPIController{},"Get:GethalfyearDialysisExamination")
65
-	beego.Router("/api/function/getyeardialysisexamination",&FunctionBaseAPIController{},"Get:GetYearDialysisExamination")
66
-	beego.Router("/api/function/gettodaybeforpenetration",&FunctionBaseAPIController{},"Get:GetTodayBeforOrpenetration")
67
-	beego.Router("/api/function/getyesterdaybeforpenetration",&FunctionBaseAPIController{},"Get:GetYesterDayBeforpinetration")
68
-	beego.Router("/api/function/getWeekBeforPenetration",&FunctionBaseAPIController{},"Get:GetWeekBeforPenetration")
69
-	beego.Router("/api/function/getMonthBeforPenetration",&FunctionBaseAPIController{},"Get:GetMonthBeforPenetration")
70
-	beego.Router("/api/function/getThreeBeforePenetrationMonthInfo",&FunctionBaseAPIController{},"Get:GetThreeMonthBeforPenetration")
71
-	beego.Router("/api/function/getHalfYearPenetration",&FunctionBaseAPIController{},"Get:GetHalfYearBeforPenetration")
72
-	beego.Router("/api/function/getYearBeforPenetration",&FunctionBaseAPIController{},"Get:GetYearBeforPenetration")
73
-	beego.Router("/api/function/getTodayPostAssessment",&FunctionBaseAPIController{},"Get:GetTodayPostAssessment")
74
-	beego.Router("/api/function/getYesterDayPostAssessment",&FunctionBaseAPIController{},"Get:GetYesterDayPostAssessment")
75
-	beego.Router("/api/function/getWeekPostAssessment",&FunctionBaseAPIController{},"Get:GetWeekPostAssessment")
76
-	beego.Router("/api/function/getMonthPostAssessment",&FunctionBaseAPIController{},"Get:GetMonthPostAssessment")
77
-	beego.Router("/api/function/getThreeMonthAssessment",&FunctionBaseAPIController{},"Get:GetThreeMonthAssessment")
78
-	beego.Router("/api/function/getHalfYearPostAssessment",&FunctionBaseAPIController{},"Get:GetHalfYearPostAssessment")
79
-	beego.Router("/api/function/getYearPostAssessment",&FunctionBaseAPIController{},"Get:GetYearPostAssessment")
80
-	beego.Router("/api/function/gettodayentrylist",&FunctionBaseAPIController{},"Get:GetTodayEntrylist")
81
-	beego.Router("/api/function/getyesterdayentrylist",&FunctionBaseAPIController{},"Get:GetYesterdayEntrylist")
82
-	beego.Router("/api/function/getweekentrylist",&FunctionBaseAPIController{},"Get:GetWeekEntrylist")
83
-	beego.Router("/api/function/getmonthentrylist",&FunctionBaseAPIController{},"Get:GetMonthEntrylist")
84
-	beego.Router("/api/function/getthreemonthlist",&FunctionBaseAPIController{},"Get:GetThreeMonthEntrylist")
85
-	beego.Router("/api/function/gethalfentrylsit",&FunctionBaseAPIController{},"Get:GetHalfYearEntrylist")
86
-	beego.Router("/api/function/getyearentrylist",&FunctionBaseAPIController{},"Get:GetYearEntrylist")
87
-	beego.Router("/api/function/gettodayexitlist",&FunctionBaseAPIController{},"Get:GetTodayExitlist")
88
-	beego.Router("/api/function/getyestrdayexitlist",&FunctionBaseAPIController{},"Get:GetYesterdayExitlist")
89
-	beego.Router("/api/function/getweekexitlist",&FunctionBaseAPIController{},"Get:GetWeekExitlist")
90
-	beego.Router("/api/function/getmonthexitlist",&FunctionBaseAPIController{},"Get:GetMonthExitlist")
91
-	beego.Router("/api/function/getthreemonthexitlist",&FunctionBaseAPIController{},"Get:GetThreeMonthExitlist")
92
-	beego.Router("/api/function/gethalfexitlist",&FunctionBaseAPIController{},"Get:GetHalfExitlist")
93
-	beego.Router("/api/function/getyearexitlist",&FunctionBaseAPIController{},"Get:GetYearExitlist")
94
-
95
-
96
-
97
-}

+ 0 - 57
controllers/function_api_controllers/function_base_controller.go View File

1
-package function_api_controllers
2
-
3
-import (
4
-	"XT_Admin_Api/controllers"
5
-	"XT_Admin_Api/enums"
6
-	"XT_Admin_Api/models/admin_models"
7
-)
8
-
9
-type FuntionBaseController struct {
10
-	controllers.BaseAPIController
11
-}
12
-
13
-func (this *FuntionBaseController) ErrorLog(format string, a ...interface{}) {
14
-	//beego.Error(fmt.Sprintf("[管理员后台] %v", fmt.Sprintf(format, a...)))
15
-}
16
-
17
-func (this *FuntionBaseController) WarnLog(format string, a ...interface{}) {
18
-	//beego.Warn(fmt.Sprintf("[管理员后台] %v", fmt.Sprintf(format, a...)))
19
-}
20
-
21
-func (this *FuntionBaseController) InfoLog(format string, a ...interface{}) {
22
-	//beego.Info(fmt.Sprintf("[管理员后台] %v", fmt.Sprintf(format, a...)))
23
-}
24
-
25
-func (this *FuntionBaseController) DebugLog(format string, a ...interface{}) {
26
-	//beego.Debug(fmt.Sprintf("[管理员后台] %v", fmt.Sprintf(format, a...)))
27
-}
28
-
29
-func (this *FuntionBaseController) TraceLog(format string, a ...interface{}) {
30
-	//beego.Trace(fmt.Sprintf("[管理员后台] %v", fmt.Sprintf(format, a...)))
31
-}
32
-
33
-func (this *FuntionBaseController) GetAdminInfo() *AdminInfo {
34
-	userInfo := this.GetSession("admin_info")
35
-	if userInfo == nil {
36
-		return nil
37
-	} else {
38
-		return userInfo.(*AdminInfo)
39
-	}
40
-}
41
-
42
-type AdminInfo struct {
43
-	Admin *admin_models.AdminAccount
44
-}
45
-
46
-type FunctionBaseAPIAuthController struct {
47
-	FuntionBaseController
48
-}
49
-
50
-func (this *FunctionBaseAPIAuthController) Prepare() {
51
-	this.FuntionBaseController.Prepare()
52
-	adminInfo := this.GetAdminInfo()
53
-	if adminInfo == nil {
54
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
55
-		this.StopRun()
56
-	}
57
-}

+ 1 - 5
main.go View File

3
 import (
3
 import (
4
 	_ "XT_Admin_Api/routers"
4
 	_ "XT_Admin_Api/routers"
5
 	"XT_Admin_Api/service"
5
 	"XT_Admin_Api/service"
6
-	"net/http"
7
-
8
 	"github.com/astaxie/beego"
6
 	"github.com/astaxie/beego"
9
 	_ "net/http/pprof"
7
 	_ "net/http/pprof"
10
 )
8
 )
11
 
9
 
12
 func init() {
10
 func init() {
13
 	service.ConnectDB()
11
 	service.ConnectDB()
14
-	go func() {
15
-		http.ListenAndServe("localhost:6060", nil)
16
-	}()
12
+
17
 }
13
 }
18
 
14
 
19
 func main() {
15
 func main() {

+ 0 - 2
routers/router.go View File

2
 
2
 
3
 import (
3
 import (
4
 	admin_api "XT_Admin_Api/controllers/admin_api_controllers"
4
 	admin_api "XT_Admin_Api/controllers/admin_api_controllers"
5
-	function_api "XT_Admin_Api/controllers/function_api_controllers"
6
 	"github.com/astaxie/beego"
5
 	"github.com/astaxie/beego"
7
 	"github.com/astaxie/beego/plugins/cors"
6
 	"github.com/astaxie/beego/plugins/cors"
8
 )
7
 )
20
 	// beego.Router("/", &controllers.MainController{})
19
 	// beego.Router("/", &controllers.MainController{})
21
 
20
 
22
 	admin_api.AdminAPIControllersRegisterRouters()
21
 	admin_api.AdminAPIControllersRegisterRouters()
23
-	function_api.FunctionAPIControllersRegisterRouters()
24
 }
22
 }