Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
SanJin 2019-08-10 12:57:09 +08:00
commit dde6800872
8 changed files with 149 additions and 95 deletions

View File

@ -106,6 +106,43 @@
</div> </div>
</div> </div>
</div> </div>
<!-- Modal -->
<div class="modal fade" id="receiveEmailModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="myModalLabel">E-mail 通知设置</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label for=""><span class="text-danger">*</span>发送人(账号)</label>
<input type="email" class="form-control" id="alertEmail" name="alertEmail" placeholder="请填写发送人账号">
</div>
<div class="form-group">
<label for=""><span class="text-danger">*</span>密码</label>
<input type="password" class="form-control" id="alertPass" name="alertPass" placeholder="请填写发送人密码">
</div>
<div class="form-group">
<label for=""><span class="text-danger">*</span>SMTP</label>
<input type="text" class="form-control" id="alertHost" name="alertHost" placeholder="例:smtp.126.com">
</div>
<div class="form-group">
<label for=""><span class="text-danger">*</span>端口</label>
<input type="number" class="form-control" id="alertPort" name="alertPort" placeholder="例:465">
</div>
<div class="form-group">
<label for=""><span class="text-danger">*</span>接收人</label>
<textarea class="form-control" id="receive" name="receive" placeholder="接收人(群发请换行)" cols="30" rows="10"></textarea>
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary" onclick="updateReceiveEmailPost()">保存</button>
</div>
</div>
</div>
</div>
<input type="hidden" value="" id="settingId"> <input type="hidden" value="" id="settingId">
{{template "footer" }} {{template "footer" }}
<script> <script>
@ -119,6 +156,9 @@
case "login": case "login":
$('#settingLoginModal').modal('show') $('#settingLoginModal').modal('show')
break break
case "alertMail":
$('#receiveEmailModal').modal('show')
break
default: default:
break break
} }
@ -139,6 +179,14 @@
} else if (arr.length == 2 && result.data[0].type == "login") { } else if (arr.length == 2 && result.data[0].type == "login") {
$("#loginName").val(arr[0]) $("#loginName").val(arr[0])
$("#loginPwd").val(arr[1]) $("#loginPwd").val(arr[1])
}else if (arr.length>=4&&result.data[0].type=="alertMail"){
$("#alertEmail").val(arr[2])
$("#alertPass").val(arr[3])
$("#alertHost").val(arr[0])
$("#alertPort").val(arr[1])
var emailArr=arr.splice(4)
var content= emailArr.join("\n")
$("#receive").text(content)
} }
} }
}).fail(function (err) { }).fail(function (err) {
@ -172,6 +220,34 @@
}) })
} }
function updateReceiveEmailPost() {
var params = {
email: $("#alertEmail").val(),
pass: $("#alertPass").val(),
host: $("#alertHost").val(),
port: $("#alertPort").val(),
receive:$("#receive").val().split(/[\s\n]/).join(","),
id: $("#settingId").val()
};
console.log(params)
$.ajax({
type: "post",
url: "/post/setting/updateAlertMail",
data: params
}).success(function (result) {
if (result.code == 200) {
if (!$("#checkbox-" + params.id).prop("checked")) {
$("#checkbox-" + params.id).click()
}
}
$('#receiveEmailModal').modal('hide')
}).fail(function (err) {
console.log(err)
})
}
function updateStatusFunc(id, ele) { function updateStatusFunc(id, ele) {
var params = { var params = {
"id": id, "id": id,

Binary file not shown.

1
go.mod
View File

@ -3,7 +3,6 @@ module HFish
go 1.12 go 1.12
require ( require (
github.com/PuerkitoBio/goquery v1.5.0
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 // indirect github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 // indirect
github.com/djimenez/iconv-go v0.0.0-20160305225143-8960e66bd3da github.com/djimenez/iconv-go v0.0.0-20160305225143-8960e66bd3da
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 // indirect github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 // indirect

6
go.sum
View File

@ -1,7 +1,3 @@
github.com/PuerkitoBio/goquery v1.5.0 h1:uGvmFXOA73IKluu/F84Xd1tt/z07GYm8X49XKHP7EJk=
github.com/PuerkitoBio/goquery v1.5.0/go.mod h1:qD2PgZ9lccMbQlc7eEOjaeRlFQON7xY8kdmcsrnKqMg=
github.com/andybalholm/cascadia v1.0.0 h1:hOCXnnZ5A+3eVDX8pvgl4kofXv2ELss0bKcqRySc45o=
github.com/andybalholm/cascadia v1.0.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y=
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 h1:kFOfPq6dUM1hTo4JG6LR5AXSUEsOjtdm0kw0FtQtMJA= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 h1:kFOfPq6dUM1hTo4JG6LR5AXSUEsOjtdm0kw0FtQtMJA=
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
@ -37,8 +33,6 @@ github.com/ugorji/go v1.1.4 h1:j4s+tAvLfL3bZyefP2SEWmhBzmuIlH/eqNuPdFPgngw=
github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c h1:uOCk1iQW6Vc18bnC13MfzScl+wdKBmM9Y9kU7Z83/lw= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c h1:uOCk1iQW6Vc18bnC13MfzScl+wdKBmM9Y9kU7Z83/lw=
golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=

View File

@ -1,88 +1,40 @@
[Redis] 127.0.0.1 - [2019-08-09 10:17:51] 已经连接 [] [HFish] 127.0.0.1 - [2019-08-09 14:59:54] "GET /setting HTTP/1.1 200 3.060008ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.87 Safari/537.36" "
[HFish] 127.0.0.1 - [2019-08-09 10:17:52] "GET /fish HTTP/1.1 200 2.071182ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36" " [GIN] 2019/08/09 - 14:59:54 | 200 | 3.217511ms | 127.0.0.1 | GET /setting
[GIN] 2019/08/09 - 10:17:52 | 200 | 2.130032ms | 127.0.0.1 | GET /fish [HFish] 127.0.0.1 - [2019-08-09 14:59:55] "GET /static/favicon.ico HTTP/1.1 200 5.239817ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.87 Safari/537.36" "
[HFish] 127.0.0.1 - [2019-08-09 10:17:52] "GET /get/fish/typeList HTTP/1.1 200 1.144126ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36" " [GIN] 2019/08/09 - 14:59:55 | 200 | 5.299609ms | 127.0.0.1 | GET /static/favicon.ico
[GIN] 2019/08/09 - 10:17:52 | 200 | 1.178674ms | 127.0.0.1 | GET /get/fish/typeList [HFish] 127.0.0.1 - [2019-08-09 14:59:55] "GET /static/js/jquery.min.map HTTP/1.1 404 25.539µs "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.87 Safari/537.36" "
[HFish] 127.0.0.1 - [2019-08-09 10:17:52] "GET /get/fish/list?page=1&pageSize=10&type=all&so_text= HTTP/1.1 200 1.975171ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36" " [GIN] 2019/08/09 - 14:59:55 | 404 | 82.16µs | 127.0.0.1 | GET /static/js/jquery.min.map
[GIN] 2019/08/09 - 10:17:52 | 200 | 2.007666ms | 127.0.0.1 | GET /get/fish/list?page=1&pageSize=10&type=all&so_text= [HFish] 127.0.0.1 - [2019-08-09 14:59:56] "GET /get/setting/info?id=2 HTTP/1.1 200 788.985µs "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.87 Safari/537.36" "
[HFish] 127.0.0.1 - [2019-08-09 10:17:52] "GET /static/favicon.ico HTTP/1.1 200 5.419563ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36" " [GIN] 2019/08/09 - 14:59:56 | 200 | 830.148µs | 127.0.0.1 | GET /get/setting/info?id=2
[GIN] 2019/08/09 - 10:17:52 | 200 | 5.465521ms | 127.0.0.1 | GET /static/favicon.ico [HFish] 127.0.0.1 - [2019-08-09 15:00:01] "POST /post/setting/updateAlertMail HTTP/1.1 200 2.580315ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.87 Safari/537.36" "
[Redis] 127.0.0.1 - [2019-08-09 10:17:58] 已经连接 [] [GIN] 2019/08/09 - 15:00:01 | 200 | 2.624391ms | 127.0.0.1 | POST /post/setting/updateAlertMail
[HFish] 127.0.0.1 - [2019-08-09 10:17:59] "GET /fish HTTP/1.1 200 2.236398ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36" " [HFish] 127.0.0.1 - [2019-08-09 15:00:01] "POST /post/setting/checkSetting HTTP/1.1 200 2.594286ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.87 Safari/537.36" "
[GIN] 2019/08/09 - 10:17:59 | 200 | 2.289634ms | 127.0.0.1 | GET /fish [GIN] 2019/08/09 - 15:00:01 | 200 | 2.651599ms | 127.0.0.1 | POST /post/setting/checkSetting
[HFish] 127.0.0.1 - [2019-08-09 10:17:59] "GET /get/fish/typeList HTTP/1.1 200 930.914µs "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36" " [HFish] 127.0.0.1 - [2019-08-09 15:01:33] "GET /setting HTTP/1.1 200 2.883976ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.87 Safari/537.36" "
[GIN] 2019/08/09 - 10:17:59 | 200 | 969.731µs | 127.0.0.1 | GET /get/fish/typeList [GIN] 2019/08/09 - 15:01:33 | 200 | 2.935666ms | 127.0.0.1 | GET /setting
[HFish] 127.0.0.1 - [2019-08-09 10:17:59] "GET /get/fish/list?page=1&pageSize=10&type=all&so_text= HTTP/1.1 200 1.368935ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36" " [HFish] 127.0.0.1 - [2019-08-09 15:01:33] "GET /static/js/jquery.min.map HTTP/1.1 404 29.96µs "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.87 Safari/537.36" "
[GIN] 2019/08/09 - 10:17:59 | 200 | 1.401889ms | 127.0.0.1 | GET /get/fish/list?page=1&pageSize=10&type=all&so_text= [GIN] 2019/08/09 - 15:01:33 | 404 | 84.656µs | 127.0.0.1 | GET /static/js/jquery.min.map
[HFish] 127.0.0.1 - [2019-08-09 10:17:59] "GET /static/favicon.ico HTTP/1.1 200 195.297µs "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36" " [HFish] 127.0.0.1 - [2019-08-09 15:01:33] "GET /static/favicon.ico HTTP/1.1 200 265.877µs "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.87 Safari/537.36" "
[GIN] 2019/08/09 - 10:17:59 | 200 | 244.786µs | 127.0.0.1 | GET /static/favicon.ico [GIN] 2019/08/09 - 15:01:33 | 200 | 318.281µs | 127.0.0.1 | GET /static/favicon.ico
[Redis] 127.0.0.1 - [2019-08-09 10:18:03] 已经连接 [] [HFish] 127.0.0.1 - [2019-08-09 15:01:35] "GET /get/setting/info?id=2 HTTP/1.1 200 985.354µs "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.87 Safari/537.36" "
[HFish] 127.0.0.1 - [2019-08-09 10:18:03] "GET /fish HTTP/1.1 200 1.97505ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36" " [GIN] 2019/08/09 - 15:01:35 | 200 | 1.033379ms | 127.0.0.1 | GET /get/setting/info?id=2
[GIN] 2019/08/09 - 10:18:03 | 200 | 2.041358ms | 127.0.0.1 | GET /fish [HFish] 127.0.0.1 - [2019-08-09 15:02:22] "GET /setting HTTP/1.1 200 2.638082ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.87 Safari/537.36" "
[HFish] 127.0.0.1 - [2019-08-09 10:18:04] "GET /get/fish/list?page=1&pageSize=10&type=all&so_text= HTTP/1.1 200 1.529297ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36" " [GIN] 2019/08/09 - 15:02:22 | 200 | 2.701529ms | 127.0.0.1 | GET /setting
[GIN] 2019/08/09 - 10:18:04 | 200 | 1.568275ms | 127.0.0.1 | GET /get/fish/list?page=1&pageSize=10&type=all&so_text= [HFish] 127.0.0.1 - [2019-08-09 15:02:22] "GET /static/js/jquery.min.map HTTP/1.1 404 29.544µs "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.87 Safari/537.36" "
[HFish] 127.0.0.1 - [2019-08-09 10:18:04] "GET /get/fish/typeList HTTP/1.1 200 894.757µs "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36" " [GIN] 2019/08/09 - 15:02:22 | 404 | 96.084µs | 127.0.0.1 | GET /static/js/jquery.min.map
[GIN] 2019/08/09 - 10:18:04 | 200 | 924.06µs | 127.0.0.1 | GET /get/fish/typeList [HFish] 127.0.0.1 - [2019-08-09 15:02:22] "GET /static/favicon.ico HTTP/1.1 200 263.921µs "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.87 Safari/537.36" "
[HFish] 127.0.0.1 - [2019-08-09 10:18:04] "GET /static/favicon.ico HTTP/1.1 200 359.707µs "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36" " [GIN] 2019/08/09 - 15:02:22 | 200 | 357.969µs | 127.0.0.1 | GET /static/favicon.ico
[GIN] 2019/08/09 - 10:18:04 | 200 | 454.558µs | 127.0.0.1 | GET /static/favicon.ico [HFish] 127.0.0.1 - [2019-08-09 15:02:22] "GET /get/setting/info?id=2 HTTP/1.1 200 1.025968ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.87 Safari/537.36" "
[Mysql] 127.0.0.1 - [2019-08-09 10:18:08] 已经连接 [] [GIN] 2019/08/09 - 15:02:22 | 200 | 1.065619ms | 127.0.0.1 | GET /get/setting/info?id=2
[Mysql] 127.0.0.1 - [2019-08-09 10:18:08] 已经关闭连接 [] [HFish] 127.0.0.1 - [2019-08-09 15:03:24] "GET /setting HTTP/1.1 200 4.512534ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.87 Safari/537.36" "
[Mysql] 127.0.0.1 - [2019-08-09 10:18:09] 已经连接 [] [GIN] 2019/08/09 - 15:03:24 | 200 | 4.78353ms | 127.0.0.1 | GET /setting
[Mysql] 127.0.0.1 - [2019-08-09 10:18:09] 已经关闭连接 [] [HFish] 127.0.0.1 - [2019-08-09 15:03:24] "GET /static/favicon.ico HTTP/1.1 200 187.512µs "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.87 Safari/537.36" "
[Mysql] 127.0.0.1 - [2019-08-09 10:18:11] 已经连接 [] [GIN] 2019/08/09 - 15:03:24 | 200 | 238.325µs | 127.0.0.1 | GET /static/favicon.ico
[Mysql] 127.0.0.1 - [2019-08-09 10:18:11] 已经关闭连接 [] [HFish] 127.0.0.1 - [2019-08-09 15:03:25] "GET /get/setting/info?id=2 HTTP/1.1 200 690.201µs "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.87 Safari/537.36" "
[Mysql] 127.0.0.1 - [2019-08-09 10:18:16] 已经连接 [] [GIN] 2019/08/09 - 15:03:25 | 200 | 737.473µs | 127.0.0.1 | GET /get/setting/info?id=2
[Mysql] 127.0.0.1 - [2019-08-09 10:18:16] 已经关闭连接 [] [HFish] 127.0.0.1 - [2019-08-09 15:03:33] "GET /setting HTTP/1.1 200 2.738534ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.87 Safari/537.36" "
[HFish] 127.0.0.1 - [2019-08-09 10:18:17] "GET /fish HTTP/1.1 200 2.27265ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36" " [GIN] 2019/08/09 - 15:03:33 | 200 | 2.799043ms | 127.0.0.1 | GET /setting
[GIN] 2019/08/09 - 10:18:17 | 200 | 2.30242ms | 127.0.0.1 | GET /fish [HFish] 127.0.0.1 - [2019-08-09 15:03:33] "GET /static/favicon.ico HTTP/1.1 200 291.803µs "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.87 Safari/537.36" "
[HFish] 127.0.0.1 - [2019-08-09 10:18:17] "GET /get/fish/typeList HTTP/1.1 200 901.372µs "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36" " [GIN] 2019/08/09 - 15:03:33 | 200 | 345.844µs | 127.0.0.1 | GET /static/favicon.ico
[GIN] 2019/08/09 - 10:18:17 | 200 | 931.964µs | 127.0.0.1 | GET /get/fish/typeList [HFish] 127.0.0.1 - [2019-08-09 15:03:34] "GET /get/setting/info?id=2 HTTP/1.1 200 647.191µs "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.87 Safari/537.36" "
[HFish] 127.0.0.1 - [2019-08-09 10:18:17] "GET /get/fish/list?page=1&pageSize=10&type=all&so_text= HTTP/1.1 200 2.227372ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36" " [GIN] 2019/08/09 - 15:03:34 | 200 | 691.157µs | 127.0.0.1 | GET /get/setting/info?id=2
[GIN] 2019/08/09 - 10:18:17 | 200 | 2.252222ms | 127.0.0.1 | GET /get/fish/list?page=1&pageSize=10&type=all&so_text=
[HFish] 127.0.0.1 - [2019-08-09 10:18:17] "GET /static/favicon.ico HTTP/1.1 200 183.466µs "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36" "
[GIN] 2019/08/09 - 10:18:17 | 200 | 222.612µs | 127.0.0.1 | GET /static/favicon.ico
[HFish] 127.0.0.1 - [2019-08-09 10:18:19] "GET /get/fish/info?id=111 HTTP/1.1 200 783.912µs "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36" "
[GIN] 2019/08/09 - 10:18:19 | 200 | 822.991µs | 127.0.0.1 | GET /get/fish/info?id=111
[HFish] 127.0.0.1 - [2019-08-09 10:18:21] "GET /get/fish/info?id=114 HTTP/1.1 200 1.085399ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36" "
[GIN] 2019/08/09 - 10:18:21 | 200 | 1.131843ms | 127.0.0.1 | GET /get/fish/info?id=114
[HFish] 127.0.0.1 - [2019-08-09 10:18:24] "GET /get/fish/info?id=112 HTTP/1.1 200 748.844µs "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36" "
[GIN] 2019/08/09 - 10:18:24 | 200 | 795.802µs | 127.0.0.1 | GET /get/fish/info?id=112
[HFish] 127.0.0.1 - [2019-08-09 10:18:26] "GET /fish HTTP/1.1 200 1.46313ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36" "
[GIN] 2019/08/09 - 10:18:26 | 200 | 1.494647ms | 127.0.0.1 | GET /fish
[HFish] 127.0.0.1 - [2019-08-09 10:18:26] "GET /get/fish/typeList HTTP/1.1 200 850.386µs "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36" "
[GIN] 2019/08/09 - 10:18:26 | 200 | 886.744µs | 127.0.0.1 | GET /get/fish/typeList
[HFish] 127.0.0.1 - [2019-08-09 10:18:26] "GET /get/fish/list?page=1&pageSize=10&type=all&so_text= HTTP/1.1 200 1.714257ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36" "
[GIN] 2019/08/09 - 10:18:26 | 200 | 1.747055ms | 127.0.0.1 | GET /get/fish/list?page=1&pageSize=10&type=all&so_text=
[HFish] 127.0.0.1 - [2019-08-09 10:18:26] "GET /static/favicon.ico HTTP/1.1 200 191.793µs "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36" "
[GIN] 2019/08/09 - 10:18:26 | 200 | 232.043µs | 127.0.0.1 | GET /static/favicon.ico
[Redis] 127.0.0.1 - [2019-08-09 10:18:32] 已经连接 []
[HFish] 127.0.0.1 - [2019-08-09 10:18:34] "GET /fish HTTP/1.1 200 1.378352ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36" "
[GIN] 2019/08/09 - 10:18:34 | 200 | 1.443137ms | 127.0.0.1 | GET /fish
[HFish] 127.0.0.1 - [2019-08-09 10:18:34] "GET /get/fish/typeList HTTP/1.1 200 1.261508ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36" "
[GIN] 2019/08/09 - 10:18:34 | 200 | 1.388568ms | 127.0.0.1 | GET /get/fish/typeList
[HFish] 127.0.0.1 - [2019-08-09 10:18:34] "GET /get/fish/list?page=1&pageSize=10&type=all&so_text= HTTP/1.1 200 2.761928ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36" "
[GIN] 2019/08/09 - 10:18:34 | 200 | 2.846441ms | 127.0.0.1 | GET /get/fish/list?page=1&pageSize=10&type=all&so_text=
[HFish] 127.0.0.1 - [2019-08-09 10:18:34] "GET /static/favicon.ico HTTP/1.1 200 202.424µs "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36" "
[GIN] 2019/08/09 - 10:18:34 | 200 | 242.915µs | 127.0.0.1 | GET /static/favicon.ico
[Mysql] 127.0.0.1 - [2019-08-09 10:18:44] 已经连接 []
[Mysql] 127.0.0.1 - [2019-08-09 10:18:44] 已经关闭连接 []
[HFish] 127.0.0.1 - [2019-08-09 10:18:51] "GET /fish HTTP/1.1 200 2.083805ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36" "
[GIN] 2019/08/09 - 10:18:51 | 200 | 2.119829ms | 127.0.0.1 | GET /fish
[HFish] 127.0.0.1 - [2019-08-09 10:18:51] "GET /get/fish/list?page=1&pageSize=10&type=all&so_text= HTTP/1.1 200 1.464338ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36" "
[GIN] 2019/08/09 - 10:18:51 | 200 | 1.499884ms | 127.0.0.1 | GET /get/fish/list?page=1&pageSize=10&type=all&so_text=
[HFish] 127.0.0.1 - [2019-08-09 10:18:51] "GET /get/fish/typeList HTTP/1.1 200 853.269µs "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36" "
[GIN] 2019/08/09 - 10:18:51 | 200 | 946.34µs | 127.0.0.1 | GET /get/fish/typeList
[HFish] 127.0.0.1 - [2019-08-09 10:18:51] "GET /static/favicon.ico HTTP/1.1 200 448.007µs "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36" "
[GIN] 2019/08/09 - 10:18:51 | 200 | 545.014µs | 127.0.0.1 | GET /static/favicon.ico
[HFish] 127.0.0.1 - [2019-08-09 10:18:53] "GET /get/fish/info?id=116 HTTP/1.1 200 1.334363ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36" "
[GIN] 2019/08/09 - 10:18:53 | 200 | 1.376606ms | 127.0.0.1 | GET /get/fish/info?id=116
[HFish] 127.0.0.1 - [2019-08-09 10:18:55] "GET /get/fish/list?page=2&pageSize=10&type=all&so_text= HTTP/1.1 200 1.633244ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36" "
[GIN] 2019/08/09 - 10:18:55 | 200 | 1.673797ms | 127.0.0.1 | GET /get/fish/list?page=2&pageSize=10&type=all&so_text=
[HFish] 127.0.0.1 - [2019-08-09 10:18:56] "GET /get/fish/list?page=2&pageSize=10&type=all&so_text= HTTP/1.1 200 1.608759ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36" "
[GIN] 2019/08/09 - 10:18:56 | 200 | 1.654414ms | 127.0.0.1 | GET /get/fish/list?page=2&pageSize=10&type=all&so_text=
[HFish] 127.0.0.1 - [2019-08-09 10:18:56] "GET /get/fish/list?page=3&pageSize=10&type=all&so_text= HTTP/1.1 200 1.466778ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36" "
[GIN] 2019/08/09 - 10:18:56 | 200 | 1.501873ms | 127.0.0.1 | GET /get/fish/list?page=3&pageSize=10&type=all&so_text=
[HFish] 127.0.0.1 - [2019-08-09 10:18:57] "GET /get/fish/list?page=4&pageSize=10&type=all&so_text= HTTP/1.1 200 1.531492ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36" "
[GIN] 2019/08/09 - 10:18:57 | 200 | 1.592529ms | 127.0.0.1 | GET /get/fish/list?page=4&pageSize=10&type=all&so_text=
[HFish] 127.0.0.1 - [2019-08-09 10:18:58] "GET /get/fish/list?page=1&pageSize=10&type=all&so_text= HTTP/1.1 200 1.641441ms "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36" "
[GIN] 2019/08/09 - 10:18:58 | 200 | 1.698537ms | 127.0.0.1 | GET /get/fish/list?page=1&pageSize=10&type=all&so_text=

View File

@ -33,3 +33,11 @@ func SendEmailToUsers(c *gin.Context) {
send.SendMail(eArr, title, content, config) send.SendMail(eArr, title, content, config)
c.JSON(http.StatusOK, error.ErrSuccessNull()) c.JSON(http.StatusOK, error.ErrSuccessNull())
} }
/*发送警告邮件*/
func SendAlertEmailToUsers(title string,content string){
sql := `select status,info from hfish_setting where type = "alertMail"`
isAlertStatus := dbUtil.Query(sql)
info := isAlertStatus[0]["info"]
config := strings.Split(info.(string), "&&")
send.SendMail(config[4:], title, content, config)
}

View File

@ -47,6 +47,9 @@ func checkInfo(id string) bool {
if num == 1 && typeStr == "fangTang" { if num == 1 && typeStr == "fangTang" {
return true return true
} }
if num >= 4 && typeStr == "alertMail" {
return true
}
return false return false
} }
func joinInfo(args ...string) string { func joinInfo(args ...string) string {
@ -80,6 +83,27 @@ func UpdateEmailInfo(c *gin.Context) {
dbUtil.Update(sql, info, 0, time.Now().Format("2006-01-02 15:04"), id) dbUtil.Update(sql, info, 0, time.Now().Format("2006-01-02 15:04"), id)
c.JSON(http.StatusOK, error.ErrSuccessNull()) c.JSON(http.StatusOK, error.ErrSuccessNull())
} }
/*更新警告邮件通知*/
func UpdateAlertMail(c *gin.Context) {
email := c.PostForm("email")
id := c.PostForm("id")
receive:=c.PostForm("receive")
pass := c.PostForm("pass")
host := c.PostForm("host")
port := c.PostForm("port")
//subType := c.PostForm("type")
receiveArr:=strings.Split(receive,",")
receiveInfo:=joinInfo(receiveArr...)
info := joinInfo(host, port, email, pass,receiveInfo)
sql := `
UPDATE hfish_setting
set info = ?,
status = ?,
update_time = ?
where id = ?;`
dbUtil.Update(sql, info, 0, time.Now().Format("2006-01-02 15:04"), id)
c.JSON(http.StatusOK, error.ErrSuccessNull())
}
/*更新设置状态*/ /*更新设置状态*/
func UpdateStatusSetting(c *gin.Context) { func UpdateStatusSetting(c *gin.Context) {

View File

@ -59,6 +59,7 @@ func LoadUrl(r *gin.Engine) {
r.GET("/setting", login.Jump, setting.Html) r.GET("/setting", login.Jump, setting.Html)
r.GET("/get/setting/info", login.Jump, setting.GetSettingInfo) r.GET("/get/setting/info", login.Jump, setting.GetSettingInfo)
r.POST("/post/setting/update", login.Jump, setting.UpdateEmailInfo) r.POST("/post/setting/update", login.Jump, setting.UpdateEmailInfo)
r.POST("/post/setting/updateAlertMail", login.Jump, setting.UpdateAlertMail)
r.POST("/post/setting/checkSetting", login.Jump, setting.UpdateStatusSetting) r.POST("/post/setting/checkSetting", login.Jump, setting.UpdateStatusSetting)
// API 接口 // API 接口