正在显示
13 个修改的文件
包含
574 行增加
和
420 行删除
1 | -module.exports = app => { | 1 | +// const passport = require('./app/etc/authorization'); |
2 | +const flash = require('connect-flash'); | ||
3 | +const passport = require('./app/middleware/authorization'); | ||
2 | 4 | ||
3 | - app.once('server', server => { | ||
4 | - | ||
5 | - }) | ||
6 | - | ||
7 | - app.on('error', (err, ctx) => { | ||
8 | - | ||
9 | - }) | ||
10 | - | ||
11 | - app.on('request', ctx => { | ||
12 | - | ||
13 | - }) | ||
14 | - | ||
15 | - app.on('response', ctx => { | ||
16 | - const used = Date.now() - ctx.starttime | ||
17 | - console.log(ctx, 'used') | ||
18 | - }) | ||
19 | -} | ||
5 | +class Hro { | ||
6 | + constructor(app) { | ||
7 | + this.app = app; | ||
8 | + } | ||
9 | + configWillLoad() { | ||
10 | + // Ready to call configDidLoad, | ||
11 | + // Config, plugin files are referred, | ||
12 | + // this is the last chance to modify the config. | ||
13 | + console.log('configWillLoad'); | ||
14 | + } | ||
15 | + configDidLoad() { | ||
16 | + // Config, plugin files have been loaded. | ||
17 | + console.log('configDidLoad'); | ||
18 | + } | ||
19 | + async didLoad() { | ||
20 | + // All files have loaded, start plugin here. | ||
21 | + console.log('didLoad'); | ||
22 | + } | ||
23 | + async willReady() { | ||
24 | + // All plugins have started, can do some thing before app ready' | ||
25 | + const { app } = this; | ||
26 | + passport(app);// 添加passport验证方法 | ||
27 | + flash(app) | ||
28 | + // console.log('willReady',app); | ||
29 | + } | ||
30 | + async didReady() { | ||
31 | + // Worker is ready, can do some things | ||
32 | + // don't need to block the app boot. | ||
33 | + console.log('didReady'); | ||
34 | + } | ||
35 | + async serverDidReady() { | ||
36 | + // Server is listening. | ||
37 | + console.log('serverDidReady'); | ||
38 | + } | ||
39 | + async beforeClose() { | ||
40 | + // Do some thing before app close. | ||
41 | + console.log('configWillLoad'); | ||
42 | + } | ||
43 | +} | ||
44 | +module.exports = Hro; |
1 | "use strict"; | 1 | "use strict"; |
2 | - | ||
3 | -const passport = require("passport"); | ||
4 | const urlencode = require("urlencode"); | 2 | const urlencode = require("urlencode"); |
5 | const async = require("async"); | 3 | const async = require("async"); |
6 | const crypto = require("crypto"); | 4 | const crypto = require("crypto"); |
7 | const fs = require("fs"); | 5 | const fs = require("fs"); |
8 | const path = require("path"); | 6 | const path = require("path"); |
9 | - | ||
10 | const Controller = require("egg").Controller; | 7 | const Controller = require("egg").Controller; |
11 | -// logger, rest, settings | ||
12 | 8 | ||
13 | class AuthController extends Controller { | 9 | class AuthController extends Controller { |
14 | - async index() { | ||
15 | - const { ctx, logger } = this; | ||
16 | - const { request } = ctx; | ||
17 | - | ||
18 | - logger.info(request); | 10 | + index(req, res, next) { |
11 | + logger.info(req); | ||
12 | + // res.redirect("https://www.baidu.com"); | ||
19 | } | 13 | } |
20 | 14 | ||
21 | - async getImg(req, res) { | 15 | + getImg(req, res, next) { |
16 | + logger.info(req.url, "1231231231"); | ||
22 | const parentdir = path.resolve(__dirname, ".."); | 17 | const parentdir = path.resolve(__dirname, ".."); |
23 | const paths = | 18 | const paths = |
24 | parentdir + "/build/public" + urlencode.decode(req.url, "utf8"); | 19 | parentdir + "/build/public" + urlencode.decode(req.url, "utf8"); |
25 | - | ||
26 | fs.readFile(paths, function (err, data) { | 20 | fs.readFile(paths, function (err, data) { |
21 | + console.log(err, data); | ||
27 | if (err) { | 22 | if (err) { |
28 | res.send("读取错误"); | 23 | res.send("读取错误"); |
29 | } else { | 24 | } else { |
@@ -32,81 +27,56 @@ class AuthController extends Controller { | @@ -32,81 +27,56 @@ class AuthController extends Controller { | ||
32 | }); | 27 | }); |
33 | } | 28 | } |
34 | 29 | ||
35 | - async indexPrefix(req, res) { | 30 | + indexPrefix() { |
36 | const { ctx } = this; | 31 | const { ctx } = this; |
37 | - | ||
38 | - ctx.body = { | ||
39 | - data: req.csrfToken(), | ||
40 | - }; | ||
41 | - | ||
42 | - return ctx.body; | 32 | + const { logger, req } = ctx; |
33 | + return (ctx.body = {}); | ||
34 | + // return ctx.body({ data: ctx.csrfToken }); | ||
35 | + // if (req.csrfToken) { | ||
36 | + // if (settings.prefix && settings.prefix.length > 1) { | ||
37 | + // res.redirect(settings.prefix.substring(0, settings.prefix.length - 1)); | ||
38 | + // } else { | ||
39 | + // res.render("index", { csrfToken: req.csrfToken() }); | ||
40 | + // } | ||
41 | + // } else res.render("index", { csrfToken: "" }); | ||
43 | } | 42 | } |
44 | 43 | ||
45 | - async productDes(req, res) { | ||
46 | - const { ctx } = this; | ||
47 | - | ||
48 | - if (req.csrfToken) { | ||
49 | - await ctx.render("chat/new-chat", { csrfToken: req.csrfToken() }); | ||
50 | - } else { | ||
51 | - await ctx.render("chat/new-chat", { csrfToken: "" }); | ||
52 | - } | 44 | + productDes(req, res, next) { |
45 | + if (req.csrfToken) | ||
46 | + res.render("chat/new-chat", { csrfToken: req.csrfToken() }); | ||
47 | + else res.render("chat/new-chat", { csrfToken: "" }); | ||
53 | } | 48 | } |
54 | 49 | ||
55 | - async recharge(req, res) { | ||
56 | - const { ctx } = this; | ||
57 | - let params = JSON.parse(urlencode.decode(req.query.params)); | ||
58 | - | ||
59 | - if (req.csrfToken) { | ||
60 | - ctx.render("recharge", { | ||
61 | - recharge: params, | ||
62 | - csrfToken: req.csrfToken(), | ||
63 | - }); | ||
64 | - } else { | ||
65 | - ctx.render("recharge", { | ||
66 | - recharge: params, | ||
67 | - csrfToken: "", | ||
68 | - }); | ||
69 | - } | 50 | + recharge(req, res) { |
51 | + var params = JSON.parse(urlencode.decode(req.query.params)); | ||
52 | + console.log(params); | ||
53 | + if (req.csrfToken) | ||
54 | + res.render("recharge", { recharge: params, csrfToken: req.csrfToken() }); | ||
55 | + else res.render("recharge", { recharge: params, csrfToken: "" }); | ||
70 | } | 56 | } |
71 | 57 | ||
72 | - async register(req, res) { | ||
73 | - const { ctx } = this; | ||
74 | - | ||
75 | - if (req.csrfToken) { | ||
76 | - ctx.render("newRegister", { csrfToken: req.csrfToken() }); | ||
77 | - } else { | ||
78 | - ctx.render("newRegister", { csrfToken: "" }); | ||
79 | - } | 58 | + register(req, res, next) { |
59 | + if (req.csrfToken) | ||
60 | + res.render("newRegister", { csrfToken: req.csrfToken() }); | ||
61 | + else res.render("newRegister", { csrfToken: "" }); | ||
80 | } | 62 | } |
81 | 63 | ||
82 | - async mobileRegister(req, res) { | ||
83 | - const { ctx } = this; | ||
84 | - | ||
85 | - if (req.csrfToken) { | ||
86 | - ctx.render("registerMobile", { csrfToken: req.csrfToken() }); | ||
87 | - } else { | ||
88 | - ctx.render("registerMobile", { csrfToken: "" }); | ||
89 | - } | 64 | + mobileRegister(req, res) { |
65 | + if (req.csrfToken) | ||
66 | + res.render("registerMobile", { csrfToken: req.csrfToken() }); | ||
67 | + else res.render("registerMobile", { csrfToken: "" }); | ||
90 | } | 68 | } |
91 | 69 | ||
92 | - async mobileRegisterSuccess(req, res) { | ||
93 | - const { ctx } = this; | ||
94 | - | ||
95 | - if (req.csrfToken) { | ||
96 | - ctx.render("registerMobileSuccess", { csrfToken: req.csrfToken() }); | ||
97 | - } else { | ||
98 | - ctx.render("registerMobileSuccess", { csrfToken: "" }); | ||
99 | - } | 70 | + mobileRegisterSuccess(req, res) { |
71 | + if (req.csrfToken) | ||
72 | + res.render("registerMobileSuccess", { csrfToken: req.csrfToken() }); | ||
73 | + else res.render("registerMobileSuccess", { csrfToken: "" }); | ||
100 | } | 74 | } |
101 | 75 | ||
102 | - async signIn(req, res) { | ||
103 | - const { ctx } = this; | ||
104 | - | ||
105 | - if (req.csrfToken) { | ||
106 | - ctx.render("newLogin", { csrfToken: req.csrfToken() }); | ||
107 | - } else { | ||
108 | - ctx.render("newLogin", { csrfToken: "" }); | ||
109 | - } | 76 | + signIn(req, res, next) { |
77 | + // console.log(req); | ||
78 | + if (req.csrfToken) res.render("newLogin", { csrfToken: req.csrfToken() }); | ||
79 | + else res.render("newLogin", { csrfToken: "" }); | ||
110 | } | 80 | } |
111 | 81 | ||
112 | async doLogin(req, res, next) { | 82 | async doLogin(req, res, next) { |
@@ -132,10 +102,35 @@ class AuthController extends Controller { | @@ -132,10 +102,35 @@ class AuthController extends Controller { | ||
132 | })(req, res, next); | 102 | })(req, res, next); |
133 | } | 103 | } |
134 | 104 | ||
135 | - async signOut(req, res) { | ||
136 | - const { ctx, logger } = this; | ||
137 | - const { session } = ctx; | 105 | + async loginCallback() { |
106 | + const { ctx } = this; | ||
107 | + if ("application/json" == ctx.request.get("accept")) { | ||
108 | + //用户名密码json登录 | ||
109 | + if (ctx.isAuthenticated() && !ctx.session.returnTo) { | ||
110 | + if(ctx.session.user_info.code>=300){ | ||
111 | + ctx.body = ctx.session.user_info | ||
112 | + }else { | ||
113 | + ctx.body = { | ||
114 | + scope: ctx.session.user_info.scope, | ||
115 | + user_info: ctx.session.user_info.user, | ||
116 | + }; | ||
117 | + } | ||
118 | + | ||
119 | + } else if (ctx.isAuthenticated() && ctx.session.returnTo) { | ||
120 | + ctx.body = { code: 301, redirect_uri: ctx.session.returnTo }; | ||
121 | + } else { | ||
122 | + ctx.body = { code: 400, message: "登录失败" }; | ||
123 | + } | ||
124 | + } else { | ||
125 | + //扫二维码第三方登录 | ||
126 | + ctx.body = { code: 400, message: "登录失败" }; | ||
127 | + } | ||
128 | + return ctx.body; | ||
129 | + } | ||
138 | 130 | ||
131 | + signOut() { | ||
132 | + const { ctx, logger } = this; | ||
133 | + const { req, res, session } = ctx; | ||
139 | if ( | 134 | if ( |
140 | session.passport && | 135 | session.passport && |
141 | session.passport.user && | 136 | session.passport.user && |
@@ -147,13 +142,13 @@ class AuthController extends Controller { | @@ -147,13 +142,13 @@ class AuthController extends Controller { | ||
147 | "You have successfully logged out" | 142 | "You have successfully logged out" |
148 | ); | 143 | ); |
149 | } | 144 | } |
150 | - | ||
151 | - req.logout(); | ||
152 | - req.flash("success", "You have successfully logged out"); | ||
153 | - res.redirect("/"); | 145 | + logger.info(req); |
146 | + // req.logout(); | ||
147 | + // req.flash("success", "You have successfully logged out"); | ||
148 | + ctx.redirect("/"); | ||
154 | } | 149 | } |
155 | 150 | ||
156 | - async smsCodes(req, res) { | 151 | + smsCodes(req, res, next) { |
157 | rest.postJson({ | 152 | rest.postJson({ |
158 | baseUrl: "url", | 153 | baseUrl: "url", |
159 | url: "auth/smscodes", | 154 | url: "auth/smscodes", |
@@ -174,7 +169,7 @@ class AuthController extends Controller { | @@ -174,7 +169,7 @@ class AuthController extends Controller { | ||
174 | } | 169 | } |
175 | } | 170 | } |
176 | 171 | ||
177 | - async tenants(req, res, next) { | 172 | + tenants(req, res, next) { |
178 | rest.register({ | 173 | rest.register({ |
179 | baseUrl: "url", | 174 | baseUrl: "url", |
180 | url: "tenants", | 175 | url: "tenants", |
@@ -191,7 +186,7 @@ class AuthController extends Controller { | @@ -191,7 +186,7 @@ class AuthController extends Controller { | ||
191 | } | 186 | } |
192 | } | 187 | } |
193 | 188 | ||
194 | - async resetPass(req, res) { | 189 | + resetPass(req, res) { |
195 | rest.putJson({ | 190 | rest.putJson({ |
196 | baseUrl: "url", | 191 | baseUrl: "url", |
197 | url: "auth/user", | 192 | url: "auth/user", |
@@ -211,9 +206,7 @@ class AuthController extends Controller { | @@ -211,9 +206,7 @@ class AuthController extends Controller { | ||
211 | } | 206 | } |
212 | } | 207 | } |
213 | 208 | ||
214 | - async updatePassword(req, res) { | ||
215 | - const { logger } = this; | ||
216 | - | 209 | + updatePassword(req, res) { |
217 | rest.patchJson({ | 210 | rest.patchJson({ |
218 | baseUrl: "url", | 211 | baseUrl: "url", |
219 | url: "users/" + req.body.userId, | 212 | url: "users/" + req.body.userId, |
@@ -232,7 +225,7 @@ class AuthController extends Controller { | @@ -232,7 +225,7 @@ class AuthController extends Controller { | ||
232 | } | 225 | } |
233 | } | 226 | } |
234 | 227 | ||
235 | - async loadUserInfo(req, res) { | 228 | + loadUserInfo(req, res) { |
236 | settings; | 229 | settings; |
237 | 230 | ||
238 | if (req.session.passport.user && req.session.passport.user.user_info) { | 231 | if (req.session.passport.user && req.session.passport.user.user_info) { |
@@ -245,9 +238,7 @@ class AuthController extends Controller { | @@ -245,9 +238,7 @@ class AuthController extends Controller { | ||
245 | } | 238 | } |
246 | } | 239 | } |
247 | 240 | ||
248 | - async getUploaderToken(req, res) { | ||
249 | - const { logger } = this; | ||
250 | - | 241 | + getUploaderToken(req, res) { |
251 | rest.postJson({ | 242 | rest.postJson({ |
252 | baseUrl: "ossUrl", | 243 | baseUrl: "ossUrl", |
253 | url: "inits", | 244 | url: "inits", |
@@ -264,9 +255,7 @@ class AuthController extends Controller { | @@ -264,9 +255,7 @@ class AuthController extends Controller { | ||
264 | } | 255 | } |
265 | } | 256 | } |
266 | 257 | ||
267 | - async getObjectTokenByID(req, res) { | ||
268 | - const { logger } = this; | ||
269 | - | 258 | + getObjectTokenByID(req, res) { |
270 | rest.get({ | 259 | rest.get({ |
271 | baseUrl: "ossUrl", | 260 | baseUrl: "ossUrl", |
272 | url: "objects/" + req.body.file_id, | 261 | url: "objects/" + req.body.file_id, |
@@ -283,7 +272,7 @@ class AuthController extends Controller { | @@ -283,7 +272,7 @@ class AuthController extends Controller { | ||
283 | } | 272 | } |
284 | } | 273 | } |
285 | 274 | ||
286 | - async delOSSObject(req, res) { | 275 | + delOSSObject(req, res) { |
287 | rest.del({ | 276 | rest.del({ |
288 | baseUrl: "ossUrl", | 277 | baseUrl: "ossUrl", |
289 | url: | 278 | url: |
@@ -307,7 +296,7 @@ class AuthController extends Controller { | @@ -307,7 +296,7 @@ class AuthController extends Controller { | ||
307 | } | 296 | } |
308 | } | 297 | } |
309 | 298 | ||
310 | - async smsVerification(req, res) { | 299 | + smsVerification(req, res) { |
311 | rest.postJson({ | 300 | rest.postJson({ |
312 | baseUrl: "url", | 301 | baseUrl: "url", |
313 | url: "auth/sms_verification", | 302 | url: "auth/sms_verification", |
@@ -332,13 +321,13 @@ class AuthController extends Controller { | @@ -332,13 +321,13 @@ class AuthController extends Controller { | ||
332 | } | 321 | } |
333 | } | 322 | } |
334 | 323 | ||
335 | - async healthMonitor(res) { | 324 | + healthMonitor(res) { |
336 | res.statusCode = 200; | 325 | res.statusCode = 200; |
337 | 326 | ||
338 | return res.send("status ok"); | 327 | return res.send("status ok"); |
339 | } | 328 | } |
340 | 329 | ||
341 | - async updateUserRoles(req, res) { | 330 | + updateUserRoles(req, res) { |
342 | rest.putJson({ | 331 | rest.putJson({ |
343 | baseUrl: "url", | 332 | baseUrl: "url", |
344 | url: "user_roles/" + req.body.user_id, | 333 | url: "user_roles/" + req.body.user_id, |
@@ -358,7 +347,7 @@ class AuthController extends Controller { | @@ -358,7 +347,7 @@ class AuthController extends Controller { | ||
358 | } | 347 | } |
359 | } | 348 | } |
360 | 349 | ||
361 | - async getRoles(req, res) { | 350 | + getRoles(req, res) { |
362 | rest.get({ | 351 | rest.get({ |
363 | baseUrl: "url", | 352 | baseUrl: "url", |
364 | url: "roles", | 353 | url: "roles", |
@@ -374,7 +363,7 @@ class AuthController extends Controller { | @@ -374,7 +363,7 @@ class AuthController extends Controller { | ||
374 | } | 363 | } |
375 | } | 364 | } |
376 | 365 | ||
377 | - async getUserRoles(req, res) { | 366 | + getUserRoles(req, res) { |
378 | rest.get({ | 367 | rest.get({ |
379 | baseUrl: "url", | 368 | baseUrl: "url", |
380 | url: | 369 | url: |
@@ -396,7 +385,7 @@ class AuthController extends Controller { | @@ -396,7 +385,7 @@ class AuthController extends Controller { | ||
396 | } | 385 | } |
397 | } | 386 | } |
398 | 387 | ||
399 | - async getTenant(req, res) { | 388 | + getTenant(req, res) { |
400 | rest.get({ | 389 | rest.get({ |
401 | baseUrl: "url", | 390 | baseUrl: "url", |
402 | url: "tenants/" + req.body.tenant_id, | 391 | url: "tenants/" + req.body.tenant_id, |
@@ -412,7 +401,7 @@ class AuthController extends Controller { | @@ -412,7 +401,7 @@ class AuthController extends Controller { | ||
412 | } | 401 | } |
413 | } | 402 | } |
414 | 403 | ||
415 | - async updateTenant(req, res) { | 404 | + updateTenant(req, res) { |
416 | rest.putJson({ | 405 | rest.putJson({ |
417 | baseUrl: "url", | 406 | baseUrl: "url", |
418 | url: "tenants/" + req.body.tenant_id, | 407 | url: "tenants/" + req.body.tenant_id, |
@@ -428,7 +417,7 @@ class AuthController extends Controller { | @@ -428,7 +417,7 @@ class AuthController extends Controller { | ||
428 | } | 417 | } |
429 | } | 418 | } |
430 | 419 | ||
431 | - async offer(req, res) { | 420 | + offer(req, res) { |
432 | rest.get({ | 421 | rest.get({ |
433 | baseUrl: "hrUrl", | 422 | baseUrl: "hrUrl", |
434 | url: | 423 | url: |
@@ -448,7 +437,7 @@ class AuthController extends Controller { | @@ -448,7 +437,7 @@ class AuthController extends Controller { | ||
448 | } | 437 | } |
449 | } | 438 | } |
450 | 439 | ||
451 | - async onboardStatus(req, res) { | 440 | + onboardStatus(req, res) { |
452 | rest.get({ | 441 | rest.get({ |
453 | baseUrl: "hrUrl", | 442 | baseUrl: "hrUrl", |
454 | url: "onboard-status", | 443 | url: "onboard-status", |
@@ -465,9 +454,9 @@ class AuthController extends Controller { | @@ -465,9 +454,9 @@ class AuthController extends Controller { | ||
465 | } | 454 | } |
466 | } | 455 | } |
467 | 456 | ||
468 | - async dowloadApp(req, res) { | ||
469 | - let mobileAgent = req.headers["user-agent"].toLowerCase(); | ||
470 | - let agent = { | 457 | + dowloadApp(req, res) { |
458 | + var mobileAgent = req.headers["user-agent"].toLowerCase(); | ||
459 | + var agent = { | ||
471 | android: | 460 | android: |
472 | mobileAgent.indexOf("android") > -1 || mobileAgent.indexOf("Adr") > -1, | 461 | mobileAgent.indexOf("android") > -1 || mobileAgent.indexOf("Adr") > -1, |
473 | iPhone: mobileAgent.indexOf("iphone") > -1, | 462 | iPhone: mobileAgent.indexOf("iphone") > -1, |
@@ -491,12 +480,12 @@ class AuthController extends Controller { | @@ -491,12 +480,12 @@ class AuthController extends Controller { | ||
491 | } | 480 | } |
492 | } | 481 | } |
493 | 482 | ||
494 | - async softwareLicense(res) { | 483 | + softwareLicense(res) { |
495 | res.render("softwareLicense"); | 484 | res.render("softwareLicense"); |
496 | } | 485 | } |
497 | 486 | ||
498 | - async changePassForRegister(req, res) { | ||
499 | - let options = { | 487 | + changePassForRegister(req, res) { |
488 | + var options = { | ||
500 | baseUrl: "url", | 489 | baseUrl: "url", |
501 | url: "users/" + req.body.user_id, | 490 | url: "users/" + req.body.user_id, |
502 | params: { | 491 | params: { |
@@ -523,8 +512,8 @@ class AuthController extends Controller { | @@ -523,8 +512,8 @@ class AuthController extends Controller { | ||
523 | } | 512 | } |
524 | } | 513 | } |
525 | 514 | ||
526 | - async changeTenant(req, res) { | ||
527 | - let params = { | 515 | + changeTenant(req, res) { |
516 | + var params = { | ||
528 | grant_type: "refresh_token", | 517 | grant_type: "refresh_token", |
529 | scope: "global_access:tenant_admin,tenant:" + req.body.id, | 518 | scope: "global_access:tenant_admin,tenant:" + req.body.id, |
530 | refresh_token: req.session.passport.user.refreshToken, | 519 | refresh_token: req.session.passport.user.refreshToken, |
@@ -620,7 +609,7 @@ class AuthController extends Controller { | @@ -620,7 +609,7 @@ class AuthController extends Controller { | ||
620 | } | 609 | } |
621 | } | 610 | } |
622 | 611 | ||
623 | - async sendRejectOffer(req, res) { | 612 | + sendRejectOffer(req, res) { |
624 | rest.get({ | 613 | rest.get({ |
625 | baseUrl: "hrUrl", | 614 | baseUrl: "hrUrl", |
626 | url: req.body.url, //传一个参数 | 615 | url: req.body.url, //传一个参数 |
@@ -642,7 +631,7 @@ class AuthController extends Controller { | @@ -642,7 +631,7 @@ class AuthController extends Controller { | ||
642 | } | 631 | } |
643 | } | 632 | } |
644 | 633 | ||
645 | - async acceptOffer(req, res) { | 634 | + acceptOffer(req, res) { |
646 | rest.get({ | 635 | rest.get({ |
647 | baseUrl: "hrUrl", | 636 | baseUrl: "hrUrl", |
648 | url: req.body.url, //传一个参数 | 637 | url: req.body.url, //传一个参数 |
@@ -664,7 +653,7 @@ class AuthController extends Controller { | @@ -664,7 +653,7 @@ class AuthController extends Controller { | ||
664 | } | 653 | } |
665 | } | 654 | } |
666 | 655 | ||
667 | - async imTokens(req, res) { | 656 | + imTokens(req, res) { |
668 | rest.post({ | 657 | rest.post({ |
669 | url: "auth/im_tokens", | 658 | url: "auth/im_tokens", |
670 | params: req.body, | 659 | params: req.body, |
@@ -679,7 +668,7 @@ class AuthController extends Controller { | @@ -679,7 +668,7 @@ class AuthController extends Controller { | ||
679 | } | 668 | } |
680 | } | 669 | } |
681 | 670 | ||
682 | - async listChannels(req, res) { | 671 | + listChannels(req, res) { |
683 | rest.get({ | 672 | rest.get({ |
684 | baseUrl: "chatUrl", | 673 | baseUrl: "chatUrl", |
685 | url: "channels?page_size=10&page=0&status=active", | 674 | url: "channels?page_size=10&page=0&status=active", |
@@ -695,8 +684,8 @@ class AuthController extends Controller { | @@ -695,8 +684,8 @@ class AuthController extends Controller { | ||
695 | } | 684 | } |
696 | } | 685 | } |
697 | 686 | ||
698 | - async filemeta(req, res) { | ||
699 | - let fullPath = | 687 | + filemeta(req, res) { |
688 | + var fullPath = | ||
700 | settings.restful.url + | 689 | settings.restful.url + |
701 | "filemeta" + | 690 | "filemeta" + |
702 | settings.restful.version + | 691 | settings.restful.version + |
@@ -754,8 +743,8 @@ class AuthController extends Controller { | @@ -754,8 +743,8 @@ class AuthController extends Controller { | ||
754 | } | 743 | } |
755 | } | 744 | } |
756 | 745 | ||
757 | - async getCustomerQrcode(req, res) { | ||
758 | - let fullPath = | 746 | + getCustomerQrcode(req, res) { |
747 | + var fullPath = | ||
759 | settings.restful.url + | 748 | settings.restful.url + |
760 | "crm" + | 749 | "crm" + |
761 | settings.restful.version + | 750 | settings.restful.version + |
@@ -784,8 +773,8 @@ class AuthController extends Controller { | @@ -784,8 +773,8 @@ class AuthController extends Controller { | ||
784 | } | 773 | } |
785 | } | 774 | } |
786 | 775 | ||
787 | - async getPositionQrcode(req, res) { | ||
788 | - let fullPath = | 776 | + getPositionQrcode(req, res) { |
777 | + var fullPath = | ||
789 | settings.restful.url + | 778 | settings.restful.url + |
790 | "recruit" + | 779 | "recruit" + |
791 | settings.restful.version + | 780 | settings.restful.version + |
@@ -815,8 +804,8 @@ class AuthController extends Controller { | @@ -815,8 +804,8 @@ class AuthController extends Controller { | ||
815 | } | 804 | } |
816 | } | 805 | } |
817 | 806 | ||
818 | - async getOSSConfig(req, res) { | ||
819 | - let fullPath = | 807 | + getOSSConfig(req, res) { |
808 | + var fullPath = | ||
820 | settings.restful.url + "filemeta" + settings.restful.version + "/config"; | 809 | settings.restful.url + "filemeta" + settings.restful.version + "/config"; |
821 | let options = { | 810 | let options = { |
822 | service_catalog: "", | 811 | service_catalog: "", |
@@ -844,7 +833,7 @@ class AuthController extends Controller { | @@ -844,7 +833,7 @@ class AuthController extends Controller { | ||
844 | } | 833 | } |
845 | } | 834 | } |
846 | 835 | ||
847 | - async weidianTempLate(req, res) { | 836 | + weidianTempLate(req, res) { |
848 | const { params } = req; | 837 | const { params } = req; |
849 | let fullPath = | 838 | let fullPath = |
850 | settings.restful.url + "socialwork/internal/minishop/" + params.id; | 839 | settings.restful.url + "socialwork/internal/minishop/" + params.id; |
@@ -882,10 +871,8 @@ class AuthController extends Controller { | @@ -882,10 +871,8 @@ class AuthController extends Controller { | ||
882 | } | 871 | } |
883 | } | 872 | } |
884 | 873 | ||
885 | - async workaiSecurityOAuth(req, res) { | ||
886 | - const { logger } = this; | ||
887 | - let params = req.query; | ||
888 | - | 874 | + workaiSecurityOAuth(req, res) { |
875 | + var params = req.query; | ||
889 | if (params.authorization_code) { | 876 | if (params.authorization_code) { |
890 | let passport = { | 877 | let passport = { |
891 | user: { | 878 | user: { |
@@ -941,7 +928,7 @@ class AuthController extends Controller { | @@ -941,7 +928,7 @@ class AuthController extends Controller { | ||
941 | callback(err, data); | 928 | callback(err, data); |
942 | } | 929 | } |
943 | }) | 930 | }) |
944 | - .on("error", function (err, response) { | 931 | + .on("error", function (_err, response) { |
945 | let err = new Error("Third login err"); | 932 | let err = new Error("Third login err"); |
946 | 933 | ||
947 | callback(err, response); | 934 | callback(err, response); |
@@ -984,7 +971,7 @@ class AuthController extends Controller { | @@ -984,7 +971,7 @@ class AuthController extends Controller { | ||
984 | callback(err, data); | 971 | callback(err, data); |
985 | } | 972 | } |
986 | }) | 973 | }) |
987 | - .on("error", function (err, response) { | 974 | + .on("error", function (_err, response) { |
988 | let err = new Error("Third login tenants list err"); | 975 | let err = new Error("Third login tenants list err"); |
989 | 976 | ||
990 | callback(err, response); | 977 | callback(err, response); |
@@ -1058,8 +1045,8 @@ class AuthController extends Controller { | @@ -1058,8 +1045,8 @@ class AuthController extends Controller { | ||
1058 | callback(err, data2); | 1045 | callback(err, data2); |
1059 | } | 1046 | } |
1060 | }) | 1047 | }) |
1061 | - .on("error", function (err, response) { | ||
1062 | - logger.error("Third login error", err); | 1048 | + .on("error", function (_err, response) { |
1049 | + logger.error("Third login error", _err); | ||
1063 | 1050 | ||
1064 | let err = new Error("Third login err"); | 1051 | let err = new Error("Third login err"); |
1065 | 1052 | ||
@@ -1139,9 +1126,8 @@ class AuthController extends Controller { | @@ -1139,9 +1126,8 @@ class AuthController extends Controller { | ||
1139 | } | 1126 | } |
1140 | } | 1127 | } |
1141 | 1128 | ||
1142 | - async getTastLink(req, res) { | ||
1143 | - let url = crypto.createHash("md5").update(req.body.id).digest("hex"); | ||
1144 | - | 1129 | + getTastLink(req, res) { |
1130 | + var url = crypto.createHash("md5").update(req.body.id).digest("hex"); | ||
1145 | if (settings.prefix && settings.prefix.length > 1) { | 1131 | if (settings.prefix && settings.prefix.length > 1) { |
1146 | res.send( | 1132 | res.send( |
1147 | req.protocol + | 1133 | req.protocol + |
@@ -1167,10 +1153,9 @@ class AuthController extends Controller { | @@ -1167,10 +1153,9 @@ class AuthController extends Controller { | ||
1167 | } | 1153 | } |
1168 | } | 1154 | } |
1169 | 1155 | ||
1170 | - async freedomJobsEmp(req, res) { | ||
1171 | - const { logger } = this; | ||
1172 | - let id = req.params.id; | ||
1173 | - | 1156 | + freedomJobsEmp(req, res) { |
1157 | + var id = req.params.id; | ||
1158 | + // var url = crypto.createHash('md5').update(id).digest('hex'); | ||
1174 | if (false) { | 1159 | if (false) { |
1175 | //验证未通过verification != url | 1160 | //验证未通过verification != url |
1176 | if (settings.prefix && settings.prefix.length > 1) { | 1161 | if (settings.prefix && settings.prefix.length > 1) { |
@@ -1234,8 +1219,8 @@ class AuthController extends Controller { | @@ -1234,8 +1219,8 @@ class AuthController extends Controller { | ||
1234 | passport.user.err = data.message; | 1219 | passport.user.err = data.message; |
1235 | } | 1220 | } |
1236 | }) | 1221 | }) |
1237 | - .on("error", function (err, response) { | ||
1238 | - logger.error("Third login error", err); | 1222 | + .on("error", function (_err, response) { |
1223 | + logger.error("Third login error", _err); | ||
1239 | 1224 | ||
1240 | let err = new Error("Third login err"); | 1225 | let err = new Error("Third login err"); |
1241 | 1226 | ||
@@ -1247,9 +1232,8 @@ class AuthController extends Controller { | @@ -1247,9 +1232,8 @@ class AuthController extends Controller { | ||
1247 | } | 1232 | } |
1248 | } | 1233 | } |
1249 | 1234 | ||
1250 | - async getShortToken(req, res) { | ||
1251 | - const { logger } = this; | ||
1252 | - let params = { | 1235 | + getShortToken(req, res) { |
1236 | + var params = { | ||
1253 | grant_type: "refresh_token", | 1237 | grant_type: "refresh_token", |
1254 | scope: req.session.passport.user.scope, | 1238 | scope: req.session.passport.user.scope, |
1255 | refresh_token: req.session.passport.user.refreshToken, | 1239 | refresh_token: req.session.passport.user.refreshToken, |
app/controller/home.js
已删除
100644 → 0
1 | -'use strict'; | ||
2 | -const Controller = require('egg').Controller; | 1 | +"use strict"; |
2 | +const Controller = require("egg").Controller; | ||
3 | 3 | ||
4 | class ProxyController extends Controller { | 4 | class ProxyController extends Controller { |
5 | async info() { | 5 | async info() { |
@@ -15,16 +15,22 @@ class ProxyController extends Controller { | @@ -15,16 +15,22 @@ class ProxyController extends Controller { | ||
15 | const { ctx } = this; | 15 | const { ctx } = this; |
16 | const { session, headers, ip } = ctx; | 16 | const { session, headers, ip } = ctx; |
17 | 17 | ||
18 | - if (session.passport && session.passport.user && session.passport.user && session.passport.user.token) { | ||
19 | - options.headers['Authorization'] = "Bearer " + session.passport.user.token; | 18 | + if ( |
19 | + session.passport && | ||
20 | + session.passport.user && | ||
21 | + session.passport.user && | ||
22 | + session.passport.user.token | ||
23 | + ) { | ||
24 | + options.headers["Authorization"] = | ||
25 | + "Bearer " + session.passport.user.token; | ||
20 | } | 26 | } |
21 | 27 | ||
22 | - if (headers['device-id']) { | ||
23 | - options.headers['Device-Id'] = headers['device-id']; | 28 | + if (headers["device-id"]) { |
29 | + options.headers["Device-Id"] = headers["device-id"]; | ||
24 | } | 30 | } |
25 | 31 | ||
26 | if (ip) { | 32 | if (ip) { |
27 | - options.headers['Client-Ip'] = ip; | 33 | + options.headers["Client-Ip"] = ip; |
28 | } | 34 | } |
29 | 35 | ||
30 | return options; | 36 | return options; |
@@ -43,7 +49,7 @@ class ProxyController extends Controller { | @@ -43,7 +49,7 @@ class ProxyController extends Controller { | ||
43 | 49 | ||
44 | addParams(options) { | 50 | addParams(options) { |
45 | const { ctx } = this; | 51 | const { ctx } = this; |
46 | - const postData = !ctx.body ? '' : JSON.stringify(ctx.body || {}); | 52 | + const postData = !ctx.body ? "" : JSON.stringify(ctx.body || {}); |
47 | 53 | ||
48 | options.params = postData; | 54 | options.params = postData; |
49 | } | 55 | } |
@@ -52,69 +58,53 @@ class ProxyController extends Controller { | @@ -52,69 +58,53 @@ class ProxyController extends Controller { | ||
52 | const { params, headers } = options; | 58 | const { params, headers } = options; |
53 | 59 | ||
54 | if (params) { | 60 | if (params) { |
55 | - headers['Content-Length'] = params.length; | 61 | + headers["Content-Length"] = params.length; |
56 | } | 62 | } |
57 | } | 63 | } |
58 | 64 | ||
59 | getOptions(url, type) { | 65 | getOptions(url, type) { |
60 | - const { config } = this; | 66 | + const { config,ctx,logger } = this; |
67 | + const { session } = ctx; | ||
68 | + const { access_token } = session.user_info; | ||
61 | const { restful = {} } = config; | 69 | const { restful = {} } = config; |
62 | const { version, host, port } = restful; | 70 | const { version, host, port } = restful; |
63 | - const catalog = url.substring(1, url.indexOf('/', 1)); | ||
64 | - const pathUrl = url.substring(url.indexOf('/', 1)); | ||
65 | - const fullPath = '/' + catalog + version + pathUrl; | 71 | + logger.info(version,'version') |
72 | + const catalog = url.substring(1, url.indexOf("/", 1)); | ||
73 | + const pathUrl = url.substring(url.indexOf("/", 1)); | ||
74 | + const fullPath = "/" + catalog + version + pathUrl; | ||
66 | 75 | ||
67 | return { | 76 | return { |
68 | - 'host': host, //后台请求地址 | ||
69 | - 'port': port, | ||
70 | - 'path': fullPath, | ||
71 | - 'method': type, | ||
72 | - 'agent': false, | ||
73 | - 'headers': { | ||
74 | - "Accept": "application/json", | 77 | + host: host, //后台请求地址 |
78 | + port: port, | ||
79 | + path: fullPath, | ||
80 | + method: type, | ||
81 | + agent: false, | ||
82 | + headers: { | ||
83 | + authorization: `Bearer ${access_token}`, | ||
84 | + Accept: "application/json", | ||
75 | "Content-Type": "application/json", | 85 | "Content-Type": "application/json", |
76 | - 'User-Agent': 'Request for Express' | ||
77 | - } | 86 | + // "User-Agent": "Request for Express", |
87 | + }, | ||
78 | }; | 88 | }; |
79 | } | 89 | } |
80 | 90 | ||
81 | async get() { | 91 | async get() { |
82 | - const { ctx, config, logger } = this; | ||
83 | - const { originalUrl, session, curl } = ctx; | ||
84 | - const { restful = {} } = config; | ||
85 | - const { host } = restful; | ||
86 | - const { access_token } = session.user_info; | ||
87 | - const url = splitUrl(originalUrl); | ||
88 | - const options = getOptions(url, 'GET'); | ||
89 | - | ||
90 | - addToken(options); | ||
91 | - | ||
92 | - const result = await curl( | ||
93 | - `${host}${url}`, | ||
94 | - { | ||
95 | - method: 'GET', | ||
96 | - dataType: 'json', | ||
97 | - headers: { | ||
98 | - 'authorization': `Bearer ${access_token}`, | ||
99 | - 'accept': 'application/json', | ||
100 | - 'content-type': 'application/json' | ||
101 | - }, | ||
102 | - timeout: [5000, 60000] | ||
103 | - } | ||
104 | - ); | ||
105 | - | ||
106 | - logger.info( | ||
107 | - "get originalUrl:", | ||
108 | - `${splitUrl(originalUrl)}`, | ||
109 | - "get host:", | ||
110 | - `${host}`, | ||
111 | - "get url:", | ||
112 | - `${url}`, | ||
113 | - "result:", | ||
114 | - result | ||
115 | - ); | ||
116 | - | ||
117 | - ctx.body = result.data || {}; | 92 | + const { ctx, logger } = this; |
93 | + const { originalUrl, } = ctx; | ||
94 | + const url = this.splitUrl(originalUrl); | ||
95 | + const options = this.getOptions(url, 'GET'); | ||
96 | + const {host ,port,path,...rest} = options | ||
97 | + logger.info(`${host}:${port}${path}`, { | ||
98 | + ...rest, | ||
99 | + timeout: [5000, 60000], | ||
100 | + },12312321) | ||
101 | + const result = await ctx.curl(`${host}:${port}${path}`, { | ||
102 | + ...rest, | ||
103 | + timeout: [5000, 60000], | ||
104 | + }); | ||
105 | + logger.info("result:", result); | ||
106 | + | ||
107 | + ctx.body = result.data|| {}; | ||
118 | 108 | ||
119 | return ctx.body; | 109 | return ctx.body; |
120 | } | 110 | } |
@@ -124,37 +114,34 @@ class ProxyController extends Controller { | @@ -124,37 +114,34 @@ class ProxyController extends Controller { | ||
124 | const { originalUrl, session, curl, request } = ctx; | 114 | const { originalUrl, session, curl, request } = ctx; |
125 | const { restful = {} } = config; | 115 | const { restful = {} } = config; |
126 | const { host } = restful; | 116 | const { host } = restful; |
127 | - const { access_token } = session.user_info | ||
128 | - const url = splitUrl(originalUrl); | ||
129 | - const options = getOptions(url, 'POST'); | 117 | + const { access_token } = session.user_info; |
118 | + const url = this.splitUrl(originalUrl); | ||
119 | + const options = this.getOptions(url, "POST"); | ||
130 | 120 | ||
131 | - addToken(options); | 121 | + this.addToken(options); |
132 | addParams(options); | 122 | addParams(options); |
133 | 123 | ||
134 | - const result = await curl( | ||
135 | - `${host}${url}`, | ||
136 | - { | ||
137 | - method: 'POST', | ||
138 | - dataType: 'json', | ||
139 | - data: JSON.stringify(request.body), | ||
140 | - headers: { | ||
141 | - 'authorization': `Bearer ${access_token}`, | ||
142 | - 'accept': 'application/json', | ||
143 | - 'content-type': 'application/json' | ||
144 | - } | ||
145 | - } | ||
146 | - ); | 124 | + const result = await curl(`${host}${url}`, { |
125 | + method: "POST", | ||
126 | + dataType: "json", | ||
127 | + data: JSON.stringify(request.body), | ||
128 | + headers: { | ||
129 | + authorization: `Bearer ${access_token}`, | ||
130 | + accept: "application/json", | ||
131 | + "content-type": "application/json", | ||
132 | + }, | ||
133 | + }); | ||
147 | 134 | ||
148 | logger.info( | 135 | logger.info( |
149 | "post proxy url:", | 136 | "post proxy url:", |
150 | `${host}${url}`, | 137 | `${host}${url}`, |
151 | - 'headers', | 138 | + "headers", |
152 | { | 139 | { |
153 | - 'authorization': `Bearer ${access_token}`, | ||
154 | - 'accept': 'application/json', | ||
155 | - 'content-type': 'application/json' | 140 | + authorization: `Bearer ${access_token}`, |
141 | + accept: "application/json", | ||
142 | + "content-type": "application/json", | ||
156 | }, | 143 | }, |
157 | - 'data', | 144 | + "data", |
158 | JSON.stringify(request.body) | 145 | JSON.stringify(request.body) |
159 | ); | 146 | ); |
160 | 147 | ||
@@ -169,36 +156,33 @@ class ProxyController extends Controller { | @@ -169,36 +156,33 @@ class ProxyController extends Controller { | ||
169 | const { hroProxy = {} } = config; | 156 | const { hroProxy = {} } = config; |
170 | const { host } = hroProxy; | 157 | const { host } = hroProxy; |
171 | const { access_token } = session.user_info; | 158 | const { access_token } = session.user_info; |
172 | - const url = splitUrl(originalUrl); | ||
173 | - const options = getOptions(url, 'PUT'); | 159 | + const url = this.splitUrl(originalUrl); |
160 | + const options = this.getOptions(url, "PUT"); | ||
174 | 161 | ||
175 | - addToken(options); | 162 | + this.addToken(options); |
176 | addParams(options); | 163 | addParams(options); |
177 | 164 | ||
178 | - const result = await curl( | ||
179 | - `${host}${url}`, | ||
180 | - { | ||
181 | - method: 'PUT', | ||
182 | - dataType: 'json', | ||
183 | - data: JSON.stringify(request.body), | ||
184 | - headers: { | ||
185 | - 'authorization': `Bearer ${access_token}`, | ||
186 | - 'accept': 'application/json', | ||
187 | - 'content-type': 'application/json' | ||
188 | - } | ||
189 | - } | ||
190 | - ); | 165 | + const result = await curl(`${host}${url}`, { |
166 | + method: "PUT", | ||
167 | + dataType: "json", | ||
168 | + data: JSON.stringify(request.body), | ||
169 | + headers: { | ||
170 | + authorization: `Bearer ${access_token}`, | ||
171 | + accept: "application/json", | ||
172 | + "content-type": "application/json", | ||
173 | + }, | ||
174 | + }); | ||
191 | 175 | ||
192 | logger.info( | 176 | logger.info( |
193 | "put proxy url:", | 177 | "put proxy url:", |
194 | `${host}${url}`, | 178 | `${host}${url}`, |
195 | - 'headers', | 179 | + "headers", |
196 | { | 180 | { |
197 | - 'authorization': `Bearer ${access_token}`, | ||
198 | - 'accept': 'application/json', | ||
199 | - 'content-type': 'application/json' | 181 | + authorization: `Bearer ${access_token}`, |
182 | + accept: "application/json", | ||
183 | + "content-type": "application/json", | ||
200 | }, | 184 | }, |
201 | - 'data', | 185 | + "data", |
202 | JSON.stringify(request.body) | 186 | JSON.stringify(request.body) |
203 | ); | 187 | ); |
204 | 188 | ||
@@ -213,36 +197,33 @@ class ProxyController extends Controller { | @@ -213,36 +197,33 @@ class ProxyController extends Controller { | ||
213 | const { hroProxy = {} } = config; | 197 | const { hroProxy = {} } = config; |
214 | const { host } = hroProxy; | 198 | const { host } = hroProxy; |
215 | const { access_token } = session.user_info; | 199 | const { access_token } = session.user_info; |
216 | - const url = splitUrl(originalUrl); | ||
217 | - const options = getOptions(url, 'HEAD'); | 200 | + const url = this.splitUrl(originalUrl); |
201 | + const options = this.getOptions(url, "HEAD"); | ||
218 | 202 | ||
219 | - addToken(options); | 203 | + this.addToken(options); |
220 | addParams(options); | 204 | addParams(options); |
221 | 205 | ||
222 | - const result = await curl( | ||
223 | - `${host}${url}`, | ||
224 | - { | ||
225 | - method: 'HEAD', | ||
226 | - dataType: 'json', | ||
227 | - data: JSON.stringify(request.body), | ||
228 | - headers: { | ||
229 | - 'authorization': `Bearer ${access_token}`, | ||
230 | - 'accept': 'application/json', | ||
231 | - 'content-type': 'application/json' | ||
232 | - } | ||
233 | - } | ||
234 | - ); | 206 | + const result = await curl(`${host}${url}`, { |
207 | + method: "HEAD", | ||
208 | + dataType: "json", | ||
209 | + data: JSON.stringify(request.body), | ||
210 | + headers: { | ||
211 | + authorization: `Bearer ${access_token}`, | ||
212 | + accept: "application/json", | ||
213 | + "content-type": "application/json", | ||
214 | + }, | ||
215 | + }); | ||
235 | 216 | ||
236 | logger.info( | 217 | logger.info( |
237 | "head proxy url:", | 218 | "head proxy url:", |
238 | `${host}${url}`, | 219 | `${host}${url}`, |
239 | - 'headers', | 220 | + "headers", |
240 | { | 221 | { |
241 | - 'authorization': `Bearer ${access_token}`, | ||
242 | - 'accept': 'application/json', | ||
243 | - 'content-type': 'application/json' | 222 | + authorization: `Bearer ${access_token}`, |
223 | + accept: "application/json", | ||
224 | + "content-type": "application/json", | ||
244 | }, | 225 | }, |
245 | - 'data', | 226 | + "data", |
246 | JSON.stringify(request.body) | 227 | JSON.stringify(request.body) |
247 | ); | 228 | ); |
248 | 229 | ||
@@ -256,37 +237,29 @@ class ProxyController extends Controller { | @@ -256,37 +237,29 @@ class ProxyController extends Controller { | ||
256 | const { originalUrl, session, curl } = ctx; | 237 | const { originalUrl, session, curl } = ctx; |
257 | const { hroProxy = {} } = config; | 238 | const { hroProxy = {} } = config; |
258 | const { host } = hroProxy; | 239 | const { host } = hroProxy; |
259 | - const { access_token } = session.user_info | ||
260 | - const url = splitUrl(originalUrl); | ||
261 | - const options = getOptions(url, 'DELETE'); | 240 | + const { access_token } = session.user_info; |
241 | + const url = this.splitUrl(originalUrl); | ||
242 | + const options = this.getOptions(url, "DELETE"); | ||
262 | 243 | ||
263 | - addToken(options); | 244 | + this.addToken(options); |
264 | addParams(options); | 245 | addParams(options); |
265 | addContentLength(options); | 246 | addContentLength(options); |
266 | 247 | ||
267 | - const result = await curl( | ||
268 | - `${host}${url}`, | ||
269 | - { | ||
270 | - method: 'DELETE', | ||
271 | - dataType: 'json', | ||
272 | - headers: { | ||
273 | - 'authorization': `Bearer ${access_token}`, | ||
274 | - 'accept': 'application/json', | ||
275 | - 'content-type': 'application/json' | ||
276 | - } | ||
277 | - } | ||
278 | - ); | 248 | + const result = await curl(`${host}${url}`, { |
249 | + method: "DELETE", | ||
250 | + dataType: "json", | ||
251 | + headers: { | ||
252 | + authorization: `Bearer ${access_token}`, | ||
253 | + accept: "application/json", | ||
254 | + "content-type": "application/json", | ||
255 | + }, | ||
256 | + }); | ||
279 | 257 | ||
280 | - logger.info( | ||
281 | - "delete proxy url:", | ||
282 | - `${host}${url}`, | ||
283 | - 'headers:', | ||
284 | - { | ||
285 | - 'authorization': `Bearer ${access_token}`, | ||
286 | - 'accept': 'application/json', | ||
287 | - 'content-type': 'application/json' | ||
288 | - } | ||
289 | - ); | 258 | + logger.info("delete proxy url:", `${host}${url}`, "headers:", { |
259 | + authorization: `Bearer ${access_token}`, | ||
260 | + accept: "application/json", | ||
261 | + "content-type": "application/json", | ||
262 | + }); | ||
290 | 263 | ||
291 | ctx.body = result.data || {}; | 264 | ctx.body = result.data || {}; |
292 | 265 |
app/middleware/authorization.js
0 → 100644
1 | +/* | ||
2 | + * 添加passport验证登录权限方法 | ||
3 | + */ | ||
4 | +module.exports = (app) => { | ||
5 | + app.passport.verify(async (ctx, user) => { | ||
6 | + const { provider = "" } = user; | ||
7 | + const { service = {} } = ctx; | ||
8 | + const { redirect_uri } = ctx.request.body; | ||
9 | + let result; | ||
10 | + switch (provider) { | ||
11 | + case "local": | ||
12 | + result = await service.login.localLogin(user); | ||
13 | + break; | ||
14 | + default: | ||
15 | + // console.log("error:", user) | ||
16 | + break; | ||
17 | + } | ||
18 | + if (result && result.code >= 300) { | ||
19 | + ctx.status = result.status; | ||
20 | + ctx.body = result.data; | ||
21 | + return false; | ||
22 | + } | ||
23 | + if (!result) { | ||
24 | + ctx.status = 500; | ||
25 | + ctx.body = { | ||
26 | + message: "用户或密码错误", | ||
27 | + }; | ||
28 | + return false; | ||
29 | + } | ||
30 | + if (redirect_uri) { | ||
31 | + ctx.session.returnTo = `${redirect_uri}?ticket=${Math.random(10000)}`; | ||
32 | + } | ||
33 | + return result; | ||
34 | + }); | ||
35 | + | ||
36 | + // 序列化与反序列化,序列化存储到session中只保存用户id | ||
37 | + app.passport.serializeUser(async (ctx, user) => { | ||
38 | + console.log(user, "user"); | ||
39 | + return user; | ||
40 | + }); | ||
41 | + | ||
42 | + app.passport.deserializeUser(async (ctx, user) => { | ||
43 | + console.log(user,'kncvkxznkcxlklasdjfajdfldkasjflkasdnvkasdnmklasndvldnsa'); | ||
44 | + return user; | ||
45 | + }); | ||
46 | +}; |
@@ -4,6 +4,6 @@ | @@ -4,6 +4,6 @@ | ||
4 | * @param {Egg.Application} app - egg application | 4 | * @param {Egg.Application} app - egg application |
5 | */ | 5 | */ |
6 | module.exports = app => { | 6 | module.exports = app => { |
7 | + require('./router/api')(app); | ||
7 | require('./router/auth')(app); | 8 | require('./router/auth')(app); |
8 | - require('./router/home')(app); | ||
9 | }; | 9 | }; |
1 | +// var payRoll = require("../json/payRoll.json"); | ||
1 | 2 | ||
2 | module.exports = (app) => { | 3 | module.exports = (app) => { |
3 | - const { router, controller } = app; | 4 | + const { router, controller} = app; |
4 | const { auth } = controller; | 5 | const { auth } = controller; |
5 | -console.log('controllerxxxxx',controller); | ||
6 | - router.get("/signOut", auth.signOut); | ||
7 | - | ||
8 | - // router.get("/img/*", auth.getImg); | ||
9 | 6 | ||
10 | - // router.get("/", auth.indexPrefix); | 7 | + const localStrategy = app.passport.authenticate("local", { |
8 | + successRedirect: "/doLogin/loginCallback", | ||
9 | + failureRedirect: "/doLogin/loginCallback", | ||
10 | + }); | ||
11 | + // router.get("/index", controller.index); | ||
12 | + router.get("/signOut", auth.signOut); | ||
11 | 13 | ||
12 | - // router.get("/productDes", auth.productDes); | 14 | + router.get("/", auth.indexPrefix); |
13 | 15 | ||
14 | - // router.get("/register", auth.register); | 16 | + router.get("/productDes", auth.productDes); |
15 | 17 | ||
16 | - // router.get("/mobileRegister", auth.mobileRegister); | 18 | + router.get("/register", auth.register); |
17 | 19 | ||
18 | - // router.get("/mobileRegisterSuccess", auth.mobileRegisterSuccess); | 20 | + router.get("/mobileRegister", auth.mobileRegister); |
19 | 21 | ||
20 | - // router.get("/signIn", auth.signIn); | 22 | + router.get("/mobileRegisterSuccess", auth.mobileRegisterSuccess); |
21 | 23 | ||
22 | - // router.post("/doLogin", auth.doLogin); | 24 | + router.get("/signIn", auth.signIn); |
23 | 25 | ||
24 | - // router.get("/signOut", auth.signOut); | 26 | + router.post("/doLogin", localStrategy); |
25 | 27 | ||
26 | - // router.post("/smsCodes", auth.smsCodes); | 28 | + router.get('/doLogin/loginCallback', auth.loginCallback); |
27 | 29 | ||
28 | - // router.post("/tenants", auth.tenants); | 30 | + router.post("/smsCodes", auth.smsCodes); |
29 | 31 | ||
30 | - // router.post("/resetPass", auth.resetPass); | 32 | + router.post("/tenants", auth.tenants); |
31 | 33 | ||
32 | - // router.post("/updatePassword", auth.updatePassword); | 34 | + router.post("/resetPass", auth.resetPass); |
33 | 35 | ||
34 | - // router.post("/loadUserInfo", auth.loadUserInfo); | 36 | + router.post("/updatePassword", auth.updatePassword); |
35 | 37 | ||
36 | - // router.post("/getUploaderToken", auth.getUploaderToken); | 38 | + router.post("/loadUserInfo", auth.loadUserInfo); |
37 | 39 | ||
38 | - // router.post("/delOSSObject", auth.delOSSObject); | 40 | + router.post("/getUploaderToken", auth.getUploaderToken); |
39 | 41 | ||
40 | - // router.post("/smsVerification", auth.smsVerification); | 42 | + router.post("/delOSSObject", auth.delOSSObject); |
41 | 43 | ||
42 | - // router.post("/getObjectTokenByID", auth.getObjectTokenByID); | 44 | + router.post("/smsVerification", auth.smsVerification); |
43 | 45 | ||
44 | - // router.post("/getUserRoles", auth.getUserRoles); | 46 | + router.post("/getObjectTokenByID", auth.getObjectTokenByID); |
45 | 47 | ||
46 | - // router.post("/getRoles", auth.getRoles); | 48 | + // router.get( |
49 | + // '/healthMonitor', | ||
50 | + // auth.healthMonitor | ||
51 | + // ) | ||
47 | 52 | ||
48 | - // router.post("/updateUserRoles", auth.updateUserRoles); | 53 | + // router.head( |
54 | + // '/healthMonitor', | ||
55 | + // auth.healthMonitor | ||
56 | + // ) | ||
49 | 57 | ||
50 | - // router.post("/getTenant", auth.getTenant); | 58 | + router.post("/getUserRoles", auth.getUserRoles); |
51 | 59 | ||
52 | - // router.post("/updateTenant", auth.updateTenant); | 60 | + router.post("/getRoles", auth.getRoles); |
53 | 61 | ||
54 | - // router.get("/offer/:requestId", auth.offer); | 62 | + router.post("/updateUserRoles", auth.updateUserRoles); |
55 | 63 | ||
56 | - // router.post("/onboardStatus", auth.onboardStatus); | 64 | + router.post("/getTenant", auth.getTenant); |
57 | 65 | ||
58 | - // router.get("/downloadApp", auth.dowloadApp); | 66 | + router.post("/updateTenant", auth.updateTenant); |
59 | 67 | ||
60 | - // router.get("/info/policy", auth.softwareLicense); | 68 | + router.get("/offer/:requestId", auth.offer); |
61 | 69 | ||
62 | - // router.get("/recharge", auth.recharge); | 70 | + router.post("/onboardStatus", auth.onboardStatus); |
63 | 71 | ||
64 | - // router.post("/changePassForRegister", auth.changePassForRegister); | 72 | + router.get("/downloadApp", auth.dowloadApp); |
65 | 73 | ||
66 | - // router.post("/changeTenant", auth.changeTenant); | 74 | + router.get("/info/policy", auth.softwareLicense); |
67 | 75 | ||
68 | - // router.post("/hr/sendRejectOffer", auth.sendRejectOffer); | 76 | + // router.get("/payRoll", function (req, res, next) { |
77 | + // res.send(payRoll); | ||
78 | + // }); | ||
69 | 79 | ||
70 | - // router.post("/hr/acceptOffer", auth.acceptOffer); | 80 | + router.get("/recharge", auth.recharge); |
71 | 81 | ||
72 | - // router.post("/imTokens", auth.imTokens); | 82 | + router.post("/changePassForRegister", auth.changePassForRegister); |
73 | 83 | ||
74 | - // router.post("/listChannels", auth.listChannels); | 84 | + router.post("/changeTenant", auth.changeTenant); |
75 | 85 | ||
76 | - // router.post("/getTastLink", auth.getTastLink); | 86 | + router.post("/hr/sendRejectOffer", auth.sendRejectOffer); |
77 | 87 | ||
78 | - // router.get("/filemeta", auth.filemeta); | 88 | + router.post("/hr/acceptOffer", auth.acceptOffer); |
79 | 89 | ||
80 | - // router.get("/getCustomerQrcode", auth.getCustomerQrcode); | 90 | + router.post("/imTokens", auth.imTokens); |
81 | 91 | ||
82 | - // router.get("/getPositionQrcode", auth.getPositionQrcode); | 92 | + router.post("/listChannels", auth.listChannels); |
83 | 93 | ||
84 | - // router.get("/minishop/:id", auth.weidianTempLate); | 94 | + router.post("/getTastLink", auth.getTastLink); |
85 | 95 | ||
86 | - // router.get("/wso-workai", auth.workaiSecurityOAuth); | 96 | + router.get("/filemeta", auth.filemeta); |
87 | 97 | ||
88 | - // router.get( | ||
89 | - // "/socialwork/freedom-jobs/emps/:id/:verification", | ||
90 | - // auth.freedomJobsEmp | ||
91 | - // ); | 98 | + router.get("/getCustomerQrcode", auth.getCustomerQrcode); |
92 | 99 | ||
93 | - // router.get("/socialwork/freedom-jobs/emps/:id", auth.freedomJobsEmp); | 100 | + router.get("/getPositionQrcode", auth.getPositionQrcode); |
94 | 101 | ||
95 | - // router.get("/getShortToken", auth.getShortToken); | 102 | + router.get("/minishop/:id", auth.weidianTempLate); |
96 | 103 | ||
97 | - // router.get("/gainianrenli/*", auth.getImg); | 104 | + router.get("/wso-workai", auth.workaiSecurityOAuth); |
98 | 105 | ||
99 | - // router.get("/waifu_img/*", auth.getImg); | 106 | + router.get( |
107 | + "/socialwork/freedom-jobs/emps/:id/:verification", | ||
108 | + auth.freedomJobsEmp | ||
109 | + ); | ||
100 | 110 | ||
101 | - // router.get("/my_img/*", auth.getImg); | 111 | + router.get("/socialwork/freedom-jobs/emps/:id", auth.freedomJobsEmp); |
102 | 112 | ||
103 | - // router.get("/invoice_file_icon/*", auth.getImg); | 113 | + router.get("/getShortToken", auth.getShortToken); |
104 | 114 | ||
105 | - // router.get("/gainianrenli/*", auth.getImg); | ||
106 | - | ||
107 | - // router.get("/claim_icons/*", auth.getImg); | 115 | + // router.get("/gainianrenli/*", controller.getImg); |
116 | + // router.get("/waifu_img/*", controller.getImg); | ||
117 | + // router.get("/my_img/*", controller.getImg); | ||
118 | + // router.get("/invoice_file_icon/*", controller.getImg); | ||
119 | + // router.get("/gainianrenli/*", controller.getImg); | ||
120 | + // router.get("/claim_icons/*", controller.getImg); | ||
108 | }; | 121 | }; |
app/router/home.js
已删除
100644 → 0
app/service/login.js
0 → 100644
1 | +const Service = require('egg').Service; | ||
2 | + | ||
3 | +class LoginService extends Service { | ||
4 | + async localLogin(user,access_token='') { | ||
5 | + const { ctx, config={}, app, logger } = this; | ||
6 | + const { restful={} } = config; | ||
7 | + const { host, port, tokenUrl,tokenMethod} = restful; | ||
8 | + const result = await ctx.curl(`${host}:${port}${tokenUrl}`, { | ||
9 | + method: `${tokenMethod}`, | ||
10 | + dataType: 'json', | ||
11 | + data: JSON.stringify(ctx.request.body), | ||
12 | + headers: { | ||
13 | + 'authorization': `Bearer ${access_token}`, | ||
14 | + 'accept': 'application/json', | ||
15 | + 'content-type': 'application/json' | ||
16 | + }, | ||
17 | + timeout: [5000, 60000] | ||
18 | + }); | ||
19 | + ctx.session.user_info = result.data; | ||
20 | + return result; | ||
21 | + } | ||
22 | + | ||
23 | +} | ||
24 | + | ||
25 | +module.exports = LoginService; |
1 | /* eslint valid-jsdoc: "off" */ | 1 | /* eslint valid-jsdoc: "off" */ |
2 | 2 | ||
3 | -'use strict'; | 3 | +"use strict"; |
4 | 4 | ||
5 | -const path = require('path') | 5 | +const path = require("path"); |
6 | /** | 6 | /** |
7 | * @param {Egg.EggAppInfo} appInfo app info | 7 | * @param {Egg.EggAppInfo} appInfo app info |
8 | */ | 8 | */ |
9 | -module.exports = appInfo => { | 9 | +module.exports = (appInfo) => { |
10 | /** | 10 | /** |
11 | * built-in config | 11 | * built-in config |
12 | * @type {Egg.EggAppConfig} | 12 | * @type {Egg.EggAppConfig} |
13 | **/ | 13 | **/ |
14 | - const config = exports = {}; | 14 | + const config = (exports = {}); |
15 | // use for cookie sign key, should change to your own and keep security | 15 | // use for cookie sign key, should change to your own and keep security |
16 | - config.keys = appInfo.name + '_1642067379356_9612'; | 16 | + config.keys = appInfo.name + "_1642067379356_9612"; |
17 | 17 | ||
18 | // add your middleware config here | 18 | // add your middleware config here |
19 | config.middleware = []; | 19 | config.middleware = []; |
@@ -24,50 +24,108 @@ module.exports = appInfo => { | @@ -24,50 +24,108 @@ module.exports = appInfo => { | ||
24 | }; | 24 | }; |
25 | 25 | ||
26 | const view = { | 26 | const view = { |
27 | - root: path.join(appInfo.baseDir, 'app/public'), | ||
28 | - defaultViewEngine: 'nunjucks', | 27 | + root: path.join(appInfo.baseDir, "app/public"), |
28 | + defaultViewEngine: "nunjucks", | ||
29 | mapping: { | 29 | mapping: { |
30 | - '.html': 'nunjucks', | ||
31 | - } | ||
32 | - } | 30 | + ".html": "nunjucks", |
31 | + }, | ||
32 | + }; | ||
33 | 33 | ||
34 | config.cluster = { | 34 | config.cluster = { |
35 | listen: { | 35 | listen: { |
36 | - path: '', | 36 | + path: "", |
37 | port: 8012, | 37 | port: 8012, |
38 | - hostname: '0.0.0.0', | ||
39 | - } | 38 | + hostname: "0.0.0.0", |
39 | + }, | ||
40 | }; | 40 | }; |
41 | 41 | ||
42 | config.restful = { | 42 | config.restful = { |
43 | - tokenUrl: '/uaa/v1/auth/tokens', | ||
44 | - tokenMethod: 'POST', | 43 | + tokenUrl: "/uaa/v1/auth/tokens", |
44 | + tokenMethod: "POST", | ||
45 | scope: "global_access:tenant_admin", | 45 | scope: "global_access:tenant_admin", |
46 | - // host: 'http://118.178.181.180:20000/', | ||
47 | - host: 'http://47.110.250.177:20000/', | ||
48 | - // host: 'http://47.110.158.110:20000/', | ||
49 | - // host:'http://120.27.220.60:20000/', | ||
50 | - // host: 'http://39.104.52.206:20000/', | ||
51 | - // host: 'http://47.99.189.12:20000/', | ||
52 | - ossUrl: 'http://47.110.250.177:20000/', | ||
53 | - version: '/v1', | 46 | + // host: 'http://118.178.181.180', |
47 | + host: "http://47.110.250.177", | ||
48 | + // host: 'http://47.110.158.110', | ||
49 | + // host:'http://120.27.220.60', | ||
50 | + // host: 'http://39.104.52.206', | ||
51 | + // host: 'http://47.99.189.12', | ||
52 | + ossUrl: "http://47.110.250.177:20000", | ||
53 | + version: "/v1", | ||
54 | // host: '47.110.158.110', | 54 | // host: '47.110.158.110', |
55 | // host: '120.27.220.60', | 55 | // host: '120.27.220.60', |
56 | - // host: '39.104.52.206', | ||
57 | - port: 20000 | 56 | + // host: '39.104.52.206', |
57 | + port: 20000, | ||
58 | }; | 58 | }; |
59 | 59 | ||
60 | config.static = { | 60 | config.static = { |
61 | - prefix: '/', | ||
62 | - dir: path.join(appInfo.baseDir, 'app/public'), | ||
63 | - dynamic: true,//是否緩存靜態資源 | ||
64 | - preload: false,//啓動項目開啓緩存 | 61 | + prefix: "/", |
62 | + dir: path.join(appInfo.baseDir, "app/public"), | ||
63 | + dynamic: true, //是否緩存靜態資源 | ||
64 | + preload: false, //啓動項目開啓緩存 | ||
65 | maxAge: 0, //緩存時間 開發建議設0 跳坑 | 65 | maxAge: 0, //緩存時間 開發建議設0 跳坑 |
66 | - buffer: false//是否緩存到内存 默認prod 緩存 | 66 | + buffer: false, //是否緩存到内存 默認prod 緩存 |
67 | + }; | ||
68 | + | ||
69 | + const security = { | ||
70 | + csrf: { | ||
71 | + xframe: { | ||
72 | + enable: false, | ||
73 | + }, | ||
74 | + // heaederName:'cookie', | ||
75 | + type: "ctoken", // can be ctoken, referer, all or any, default to ctoken | ||
76 | + useSession: false, // if useSession set to true, the secret will keep in session instead of cookie | ||
77 | + ignoreJSON: false, // skip check JSON requests if ignoreJSON set to true | ||
78 | + cookieName: "csrfToken", // csrf token's cookie name | ||
79 | + sessionName: "csrfToken", // csrf token's session name | ||
80 | + headerName: "x-csrf-token", // request csrf token's name in header | ||
81 | + bodyName: "_csrf", // request csrf token's name in body | ||
82 | + queryName: "_csrf", // request csrf token's name in query | ||
83 | + refererWhiteList: [], // referer white list | ||
84 | + | ||
85 | + // queryName: '_csrf', // 通过 query 传递 CSRF token 的默认字段为 _csrf | ||
86 | + // bodyName: '_csrf', // 通过 body 传递 CSRF token 的默认字段为 _csrf | ||
87 | + ignore: (ctx) => { | ||
88 | + if ( | ||
89 | + ctx.request.url.indexOf("/api") != -1 || | ||
90 | + ctx.request.url.indexOf("/doLogin") != -1 | ||
91 | + ) { | ||
92 | + return true; | ||
93 | + } | ||
94 | + return false; | ||
95 | + }, | ||
96 | + }, | ||
97 | + }; | ||
98 | + | ||
99 | + config.connectHistoryApiFallback = { | ||
100 | + whiteList: ["/api", "/passport", "/__webpack_hmr"], | ||
101 | + }; | ||
102 | + | ||
103 | + config.logger = { | ||
104 | + consoleLevel: "DEBUG", | ||
105 | + // dir:'/root/logs/eggjs' | ||
106 | + }; | ||
107 | + | ||
108 | + config.passportLocal = { | ||
109 | + usernameField: 'username', | ||
110 | + passwordField: 'password', | ||
111 | + }; | ||
112 | + | ||
113 | + //redis config | ||
114 | + const redis = { | ||
115 | + client: { | ||
116 | + host: "127.0.0.1", | ||
117 | + port: "6379", | ||
118 | + password: "", | ||
119 | + db: "1", | ||
120 | + }, | ||
121 | + agent: true, | ||
67 | }; | 122 | }; |
68 | 123 | ||
69 | return { | 124 | return { |
70 | ...config, | 125 | ...config, |
71 | ...userConfig, | 126 | ...userConfig, |
127 | + security, | ||
128 | + redis, | ||
129 | + view, | ||
72 | }; | 130 | }; |
73 | }; | 131 | }; |
1 | 'use strict'; | 1 | 'use strict'; |
2 | 2 | ||
3 | + | ||
4 | + | ||
5 | +/* | ||
6 | +* nunjucks view config | ||
7 | +*/ | ||
8 | +const nunjucks = { | ||
9 | + enable: true, | ||
10 | + package: 'egg-view-nunjucks' | ||
11 | +} | ||
12 | + | ||
13 | + | ||
14 | +/* | ||
15 | +* passport config | ||
16 | +*/ | ||
17 | +const passport = { | ||
18 | + enable: true, | ||
19 | + package: 'egg-passport', | ||
20 | +}; | ||
21 | +const passportLocal = { | ||
22 | + enable: true, | ||
23 | + package: 'egg-passport-local', | ||
24 | +}; | ||
25 | + | ||
26 | +/* | ||
27 | +* redis config | ||
28 | +*/ | ||
29 | +const sessionRedis = { | ||
30 | + enable: true, | ||
31 | + package: 'egg-session-redis', | ||
32 | +}; | ||
33 | + | ||
34 | +const redis = { | ||
35 | + enable: true, | ||
36 | + package: 'egg-redis', | ||
37 | +}; | ||
38 | + | ||
39 | + | ||
3 | /** @type Egg.EggPlugin */ | 40 | /** @type Egg.EggPlugin */ |
4 | module.exports = { | 41 | module.exports = { |
5 | // had enabled by egg | 42 | // had enabled by egg |
6 | // static: { | 43 | // static: { |
7 | // enable: true, | 44 | // enable: true, |
8 | // } | 45 | // } |
46 | + nunjucks, | ||
47 | + passport, | ||
48 | + passportLocal, | ||
49 | + sessionRedis, | ||
50 | + redis, | ||
9 | }; | 51 | }; |
@@ -8,18 +8,24 @@ | @@ -8,18 +8,24 @@ | ||
8 | }, | 8 | }, |
9 | "dependencies": { | 9 | "dependencies": { |
10 | "egg": "^2.15.1", | 10 | "egg": "^2.15.1", |
11 | - "egg-scripts": "^2.11.0" | 11 | + "egg-scripts": "^2.11.0", |
12 | + "egg-session-redis": "^2.1.0", | ||
13 | + "egg-view-nunjucks": "^2.3.0" | ||
12 | }, | 14 | }, |
13 | "devDependencies": { | 15 | "devDependencies": { |
14 | "async": "^3.2.3", | 16 | "async": "^3.2.3", |
15 | "autod": "^3.0.1", | 17 | "autod": "^3.0.1", |
16 | "autod-egg": "^1.1.0", | 18 | "autod-egg": "^1.1.0", |
19 | + "connect-flash": "^0.1.1", | ||
20 | + "crypto": "^1.0.1", | ||
17 | "egg-bin": "^4.11.0", | 21 | "egg-bin": "^4.11.0", |
18 | "egg-ci": "^1.11.0", | 22 | "egg-ci": "^1.11.0", |
19 | "egg-mock": "^3.21.0", | 23 | "egg-mock": "^3.21.0", |
24 | + "egg-passport": "^2.1.1", | ||
25 | + "egg-passport-local": "^1.2.1", | ||
26 | + "egg-redis": "^2.4.0", | ||
20 | "eslint": "^5.13.0", | 27 | "eslint": "^5.13.0", |
21 | "eslint-config-egg": "^7.1.0", | 28 | "eslint-config-egg": "^7.1.0", |
22 | - "passport": "^0.5.2", | ||
23 | "urlencode": "^1.1.0" | 29 | "urlencode": "^1.1.0" |
24 | }, | 30 | }, |
25 | "engines": { | 31 | "engines": { |
请
注册
或
登录
后发表评论