add
yj
2024-12-05 b9900893177c78fc559223521fe839aa21000017
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
<!DOCTYPE html>
<html>
<head>
    <title>Dobbin Framework API文档 方法详情</title>
    <link href="https://iotechn.oss-cn-hangzhou.aliyuncs.com/open/style/commons.css" rel="stylesheet" type="text/css"/>
    <link rel="stylesheet" href="https://iotechn.oss-cn-hangzhou.aliyuncs.com/open/stylesheets/commons.css">
    <link rel="stylesheet" type="text/css" href="https://iotechn.oss-cn-hangzhou.aliyuncs.com/open/stylesheets/index-news.css">
    <script src="https://iotechn.oss-cn-hangzhou.aliyuncs.com/open/js/jquery-lastest.js"></script>
</head><body>
<div class="open-header clearfix">
    <div class="pm">
        <div class="open-header-c1 fl">
            <!-- logo -->
            <a href="/"><span class='open-header-icon '></span></a>
        </div>
    </div>
</div>
<div class="open-nav">
    <div class="pm">
        <ul class="openapi-nav">
            <li class="openapi-nav-apis" type=""><a href="/info/group/${gp}">API</a></li>
        </ul>
    </div>
</div>
<script type="text/javascript">
    function setLang(lang){
        $.post("/lang",{lang:lang},function(result){
            window.location.reload(true);
        });
    }
    var selected="index";
    var locationPath=window.location.pathname.toLowerCase();
    if(locationPath.indexOf("apis")>0||locationPath.indexOf("testapi")>0){
        selected="apis";
    }else if(locationPath.indexOf("docs")>0){
        selected="docs";
    }else if(locationPath.indexOf("enter")>0){
        selected="enter";
    }
    $(".openapi-nav li").removeClass("active");
    $(".openapi-nav-"+selected).addClass("active");
