Skip to content
This repository was archived by the owner on Apr 10, 2024. It is now read-only.

Commit 8663fe7

Browse files
committed
add: 开发分析所有接口
1 parent 2f77af1 commit 8663fe7

26 files changed

+1054
-2
lines changed

.idea/compiler.xml

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/kotlinc.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules/com.ciy.plugin.YapiAndroidPlugin.iml

+13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules/com.ciy.plugin.YapiAndroidPlugin.main.iml

+43
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules/com.ciy.plugin.YapiAndroidPlugin.test.iml

+53
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Plugin/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Plugin.jar

Plugin/Plugin.iml

+2
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,7 @@
99
</content>
1010
<orderEntry type="jdk" jdkName="IntelliJ IDEA IU-183.5429.30" jdkType="IDEA JDK" />
1111
<orderEntry type="sourceFolder" forTests="false" />
12+
<orderEntry type="library" name="Gradle: com.squareup.okhttp3:okhttp:4.2.2" level="project" />
13+
<orderEntry type="library" name="Gradle: com.squareup.okio:okio:2.2.2" level="project" />
1214
</component>
1315
</module>

Plugin/resources/mipmap/build.svg

-1
This file was deleted.

Plugin/resources/mipmap/icon.png

1.56 KB
Loading
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.ciy.plugin
2+
3+
/**
4+
* 常量类
5+
*/
6+
object Constants {
7+
// yapi 地址
8+
@JvmField
9+
var yapiUrl: String = ""
10+
// token
11+
@JvmField
12+
var token: String = ""
13+
}

Plugin/src/com/ciy/plugin/ShowInputDialogAction.kt

+33
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
package com.ciy.plugin
22

3+
import com.ciy.plugin.modle.ApiBean
4+
import com.ciy.plugin.modle.ProjectInfoBean
5+
import com.ciy.plugin.ui.AnalysisApiListProgressDialog
6+
import com.ciy.plugin.ui.InputUrlDialog
7+
import com.ciy.plugin.ui.SelectApiDialog
38
import com.intellij.openapi.actionSystem.AnAction
49
import com.intellij.openapi.actionSystem.AnActionEvent
510
import com.intellij.openapi.application.ApplicationManager
11+
import com.intellij.openapi.module.Module
12+
import com.intellij.openapi.project.Project
13+
import sun.security.pkcs11.Secmod
614

715
/**
816
* 显示输入框动作
@@ -13,8 +21,33 @@ class ShowInputDialogAction : AnAction() {
1321
isEnabledInModalContext = true
1422
}
1523

24+
private var project: Project? = null
25+
26+
/**
27+
* 点击图标
28+
*/
1629
override fun actionPerformed(p0: AnActionEvent) {
30+
project = p0.project
1731
if (!ApplicationManager.getApplication().isHeadlessEnvironment) {
32+
InputUrlDialog(InputUrlDialog.InputUrlDialogListener {
33+
showSelectApiDialog(it)
34+
}).isVisible = true
1835
}
1936
}
37+
38+
/**
39+
* 选择Api
40+
*/
41+
fun showSelectApiDialog(p: ProjectInfoBean) {
42+
SelectApiDialog(project, p, SelectApiDialog.SelectApiDialogListener { module, apiBeans ->
43+
analysisApiList(module, apiBeans)
44+
}).isVisible = true
45+
}
46+
47+
/**
48+
* 分析Api列表
49+
*/
50+
fun analysisApiList(module: Module, apiList: List<ApiBean>) {
51+
AnalysisApiListProgressDialog(apiList).isVisible = true
52+
}
2053
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package com.ciy.plugin.modle
2+
3+
data class ApiInfoBean(
4+
val __v: Int,
5+
val _id: Int,
6+
val add_time: Int,
7+
val api_opened: Boolean,
8+
val catid: Int,
9+
val desc: String,
10+
val edit_uid: Int,
11+
val index: Int,
12+
val markdown: String,
13+
val method: String,
14+
val path: String,
15+
val project_id: Int,
16+
val req_body_form: List<ApiInfoBody>,
17+
val req_body_is_json_schema: Boolean,
18+
val req_body_other: String,
19+
val req_body_type: String,
20+
val req_headers: List<ApiInfoBody>,
21+
val req_params: List<ApiInfoBody>,
22+
val req_query: List<ApiInfoBody>,
23+
val res_body: String,
24+
val res_body_is_json_schema: Boolean,
25+
val res_body_type: String,
26+
val status: String,
27+
val tag: List<Any>,
28+
val title: String,
29+
val type: String,
30+
val uid: Int,
31+
val up_time: Int,
32+
val username: String
33+
)
34+
35+
data class ApiInfoBody(
36+
val _id: String,
37+
val name: String,
38+
val required: String,
39+
val value: String,
40+
val type: String,
41+
val desc: String
42+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.ciy.plugin.modle
2+
3+
data class ApiListBean(
4+
val count: Int,
5+
val list: List<ApiBean>,
6+
val total: Int
7+
)
8+
9+
data class ApiBean(
10+
val _id: Int,
11+
val add_time: Int,
12+
val api_opened: Boolean,
13+
val catid: Int,
14+
val edit_uid: Int,
15+
val method: String,
16+
val path: String,
17+
val project_id: Int,
18+
val status: String,
19+
val tag: List<Any>,
20+
val title: String,
21+
val uid: Int,
22+
var select: Boolean
23+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.ciy.plugin.modle
2+
3+
/**
4+
* 接口分类
5+
*/
6+
data class CatMenuBean(
7+
val __v: Int,
8+
val _id: Int,
9+
val add_time: Int,
10+
val desc: String,
11+
val index: Int,
12+
val name: String,
13+
val project_id: Int,
14+
val uid: Int,
15+
val up_time: Int
16+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package com.ciy.plugin.modle
2+
3+
/**
4+
* 项目基本信息
5+
*/
6+
data class ProjectInfoBean(
7+
val _id: Int,
8+
val add_time: Int,
9+
val basepath: String,
10+
val cat: List<Any>,
11+
val color: String,
12+
val env: List<Env>,
13+
val group_id: Int,
14+
val icon: String,
15+
val is_json5: Boolean,
16+
val is_mock_open: Boolean,
17+
val name: String,
18+
val project_type: String,
19+
val role: Boolean,
20+
val strice: Boolean,
21+
val switch_notice: Boolean,
22+
val tag: List<Any>,
23+
val uid: Int,
24+
val up_time: Int
25+
)
26+
27+
data class Env(
28+
val _id: String,
29+
val domain: String,
30+
val global: List<Any>,
31+
val header: List<Any>,
32+
val name: String
33+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package com.ciy.plugin.modle
2+
3+
data class YapiResult<T>(val errcode: Int, val errmsg: String, val data: T)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.ciy.plugin.ui.AnalysisApiListProgressDialog">
3+
<grid id="cbd77" binding="contentPane" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
4+
<margin top="10" left="10" bottom="10" right="10"/>
5+
<constraints>
6+
<xy x="48" y="54" width="667" height="69"/>
7+
</constraints>
8+
<properties/>
9+
<border type="none"/>
10+
<children>
11+
<component id="c3c6" class="javax.swing.JProgressBar" binding="pb">
12+
<constraints>
13+
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
14+
</constraints>
15+
<properties/>
16+
</component>
17+
<component id="35c30" class="javax.swing.JLabel" binding="lb">
18+
<constraints>
19+
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
20+
</constraints>
21+
<properties>
22+
<text value=""/>
23+
</properties>
24+
</component>
25+
</children>
26+
</grid>
27+
</form>

0 commit comments

Comments
 (0)