Skip to content

Commit 3e11e99

Browse files
author
pedro
committed
update:更新代码规范和注释
1 parent 480e4ee commit 3e11e99

7 files changed

Lines changed: 18 additions & 7 deletions

File tree

app/api/cms/log.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,10 @@ log.linGet(
7474
groupRequired,
7575
async ctx => {
7676
const v = await new PaginateValidator().validate(ctx);
77-
const arr = await logDao.getUserNames(v.get("query.page"), v.get("query.count"));
77+
const arr = await logDao.getUserNames(
78+
v.get("query.page"),
79+
v.get("query.count")
80+
);
7881
ctx.json(arr);
7982
}
8083
);

app/api/v1/book.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ const {
77
CreateOrUpdateBookValidator
88
} = require("../../validators/book");
99

10-
const {
11-
PositiveIdValidator
12-
} = require("../../validators/common");
10+
const { PositiveIdValidator } = require("../../validators/common");
1311

1412
const { BookNotFound } = require("../../libs/err-code");
1513
const { Book } = require("../../models/book");

app/app.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ const Koa = require("koa");
44
const KoaBodyParser = require("koa-bodyparser");
55
const cors = require("@koa/cors");
66
const { config } = require("lin-mizar/lin/config");
7-
// const { User2 } = require('./models/user');
87

98
function applyCors (app) {
109
// 跨域

app/config/setting.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ exports.apiDir = "app/api";
88

99
exports.accessExp = 60 * 60; // 1h 单位秒
1010

11+
// exports.refreshExp 设置refresh_token的过期时间
12+
1113
// 暂不启用
1214
exports.pluginPath = {
1315
// plugin name

app/dao/admin.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ class AdminDao {
2020
"SELECT lin_user.*,lin_group.`name` as group_name FROM lin_user LEFT JOIN lin_group ON lin_user.group_id = lin_group.id WHERE";
2121
groupId && (sql += " lin_user.group_id = :id AND");
2222
let users = await db.query(
23-
sql + " lin_user.admin = :admin AND lin_user.delete_time IS NULL LIMIT :count OFFSET :start ",
23+
sql +
24+
" lin_user.admin = :admin AND lin_user.delete_time IS NULL LIMIT :count OFFSET :start ",
2425
{
2526
replacements: groupId
2627
? {

app/models/user.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
/**
2+
* 扩展userModel的示例
3+
* 如果你的数据库中,已经存在了lin_user这张表
4+
* 你使用扩展userModel后,或许不会生效,请先在数据库删除原来的lin_user
5+
* 然后再运行程序
6+
*/
17
"use strict";
28

39
const { modelExtend } = require("lin-mizar/lin/factory");
@@ -6,7 +12,7 @@ const Sequelize = require("sequelize");
612

713
const User2 = modelExtend(User, {
814
phone: {
9-
type: Sequelize.STRING,
15+
type: Sequelize.STRING(30),
1016
unique: true,
1117
allowNull: true
1218
}

code.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222

2323
10070 禁止操作
2424

25+
10100 refresh token 获取失败
26+
2527
## 项目使用的状态码
2628

2729
80010 图书未找到

0 commit comments

Comments
 (0)