|
|
@@ -6,7 +6,11 @@ import ( |
|
|
|
"applet/app/customer/md" |
|
|
|
"applet/app/customer/svc" |
|
|
|
"applet/app/e" |
|
|
|
"context" |
|
|
|
"github.com/chromedp/chromedp" |
|
|
|
"github.com/chromedp/chromedp/device" |
|
|
|
"github.com/gin-gonic/gin" |
|
|
|
"io/ioutil" |
|
|
|
) |
|
|
|
|
|
|
|
func CurlAlipayPlanetEcocampusApiRosterSignUpInfo(c *gin.Context) { |
|
|
@@ -33,3 +37,45 @@ func Demo(c *gin.Context) { |
|
|
|
e.OutSuc(c, nil, nil) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
func SanHu(c *gin.Context) { |
|
|
|
url := c.DefaultQuery("url", "") |
|
|
|
if url == "" { |
|
|
|
e.OutErr(c, e.ERR_NO_DATA, "网址不能为空") |
|
|
|
return |
|
|
|
} |
|
|
|
ctx, cancel := chromedp.NewContext(context.Background()) |
|
|
|
defer cancel() |
|
|
|
var b1, b2 []byte |
|
|
|
if err := chromedp.Run(ctx, |
|
|
|
// emulate iPhone 7 landscape |
|
|
|
chromedp.Emulate(device.IPhone8Plus), |
|
|
|
chromedp.Navigate(url), |
|
|
|
chromedp.CaptureScreenshot(&b1), |
|
|
|
|
|
|
|
// reset |
|
|
|
chromedp.Emulate(device.Reset), |
|
|
|
|
|
|
|
// set really large viewport |
|
|
|
chromedp.EmulateViewport(1920, 2000), |
|
|
|
chromedp.Navigate(url), |
|
|
|
chromedp.CaptureScreenshot(&b2), |
|
|
|
); err != nil { |
|
|
|
e.OutErr(c, e.ERR, err.Error()) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
if err := ioutil.WriteFile("./static/template/sanHu/IPhone8Plus.png", b1, 0777); err != nil { |
|
|
|
e.OutErr(c, e.ERR, err.Error()) |
|
|
|
return |
|
|
|
} |
|
|
|
if err := ioutil.WriteFile("./static/template/sanHu/Pc.png", b2, 0777); err != nil { |
|
|
|
e.OutErr(c, e.ERR, err.Error()) |
|
|
|
return |
|
|
|
} |
|
|
|
e.OutSuc(c, map[string]interface{}{ |
|
|
|
"iphone8_plus": "https://zs.zehaochi.net/template/sanHu/IPhone8Plus.png", |
|
|
|
"pc": "https://zs.zehaochi.net/template/sanHu/Pc.png", |
|
|
|
}, nil) |
|
|
|
return |
|
|
|
} |