func (this *PaymentC) getAliPayment(ctx *web.Context) payment.IPayment { var p payment.IPayment if guitl.IsMobileAgent(ctx.Request.UserAgent()) { p = &payment.AliPayWap{ Partner: "2088021187655650", Key: "3aijnz4020um0c7iq0ayanaqqcxtxk5i", Seller: "*****@*****.**", PrivateKey: `-----BEGIN ENCRYPTED PRIVATE KEY----- MIICoTAbBgkqhkiG9w0BBQMwDgQIu5+aUzZxXVUCAggABIICgMJ/Hc9wnG//S/Rg 7f4ReeAP0cybL3dO5MUHUnQDa6gGebSPMmB/rAXjtMmTjzyYCjhbJyRkSHKNWLIx zZdHMv4T7A/cHK0owRKSNnW7AzY4seCBbnsLteVo33PBAF5u+tO9O5maBm2Rv9xi 3gtSH2gh5RoGrjF85VsRm0Vn/e/4Q3dB/IN5YZt2W76GJpPpLk9ltgmJYFcJ0c3X LAqK08RQGN7TfHptYFydrtBftFI6kj1jn7Qs3h7Uqc1qpnDroWqSio7IWE6cF8Nx XD94xuIPLBVlRjGPIZq1PwaIO0cfcAkcD8JZqVMCn99c9x5MW0DFzNjotithZB2v ApooLlhYqoLOrPGpUW8aOnaJ15/awMsJYtyvjF4/IkY6Q1xVqwCTKnNq9aMlmKZU W+8gnJxpqVRNCUC6fuJhLU2fPD85RWfHoAq8iNxz1nz8KHiVVh3FSwS1RyxV6amH ozar9aGZPlh1zT649h51YSpLy/q2pJwfl78a97ArAqXCCltLF/oMDqwcs4BqM9qP PUcSt0k6mURvLwBe2ztop4xTFONn5DizAvEmdTO1YHOQlqDXbxSfO9gH7Yj5fmoL AdebjiSZfR//1dvePyM8wkk67PdWItxuNGKg7TeZCxfsGkYsq4t38rRNHmSvevV0 c9XWpbqupJy/g8OsP1Afj4F+9W3wBkhiMFvidIvJcTnkvmxJGz+dJb/feBr10Il+ +CVucgZdPkMQoREe+FDV3G3K1ZaoGLvbZwcUBsyF0X/l3TIjgjQxuW8j+1NMkstF TsARjljf7udXaOCK7Uf6vujC2Zk3UI/39LSJ12WAB/Wgc1TEhBq/e6hnyGXtbuBf Ibg2Kl0= -----END ENCRYPTED PRIVATE KEY-----`, } } else { p = &payment.AliPay{ Partner: "2088021187655650", Key: "3aijnz4020um0c7iq0ayanaqqcxtxk5i", Seller: "*****@*****.**", } } return p }
func main() { fmt.Println(crypto.Sha1([]byte("rskd3p"))) fmt.Println(domain.PartnerSha1Pwd("zs", "gcY!zs1654320s")) fmt.Println(domain.NewApiId(105)) fmt.Println(domain.MemberSha1Pwd("jumy257")) fmt.Println(1 << 2) fmt.Println(util.IsMobileAgent("Mozilla/5.0 (Linux; U; Android 2.3.7; en-us; Nexus One Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1")) tagRegexp := regexp.MustCompile("\\s*([^:\\|]+):([^:\\|]+)\\s*\\|*") matches := tagRegexp.FindAllStringSubmatch("G1:10|G2:12|G3:14", -1) for i := 0; i < len(matches); i++ { fmt.Println(i, "---", matches[i][1], matches[i][2]) } fmt.Println("/main/change_device?device=3&return_url=/main/t/123" + url.QueryEscape("?return_url=/app")) }
// 获取浏览设备 func GetBrownerDevice(ctx *web.Context) string { ck, err := ctx.Request.Cookie(clientDeviceTypeCookieId) if err == nil && ck != nil { switch ck.Value { case "1": return DevicePC case "2": return DeviceMobile case "3": return DeviceTouchPad case "4": return DeviceAppEmbed } } if gutil.IsMobileAgent(ctx.Request.UserAgent()) { return DeviceMobile } return DevicePC }