|
@@ -12,6 +12,7 @@ import (
|
|
"math"
|
|
"math"
|
|
"math/big"
|
|
"math/big"
|
|
mathRand "math/rand"
|
|
mathRand "math/rand"
|
|
|
|
+ "net/http"
|
|
"net/url"
|
|
"net/url"
|
|
"reflect"
|
|
"reflect"
|
|
"regexp"
|
|
"regexp"
|
|
@@ -706,3 +707,12 @@ func RetainDecimal(v float64, n int) float64 {
|
|
n10 := math.Pow10(n)
|
|
n10 := math.Pow10(n)
|
|
return math.Trunc((v+0.5/n10)*n10) / n10
|
|
return math.Trunc((v+0.5/n10)*n10) / n10
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+//判断是否是微信访问
|
|
|
|
+func CheckWxBrowser(Request *http.Request) bool {
|
|
|
|
+ if strings.Index(Request.UserAgent(), "MicroMessenger") > -1 || strings.Index(Request.UserAgent(), "Wechat") > -1 {
|
|
|
|
+ return true
|
|
|
|
+ } else {
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
|
|
+}
|