</script>  <div class="pm">
    <nav class="open-breadcrumbs">
        <a href="#" >API</a>/<a href="/info/group/${gp}">${gp}</a>/${model.name}
    </nav>
    <div class="clearfix">
        <div class="open-grid-c1">
            <aside class="open-sideber">
                <ul class="open-sideber-list1">
                    <li>
                        <a href="javascript:void(0);" onclick="return false;" class="groupName ">${gp}开放接口</a>
                        <ul class="open-sideber-list2">
                            <#list methods as method>
                                <li data-name="${method.name}">
                                    <a href="/info/api/${gp}/${method.name}">
                                        ${method.description}
                                        <br>${gp}.${method.name}
                                    </a>
                                </li>
                             </#list>
                        </ul>
                    </li>
                </ul>
            </aside>
        </div>
        <div class="open-grid-c2">
            <section class="open-detail">
                <h1>${model.name}</h1>
                <section>
                    <h2>API 描述</h2>
                    <p>${model.description}</p>
                </section>
                <section>
                    <h2>参数列表</h2>
                    <section>
                        <h3>系统级别参数</h3>
                        <table>
                            <thead>
                            <tr>
                                <th>必要性</th>
                                <th>参数名</th>
                                <th>类型</th>
                                <th>描述</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr>
                                <td>必填</td>
                                <td>_gp</td>
                                <td><a href="javascript:void(0);">string</a></td>
                                <td>method,所在分组 ${gp}</td>
                            </tr>
 
                            <tr>
                                <td>必填</td>
                                <td>_mt</td>
                                <td><a href="javascript:void(0);">string</a></td>
                                <td>method,请求的方法名 ${model.name}</td>
                            </tr>
                            </tbody>
                        </table>
                        <hr>
                        <h3>应用级别参数</h3>
                        <table>
                            <thead>
                            <tr>
                                <th>必要性</th>
                                <th>参数名</th>
                                <th>class类型</th>
                                <th>方式类型</th>
                                <th>描述</th>
                            </tr>
                            </thead>
                            <tbody>
                            <#list model.parameters as param>
                                <tr>
                                    <td>
                                        <#if param.required>
                                            必填
                                        <#else>
                                            可空
                                        </#if>
                                    </td>
                                    <td>${param.name}</td>
                                    <td>${param.paramType}</td>
                                    <td>${param.type}</td>
                                    <td>${param.description}</td>
                                </tr>
                            </#list>
 
                            </tbody>
                        </table>
                    </section>
                </section>
                <section>
                    <h2>返回值</h2>
                    <section>
                        <h3>返回类型 </h3>
                        <p>${model.retType} </p>
 
                        <#if model.retObj??>
                            <hr>
                            <h3>类型定义</h3>
                            <table>
                                <thead>
                                <tr>
                                    <th>属性名</th>
                                    <th>类型</th>
                                    <th>描述</th>
                                </tr>
                                </thead>
                                <tbody>
                                    <#list model.retObj as field>
                                        <tr>
                                            <td>${field.name}</td>
                                            <td><a href="#${field.type}">${field.type}</a></td>
                                            <td>
                                                <span>${field.description}</span>
                                                <#if field.enums??>
                                                    <a onclick="copyText('${field.map}')">复制MAP</a>
                                                </#if>
                                                <#if field.enums??>
                                                    <a onclick="copyText('${field.filter}')">复制Filter</a>
                                                </#if>
                                            </td>
                                        </tr>
                                    </#list>
                                </tbody>
                            </table>
                        </#if>
                    </section>
                </section>
                <#if model.entityList??>
                <section>
                    <h2>实体</h2>
                    <#list model.entityList as entity>
                    <section>
                        <hr id="${entity.type}">
                        <h3>类型定义 ${entity.type}</h3>
                        <table>
                            <thead>
                            <tr>
                                <th>属性名</th>
                                <th>类型</th>
                                <th>描述</th>
                            </tr>
                            </thead>
                            <tbody>
                            <#list entity.fields as field>
                            <tr>
                                <td>${field.name}</td>
                                <td><a href="#${field.type}">${field.type}</a></td>
                                <td>
                                    <span>${field.description}</span>
                                    <#if field.enums??>
                                        <a onclick="copyText('${field.map}')">复制MAP</a>
                                    </#if>
                                    <#if field.enums??>
                                        <a onclick="copyText('${field.filter}')">复制Filter</a>
                                    </#if>
                                </td>
                            </tr>
                            </#list>
                            </tbody>
                        </table>
                    </section>
                    </#list>
                </section>
                </#if>
                <section>
                    <h2>测试Api</h2>
                    <table>
                        <thead>
                        <tr>
                            <th>parameter name</th>
                            <th>value</th>
                            <th>description</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr>
                            <td>_gp<span class="text-important">*</span></td>
                            <td id="_gp">${gp}</td>
                            <td>请求参数分组</td>
                        </tr>
                        <tr>
                            <td>_mt<span class="text-important">*</span></td>
                            <td id="_mt">${model.name}</td>
                            <td>请求参数名</td>
                        </tr>
                        <#list model.parameters as param>
                            <#if param.type == "USER_ID">
                                <tr>
                                    <td>accessToken<span class="text-important">
                                        <#if param.required>
                                            <span class="text-important">*</span>
                                        </#if>
                                    </span></td>
                                    <td><input id="access_token" name="access_token" type="text"></td>
                                    <td>需要用户登录的接口</td>
                                </tr>
                            <#elseif param.type == "ADMIN_ID">
                                <tr>
                                    <td>AdminToken<span class="text-important">
                                        <#if param.required>
                                            <span class="text-important">*</span>
                                        </#if>
                                    </span></td>
                                    <td><input id="admin_access_token" name="admin_access_token" type="text"></td>
                                    <td>需要管理员登录的接口</td>
                            <#else>
                                <tr>
                                    <td>${param.name}
                                        <#if param.required>
                                            <span class="text-important">*</span>
                                        </#if>
                                    </td>
                                    <td><input id="${param.name}" name="${param.name}" type="text"></td>
                                    <td>
                                        <span>${param.description}</span>
                                    </td>
 
                                </tr>
                            </#if>
 
                        </#list>
                        </tbody>
                    </table>
                    <hr>
                    <a href="javascript:" class="open-detail-btn" id="submitId">submit</a>
                    <hr>
                    <div class="clearfix">
                        <section style="margin-bottom: 20px">
                            <h2>request:</h2>
                            <pre class="prettyprint lang-http"><code id="urlParams" style="min-height: 100px" class="hljs"><span class="hljs-attribute"></span></code></pre>
                        </section>
                        <section style="margin-bottom: 20px">
                            <h2>response:</h2>
                            <pre class="prettyprint lang-json"><code id="result" style="min-height: 100px" class="hljs"></code></pre>
                        </section>
                    </div>
                </section>
                <section>
                    <h2>异常返回值</h2>
                    <section>
                        <table>
                            <thead>
                            <tr>
                                <th>异常返回值</th>
                                <th>描述</th>
                            </tr>
                            </thead>
                            <tbody>
                            <#list exceptionList as exc>
                            <tr>
                                <td>${exc.code}</td>
                                <td>${exc.msg}</td>
                            </tr>
                            </#list>
 
                            </tbody>
                        </table>
                    </section>
                </section>
            </section>
        </div>
    </div>
