Skip to content

Commit

Permalink
refactor(web): 🔧 优化数据处理逻辑
Browse files Browse the repository at this point in the history
使用forEach替代map并添加parseInt以确保类型安全
  • Loading branch information
a76yyyy committed Jan 29, 2025
1 parent 9c27c28 commit 9a5787a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion web/static/coffee/har/analysis.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ define (require, exports, module) ->
(c.name for c in entry.request.cookies when c.checked)
(c.value for c in entry.request.cookies when c.checked)
[entry.request.postData?.text, ]
].map((list) ->
].forEach((list) =>
for string in list
for each in exports.variables(string)
if each? not in result
Expand Down
2 changes: 1 addition & 1 deletion web/static/har/analysis.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions web/tpl/taskmulti.html
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,11 @@ <h4 class="modal-title" id="myModalLabel">多任务操作</h4>
// 'cron_sec' : $('#cron_sec')[0].value,
}
data['settime'] = JSON.stringify(settime_tmp);
if (settime_tmp['randtimezone1'] >= settime_tmp['randtimezone2']){
if (parseInt(settime_tmp['randtimezone1']) >= parseInt(settime_tmp['randtimezone2'])){
$('#run-result').html("<h1 class=\"alert alert-danger text-center\">随机值错误</h1><div><pre>开启随机时tz1 需大于 tz2</pre></div>").show();
return false;
}
if (settime_tmp['randtimezone1'] > 604800 || settime_tmp['randtimezone2'] > 604800){
if (parseInt(settime_tmp['randtimezone1']) > 604800 || parseInt(settime_tmp['randtimezone2']) > 604800){
$('#run-result').html("<h1 class=\"alert alert-danger text-center\">随机值错误</h1><div><pre>随机值不能大于604800</pre></div>").show();
return false;
}
Expand Down

0 comments on commit 9a5787a

Please sign in to comment.