diff --git a/.gitignore b/.gitignore index e1b5b115..7b1afc16 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +server/server config.yaml .idea node_modules diff --git a/README.md b/README.md index 64c41368..04375d9b 100644 --- a/README.md +++ b/README.md @@ -2,12 +2,21 @@ [![Build Status](https://www.travis-ci.org/CodFrm/cxmooc-tools.svg?branch=master)](https://www.travis-ci.org/CodFrm/cxmooc-tools) ![GitHub All Releases](https://img.shields.io/github/downloads/codfrm/cxmooc-tools/total.svg) ![GitHub tag (latest SemVer)](https://img.shields.io/github/tag/codfrm/cxmooc-tools.svg?label=version) +![[Chrome](https://chrome.google.com/webstore/detail/%E8%B6%85%E6%98%9F%E6%85%95%E8%AF%BE%E5%B0%8F%E5%B7%A5%E5%85%B7/kkicgcijebblepmephnfganiiochecfl?hl=zh-CN)](https://img.shields.io/badge/chrome-success-brightgreen) +![[FireFox](https://addons.mozilla.org/zh-CN/firefox/addon/%E8%B6%85%E6%98%9F%E6%85%95%E8%AF%BE%E5%B0%8F%E5%B7%A5%E5%85%B7/)](https://img.shields.io/badge/firefox-success-brightgreen) +![[tampermonkey](https://greasyfork.org/zh-CN/scripts/376190-%E8%B6%85%E6%98%9F%E6%85%95%E8%AF%BE%E5%B0%8F%E5%B7%A5%E5%85%B7)](https://img.shields.io/badge/tampermonkey-success-yellowgreen) + ## 关于超星慕课小工具 > **[使用文档](https://cx-doc.xloli.top/)** 一个超星(学习通)和智慧树(知到)刷课工具,火狐,谷歌,油猴支持.全自动任务,视频倍速秒过,作业考试题库,验证码自动打码(੧ᐛ੭挂科模式,启动) +### 应用商店 +[Chrome商店](https://chrome.google.com/webstore/detail/%E8%B6%85%E6%98%9F%E6%85%95%E8%AF%BE%E5%B0%8F%E5%B7%A5%E5%85%B7/kkicgcijebblepmephnfganiiochecfl?hl=zh-CN) +[FireFox商店](https://addons.mozilla.org/zh-CN/firefox/addon/%E8%B6%85%E6%98%9F%E6%85%95%E8%AF%BE%E5%B0%8F%E5%B7%A5%E5%85%B7/) +[greasyfork](https://greasyfork.org/zh-CN/scripts/376190-%E8%B6%85%E6%98%9F%E6%85%95%E8%AF%BE%E5%B0%8F%E5%B7%A5%E5%85%B7) + ### 浏览器适配列表 * [x] Chrome for PC * [x] Firefox for PC @@ -88,6 +97,8 @@ Blog地址:[http://blog.icodef.com/2018/01/25/1304](http://blog.icodef.com/2018/ ## 赞助 微信扫一扫,赏个鸡腿? +[赞助列表](https://cx-doc.xloli.top/4-Reward/) + ![](docs/.vuepress/public/img/reward.png) ## 免责声明 diff --git a/docs/1-UserGuide/1-0-developer.md b/docs/1-UserGuide/1-0-developer.md index 6fd0bc53..ab2eb963 100644 --- a/docs/1-UserGuide/1-0-developer.md +++ b/docs/1-UserGuide/1-0-developer.md @@ -7,6 +7,7 @@ title: 开发者 ### 环境: * Node.js * webpack +* Yarn ### Build ```bash @@ -34,4 +35,11 @@ yarn run server 1. 执行`yarn run build`,此时会在`build/cxmooc-tools`目录下生成插件文件。 2. 打开Chrome浏览器的更多工具选项,打开扩展程序页面并启用开发者模式。 -3. 加载已解压的扩展程序,路径选择`build/cxmooc-tools` \ No newline at end of file +3. 加载已解压的扩展程序,路径选择`build/cxmooc-tools` + +## 其它 +你也可以加入tg群组或者qq群或者在github上发送issue来交流: + +[telegram群组](https://t.me/joinchat/MHU8Gg2fP3Q51HLY2wqmQA) + +[QQ群790774208](https://jq.qq.com/?_wv=1027&k=5e10NSV) diff --git a/docs/1-UserGuide/1-1-chrome.md b/docs/1-UserGuide/1-1-chrome.md index 927812fb..f9ada9ff 100644 --- a/docs/1-UserGuide/1-1-chrome.md +++ b/docs/1-UserGuide/1-1-chrome.md @@ -2,9 +2,12 @@ title: Chrome(内核)浏览器安装 --- +**chrome商店:[超星慕课小工具](https://chrome.google.com/webstore/detail/%E8%B6%85%E6%98%9F%E6%85%95%E8%AF%BE%E5%B0%8F%E5%B7%A5%E5%85%B7/kkicgcijebblepmephnfganiiochecfl?hl=zh-CN)** + 如果觉得步骤过于复杂或者繁琐,进直接下载[releases页面](https://github.com/CodFrm/cxmooc-tools/releases)的打包版本,适合小白用户(但是版本更新可能较慢) ## Chrome扩展 +> 如果你可以进入chrome商店,那么推荐你直接使用上面的chrome商店链接安装 下载发布的版本[cxmooc-tools.crx](https://github.com/CodFrm/cxmooc-tools/releases)无需安装环境,下载即可使用。 diff --git a/docs/1-UserGuide/1-2-firefox.md b/docs/1-UserGuide/1-2-firefox.md index 1cbd0483..1f065bbf 100644 --- a/docs/1-UserGuide/1-2-firefox.md +++ b/docs/1-UserGuide/1-2-firefox.md @@ -4,6 +4,8 @@ title: FireFox插件 本插件上传至了火狐浏览器,可以直接在火狐浏览器的扩展商店进行下载 +[FireFox商店](https://addons.mozilla.org/zh-CN/firefox/addon/%E8%B6%85%E6%98%9F%E6%85%95%E8%AF%BE%E5%B0%8F%E5%B7%A5%E5%85%B7/) + ## 火狐浏览器扩展 如果你是火狐浏览器用户,请直接前往 diff --git a/docs/1-UserGuide/1-3-tampermonkey.md b/docs/1-UserGuide/1-3-tampermonkey.md index 4d31d38d..4ac012e4 100644 --- a/docs/1-UserGuide/1-3-tampermonkey.md +++ b/docs/1-UserGuide/1-3-tampermonkey.md @@ -7,6 +7,7 @@ Tampermonkey,以下都称为油猴 油猴脚本使用需要去安装另外一个**Tampermonkey**插件,然后在 **[Greasy Fork/376190-cxmooc-tools](https://greasyfork.org/zh-CN/scripts/376190-cxmooc-tools)** 页面获取本插件 +- [超星慕课小工具](https://greasyfork.org/zh-CN/scripts/376190-%E8%B6%85%E6%98%9F%E6%85%95%E8%AF%BE%E5%B0%8F%E5%B7%A5%E5%85%B7) - [智慧树小工具](https://greasyfork.org/zh-CN/scripts/382037-%E6%99%BA%E6%85%A7%E6%A0%91%E5%B0%8F%E5%B7%A5%E5%85%B7) ### 配置修改 diff --git a/docs/1-UserGuide/README.md b/docs/1-UserGuide/README.md index f69864e1..86226b9f 100644 --- a/docs/1-UserGuide/README.md +++ b/docs/1-UserGuide/README.md @@ -6,11 +6,19 @@ title: 快速开始 本插件提供多种使用方式,暂时只**支持`超星/学习通`与`智慧树/知到`**,请按照需求查阅相应的文档支持,**遇到问题请优先查看文档/常见问题**,如果文档没有说明/无法解决问题再qq群询问或者发issue. ## 安装 + +### 应用市场 +[Chrome商店](https://chrome.google.com/webstore/detail/%E8%B6%85%E6%98%9F%E6%85%95%E8%AF%BE%E5%B0%8F%E5%B7%A5%E5%85%B7/kkicgcijebblepmephnfganiiochecfl?hl=zh-CN) +[FireFox商店](https://addons.mozilla.org/zh-CN/firefox/addon/%E8%B6%85%E6%98%9F%E6%85%95%E8%AF%BE%E5%B0%8F%E5%B7%A5%E5%85%B7/) +[greasyfork](https://greasyfork.org/zh-CN/scripts/376190-%E8%B6%85%E6%98%9F%E6%85%95%E8%AF%BE%E5%B0%8F%E5%B7%A5%E5%85%B7) + ### 小白(推荐) 小白用户使用已经打包好了的浏览器版本使用:[**打包版浏览器**](/1-UserGuide/1-1-chrome.html#打包版浏览器),但是这个更新速度较慢,也可以自己手动更新 或者使用FireFox浏览器,前往FireFox商店下载更新:[**FireFox**](/1-UserGuide/1-2-firefox.html) +[FireFox商店](https://addons.mozilla.org/zh-CN/firefox/addon/%E8%B6%85%E6%98%9F%E6%85%95%E8%AF%BE%E5%B0%8F%E5%B7%A5%E5%85%B7/) + ## 刷课 直接进入相对于的刷课平台(超星:[http://mooc.chaoxing.com/](http://mooc.chaoxing.com/),智慧树:[https://passport.zhihuishu.com/login](https://passport.zhihuishu.com/login)),直接打开课程即可. diff --git a/docs/4-Reward/README.md b/docs/4-Reward/README.md index 5824c3fb..4b7023d5 100644 --- a/docs/4-Reward/README.md +++ b/docs/4-Reward/README.md @@ -15,7 +15,7 @@ title: 捐赠 |金额|渠道|捐赠者|备注| |----|----|----|----| |¥ 10.00|微信赞赏码|地瓜|一之大帅比| -|¥ 66.00|支付宝转账|StʌrunneR|解决了工具人给女神刷网课的难题*3| +|¥ 66.00|支付宝转账|StʌrunneR|解决了失去女神的工具人刷网课的难题*3| |¥ 10.00|微信赞赏码|自律|感谢| |¥ 10.00|微信赞赏码|蠢黑通行|解决了工具人给女神刷网课的难题*2| |¥ 10.00|微信赞赏码|深梦|| diff --git a/server/application/service/topic_test.go b/server/application/service/topic_test.go index cbca56a9..53f16c16 100644 --- a/server/application/service/topic_test.go +++ b/server/application/service/topic_test.go @@ -101,13 +101,13 @@ func TestTopic_SubmitTopic(t *testing.T) { integral: domain.NewIntegralService(mocki), } - topic1 := dto.SubmitTopic{Answers: []map[string]interface{}{ + topic1 := &dto.SubmitTopic{Answers: []map[string]interface{}{ {"option": "A", "content": "选项A"}, {"option": "B", "content": "选项B"}, {"option": "C", "content": "选项C"}, }, Correct: []map[string]interface{}{ {"option": "A", "content": "选项A"}, {"option": "B", "content": "选项B"}, }, Topic: "多选,中文标点。()", Type: 2} - topic2 := dto.SubmitTopic{Answers: []map[string]interface{}{ + topic2 := &dto.SubmitTopic{Answers: []map[string]interface{}{ {"option": true, "content": true}, }, Correct: []map[string]interface{}{ {"option": true, "content": true}, @@ -128,7 +128,7 @@ func TestTopic_SubmitTopic(t *testing.T) { et.SetTopic("多选,中文标点.()") mock.On("FindByHash", "05d901980b216c5f8c6b8d6e1f6820b6").Return(et, nil) - hash, add, err := topic.SubmitTopic([]dto.SubmitTopic{topic1, topic2}, "localhost", "cx", "tk") + hash, add, err := topic.SubmitTopic([]*dto.SubmitTopic{topic1, topic2}, "localhost", "cx", "tk") assert.Nil(t, err) assert.Equal(t, utils.Md5("多选,中文标点.()2"), hash[0].Hash) @@ -137,13 +137,13 @@ func TestTopic_SubmitTopic(t *testing.T) { topic2.Topic = "error" mock.On("Exist", "error").Return(false, errors.New("error")) - _, _, err = topic.SubmitTopic([]dto.SubmitTopic{topic1, topic2}, "localhost", "cx", "tk") + _, _, err = topic.SubmitTopic([]*dto.SubmitTopic{topic1, topic2}, "localhost", "cx", "tk") assert.Error(t, err) topic2.Topic = "save error" mock.On("Exist", "save error").Return(false, nil) mock.On("Save", "save error").Return(errors.New("error")) - _, _, err = topic.SubmitTopic([]dto.SubmitTopic{topic1, topic2}, "localhost", "cx", "tk") + _, _, err = topic.SubmitTopic([]*dto.SubmitTopic{topic1, topic2}, "localhost", "cx", "tk") assert.Error(t, err) } diff --git a/server/application/service/user_test.go b/server/application/service/user_test.go index bb43784e..98c14f5a 100644 --- a/server/application/service/user_test.go +++ b/server/application/service/user_test.go @@ -30,8 +30,8 @@ func TestUser_CheckIn(t *testing.T) { Token: "tk", Num: 20, }, nil) - mockt.On("Commit").Return() - mockt.On("Close").Return() + mockt.On("Commit").Return(nil) + mockt.On("Close").Return(nil) token, err := user.CheckIn("qq") assert.Nil(t, err) diff --git a/server/domain/repository/mocks/IntegerTransactionRepository.go b/server/domain/repository/mocks/IntegerTransactionRepository.go index 4b7eb71a..ddf16c1e 100644 --- a/server/domain/repository/mocks/IntegerTransactionRepository.go +++ b/server/domain/repository/mocks/IntegerTransactionRepository.go @@ -13,13 +13,31 @@ type IntegerTransactionRepository struct { } // Close provides a mock function with given fields: -func (_m *IntegerTransactionRepository) Close() { - _m.Called() +func (_m *IntegerTransactionRepository) Close() error { + ret := _m.Called() + + var r0 error + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() + } else { + r0 = ret.Error(0) + } + + return r0 } // Commit provides a mock function with given fields: -func (_m *IntegerTransactionRepository) Commit() { - _m.Called() +func (_m *IntegerTransactionRepository) Commit() error { + ret := _m.Called() + + var r0 error + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() + } else { + r0 = ret.Error(0) + } + + return r0 } // LockIntegral provides a mock function with given fields: token @@ -46,8 +64,17 @@ func (_m *IntegerTransactionRepository) LockIntegral(token string) (*entity.Inte } // Rollback provides a mock function with given fields: -func (_m *IntegerTransactionRepository) Rollback() { - _m.Called() +func (_m *IntegerTransactionRepository) Rollback() error { + ret := _m.Called() + + var r0 error + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() + } else { + r0 = ret.Error(0) + } + + return r0 } // Update provides a mock function with given fields: integral diff --git a/server/interface/handler/topic.go b/server/interface/handler/topic.go index 5f3abd89..47be65e7 100644 --- a/server/interface/handler/topic.go +++ b/server/interface/handler/topic.go @@ -148,7 +148,7 @@ func (t *topic) excelToTopic(line int, row []string) (*dto.ImportTopic, error) { if row[0] != "超星" { // 检测是否有答案内容 for _, val := range ret.Correct { - if v, ok := val["Content"].(string); ok && v == "" { + if v, ok := val["content"].(string); ok && v == "" { return nil, errs.New(200, -1, strconv.Itoa(line)+"行错误,超星考试和智慧树要求必须有选项内容") } } diff --git a/server/interface/handler/topic_test.go b/server/interface/handler/topic_test.go index 18a2bb4b..267447ee 100644 --- a/server/interface/handler/topic_test.go +++ b/server/interface/handler/topic_test.go @@ -14,8 +14,8 @@ func Test_topic_excelToTopic(t *testing.T) { assert.Nil(t, err) assert.Equal(t, int32(2), topic.Type) assert.Equal(t, 3, len(topic.Correct)) - assert.Equal(t, "A", topic.Correct[0]["Option"]) - assert.Equal(t, "", topic.Correct[0]["Content"]) + assert.Equal(t, "A", topic.Correct[0]["option"]) + assert.Equal(t, "", topic.Correct[0]["content"]) topic, err = tp.excelToTopic(1, []string{ "超星", "红楼梦的艺术价值体现在以下哪几项?", "选择", "C", @@ -23,8 +23,8 @@ func Test_topic_excelToTopic(t *testing.T) { assert.Nil(t, err) assert.Equal(t, int32(1), topic.Type) assert.Equal(t, 1, len(topic.Correct)) - assert.Equal(t, "C", topic.Correct[0]["Option"]) - assert.Equal(t, "", topic.Correct[0]["Content"]) + assert.Equal(t, "C", topic.Correct[0]["option"]) + assert.Equal(t, "", topic.Correct[0]["content"]) topic, err = tp.excelToTopic(1, []string{ "超星", "红楼梦的艺术价值体现在以下哪几项?", "选择", "问群", @@ -32,8 +32,8 @@ func Test_topic_excelToTopic(t *testing.T) { assert.Nil(t, err) assert.Equal(t, int32(1), topic.Type) assert.Equal(t, 1, len(topic.Correct)) - assert.Equal(t, "A", topic.Correct[0]["Option"]) - assert.Equal(t, "问群", topic.Correct[0]["Content"]) + assert.Equal(t, "A", topic.Correct[0]["option"]) + assert.Equal(t, "问群", topic.Correct[0]["content"]) topic, err = tp.excelToTopic(1, []string{ "超星", "红楼梦的艺术价值体现在以下哪几项?", "选择", "ABC", "", @@ -56,21 +56,21 @@ func Test_topic_excelToTopic(t *testing.T) { "超星考试", "西游记团队中,为什么只有唐僧适合当领导.()", "选择", "唐僧有坚定的信仰与信念。", "唐僧有坚定的目标。", }) assert.Nil(t, err) - assert.Equal(t, "B", topic.Correct[1]["Option"]) - assert.Equal(t, "唐僧有坚定的目标。", topic.Correct[1]["Content"]) + assert.Equal(t, "B", topic.Correct[1]["option"]) + assert.Equal(t, "唐僧有坚定的目标。", topic.Correct[1]["content"]) topic, err = tp.excelToTopic(1, []string{ "超星考试", "超星慕课小工具文档地址和开源地址", "填空", "https://cx-doc.xloli.top/", "https://github.com/CodFrm/cxmooc-tools", "", }) assert.Nil(t, err) - assert.Equal(t, "一", topic.Correct[0]["Option"]) - assert.Equal(t, "https://cx-doc.xloli.top/", topic.Correct[0]["Content"]) + assert.Equal(t, "一", topic.Correct[0]["option"]) + assert.Equal(t, "https://cx-doc.xloli.top/", topic.Correct[0]["content"]) topic, err = tp.excelToTopic(1, []string{ "超星考试", "红楼梦是清代世情小说的代表之作.", "判断", "1", "", }) assert.Nil(t, err) - assert.Equal(t, true, topic.Correct[0]["Option"]) - assert.Equal(t, true, topic.Correct[0]["Content"]) + assert.Equal(t, true, topic.Correct[0]["option"]) + assert.Equal(t, true, topic.Correct[0]["content"]) }