<textarea id="copyborad" style="display: none"></textarea>
</div>
 
<div class="open-footer">
    <ul>
        <li><a href="#">API</a></li>
    </ul>
    <p>备案</p>
</div>
<script type="text/javascript">
    var path = location.pathname.split("/");
    var len = path.length;
    if(len > 2){
        var groupElement = $("." + path[len-2]);
        groupElement.addClass("active");
        groupElement.parent().parent().find("ul").css("display", "block");
        $("[data-name='" + decodeURI(path[len-1]) + "']").addClass("active");
    }
    $(".groupName").click(function(){
        if($(this).parent().parent().find("ul").css("display") == "block"){
            $(this).removeClass('active');
            $($(this).parent().parent().find("ul")).css("display", "none");
        }
        else{
            $(this).addClass('active');
            $($(this).parent().parent().find("ul")).css("display", "block");
        }
    });
    function setLang(lang){
        $.post("/lang",{lang:lang},function(result){
            window.location.reload(true);
        });
    }
</script>
<script>
    function copyText(text) {
        var copyborad = document.getElementById("copyborad");
        copyborad.style.display = 'block'
        copyborad.value = text; // 修改文本框的内容
        copyborad.select(); // 选中文本
        document.execCommand("copy"); // 执行浏览器复制命令
        copyborad.style.display = 'none'
        alert("复制成功");
    }
    function getParamData(){
        //获取参数
        var requestData = {};
        requestData._gp = $("#_gp").text();
        requestData._mt = $("#_mt").text();
        <#list model.parameters as param>
        <#if param.type != "USER_ID">
        requestData.${param.name} = $("#${param.name}").val();
        </#if>
        </#list>
        return requestData;
    }
 
    $('#submitId').click(function(){
        var data = getParamData();
        var accessToken = $("#access_token").val();
        var adminAccessToken = $("#admin_access_token").val();
        $.ajax({
            type:"POST",
            url:'/m.api',
            dataType: "json",
            data: data,
            beforeSend: function (request) {
                if (accessToken) {
                    request.setRequestHeader("ACCESSTOKEN", accessToken);
                }
                if (adminAccessToken) {
                    request.setRequestHeader("ADMINTOKEN", adminAccessToken);
                }
            },
            cache:true,
            success:success,
            error:error
        });
 
 
        function success(data){
            $("#result").text(JSON.stringify(data, undefined, 4));
        }
 
        function error(data){
            console.log(data);
        }
 
        var urlValue = [];
        for(var prop in data){
            urlValue.push(prop + "=" + data[prop]);
        }
        $("#urlParams").text("GET \r\n--url "+"/m.api?" + urlValue.join("&")+" \r\n--header access_token=" + accessToken);
    });
</script>
 
</body>
</html>