update
This commit is contained in:
parent
43f5b14de9
commit
c8eedf5a8f
@ -4,13 +4,14 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"testfb/config"
|
"testfb/config"
|
||||||
"testfb/models"
|
"testfb/models"
|
||||||
|
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
"github.com/gofiber/storage/redis/v3"
|
"github.com/gofiber/storage/redis/v3"
|
||||||
"fmt"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// POST 根据身份证和token,来获取家长或老师的基本信息
|
// POST 根据身份证和token,来获取家长或老师的基本信息
|
||||||
@ -58,6 +59,7 @@ func GetUserInfo(redisClient *redis.Storage) fiber.Handler {
|
|||||||
// 解析返回的json数据,判断是否有code字段并且code是否为1,如果是,则获取并返回token
|
// 解析返回的json数据,判断是否有code字段并且code是否为1,如果是,则获取并返回token
|
||||||
var result map[string]interface{}
|
var result map[string]interface{}
|
||||||
json.Unmarshal(body, &result)
|
json.Unmarshal(body, &result)
|
||||||
|
fmt.Println(result)
|
||||||
if _, ok := result["code"]; !ok || result["code"] != 1 {
|
if _, ok := result["code"]; !ok || result["code"] != 1 {
|
||||||
return c.Status(http.StatusUnauthorized).JSON(fiber.Map{
|
return c.Status(http.StatusUnauthorized).JSON(fiber.Map{
|
||||||
"message": "获取学生信息失败,身份证无效",
|
"message": "获取学生信息失败,身份证无效",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user