// Package gwt provides ... package utils type LoginResult struct { Token string `json:"token"` Customer Customer `json:"customer"` } type Customer struct { IDPlus int64 `gorm:"column:customer_info_id;AUTO_INCREMENT"` CustomerID string CustomerName string Avatar string MobilePhone string Email string Gender int BirthDay string `gorm:"column:birthday"` Area string CustomerLevel int UserPoint int64 UserMoney float64 RedbagAmt float64 FirstLogin bool RegisterTime string Latitude float64 Longitude float64 Password string OpenID string QQID string LoginType int BindType int Valid int IsVip int ServiceNo string IsCTI bool // 是否CTI注册用户 } ////生成token //func GenerateToken(c *gin.Context, emp models.Customer) { // j := &jwt.JWT{ // []byte("martin"), // } // claims := jwt.Customclaims{ // emp.CustomerName, // emp.MobilePhone, // emp.CustomerID, // jwtgo.StandardClaims{ // NotBefore: int64(time.Now().Unix() - 1000), //签名生效时间 // ExpiresAt: int64(time.Now().Unix() + 3600), //签名过期时间 一小时 // Issuer: "martin", //签名发行者 // }, // } // token, err := j.CreateToken(claims) // if err != nil { // c.JSON(http.StatusOK, gin.H{ // "status": -1, // "msg": err.Error(), // }) // } // log.Println(token) // data := LoginResult{ // Token: token, // Customer: emp, // } // c.JSON(http.StatusOK, gin.H{ // "status": 0, // "msg": "登录成功", // "data": data, // }) // return //}