You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
790 B
33 lines
790 B
package member
|
|
|
|
import (
|
|
"github.com/gogf/gf/v2/net/ghttp"
|
|
"link_homework/internal/model/dto"
|
|
"link_homework/utility"
|
|
)
|
|
|
|
// MemberController 处理与成员相关的操作
|
|
type MemberController struct{}
|
|
|
|
// GetJwcode 获取用户的 jwcode
|
|
// MemberController.GetJwcode
|
|
func (c *MemberController) GetJwcode(r *ghttp.Request) {
|
|
// 获取 token 参数
|
|
token := r.Get("token").String()
|
|
if token == "" {
|
|
r.Response.WriteJsonExit(dto.Error("Token is required"))
|
|
return
|
|
}
|
|
|
|
// 调用 GetJwcodeJSON 函数获取 jwcode
|
|
result := utility.GetJwcodeJSON(token)
|
|
if result.Code != 200 {
|
|
r.Response.WriteJsonExit(result) // 直接返回错误结果
|
|
return
|
|
}
|
|
|
|
// 成功返回 jwcode
|
|
r.Response.WriteJsonExit(dto.SuccessWithData(map[string]interface{}{
|
|
"jwcode": result.Data,
|
|
}))
|
|
}
|