commit
continuous-integration/drone/push Build is passing Details

master
黄海 4 years ago
parent d9ee6ebad7
commit cf6ae44f7b

@ -4,13 +4,11 @@
<option name="autoReloadType" value="ALL" />
</component>
<component name="ChangeListManager">
<list default="true" id="19c8c37d-a056-451c-a29d-fb612b9a3e2f" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/Business/CaptchaRelate/CaptchaController/CaptchaController.go" afterDir="false" />
<list default="true" id="19c8c37d-a056-451c-a29d-fb612b9a3e2f" name="Default Changelist" comment="commit">
<change afterPath="$PROJECT_DIR$/static/getcapt.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Business/ImRelate/ImRelateController/ImRelateController.go" beforeDir="false" afterPath="$PROJECT_DIR$/Business/ImRelate/ImRelateController/ImRelateController.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Router/CommonToolsRouter.go" beforeDir="false" afterPath="$PROJECT_DIR$/Router/CommonToolsRouter.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/go.mod" beforeDir="false" afterPath="$PROJECT_DIR$/go.mod" afterDir="false" />
<change beforePath="$PROJECT_DIR$/go.sum" beforeDir="false" afterPath="$PROJECT_DIR$/go.sum" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Business/CaptchaRelate/CaptchaController/CaptchaController.go" beforeDir="false" afterPath="$PROJECT_DIR$/Business/CaptchaRelate/CaptchaController/CaptchaController.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.go" beforeDir="false" afterPath="$PROJECT_DIR$/main.go" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -21,6 +19,7 @@
<option name="RECENT_TEMPLATES">
<list>
<option value="Go File" />
<option value="HTML File" />
</list>
</option>
</component>
@ -39,6 +38,7 @@
<component name="PropertiesComponent">
<property name="ASKED_ADD_EXTERNAL_FILES" value="true" />
<property name="DefaultGoTemplateProperty" value="Go File" />
<property name="DefaultHtmlFileTemplate" value="HTML File" />
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
@ -101,6 +101,10 @@
</option>
<option name="oldMeFiltersMigrated" value="true" />
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="commit" />
<option name="LAST_COMMIT_MESSAGE" value="commit" />
</component>
<component name="VgoProject">
<integration-enabled>true</integration-enabled>
</component>

@ -8,17 +8,17 @@ import (
"net/http"
)
//模块的路由配置
// Routers 模块的路由配置
func Routers(r *gin.RouterGroup) {
rr := r.Group("/captchaRelate")
rr.GET("/GetOne", GetOne)
rr.GET("/Verify", Verify)
rr.POST("/Verify", Verify)
}
// 设置自带的store
var store = base64Captcha.DefaultMemStore
//存储验证码的结构
// CaptchaResult 存储验证码的结构
type CaptchaResult struct {
Id string `json:"id"`
Base64Blob string `json:"base_64_blob"`

@ -25,6 +25,8 @@ func main() {
gin.SetMode(gin.DebugMode)
// 开启gin服务器
r := gin.Default()
//设置静态资源
r.Static("/dsSzxy/static", "./static")
// 使用跨域中间件
r.Use(Utils.Cors())
//主路由

@ -0,0 +1,49 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
</head>
<body>
<img id="capt" src=""/><br/>
<input id="captvalue" placeholder="请输入验证码"/><br/>
<input type="button" name="save" value="提交" onclick="submit()"/>
<script>
var curCaptId = "";
//得到图形验证码和id
$.ajax({
type: "GET",
url: "/dsSzxy/captchaRelate/GetOne",
data: {},
dataType: "JSON",
success: function (result) {
curCaptId = result.captcha.id;
document.getElementById("capt").src = result.captcha.base_64_blob;
}
});
//提交验证码和id
function submit() {
var capt = document.getElementById("captvalue").value;
var postdata = {
"id": curCaptId,
"capt": capt
};
$.ajax({
type: "POST",
url: "/dsSzxy/captchaRelate/Verify",
data: postdata,
dataType: "JSON",
success: function (result) {
if (result.code == 0) {
alert("验证成功");
} else {
alert("验证错误:" + result.msg);
}
}
});
}
</script>
</body>
</html>
Loading…
Cancel
Save