Yankun168 1 жил өмнө
parent
commit
5a0eafe04c

+ 6 - 0
.idea/JavaSceneConfigState.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="SmartInputSourceJavaSceneConfigState">
+    <option name="customChineseScenes" value="{&quot;capsLockState&quot;:false,&quot;code&quot;:&quot;;Printf(format);Println(a);TalentHttpResult(Msg)&quot;,&quot;enable&quot;:true,&quot;languageType&quot;:&quot;CHINESE&quot;,&quot;name&quot;:&quot;自定义中文切换&quot;,&quot;tip&quot;:&quot;&quot;}" />
+  </component>
+</project>

+ 13 - 2
app/api/youngee_talent_api/talent_auth_get_api.go

@@ -1,6 +1,7 @@
 package youngeetalentapi
 
 import (
+	"fmt"
 	"youngmini_server/app/service/youngee_sectask_service"
 	"youngmini_server/app/service/youngee_talent_service"
 	"youngmini_server/app/service/youngee_task_service"
@@ -8,14 +9,17 @@ import (
 	"github.com/gogf/gf/net/ghttp"
 )
 
+// 声明结构体对象
 var TalentAuthGetApi = talentAuthGetApi{}
 
+// 定义结构体controller
 type talentAuthGetApi struct{}
 
+// 给controller对象绑定方法  放方法绑定在该结构体上
 // 获取单个项目详情
 func (*talentAuthGetApi) GetProjectDetail(r *ghttp.Request) {
 	res := youngee_task_service.GetProjectDetail(r)
-
+	fmt.Println("展示单个种草商品")
 	err := r.Response.WriteJson(res)
 	if err != nil {
 		panic("write response error")
@@ -26,6 +30,7 @@ func (*talentAuthGetApi) GetProjectDetail(r *ghttp.Request) {
 // youngee_talent_info、youngee_task_info
 func (*talentAuthGetApi) GetTalentInfo(r *ghttp.Request) {
 	res := youngee_talent_service.GetTalentInfo(r)
+	fmt.Println("获取达人信息(申请带货若未绑定个人信息,则跳到这)")
 	err := r.Response.WriteJson(res)
 	if err != nil {
 		panic("write response error")
@@ -74,7 +79,10 @@ func (*talentAuthGetApi) GetTalentAccount(r *ghttp.Request) {
 
 // 判断达人是否登录
 func (*talentAuthGetApi) IsLogin(r *ghttp.Request) {
+	r.Response.Writeln("islogin接口检查")
+	//此res就是前端中的res
 	res := youngee_talent_service.IsLogin(r)
+
 	err := r.Response.WriteJson(res)
 	if err != nil {
 		panic("write response error")
@@ -125,7 +133,9 @@ func (*talentAuthGetApi) GetTaskNum(r *ghttp.Request) {
 	}
 }
 
+// 获取任务详情
 func (*talentAuthGetApi) GetTaskDetail(r *ghttp.Request) {
+	fmt.Println("获取种草任务详情")
 	res := youngee_task_service.GetTaskDetail(r)
 	err := r.Response.WriteJson(res)
 	if err != nil {
@@ -342,8 +352,8 @@ func (*talentAuthGetApi) GetTalentPointInfo(r *ghttp.Request) {
 
 // 获取单个选品项目详情
 func (*talentAuthGetApi) GetSelectionDetail(r *ghttp.Request) {
+	fmt.Println("单个带货商品展示咯")
 	res := youngee_sectask_service.GetSelectionDetail(r)
-
 	err := r.Response.WriteJson(res)
 	if err != nil {
 		panic("write response error")
@@ -379,6 +389,7 @@ func (*talentAuthGetApi) GetLeadYoungTeamId(r *ghttp.Request) {
 }
 
 func (*talentAuthGetApi) GetSecTaskDetail(r *ghttp.Request) {
+	fmt.Println("获取带货任务详情")
 	res := youngee_sectask_service.GetSecTaskDetail(r)
 	err := r.Response.WriteJson(res)
 	if err != nil {

+ 2 - 1
app/api/youngee_talent_api/talent_auth_post_api.go

@@ -1,6 +1,7 @@
 package youngeetalentapi
 
 import (
+	"fmt"
 	"github.com/gogf/gf/net/ghttp"
 	"youngmini_server/app/service/youngee_sectask_service"
 	"youngmini_server/app/service/youngee_talent_service"
@@ -24,7 +25,7 @@ func (*talentAuthPostApi) TalentInfo(r *ghttp.Request) {
 // TalentInfo 提交达人个人资料
 func (*talentAuthPostApi) UpdateTalentInfo(r *ghttp.Request) {
 	res := youngee_talent_service.OnUpdateTalentInfo(r)
-
+	fmt.Println("插入成功")
 	err := r.Response.WriteJson(res)
 	if err != nil {
 		panic("write response error")

+ 6 - 1
app/api/youngee_talent_api/talent_get_api.go

@@ -1,6 +1,7 @@
 package youngeetalentapi
 
 import (
+	"fmt"
 	"youngmini_server/app/service/youngee_sectask_service"
 	"youngmini_server/app/service/youngee_talent_service"
 	"youngmini_server/app/service/youngee_task_service"
@@ -13,7 +14,7 @@ var TalentGetApi = talentGetApi{}
 type talentGetApi struct {
 }
 
-// GetInfoTables 获取所有信息表
+// GetInfoTables 获取数据库中所有info_所有信息表的信息存在res的data中
 func (*talentGetApi) GetInfoTables(r *ghttp.Request) {
 	res := youngee_talent_service.GetInfoTables()
 
@@ -26,6 +27,7 @@ func (*talentGetApi) GetInfoTables(r *ghttp.Request) {
 // 获取任务大厅展示列表
 func (*talentGetApi) GetProjectList(r *ghttp.Request) {
 	res := youngee_task_service.GetProjectInfoList(r)
+	fmt.Println("我进入了talent_get_api中的GetProjectList(展示所有种草)")
 
 	err := r.Response.WriteJson(res)
 	if err != nil {
@@ -34,8 +36,11 @@ func (*talentGetApi) GetProjectList(r *ghttp.Request) {
 }
 
 // 获取选品任务广场展示列表
+// 前端可能传过来筛选和搜索的参数
+// 筛选参数参数形如&secform[]=2&secform[]=3&secform[]=9
 func (*talentGetApi) GetSelectionList(r *ghttp.Request) {
 	res := youngee_sectask_service.GetSelectionList(r)
+	fmt.Println("我进入了talent_get_api中的GetSelectionList(展示所有带货)")
 
 	err := r.Response.WriteJson(res)
 	if err != nil {

+ 2 - 0
app/api/youngee_talent_api/talent_post_api.go

@@ -1,6 +1,7 @@
 package youngeetalentapi
 
 import (
+	"fmt"
 	"github.com/gogf/gf/net/ghttp"
 	"youngmini_server/app/service/youngee_talent_service"
 )
@@ -14,6 +15,7 @@ type talentPostApi struct {
 func (*talentPostApi) Login(r *ghttp.Request) {
 	// 向微信服务端校验登录凭证
 	res := youngee_talent_service.WxLogin(r)
+	fmt.Println("here")
 	err := r.Response.WriteJson(res)
 	if err != nil {
 		panic("write response error")

+ 7 - 0
app/model/model.go

@@ -8,6 +8,13 @@ import (
 	"github.com/gogf/gf/os/gtime"
 )
 
+//抖音授权info_auth表内容
+type AuthInfo struct {
+	Id    int    `json:"id" orm:"id,primary"`
+	Code  string `json:"code" orm:"code"`
+	State string `json:"state" orm:"state"`
+}
+
 // BobocoinDeductRecord is the golang structure for table bobocoin_deduct_record.
 type BobocoinDeductRecord struct {
 	RecordId       uint64      `orm:"record_id,primary" json:"record_id"`       // 扣费记录ID

+ 46 - 17
app/service/youngee_sectask_service/seletion_square.go

@@ -33,9 +33,10 @@ func GetSelectionList(r *ghttp.Request) *TalentHttpResult {
 
 	pageIndex := r.GetQueryInt("idx", -1)
 	cntPerPage := r.GetQueryInt("cnt", -1)
-	platform := r.Get("platform")
+	//platform := r.Get("platform")
 	secForm := r.Get("secform")
 	taskForm := r.Get("taskform")
+	categoryForm := r.Get("categoryform")
 	searchValue := r.Get("searchvalue")
 	if pageIndex == -1 || cntPerPage == -1 || cntPerPage == 0 {
 		return &TalentHttpResult{Code: -1, Msg: "参数错误"}
@@ -63,21 +64,32 @@ func GetSelectionList(r *ghttp.Request) *TalentHttpResult {
 		taskFormList = taskForm.([]interface{})
 	}
 
-	// 如果有平台的过滤条件,则将平台列表保存于platformList
-	var platformList []interface{}
-	if platform != nil {
-		if reflect.TypeOf(platform).Kind() != reflect.Slice {
-			return &TalentHttpResult{Code: -2, Msg: "搜索条件平台类型错误"}
+	// 如果有商品类目的过滤条件,则将过滤条件保存于categoryFormList
+	var categoryFormList []interface{}
+	if categoryForm != nil {
+		if reflect.TypeOf(categoryForm).Kind() != reflect.Slice {
+			return &TalentHttpResult{Code: -2, Msg: "搜索条件任务形式错误"}
 		}
 
-		platformList = make([]interface{}, 0)
-		platformList = platform.([]interface{})
+		categoryFormList = make([]interface{}, 0)
+		categoryFormList = categoryForm.([]interface{})
 	}
 
+	// 如果有平台的过滤条件,则将平台列表保存于platformList  弃用
+	/*	var platformList []interface{}
+		if platform != nil {
+			if reflect.TypeOf(platform).Kind() != reflect.Slice {
+				return &TalentHttpResult{Code: -2, Msg: "搜索条件平台类型错误"}
+			}
+
+			platformList = make([]interface{}, 0)
+			platformList = platform.([]interface{})
+		}*/
+
 	// 构造查询的条件
 	startId := pageIndex * cntPerPage
 	whereStr := fmt.Sprintf("(selection_status >= %d)", selectionStatusInProgress)
-	if platformList != nil {
+	/*	if platformList != nil {
 		whereStr = whereStr + " and platform in ("
 		for _, v := range platformList {
 			whereStr += v.(string) + ", "
@@ -85,7 +97,7 @@ func GetSelectionList(r *ghttp.Request) *TalentHttpResult {
 
 		whereStr = whereStr[0 : len(whereStr)-2]
 		whereStr += ")"
-	}
+	}*/
 
 	if taskFormList != nil {
 		whereStr += " and task_mode in ("
@@ -105,21 +117,36 @@ func GetSelectionList(r *ghttp.Request) *TalentHttpResult {
 		whereStr = whereStr[0 : len(whereStr)-2]
 		whereStr += ")"
 	}
+
+	if categoryFormList != nil {
+		whereStr += " and product_category in ("
+		for _, v := range categoryFormList {
+			whereStr += v.(string) + ", "
+		}
+
+		whereStr = whereStr[0 : len(whereStr)-2]
+		whereStr += ")"
+	}
+
+	//搜索栏
 	if searchValue != nil {
 		whereStr += " and selection_name like '%" + searchValue.(string) + "%'"
 	}
 
 	// 查询所有selection
+	//YounggeeSelectionInfo含有表中的所有属性
 	var selectionList = []model.YounggeeSelectionInfo{}
-	err := g.Model(dao.YounggeeSelectionInfo.Table).Where(whereStr).Scan(&selectionList)
+	//err := g.Model(dao.YounggeeSelectionInfo.Table).Where(whereStr).Scan(&selectionList)
+	//展示带货商品的排序规则  预估赚、ddl未处理
+	err := g.Model(dao.YounggeeSelectionInfo.Table).Where(whereStr).Order("commission_rate DESC , task_reward DESC ").Scan(&selectionList)
 	if err != nil {
 		return &TalentHttpResult{Code: -3, Msg: "查询数据库失败"}
 	}
-	fmt.Println("searchValue:", searchValue)
-	fmt.Println("secFormList:", secFormList)
-	fmt.Println("taskFormList:", taskFormList)
+	fmt.Println("****searchValue:", searchValue)
+	fmt.Println("****secFormList:", secFormList)
+	fmt.Println("****taskFormList:", taskFormList)
 
-	fmt.Println("whereStr: ", whereStr)
+	fmt.Println("****whereStr: ", whereStr)
 
 	// 判断请求页面是否超过最大页面
 	c, err := g.DB().Model(dao.YounggeeSelectionInfo.Table).Where(whereStr).Count()
@@ -139,8 +166,9 @@ func GetSelectionList(r *ghttp.Request) *TalentHttpResult {
 	var selectionInfoList = youngee_talent_model.SelectionInfoList{
 		Count: c,
 	}
+
 	err = g.DB().Model(dao.YounggeeSelectionInfo.Table).WithAll().Where(whereStr).
-		Order("selection_status ASC,task_ddl DESC, selection_id").Limit(startId, cntPerPage).Scan(&selectionInfoList.SeletionInfos)
+		Order("selection_status ASC , task_ddl DESC , commission_rate DESC , task_reward DESC, selection_id").Limit(startId, cntPerPage).Scan(&selectionInfoList.SeletionInfos)
 	if err != nil {
 		return &TalentHttpResult{Code: -6, Msg: "查询数据库失败"}
 	}
@@ -173,7 +201,7 @@ func IsSignUpSecTask(r *ghttp.Request) *TalentHttpResult {
 		return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
 	}
 	selectionId := r.GetQueryInt("selection_id", -1)
-
+	//定义接口存该达人所有的报名任务
 	task := []model.YounggeeSecTaskInfo{}
 	err = g.Model(dao.YounggeeSecTaskInfo.Table).Where("selection_id = ? and talent_id = ?", selectionId, tid).Scan(&task)
 	if err != nil {
@@ -186,6 +214,7 @@ func IsSignUpSecTask(r *ghttp.Request) *TalentHttpResult {
 	} else {
 		isSign.IsSign = 0
 	}
+	fmt.Println("判断报名*********", isSign)
 	return &TalentHttpResult{Code: 0, Msg: "success", Data: isSign}
 }
 

+ 1 - 0
app/service/youngee_talent_service/info_tables.go

@@ -10,6 +10,7 @@ import (
 
 func GetInfoTables() *TalentHttpResult {
 	allInfos := youngee_talent_model.InfoTables{}
+	//Scan 将查询结果扫描到提供的变量中
 	err := g.DB().Model(model.InfoTalentAgeBracket{}).Scan(&allInfos.AgeBracket)
 	if err != nil {
 		return &TalentHttpResult{Code: -1, Msg: "query age bracket failed"}

+ 2 - 0
app/service/youngee_talent_service/talent_account.go

@@ -1,6 +1,7 @@
 package youngee_talent_service
 
 import (
+	"fmt"
 	"youngmini_server/app/dao"
 	"youngmini_server/app/model/youngee_talent_model"
 	"youngmini_server/app/utils"
@@ -16,6 +17,7 @@ func GetTalentAccount(r *ghttp.Request) *TalentHttpResult {
 	}
 
 	res, err := g.DB().Model("youngee_platform_account_info").All("talent_id", tid)
+	fmt.Println("该账号社媒平台绑定结果为__________:", res)
 	if err != nil {
 		return &TalentHttpResult{Code: -2, Msg: "query database error"}
 	}

+ 1 - 0
app/service/youngee_talent_service/talent_address.go

@@ -112,6 +112,7 @@ func OnAddTalentAddress(r *ghttp.Request) *TalentHttpResult {
 		if tErr != nil {
 			return tErr
 		}
+
 		return nil
 	})
 

+ 7 - 1
app/service/youngee_talent_service/wxlogin.go

@@ -38,10 +38,13 @@ func WxLogin(r *ghttp.Request) *TalentHttpResult {
 	secret := g.Config().GetString("miniapp.appsecret")
 
 	url := fmt.Sprintf(urlformat, appId, secret, l.Code)
+	fmt.Println("url----->", url)
+	//通过前端uni.login获得了code用于拼接url
 	resp, err := http.Get(url)
 	if err != nil {
 		return &TalentHttpResult{Code: -2, Msg: err.Error()}
 	}
+	//http.Get(url)之后要关闭
 	defer resp.Body.Close()
 
 	// 解码微信服务端传来的信息
@@ -52,6 +55,7 @@ func WxLogin(r *ghttp.Request) *TalentHttpResult {
 	}
 
 	if wxResp.ErrCode != 0 {
+		fmt.Printf("错误码:%d, 错误信息:%s", wxResp.ErrCode, wxResp.ErrMsg)
 		return &TalentHttpResult{Code: -4, Msg: fmt.Sprintf("errCode:%d, errmsg:%s", wxResp.ErrCode, wxResp.ErrMsg)}
 	}
 
@@ -65,6 +69,7 @@ func WxLogin(r *ghttp.Request) *TalentHttpResult {
 	if rec != nil && rec[dao.YoungeeTalentInfo.Columns.InBlacklist].Int() > 0 {
 		return &TalentHttpResult{Code: -6, Msg: "in black list"}
 	}
+	//获得登录后的返回结果对象
 	res := youngee_talent_model.LoginResultData{}
 	var newTalentId string
 	if rec == nil {
@@ -106,6 +111,7 @@ func WxLogin(r *ghttp.Request) *TalentHttpResult {
 
 	// 用微信的openid和SessionKey的md5做为token
 	token, err := gmd5.EncryptString(wxResp.OpenId + wxResp.SessionKey)
+	fmt.Println("token is " + token)
 	if err != nil {
 		return &TalentHttpResult{Code: -9, Msg: "generate key failed"}
 	}
@@ -128,5 +134,5 @@ func WxLogin(r *ghttp.Request) *TalentHttpResult {
 
 func IsLogin(r *ghttp.Request) *TalentHttpResult {
 
-	return &TalentHttpResult{Code: 0, Msg: "success"}
+	return &TalentHttpResult{Code: 0, Msg: "success"}
 }

+ 1 - 0
app/service/youngee_task_service/project_info.go

@@ -175,6 +175,7 @@ func GetProjectInfoList(r *ghttp.Request) *TalentHttpResult {
 // 获取单个项目详情service
 func GetProjectDetail(r *ghttp.Request) *TalentHttpResult {
 	pid := r.GetQueryInt("projectid", 0)
+
 	if pid == 0 {
 		return &TalentHttpResult{Code: -2, Msg: "parse param error"}
 	}

+ 1 - 0
app/service/youngee_task_service/task_info.go

@@ -447,6 +447,7 @@ func GetTaskNum(r *ghttp.Request) *TalentHttpResult {
 
 // 获取任务详情
 func GetTaskDetail(r *ghttp.Request) *TalentHttpResult {
+
 	taskId := r.GetQueryInt("task_id", -1)
 
 	var task *model.YoungeeTaskInfo

+ 1 - 1
app/system/wxpay/wxpay_api.go

@@ -10,7 +10,7 @@ var WxPay = wxPayApi{}
 type wxPayApi struct{}
 
 func (*wxPayApi) WxPay(r *ghttp.Request) {
-	// 解析参数
+	// 解析参数并存放在定义好的请求结构体对象req中,万物皆结构体
 	var req *WxPayRequestData
 	if err := r.Parse(&req); err != nil {
 		response.ParamErr(r, err)

+ 1 - 0
app/system/wxpay/wxpay_service.go

@@ -18,6 +18,7 @@ var service = new(wxPayService)
 type wxPayService struct {
 }
 
+// 给结构体绑定一个方法,相当于类方法,
 func (s *wxPayService) WxPayRequest(r *ghttp.Request, req WxPayRequestData) (WxPayResponseData, error) {
 
 	openId, err := utils.SessionTalentInfo.GetOpenIdFromSession(r)

BIN
main.exe


BIN
main.exe~


+ 73 - 33
router/router.go

@@ -1,17 +1,17 @@
 package router
 
 import (
+	"github.com/gogf/gf/frame/g"
+	"github.com/gogf/gf/net/ghttp"
 	youngeetalentapi "youngmini_server/app/api/youngee_talent_api"
+	"youngmini_server/app/model"
 	"youngmini_server/app/system/assignment"
 	"youngmini_server/app/system/sectask"
 	"youngmini_server/app/system/wxpay"
 	"youngmini_server/middleware"
-
-	"github.com/gogf/gf/frame/g"
-	"github.com/gogf/gf/net/ghttp"
 )
 
-// MiddlewareCORS 允许跨域请求中间件
+// MiddlewareCORS 允许跨域请求中间件 所有的路由都会经过这个中间件
 func MiddlewareCORS(r *ghttp.Request) {
 	corsOptions := r.Response.DefaultCORSOptions()
 	corsOptions.AllowHeaders = "Authorization,Content-Length,X-CSRF-Token,Token,session,X_Requested_With,Accept,Origin,Host,Connection,Accept-Encoding,Accept-Language,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Pragma"
@@ -32,37 +32,45 @@ func MiddlewareCORS(r *ghttp.Request) {
 }
 
 // MiddlewareAuth 用户认证中间件
-// func MiddlewareAuth(r *ghttp.Request) {
-// 	//排除路径
-// 	array := garray.NewFrom(g.Slice{"/admin/account"})
-// 	if array.Contains(r.RequestURI) == false {
-// 		userData, err := backstage_service.Token.AuthorizationGetUserData(r)
-// 		if err != nil {
-// 			r.Response.WriteStatus(http.StatusForbidden)
-// 			response.JsonExit(r, http.StatusForbidden, err.Error())
-// 		}
-// 		if userData == nil {
-// 			r.Response.WriteStatus(http.StatusUnauthorized)
-// 			response.JsonExit(r, http.StatusForbidden, "用户不存在")
-// 		}
-// 	}
-// 	// 中间件处理逻辑
-// 	r.Middleware.Next()
-// }
+//
+//	func MiddlewareAuth(r *ghttp.Request) {
+//		//排除路径
+//		array := garray.NewFrom(g.Slice{"/admin/account"})
+//		if array.Contains(r.RequestURI) == false {
+//			userData, err := backstage_service.Token.AuthorizationGetUserData(r)
+//			if err != nil {
+//				r.Response.WriteStatus(http.StatusForbidden)
+//				response.JsonExit(r, http.StatusForbidden, err.Error())
+//			}
+//			if userData == nil {
+//				r.Response.WriteStatus(http.StatusUnauthorized)
+//				response.JsonExit(r, http.StatusForbidden, "用户不存在")
+//			}
+//		}
+//		// 中间件处理逻辑
+//		r.Middleware.Next()
+//	}
+//
+// 用于存数据库的验证信息
+// json用于序列化和反序列化
 
 // MiddlewareSuperAuth 超级管理员可以操作的登录接口
-// func MiddlewareSuperAuth(r *ghttp.Request) {
-// 	// 排除路径
-// 	userData, _ := backstage_service.Token.AuthorizationGetUserData(r)
-// 	if userData.User != "10000000" {
-// 		r.Response.WriteStatus(http.StatusPaymentRequired)
-// 		response.JsonExit(r, http.StatusPaymentRequired, "没有权限操作")
-// 	}
-// 	// 中间件处理逻辑
-// 	r.Middleware.Next()
-// }
+//
+//	func MiddlewareSuperAuth(r *ghttp.Request) {
+//		// 排除路径
+//		userData, _ := backstage_service.Token.AuthorizationGetUserData(r)
+//		if userData.User != "10000000" {
+//			r.Response.WriteStatus(http.StatusPaymentRequired)
+//			response.JsonExit(r, http.StatusPaymentRequired, "没有权限操作")
+//		}
+//		// 中间件处理逻辑
+//		r.Middleware.Next()
+//	}
 func init() {
 	s := g.Server()
+	//检查是否能访问数据库
+	md := g.Model("younggee_user")
+	bk, err := md.One()
 
 	// 解决跨域
 	s.BindMiddleware("/*", MiddlewareCORS)
@@ -70,9 +78,41 @@ func init() {
 	// v2小程序端接口
 	s.Group("/youngee/c", func(group *ghttp.RouterGroup) {
 		group.Middleware(middleware.ErrorHandler)
-
+		//group.GET("/ping", func(r *ghttp.Request)才表示/youngee/c/ping生效
 		s.BindHandler("/ping", func(r *ghttp.Request) {
-			r.Response.Write("哈喽世界!")
+			if err == nil {
+				r.Response.WriteJson(bk)
+			}
+		})
+		s.BindHandler("/douyinauth", func(r *ghttp.Request) {
+			r.Response.WriteJson("here to auth")
+			println("begin to auth")
+			code := r.GetString("code")
+			state := r.GetString("state")
+			//结构体赋值
+			authInfo := &model.AuthInfo{
+				Code:  code,
+				State: state,
+			}
+
+			// 使用ORM保存到数据库
+			if _, err := g.DB().Model("info_auth").Save(authInfo); err != nil {
+				r.Response.WriteJson(g.Map{
+					"error": err.Error(),
+				})
+				return
+			}
+
+			// 将保存成功的信息写入响应
+			r.Response.WriteJson(g.Map{
+				"message": "Auth info saved successfully",
+			})
+
+			// 将 map 序列化为 JSON 并写入响应
+			r.Response.WriteJson(authInfo)
+			println("over")
+			//存数据库info_auth中
+
 		})
 		// group.GET("/ping", func(r *ghttp.Request) {
 		// 	r.Response.Write("哈喽世界!")

+ 17 - 0
test.html

@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>上传文件</title>
+</head>
+<body>
+
+<form action="/upload" method="post" enctype="multipart/form-data">
+    <input type="file" name="ufile"> <br>
+    <input type="file" name="ufiles" multiple> <br>
+    <input type="submit" value="上传">
+</form>
+
+</body>
+</html>