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.
37 lines
950 B
37 lines
950 B
package utilService
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/dgrijalva/jwt-go"
|
|
"github.com/gin-gonic/gin"
|
|
gocloud "github.com/mgr9525/go-cloud"
|
|
"time"
|
|
)
|
|
|
|
func NewDomainToken(c *gin.Context, id int64, xid string, remeber bool) (string, error) {
|
|
/*var dms string
|
|
if comm.REG_Host.MatchString(c.Req.Host) {
|
|
strs := comm.REG_Host.FindAllStringSubmatch(c.Req.Host, 1)[0]
|
|
dms = strs[3]
|
|
}
|
|
logrusInfo("NewDomainToken.dms=" + dms)
|
|
return gocloud.SetToken(c, &jwt.MapClaims{
|
|
"id": fmt.Sprintf("%d", id),
|
|
"xid": xid,
|
|
"times": time.Now(),
|
|
}, remeber, dms)*/
|
|
return gocloud.SetToken(c, jwt.MapClaims{
|
|
"id": fmt.Sprintf("%d", id),
|
|
"xid": xid,
|
|
"times": time.Now(),
|
|
}, remeber)
|
|
}
|
|
func ClearDomainToken(c *gin.Context) error {
|
|
/*var dms string
|
|
if comm.REG_Host.MatchString(c.Req.Host) {
|
|
strs := comm.REG_Host.FindAllStringSubmatch(c.Req.Host, 1)[0]
|
|
dms = strs[3]
|
|
}
|
|
return gocloud.ClearToken(c, dms)*/
|
|
return gocloud.ClearToken(c)
|
|
}
|