陈少旭 7 months ago
parent
commit
ebb05c4d4c

+ 4 - 0
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
+	"fmt"
7
 )
8
 )
8
 
9
 
9
 type AdminBaseAPIController struct {
10
 type AdminBaseAPIController struct {
32
 
33
 
33
 func (this *AdminBaseAPIController) GetAdminInfo() *AdminInfo {
34
 func (this *AdminBaseAPIController) GetAdminInfo() *AdminInfo {
34
 	userInfo := this.GetSession("admin_info")
35
 	userInfo := this.GetSession("admin_info")
36
+	fmt.Println(userInfo)
37
+
35
 	if userInfo == nil {
38
 	if userInfo == nil {
36
 		return nil
39
 		return nil
37
 	} else {
40
 	} else {
50
 func (this *AdminBaseAPIAuthController) Prepare() {
53
 func (this *AdminBaseAPIAuthController) Prepare() {
51
 	this.AdminBaseAPIController.Prepare()
54
 	this.AdminBaseAPIController.Prepare()
52
 	adminInfo := this.GetAdminInfo()
55
 	adminInfo := this.GetAdminInfo()
56
+	fmt.Println(adminInfo)
53
 	if adminInfo == nil {
57
 	if adminInfo == nil {
54
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
58
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
55
 		this.StopRun()
59
 		this.StopRun()

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

17
 	beego.Router("/admin/api/custom/edit", &CustomAPIController{}, "post:ModifyCustom")
17
 	beego.Router("/admin/api/custom/edit", &CustomAPIController{}, "post:ModifyCustom")
18
 	beego.Router("/admin/api/custom/list", &CustomAPIController{}, "get:GetCustomList")
18
 	beego.Router("/admin/api/custom/list", &CustomAPIController{}, "get:GetCustomList")
19
 	beego.Router("/admin/api/custom/get", &CustomAPIController{}, "get:GetCustom")
19
 	beego.Router("/admin/api/custom/get", &CustomAPIController{}, "get:GetCustom")
20
-	beego.Router("/admin/api/checkcustom/get", &CustomAPIController{}, "get:GetWaitCheckCustom")
20
+	//beego.Router("/admin/api/checkcustom/get", &CustomAPIController{}, "get:GetWaitCheckCustom")
21
 
21
 
22
 	beego.Router("/admin/api/paymentcollection/create", &CustomAPIController{}, "post:CreatePaymentCollection")
22
 	beego.Router("/admin/api/paymentcollection/create", &CustomAPIController{}, "post:CreatePaymentCollection")
23
 	beego.Router("/admin/api/paymentcollection/get", &CustomAPIController{}, "get:GetPaymentCollection")
23
 	beego.Router("/admin/api/paymentcollection/get", &CustomAPIController{}, "get:GetPaymentCollection")

+ 3 - 0
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"
6
 )
7
 )
7
 
8
 
8
 type LoginAPIController struct {
9
 type LoginAPIController struct {
29
 	this.SetSession("admin_info", &AdminInfo{
30
 	this.SetSession("admin_info", &AdminInfo{
30
 		Admin: admin,
31
 		Admin: admin,
31
 	})
32
 	})
33
+	//userInfo := this.GetSession("admin_info")
34
+	fmt.Println(this.GetSession("admin_info"))
32
 	this.ServeSuccessJSON(map[string]interface{}{
35
 	this.ServeSuccessJSON(map[string]interface{}{
33
 		"admin": admin,
36
 		"admin": admin,
34
 	})
37
 	})

+ 5 - 0
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"
6
 
7
 
7
 	"github.com/astaxie/beego"
8
 	"github.com/astaxie/beego"
9
+	_ "net/http/pprof"
8
 )
10
 )
9
 
11
 
10
 func init() {
12
 func init() {
11
 	service.ConnectDB()
13
 	service.ConnectDB()
14
+	go func() {
15
+		http.ListenAndServe("localhost:6060", nil)
16
+	}()
12
 }
17
 }
13
 
18
 
14
 func main() {
19
 func main() {