Skip to content
This repository has been archived by the owner on Dec 6, 2019. It is now read-only.

Commit

Permalink
fixed issue #2
Browse files Browse the repository at this point in the history
修复同一课程和教师在多个上课时间情况下,错误使用首个上课时间进行选课的bug
  • Loading branch information
qhgz2013 committed Mar 12, 2018
1 parent d2f151c commit 2db653b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
14 changes: 7 additions & 7 deletions FuckJW2005/Form1.Designer.cs

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

16 changes: 14 additions & 2 deletions FuckJW2005/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,11 @@ private bool submit_course_data(string course_id)
try
{
ns.HttpPost(url, post_data, NetStream.DEFAULT_CONTENT_TYPE_PARAM, header);
if (ns.HTTP_Response.StatusCode != System.Net.HttpStatusCode.OK)
{
debug_output("HTTP错误:服务器返回" + (int)ns.HTTP_Response.StatusCode + "(" + ns.HTTP_Response.StatusDescription + ")");
return false; //status check
}
var response_str = ns.ReadResponseString(Encoding.Default);
return check_course_selected(response_str.Replace("\r", "").Replace("\n", ""));
}
Expand All @@ -598,13 +603,15 @@ private void select_course_callback()
try
{
//init
string course_name = "", teacher_name = "";
string course_name = "", teacher_name = "", course_time = "";
Invoke(new ThreadStart(delegate
{
courseName.Enabled = false;
teacher.Enabled = false;
courseTime.Enabled = false;
course_name = courseName.Text;
teacher_name = teacher.Text;
course_time = courseTime.Text;
goFuck.Enabled = true;
goFuck.Text = "不干";
}));
Expand All @@ -617,7 +624,7 @@ private void select_course_callback()
//getting course_name
courses course = course_list.Find((courses obj) =>
{
return (obj.Name == course_name && obj.Teacher == teacher_name);
return (obj.Name == course_name && obj.Teacher == teacher_name && obj.Time == course_time);
});

if (!string.IsNullOrEmpty(course.CheckBoxStr))
Expand All @@ -630,6 +637,10 @@ private void select_course_callback()
Thread.Sleep(3000);
} while (!suc);
}
else
{
debug_output("未找到相关课程,大概是个bug吧");
}
}
catch (ThreadAbortException) { }
catch (Exception ex)
Expand All @@ -643,6 +654,7 @@ private void select_course_callback()
{
courseName.Enabled = true;
teacher.Enabled = true;
courseTime.Enabled = true;
goFuck.Text = "开干";
threadUsing = false;
}));
Expand Down

0 comments on commit 2db653b

Please sign in to comment.