|
@@ -2,10 +2,12 @@ package jyutil
|
|
|
|
|
|
import (
|
|
|
util "app.yhyue.com/moapp/jybase/common"
|
|
|
+ "app.yhyue.com/moapp/jybase/go-xweb/httpsession"
|
|
|
"app.yhyue.com/moapp/jypkg/compatible"
|
|
|
"app.yhyue.com/moapp/jypkg/public"
|
|
|
"encoding/json"
|
|
|
. "jy/src/jfw/modules/app/src/jfw/config"
|
|
|
+ "net/http"
|
|
|
"reflect"
|
|
|
"regexp"
|
|
|
"sort"
|
|
@@ -247,3 +249,29 @@ func Handle(data []interface{}, host string) []AdInfo {
|
|
|
}
|
|
|
return res
|
|
|
}
|
|
|
+
|
|
|
+func ChangeLoginCookie(status, timeOut int, w http.ResponseWriter, name, value string) {
|
|
|
+ switch status {
|
|
|
+ case 1:
|
|
|
+ http.SetCookie(w, &http.Cookie{
|
|
|
+ Name: name,
|
|
|
+ Value: value,
|
|
|
+ Path: "/",
|
|
|
+ HttpOnly: false,
|
|
|
+ MaxAge: timeOut,
|
|
|
+ Expires: time.Now().Add(time.Duration(timeOut)),
|
|
|
+ Domain: httpsession.Domain,
|
|
|
+ })
|
|
|
+ default:
|
|
|
+ http.SetCookie(w, &http.Cookie{
|
|
|
+ Name: name,
|
|
|
+ Value: value,
|
|
|
+ Path: "/",
|
|
|
+ HttpOnly: false,
|
|
|
+ MaxAge: -1,
|
|
|
+ Expires: time.Now().Add(-1),
|
|
|
+ Domain: httpsession.Domain,
|
|
|
+ })
|
|
|
+
|
|
|
+ }
|
|
|
+}
|