正在显示
2 个修改的文件
包含
277 行增加
和
239 行删除
1 | +"use strict"; | |
2 | + | |
1 | 3 | const passport = require("passport"); |
2 | 4 | const urlencode = require("urlencode"); |
3 | 5 | const async = require("async"); |
4 | 6 | const crypto = require("crypto"); |
5 | -const fs =require('fs') | |
7 | +const fs = require("fs"); | |
6 | 8 | const path = require("path"); |
7 | 9 | |
8 | -exports = module.exports = function (logger, rest, settings) { | |
9 | - function index(req, res, next) { | |
10 | - logger.info(req); | |
11 | - // res.redirect("https://www.baidu.com"); | |
10 | +const Controller = require("egg").Controller; | |
11 | +// logger, rest, settings | |
12 | + | |
13 | +class AuthController extends Controller { | |
14 | + async index() { | |
15 | + const { ctx, logger } = this; | |
16 | + const { request } = ctx; | |
17 | + | |
18 | + logger.info(request); | |
12 | 19 | } |
13 | 20 | |
14 | - function getImg(req, res, next) { | |
15 | - logger.info(req.url, "1231231231"); | |
16 | - const parentdir = path.resolve(__dirname, "..") | |
17 | - const paths = parentdir+'/build/public'+urlencode.decode(req.url, 'utf8') | |
18 | - fs.readFile(paths,function(err,data){ | |
19 | - console.log(err,data) | |
21 | + async getImg(req, res) { | |
22 | + const parentdir = path.resolve(__dirname, ".."); | |
23 | + const paths = | |
24 | + parentdir + "/build/public" + urlencode.decode(req.url, "utf8"); | |
25 | + | |
26 | + fs.readFile(paths, function (err, data) { | |
20 | 27 | if (err) { |
21 | - res.send('读取错误') | |
28 | + res.send("读取错误"); | |
22 | 29 | } else { |
23 | - res.send(data) | |
30 | + res.send(data); | |
24 | 31 | } |
25 | - }) | |
32 | + }); | |
26 | 33 | } |
27 | 34 | |
28 | - function indexPrefix(req, res) { | |
29 | - // logger.info(req.csrfToken(),'req.cssadasdas'); | |
30 | - res.send({data:req.csrfToken()}) | |
31 | - // if (req.csrfToken) { | |
32 | - // if (settings.prefix && settings.prefix.length > 1) { | |
33 | - // res.redirect(settings.prefix.substring(0, settings.prefix.length - 1)); | |
34 | - // } else { | |
35 | - // res.render("index", { csrfToken: req.csrfToken() }); | |
36 | - // } | |
37 | - // } else res.render("index", { csrfToken: "" }); | |
35 | + async indexPrefix(req, res) { | |
36 | + const { ctx } = this; | |
37 | + | |
38 | + ctx.body = { | |
39 | + data: req.csrfToken(), | |
40 | + }; | |
41 | + | |
42 | + return ctx.body; | |
38 | 43 | } |
39 | 44 | |
40 | - function productDes(req, res, next) { | |
41 | - if (req.csrfToken) | |
42 | - res.render("chat/new-chat", { csrfToken: req.csrfToken() }); | |
43 | - else res.render("chat/new-chat", { csrfToken: "" }); | |
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 | 53 | } |
45 | 54 | |
46 | - function recharge(req, res) { | |
47 | - var params = JSON.parse(urlencode.decode(req.query.params)); | |
48 | - console.log(params); | |
49 | - if (req.csrfToken) | |
50 | - res.render("recharge", { recharge: params, csrfToken: req.csrfToken() }); | |
51 | - else res.render("recharge", { recharge: params, csrfToken: "" }); | |
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 | + } | |
52 | 70 | } |
53 | 71 | |
54 | - function register(req, res, next) { | |
55 | - if (req.csrfToken) | |
56 | - res.render("newRegister", { csrfToken: req.csrfToken() }); | |
57 | - else res.render("newRegister", { csrfToken: "" }); | |
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 | 80 | } |
59 | 81 | |
60 | - function mobileRegister(req, res) { | |
61 | - if (req.csrfToken) | |
62 | - res.render("registerMobile", { csrfToken: req.csrfToken() }); | |
63 | - else res.render("registerMobile", { csrfToken: "" }); | |
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 | 90 | } |
65 | 91 | |
66 | - function mobileRegisterSuccess(req, res) { | |
67 | - if (req.csrfToken) | |
68 | - res.render("registerMobileSuccess", { csrfToken: req.csrfToken() }); | |
69 | - else res.render("registerMobileSuccess", { csrfToken: "" }); | |
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 | 100 | } |
71 | 101 | |
72 | - function signIn(req, res, next) { | |
73 | - // console.log(req); | |
74 | - if (req.csrfToken) res.render("newLogin", { csrfToken: req.csrfToken() }); | |
75 | - else res.render("newLogin", { csrfToken: "" }); | |
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 | 110 | } |
77 | 111 | |
78 | - function doLogin(req, res, next) { | |
112 | + async doLogin(req, res, next) { | |
79 | 113 | passport.authenticate("local", function (err, user, info) { |
80 | - console.log("doLogin:", err, user, info); | |
81 | 114 | if (err) { |
82 | 115 | return next(err); |
83 | 116 | } |
117 | + | |
84 | 118 | if (!user) { |
85 | 119 | return res.send(info); |
86 | 120 | } |
121 | + | |
87 | 122 | req.logIn(user, function (err) { |
88 | 123 | if (err) { |
89 | 124 | return next(err); |
90 | 125 | } |
126 | + | |
91 | 127 | return res.send({ |
92 | 128 | ok: "登录成功", |
93 | 129 | user_info: req.session.passport.user.user_info, |
... | ... | @@ -96,23 +132,28 @@ exports = module.exports = function (logger, rest, settings) { |
96 | 132 | })(req, res, next); |
97 | 133 | } |
98 | 134 | |
99 | - function signOut(req, res, next) { | |
135 | + async signOut(req, res) { | |
136 | + const { ctx, logger } = this; | |
137 | + const { session } = ctx; | |
138 | + | |
100 | 139 | if ( |
101 | - req.session.passport && | |
102 | - req.session.passport.user && | |
103 | - req.session.passport.user.user_info && | |
104 | - req.session.passport.user.user_info.user | |
105 | - ) | |
140 | + session.passport && | |
141 | + session.passport.user && | |
142 | + session.passport.user.user_info && | |
143 | + session.passport.user.user_info.user | |
144 | + ) { | |
106 | 145 | logger.info( |
107 | - req.session.passport.user.user_info.user, | |
146 | + session.passport.user.user_info.user, | |
108 | 147 | "You have successfully logged out" |
109 | 148 | ); |
149 | + } | |
150 | + | |
110 | 151 | req.logout(); |
111 | 152 | req.flash("success", "You have successfully logged out"); |
112 | 153 | res.redirect("/"); |
113 | 154 | } |
114 | 155 | |
115 | - function smsCodes(req, res, next) { | |
156 | + async smsCodes(req, res) { | |
116 | 157 | rest.postJson({ |
117 | 158 | baseUrl: "url", |
118 | 159 | url: "auth/smscodes", |
... | ... | @@ -123,8 +164,8 @@ exports = module.exports = function (logger, rest, settings) { |
123 | 164 | options: {}, |
124 | 165 | excludeToken: true, |
125 | 166 | }); |
167 | + | |
126 | 168 | function _cb(data, response) { |
127 | - logger.info("back data:", data); | |
128 | 169 | if (response.statusCode < 300) { |
129 | 170 | res.send({ code: 200, message: "发送成功" }); |
130 | 171 | } else { |
... | ... | @@ -133,7 +174,7 @@ exports = module.exports = function (logger, rest, settings) { |
133 | 174 | } |
134 | 175 | } |
135 | 176 | |
136 | - function tenants(req, res, next) { | |
177 | + async tenants(req, res, next) { | |
137 | 178 | rest.register({ |
138 | 179 | baseUrl: "url", |
139 | 180 | url: "tenants", |
... | ... | @@ -144,13 +185,13 @@ exports = module.exports = function (logger, rest, settings) { |
144 | 185 | options: {}, |
145 | 186 | excludeToken: true, |
146 | 187 | }); |
188 | + | |
147 | 189 | function _cb(data, response) { |
148 | - logger.info("back data:", data); | |
149 | 190 | res.send(data); |
150 | 191 | } |
151 | 192 | } |
152 | 193 | |
153 | - function resetPass(req, res) { | |
194 | + async resetPass(req, res) { | |
154 | 195 | rest.putJson({ |
155 | 196 | baseUrl: "url", |
156 | 197 | url: "auth/user", |
... | ... | @@ -164,13 +205,15 @@ exports = module.exports = function (logger, rest, settings) { |
164 | 205 | res: res, |
165 | 206 | options: {}, |
166 | 207 | }); |
208 | + | |
167 | 209 | function _cb(data, response) { |
168 | - logger.info("back data:", data); | |
169 | 210 | res.send(data); |
170 | 211 | } |
171 | 212 | } |
172 | 213 | |
173 | - function updatePassword(req, res) { | |
214 | + async updatePassword(req, res) { | |
215 | + const { logger } = this; | |
216 | + | |
174 | 217 | rest.patchJson({ |
175 | 218 | baseUrl: "url", |
176 | 219 | url: "users/" + req.body.userId, |
... | ... | @@ -182,14 +225,16 @@ exports = module.exports = function (logger, rest, settings) { |
182 | 225 | res: res, |
183 | 226 | options: {}, |
184 | 227 | }); |
228 | + | |
185 | 229 | function _cb(data, response) { |
186 | 230 | logger.info("back data:", data); |
187 | 231 | res.send(data); |
188 | 232 | } |
189 | 233 | } |
190 | 234 | |
191 | - function loadUserInfo(req, res) { | |
235 | + async loadUserInfo(req, res) { | |
192 | 236 | settings; |
237 | + | |
193 | 238 | if (req.session.passport.user && req.session.passport.user.user_info) { |
194 | 239 | res.send({ |
195 | 240 | user_info: req.session.passport.user.user_info, |
... | ... | @@ -200,7 +245,9 @@ exports = module.exports = function (logger, rest, settings) { |
200 | 245 | } |
201 | 246 | } |
202 | 247 | |
203 | - function getUploaderToken(req, res) { | |
248 | + async getUploaderToken(req, res) { | |
249 | + const { logger } = this; | |
250 | + | |
204 | 251 | rest.postJson({ |
205 | 252 | baseUrl: "ossUrl", |
206 | 253 | url: "inits", |
... | ... | @@ -210,13 +257,16 @@ exports = module.exports = function (logger, rest, settings) { |
210 | 257 | res: res, |
211 | 258 | options: {}, |
212 | 259 | }); |
260 | + | |
213 | 261 | function _cb(data, response) { |
214 | 262 | logger.info("back data:", data); |
215 | 263 | res.send(data); |
216 | 264 | } |
217 | 265 | } |
218 | 266 | |
219 | - function getObjectTokenByID(req, res) { | |
267 | + async getObjectTokenByID(req, res) { | |
268 | + const { logger } = this; | |
269 | + | |
220 | 270 | rest.get({ |
221 | 271 | baseUrl: "ossUrl", |
222 | 272 | url: "objects/" + req.body.file_id, |
... | ... | @@ -226,13 +276,14 @@ exports = module.exports = function (logger, rest, settings) { |
226 | 276 | res: res, |
227 | 277 | options: {}, |
228 | 278 | }); |
279 | + | |
229 | 280 | function _cb(data, response) { |
230 | 281 | logger.info("back data:", data); |
231 | 282 | res.send(data); |
232 | 283 | } |
233 | 284 | } |
234 | 285 | |
235 | - function delOSSObject(req, res) { | |
286 | + async delOSSObject(req, res) { | |
236 | 287 | rest.del({ |
237 | 288 | baseUrl: "ossUrl", |
238 | 289 | url: |
... | ... | @@ -248,16 +299,15 @@ exports = module.exports = function (logger, rest, settings) { |
248 | 299 | res: res, |
249 | 300 | options: {}, |
250 | 301 | }); |
302 | + | |
251 | 303 | function _cb(data, response) { |
252 | - logger.info("back data:", data); | |
253 | - console.log(response.statusCode); | |
254 | 304 | if (response.statusCode < 300) { |
255 | 305 | res.send({ delete: "ok" }); |
256 | 306 | } |
257 | 307 | } |
258 | 308 | } |
259 | 309 | |
260 | - function smsVerification(req, res) { | |
310 | + async smsVerification(req, res) { | |
261 | 311 | rest.postJson({ |
262 | 312 | baseUrl: "url", |
263 | 313 | url: "auth/sms_verification", |
... | ... | @@ -268,8 +318,8 @@ exports = module.exports = function (logger, rest, settings) { |
268 | 318 | options: {}, |
269 | 319 | excludeToken: true, |
270 | 320 | }); |
321 | + | |
271 | 322 | function _cb(data, response) { |
272 | - logger.info("back data:", data); | |
273 | 323 | if (response.statusCode < 300) { |
274 | 324 | res.send({ code: 200, message: "发送成功" }); |
275 | 325 | } else { |
... | ... | @@ -282,12 +332,13 @@ exports = module.exports = function (logger, rest, settings) { |
282 | 332 | } |
283 | 333 | } |
284 | 334 | |
285 | - function healthMonitor(res) { | |
335 | + async healthMonitor(res) { | |
286 | 336 | res.statusCode = 200; |
337 | + | |
287 | 338 | return res.send("status ok"); |
288 | 339 | } |
289 | 340 | |
290 | - function updateUserRoles(req, res) { | |
341 | + async updateUserRoles(req, res) { | |
291 | 342 | rest.putJson({ |
292 | 343 | baseUrl: "url", |
293 | 344 | url: "user_roles/" + req.body.user_id, |
... | ... | @@ -297,8 +348,8 @@ exports = module.exports = function (logger, rest, settings) { |
297 | 348 | res: res, |
298 | 349 | options: {}, |
299 | 350 | }); |
351 | + | |
300 | 352 | function _cb(data, response) { |
301 | - logger.info("back data:", data); | |
302 | 353 | if (response.statusCode < 300) { |
303 | 354 | res.send({ back: "ok" }); |
304 | 355 | } else { |
... | ... | @@ -307,7 +358,7 @@ exports = module.exports = function (logger, rest, settings) { |
307 | 358 | } |
308 | 359 | } |
309 | 360 | |
310 | - function getRoles(req, res) { | |
361 | + async getRoles(req, res) { | |
311 | 362 | rest.get({ |
312 | 363 | baseUrl: "url", |
313 | 364 | url: "roles", |
... | ... | @@ -317,13 +368,13 @@ exports = module.exports = function (logger, rest, settings) { |
317 | 368 | res: res, |
318 | 369 | options: {}, |
319 | 370 | }); |
371 | + | |
320 | 372 | function _cb(data, response) { |
321 | - logger.info("back data:", data); | |
322 | 373 | res.send(data); |
323 | 374 | } |
324 | 375 | } |
325 | 376 | |
326 | - function getUserRoles(req, res) { | |
377 | + async getUserRoles(req, res) { | |
327 | 378 | rest.get({ |
328 | 379 | baseUrl: "url", |
329 | 380 | url: |
... | ... | @@ -339,13 +390,13 @@ exports = module.exports = function (logger, rest, settings) { |
339 | 390 | res: res, |
340 | 391 | options: {}, |
341 | 392 | }); |
393 | + | |
342 | 394 | function _cb(data, response) { |
343 | - logger.info("back data:", data); | |
344 | 395 | res.send(data); |
345 | 396 | } |
346 | 397 | } |
347 | 398 | |
348 | - function getTenant(req, res) { | |
399 | + async getTenant(req, res) { | |
349 | 400 | rest.get({ |
350 | 401 | baseUrl: "url", |
351 | 402 | url: "tenants/" + req.body.tenant_id, |
... | ... | @@ -355,13 +406,13 @@ exports = module.exports = function (logger, rest, settings) { |
355 | 406 | res: res, |
356 | 407 | options: {}, |
357 | 408 | }); |
409 | + | |
358 | 410 | function _cb(data, response) { |
359 | - logger.info("back data:", data); | |
360 | 411 | res.send(data); |
361 | 412 | } |
362 | 413 | } |
363 | 414 | |
364 | - function updateTenant(req, res) { | |
415 | + async updateTenant(req, res) { | |
365 | 416 | rest.putJson({ |
366 | 417 | baseUrl: "url", |
367 | 418 | url: "tenants/" + req.body.tenant_id, |
... | ... | @@ -371,13 +422,13 @@ exports = module.exports = function (logger, rest, settings) { |
371 | 422 | res: res, |
372 | 423 | options: {}, |
373 | 424 | }); |
425 | + | |
374 | 426 | function _cb(data, response) { |
375 | - logger.info("back data:", data); | |
376 | 427 | res.send(data); |
377 | 428 | } |
378 | 429 | } |
379 | 430 | |
380 | - function offer(req, res) { | |
431 | + async offer(req, res) { | |
381 | 432 | rest.get({ |
382 | 433 | baseUrl: "hrUrl", |
383 | 434 | url: |
... | ... | @@ -389,17 +440,15 @@ exports = module.exports = function (logger, rest, settings) { |
389 | 440 | options: {}, |
390 | 441 | excludeToken: true, |
391 | 442 | }); |
443 | + | |
392 | 444 | function _cb(data, response) { |
393 | - logger.info("back data:", data); | |
394 | - //res.send(data); | |
395 | - console.log(data); | |
396 | 445 | data["offerId"] = req.params.requestId; |
397 | 446 | data["tenantId"] = req.query.tenant_id; |
398 | 447 | res.render("offer", data); |
399 | 448 | } |
400 | 449 | } |
401 | 450 | |
402 | - function onboardStatus(req, res) { | |
451 | + async onboardStatus(req, res) { | |
403 | 452 | rest.get({ |
404 | 453 | baseUrl: "hrUrl", |
405 | 454 | url: "onboard-status", |
... | ... | @@ -410,15 +459,15 @@ exports = module.exports = function (logger, rest, settings) { |
410 | 459 | options: {}, |
411 | 460 | useUrl: true, |
412 | 461 | }); |
462 | + | |
413 | 463 | function _cb(data, response) { |
414 | - logger.info("back data:", data); | |
415 | 464 | res.send(data); |
416 | 465 | } |
417 | 466 | } |
418 | 467 | |
419 | - function dowloadApp(req, res) { | |
420 | - var mobileAgent = req.headers["user-agent"].toLowerCase(); | |
421 | - var agent = { | |
468 | + async dowloadApp(req, res) { | |
469 | + let mobileAgent = req.headers["user-agent"].toLowerCase(); | |
470 | + let agent = { | |
422 | 471 | android: |
423 | 472 | mobileAgent.indexOf("android") > -1 || mobileAgent.indexOf("Adr") > -1, |
424 | 473 | iPhone: mobileAgent.indexOf("iphone") > -1, |
... | ... | @@ -442,12 +491,12 @@ exports = module.exports = function (logger, rest, settings) { |
442 | 491 | } |
443 | 492 | } |
444 | 493 | |
445 | - function softwareLicense(res) { | |
494 | + async softwareLicense(res) { | |
446 | 495 | res.render("softwareLicense"); |
447 | 496 | } |
448 | 497 | |
449 | - function changePassForRegister(req, res) { | |
450 | - var options = { | |
498 | + async changePassForRegister(req, res) { | |
499 | + let options = { | |
451 | 500 | baseUrl: "url", |
452 | 501 | url: "users/" + req.body.user_id, |
453 | 502 | params: { |
... | ... | @@ -458,27 +507,31 @@ exports = module.exports = function (logger, rest, settings) { |
458 | 507 | res: res, |
459 | 508 | options: {}, |
460 | 509 | }; |
510 | + | |
461 | 511 | if (req.body.access_token) { |
462 | - console.log("@@@!!!!!!!!!!!!!!!!"); | |
463 | 512 | options.options = { |
464 | 513 | accessToken: req.body.access_token, |
465 | 514 | }; |
515 | + | |
466 | 516 | options["excludeToken"] = true; |
467 | 517 | } |
518 | + | |
468 | 519 | rest.patchJson(options); |
520 | + | |
469 | 521 | function _cb(data, response) { |
470 | - logger.info("back data:", data); | |
471 | 522 | res.send(data); |
472 | 523 | } |
473 | 524 | } |
474 | 525 | |
475 | - function changeTenant(req, res) { | |
476 | - var params = { | |
526 | + async changeTenant(req, res) { | |
527 | + let params = { | |
477 | 528 | grant_type: "refresh_token", |
478 | 529 | scope: "global_access:tenant_admin,tenant:" + req.body.id, |
479 | 530 | refresh_token: req.session.passport.user.refreshToken, |
480 | 531 | }; |
532 | + | |
481 | 533 | req.session.passport.user.token = ""; |
534 | + | |
482 | 535 | rest.postJson({ |
483 | 536 | baseUrl: "url", |
484 | 537 | url: |
... | ... | @@ -494,9 +547,8 @@ exports = module.exports = function (logger, rest, settings) { |
494 | 547 | options: {}, |
495 | 548 | excludeToken: true, |
496 | 549 | }); |
550 | + | |
497 | 551 | function _cb(data, response) { |
498 | - console.log(data); | |
499 | - logger.info("back data:", data); | |
500 | 552 | if (response.statusCode < 300) { |
501 | 553 | req.session.passport.user.token = data.access_token; |
502 | 554 | req.session.passport.user.refreshToken = data.refresh_token; |
... | ... | @@ -531,11 +583,11 @@ exports = module.exports = function (logger, rest, settings) { |
531 | 583 | }); |
532 | 584 | } |
533 | 585 | } |
586 | + | |
534 | 587 | function _scb(data1, response) { |
535 | 588 | if (response.statusCode < 300 && data1.items) { |
536 | 589 | req.session.passport.user.user_info.perms = data1.items; |
537 | 590 | req.session.save(function () { |
538 | - // res.send({"code":200,"message":"切换租户成功"}); | |
539 | 591 | rest.get({ |
540 | 592 | baseUrl: "url", |
541 | 593 | url: |
... | ... | @@ -555,6 +607,7 @@ exports = module.exports = function (logger, rest, settings) { |
555 | 607 | res.send({ code: response.statusCode, message: data1.message }); |
556 | 608 | } |
557 | 609 | } |
610 | + | |
558 | 611 | function _scb1(data2, response) { |
559 | 612 | if (response.statusCode < 300 && data2 && data2.bucket) { |
560 | 613 | req.session.passport.user.user_info.oss = data2; |
... | ... | @@ -567,7 +620,7 @@ exports = module.exports = function (logger, rest, settings) { |
567 | 620 | } |
568 | 621 | } |
569 | 622 | |
570 | - function sendRejectOffer(req, res) { | |
623 | + async sendRejectOffer(req, res) { | |
571 | 624 | rest.get({ |
572 | 625 | baseUrl: "hrUrl", |
573 | 626 | url: req.body.url, //传一个参数 |
... | ... | @@ -579,8 +632,8 @@ exports = module.exports = function (logger, rest, settings) { |
579 | 632 | excludeToken: true, |
580 | 633 | useUrl: true, |
581 | 634 | }); |
635 | + | |
582 | 636 | function _cb(data, response) { |
583 | - logger.info("back data:", data); | |
584 | 637 | if (response.statusCode < 300) { |
585 | 638 | res.send({ action: "ok" }); |
586 | 639 | } else { |
... | ... | @@ -589,7 +642,7 @@ exports = module.exports = function (logger, rest, settings) { |
589 | 642 | } |
590 | 643 | } |
591 | 644 | |
592 | - function acceptOffer(req, res) { | |
645 | + async acceptOffer(req, res) { | |
593 | 646 | rest.get({ |
594 | 647 | baseUrl: "hrUrl", |
595 | 648 | url: req.body.url, //传一个参数 |
... | ... | @@ -601,8 +654,8 @@ exports = module.exports = function (logger, rest, settings) { |
601 | 654 | excludeToken: true, |
602 | 655 | useUrl: true, |
603 | 656 | }); |
657 | + | |
604 | 658 | function _cb(data, response) { |
605 | - logger.info("back data:", data); | |
606 | 659 | if (response.statusCode < 300) { |
607 | 660 | res.send({ action: "ok" }); |
608 | 661 | } else { |
... | ... | @@ -611,7 +664,7 @@ exports = module.exports = function (logger, rest, settings) { |
611 | 664 | } |
612 | 665 | } |
613 | 666 | |
614 | - function imTokens(req, res) { | |
667 | + async imTokens(req, res) { | |
615 | 668 | rest.post({ |
616 | 669 | url: "auth/im_tokens", |
617 | 670 | params: req.body, |
... | ... | @@ -620,13 +673,13 @@ exports = module.exports = function (logger, rest, settings) { |
620 | 673 | res: res, |
621 | 674 | options: {}, |
622 | 675 | }); |
676 | + | |
623 | 677 | function _cb(data, response) { |
624 | - logger.info("back data:", data); | |
625 | 678 | res.send(data); |
626 | 679 | } |
627 | 680 | } |
628 | 681 | |
629 | - function listChannels(req, res) { | |
682 | + async listChannels(req, res) { | |
630 | 683 | rest.get({ |
631 | 684 | baseUrl: "chatUrl", |
632 | 685 | url: "channels?page_size=10&page=0&status=active", |
... | ... | @@ -636,14 +689,14 @@ exports = module.exports = function (logger, rest, settings) { |
636 | 689 | res: res, |
637 | 690 | options: {}, |
638 | 691 | }); |
692 | + | |
639 | 693 | function _cb(data, response) { |
640 | - logger.info("back data:", data); | |
641 | 694 | res.send(data); |
642 | 695 | } |
643 | 696 | } |
644 | 697 | |
645 | - function filemeta(req, res) { | |
646 | - var fullPath = | |
698 | + async filemeta(req, res) { | |
699 | + let fullPath = | |
647 | 700 | settings.restful.url + |
648 | 701 | "filemeta" + |
649 | 702 | settings.restful.version + |
... | ... | @@ -655,8 +708,8 @@ exports = module.exports = function (logger, rest, settings) { |
655 | 708 | req.query.bucket + |
656 | 709 | "&object=" + |
657 | 710 | encodeURIComponent(req.query.object); |
658 | - console.info("fullPath::::::", fullPath); | |
659 | - var options = { | |
711 | + | |
712 | + let options = { | |
660 | 713 | service_catalog: "", |
661 | 714 | url: fullPath, |
662 | 715 | useUrl: true, |
... | ... | @@ -666,17 +719,19 @@ exports = module.exports = function (logger, rest, settings) { |
666 | 719 | res: res, |
667 | 720 | options: {}, |
668 | 721 | }; |
722 | + | |
669 | 723 | rest.get(options); |
724 | + | |
670 | 725 | function _cb(data, response) { |
671 | 726 | if (data && data.download_url) { |
672 | 727 | if (req.query.type && "json" == req.query.type) { |
673 | 728 | res.send(data); |
674 | 729 | } else { |
675 | - var url = data.download_url; | |
730 | + let url = data.download_url; | |
676 | 731 | let path = url.split("?")[0]; |
677 | 732 | let pathArray = path.split("/"); |
678 | 733 | let result = []; |
679 | - for (var i = 0; i < pathArray.length; i++) { | |
734 | + for (let i = 0; i < pathArray.length; i++) { | |
680 | 735 | if (i == pathArray.length - 1) { |
681 | 736 | result.push(encodeURIComponent(pathArray[i])); |
682 | 737 | } else { |
... | ... | @@ -699,15 +754,15 @@ exports = module.exports = function (logger, rest, settings) { |
699 | 754 | } |
700 | 755 | } |
701 | 756 | |
702 | - function getCustomerQrcode(req, res) { | |
703 | - var fullPath = | |
757 | + async getCustomerQrcode(req, res) { | |
758 | + let fullPath = | |
704 | 759 | settings.restful.url + |
705 | 760 | "crm" + |
706 | 761 | settings.restful.version + |
707 | 762 | "/customers/" + |
708 | 763 | req.query.id + |
709 | 764 | "/qrcode"; |
710 | - var options = { | |
765 | + let options = { | |
711 | 766 | service_catalog: "", |
712 | 767 | url: fullPath, |
713 | 768 | useUrl: true, |
... | ... | @@ -717,7 +772,9 @@ exports = module.exports = function (logger, rest, settings) { |
717 | 772 | res: res, |
718 | 773 | options: {}, |
719 | 774 | }; |
775 | + | |
720 | 776 | rest.get(options); |
777 | + | |
721 | 778 | function _cb(data, response) { |
722 | 779 | if (data && data.url_path) { |
723 | 780 | res.redirect(301, data.url_path); |
... | ... | @@ -727,15 +784,16 @@ exports = module.exports = function (logger, rest, settings) { |
727 | 784 | } |
728 | 785 | } |
729 | 786 | |
730 | - function getPositionQrcode(req, res) { | |
731 | - var fullPath = | |
787 | + async getPositionQrcode(req, res) { | |
788 | + let fullPath = | |
732 | 789 | settings.restful.url + |
733 | 790 | "recruit" + |
734 | 791 | settings.restful.version + |
735 | 792 | "/positions/" + |
736 | 793 | req.query.id + |
737 | 794 | "/qrcode"; |
738 | - var options = { | |
795 | + | |
796 | + let options = { | |
739 | 797 | service_catalog: "", |
740 | 798 | url: fullPath, |
741 | 799 | useUrl: true, |
... | ... | @@ -745,7 +803,9 @@ exports = module.exports = function (logger, rest, settings) { |
745 | 803 | res: res, |
746 | 804 | options: {}, |
747 | 805 | }; |
806 | + | |
748 | 807 | rest.get(options); |
808 | + | |
749 | 809 | function _cb(data, response) { |
750 | 810 | if (data && data.url_path) { |
751 | 811 | res.redirect(301, data.url_path); |
... | ... | @@ -755,10 +815,10 @@ exports = module.exports = function (logger, rest, settings) { |
755 | 815 | } |
756 | 816 | } |
757 | 817 | |
758 | - function getOSSConfig(req, res) { | |
759 | - var fullPath = | |
818 | + async getOSSConfig(req, res) { | |
819 | + let fullPath = | |
760 | 820 | settings.restful.url + "filemeta" + settings.restful.version + "/config"; |
761 | - var options = { | |
821 | + let options = { | |
762 | 822 | service_catalog: "", |
763 | 823 | url: fullPath, |
764 | 824 | useUrl: true, |
... | ... | @@ -768,10 +828,13 @@ exports = module.exports = function (logger, rest, settings) { |
768 | 828 | res: res, |
769 | 829 | options: {}, |
770 | 830 | }; |
831 | + | |
771 | 832 | rest.get(options); |
833 | + | |
772 | 834 | function _cb(data, response) { |
773 | 835 | if (data && data.bucket) { |
774 | 836 | req.session.passport.user.user_info.oss = data; |
837 | + | |
775 | 838 | req.session.save(function () { |
776 | 839 | res.send({ code: 200, message: "oss配置加载成功" }); |
777 | 840 | }); |
... | ... | @@ -781,11 +844,11 @@ exports = module.exports = function (logger, rest, settings) { |
781 | 844 | } |
782 | 845 | } |
783 | 846 | |
784 | - function weidianTempLate(req, res) { | |
847 | + async weidianTempLate(req, res) { | |
785 | 848 | const { params } = req; |
786 | - var fullPath = | |
849 | + let fullPath = | |
787 | 850 | settings.restful.url + "socialwork/internal/minishop/" + params.id; |
788 | - var options = { | |
851 | + let options = { | |
789 | 852 | service_catalog: "", |
790 | 853 | url: fullPath, |
791 | 854 | useUrl: true, |
... | ... | @@ -796,15 +859,18 @@ exports = module.exports = function (logger, rest, settings) { |
796 | 859 | options: {}, |
797 | 860 | excludeToken: true, |
798 | 861 | }; |
862 | + | |
799 | 863 | rest.get(options); |
864 | + | |
800 | 865 | function _cb(data, response) { |
801 | - logger.info("back data:", data); | |
802 | 866 | if (response.statusCode < 300) { |
803 | 867 | const { shop_logo = [], shop_name = "", shop_comment = "" } = data; |
804 | 868 | let imgUrl = ""; |
869 | + | |
805 | 870 | if (shop_logo.length > 0) { |
806 | 871 | imgUrl = "http://oss.workai.com.cn/public/" + shop_logo[0].object; |
807 | 872 | } |
873 | + | |
808 | 874 | res.render("template/weiDian", { |
809 | 875 | imgUrl: imgUrl, |
810 | 876 | shop_name: shop_name, |
... | ... | @@ -816,10 +882,12 @@ exports = module.exports = function (logger, rest, settings) { |
816 | 882 | } |
817 | 883 | } |
818 | 884 | |
819 | - function workaiSecurityOAuth(req, res) { | |
820 | - var params = req.query; | |
885 | + async workaiSecurityOAuth(req, res) { | |
886 | + const { logger } = this; | |
887 | + let params = req.query; | |
888 | + | |
821 | 889 | if (params.authorization_code) { |
822 | - var passport = { | |
890 | + let passport = { | |
823 | 891 | user: { |
824 | 892 | refreshToken: "", |
825 | 893 | token: "", |
... | ... | @@ -828,25 +896,16 @@ exports = module.exports = function (logger, rest, settings) { |
828 | 896 | err: null, |
829 | 897 | }, |
830 | 898 | }; |
899 | + | |
831 | 900 | async.waterfall( |
832 | 901 | [ |
833 | 902 | function (callback) { |
834 | 903 | //第三方登录 |
835 | - var tempParams = { | |
904 | + let tempParams = { | |
836 | 905 | grant_type: "authorization_code_v1", |
837 | 906 | code: params.authorization_code, |
838 | 907 | }; |
839 | - // var tempParams={ | |
840 | - // "grant_type":"password", | |
841 | - // "username":"18510929499", | |
842 | - // "scope":"global_access:tenant_admin", | |
843 | - // "password":"a123456" | |
844 | - // }; | |
845 | - logger.info( | |
846 | - "Third login", | |
847 | - settings.restful.url + "uaa/v1/auth/tokens", | |
848 | - tempParams | |
849 | - ); | |
908 | + | |
850 | 909 | rest.restful |
851 | 910 | .postJson( |
852 | 911 | settings.restful.url + "uaa/v1/auth/tokens", |
... | ... | @@ -859,9 +918,9 @@ exports = module.exports = function (logger, rest, settings) { |
859 | 918 | } |
860 | 919 | ) |
861 | 920 | .on("success", function (data) { |
862 | - logger.info("Third login json data:", data); | |
863 | 921 | if (data.access_token) { |
864 | - var scopes = data.scope.split(","); | |
922 | + let scopes = data.scope.split(","); | |
923 | + | |
865 | 924 | passport.user.token = data.access_token; |
866 | 925 | passport.user.refreshToken = data.refresh_token; |
867 | 926 | passport.user.user_info = data.user || {}; |
... | ... | @@ -872,35 +931,41 @@ exports = module.exports = function (logger, rest, settings) { |
872 | 931 | passport.user.real_auth_status = data.user.real_auth_status; |
873 | 932 | passport.user.credential_status = data.user.credential_status; |
874 | 933 | passport.user.user_info.scope = scopes[0]; |
934 | + | |
875 | 935 | callback(null, data); |
876 | 936 | } else { |
877 | - var err = new Error("Third login err"); | |
937 | + let err = new Error("Third login err"); | |
938 | + | |
878 | 939 | passport.user.err = data.message; |
940 | + | |
879 | 941 | callback(err, data); |
880 | 942 | } |
881 | 943 | }) |
882 | 944 | .on("error", function (err, response) { |
883 | - logger.error("Third login error", err); | |
884 | - var err = new Error("Third login err"); | |
945 | + let err = new Error("Third login err"); | |
946 | + | |
885 | 947 | callback(err, response); |
886 | 948 | }) |
887 | 949 | .on("fail", function (data, response) { |
888 | - logger.error("Third login fail", data); | |
889 | 950 | callback(data, response); |
890 | 951 | }); |
891 | 952 | }, |
953 | + | |
892 | 954 | function (data, callback) { |
893 | 955 | //获取机构列表 |
894 | - var tempHead = {}; | |
895 | - var ip = req.ip.match(/\d+\.\d+\.\d+\.\d+/)[0]; | |
896 | - var user_agent = req.headers["user-agent"] || ""; | |
956 | + let tempHead = {}; | |
957 | + let ip = req.ip.match(/\d+\.\d+\.\d+\.\d+/)[0]; | |
958 | + let user_agent = req.headers["user-agent"] || ""; | |
959 | + | |
897 | 960 | tempHead["SXClientIP"] = ip; |
898 | 961 | tempHead["User-Agent"] = user_agent; |
962 | + | |
899 | 963 | logger.info( |
900 | 964 | "Third login tenants", |
901 | 965 | settings.restful.url + "uaa/v1/tenants?all=true", |
902 | 966 | { accessToken: data.access_token, headers: tempHead } |
903 | 967 | ); |
968 | + | |
904 | 969 | rest.restful |
905 | 970 | .get(settings.restful.url + "uaa/v1/tenants?all=true", { |
906 | 971 | accessToken: data.access_token, |
... | ... | @@ -908,36 +973,44 @@ exports = module.exports = function (logger, rest, settings) { |
908 | 973 | }) |
909 | 974 | .on("success", function (data1) { |
910 | 975 | logger.info("Third login tenants list:", data1); |
976 | + | |
911 | 977 | if (data1 && data1.items && data1.items.length > 0) { |
912 | 978 | callback(null, data1.items); |
913 | 979 | } else { |
914 | - var err = new Error("Third login tenants list err"); | |
980 | + let err = new Error("Third login tenants list err"); | |
981 | + | |
915 | 982 | passport.user.err = data.message; |
983 | + | |
916 | 984 | callback(err, data); |
917 | 985 | } |
918 | 986 | }) |
919 | 987 | .on("error", function (err, response) { |
920 | - var err = new Error("Third login tenants list err"); | |
988 | + let err = new Error("Third login tenants list err"); | |
989 | + | |
921 | 990 | callback(err, response); |
922 | 991 | }) |
923 | 992 | .on("fail", function (data, response) { |
924 | 993 | callback(data, response); |
925 | 994 | }); |
926 | 995 | }, |
996 | + | |
927 | 997 | function (data, callback) { |
928 | 998 | //刷新token |
929 | 999 | if (data && data.length == 1) { |
930 | - var params = { | |
1000 | + let params = { | |
931 | 1001 | grant_type: "refresh_token", |
932 | 1002 | scope: "global_access:tenant_admin,tenant:" + data[0].id, |
933 | 1003 | refresh_token: passport.user.refreshToken, |
934 | 1004 | }; |
1005 | + | |
935 | 1006 | passport.user.token = ""; |
1007 | + | |
936 | 1008 | logger.info( |
937 | 1009 | "Third login tokens", |
938 | 1010 | settings.restful.url + "uaa/v1/auth/tokens", |
939 | 1011 | params |
940 | 1012 | ); |
1013 | + | |
941 | 1014 | rest.restful |
942 | 1015 | .postJson(settings.restful.url + "uaa/v1/auth/tokens", params, { |
943 | 1016 | headers: { |
... | ... | @@ -947,8 +1020,10 @@ exports = module.exports = function (logger, rest, settings) { |
947 | 1020 | }) |
948 | 1021 | .on("success", function (data2) { |
949 | 1022 | logger.info("Third login json data2:", data2); |
1023 | + | |
950 | 1024 | if (data2.access_token) { |
951 | - var scopes = data2.scope.split(","); | |
1025 | + let scopes = data2.scope.split(","); | |
1026 | + | |
952 | 1027 | passport.user.token = data2.access_token; |
953 | 1028 | passport.user.refreshToken = data2.refresh_token; |
954 | 1029 | passport.user.user_info = data2.user || {}; |
... | ... | @@ -973,31 +1048,39 @@ exports = module.exports = function (logger, rest, settings) { |
973 | 1048 | type: data2.type, |
974 | 1049 | wx_open_id: data2.wx_open_id, |
975 | 1050 | }; |
1051 | + | |
976 | 1052 | callback(null, data2); |
977 | 1053 | } else { |
978 | - var err = new Error("Third login err"); | |
1054 | + let err = new Error("Third login err"); | |
1055 | + | |
979 | 1056 | passport.user.err = data2.message; |
1057 | + | |
980 | 1058 | callback(err, data2); |
981 | 1059 | } |
982 | 1060 | }) |
983 | 1061 | .on("error", function (err, response) { |
984 | 1062 | logger.error("Third login error", err); |
985 | - var err = new Error("Third login err"); | |
1063 | + | |
1064 | + let err = new Error("Third login err"); | |
1065 | + | |
986 | 1066 | callback(err, response); |
987 | 1067 | }) |
988 | 1068 | .on("fail", function (data2, response) { |
989 | 1069 | logger.error("Third login fail", data2); |
1070 | + | |
990 | 1071 | callback(data2, response); |
991 | 1072 | }); |
992 | 1073 | } else if (data && data.length > 1) { |
993 | 1074 | // #/login/choose-tenant |
994 | 1075 | callback(null, data); |
995 | 1076 | } else { |
996 | - var err = new Error("Third login tenants list item error"); | |
1077 | + let err = new Error("Third login tenants list item error"); | |
1078 | + | |
997 | 1079 | callback(err, data); |
998 | 1080 | } |
999 | 1081 | }, |
1000 | 1082 | ], |
1083 | + | |
1001 | 1084 | function (err, result) { |
1002 | 1085 | if (err) { |
1003 | 1086 | //登陆失败跳转失败页 |
... | ... | @@ -1056,8 +1139,9 @@ exports = module.exports = function (logger, rest, settings) { |
1056 | 1139 | } |
1057 | 1140 | } |
1058 | 1141 | |
1059 | - function getTastLink(req, res) { | |
1060 | - var url = crypto.createHash("md5").update(req.body.id).digest("hex"); | |
1142 | + async getTastLink(req, res) { | |
1143 | + let url = crypto.createHash("md5").update(req.body.id).digest("hex"); | |
1144 | + | |
1061 | 1145 | if (settings.prefix && settings.prefix.length > 1) { |
1062 | 1146 | res.send( |
1063 | 1147 | req.protocol + |
... | ... | @@ -1083,9 +1167,10 @@ exports = module.exports = function (logger, rest, settings) { |
1083 | 1167 | } |
1084 | 1168 | } |
1085 | 1169 | |
1086 | - function freedomJobsEmp(req, res) { | |
1087 | - var id = req.params.id; | |
1088 | - // var url = crypto.createHash('md5').update(id).digest('hex'); | |
1170 | + async freedomJobsEmp(req, res) { | |
1171 | + const { logger } = this; | |
1172 | + let id = req.params.id; | |
1173 | + | |
1089 | 1174 | if (false) { |
1090 | 1175 | //验证未通过verification != url |
1091 | 1176 | if (settings.prefix && settings.prefix.length > 1) { |
... | ... | @@ -1095,7 +1180,7 @@ exports = module.exports = function (logger, rest, settings) { |
1095 | 1180 | } |
1096 | 1181 | } else { |
1097 | 1182 | //验证通过跳转,获取token存到session里 |
1098 | - var passport = { | |
1183 | + let passport = { | |
1099 | 1184 | user: { |
1100 | 1185 | refreshToken: "", |
1101 | 1186 | token: "", |
... | ... | @@ -1104,11 +1189,12 @@ exports = module.exports = function (logger, rest, settings) { |
1104 | 1189 | err: null, |
1105 | 1190 | }, |
1106 | 1191 | }; |
1107 | - var tempParams = { | |
1192 | + let tempParams = { | |
1108 | 1193 | grant_type: "client_credential", |
1109 | 1194 | client_id: "340161778618994688", //多宝鱼环境 |
1110 | 1195 | client_secret: "0f8c30aa3d15332652f62c3eaf22fdea", |
1111 | 1196 | }; |
1197 | + | |
1112 | 1198 | rest.restful |
1113 | 1199 | .postJson(settings.restful.url + "uaa/v1/auth/tokens", tempParams, { |
1114 | 1200 | headers: { |
... | ... | @@ -1118,7 +1204,8 @@ exports = module.exports = function (logger, rest, settings) { |
1118 | 1204 | }) |
1119 | 1205 | .on("success", function (data) { |
1120 | 1206 | if (data.access_token) { |
1121 | - var scopes = data.scope.split(","); | |
1207 | + let scopes = data.scope.split(","); | |
1208 | + | |
1122 | 1209 | passport.user.token = data.access_token; |
1123 | 1210 | passport.user.refreshToken = data.refresh_token; |
1124 | 1211 | passport.user.user_info = data.user; |
... | ... | @@ -1130,6 +1217,7 @@ exports = module.exports = function (logger, rest, settings) { |
1130 | 1217 | passport.user.credential_status = data.user.credential_status; |
1131 | 1218 | passport.user.user_info.scope = scopes[0]; |
1132 | 1219 | req.session.passport = passport; |
1220 | + | |
1133 | 1221 | req.session.save(function () { |
1134 | 1222 | if (settings.prefix && settings.prefix.length > 1) { |
1135 | 1223 | res.redirect( |
... | ... | @@ -1148,7 +1236,9 @@ exports = module.exports = function (logger, rest, settings) { |
1148 | 1236 | }) |
1149 | 1237 | .on("error", function (err, response) { |
1150 | 1238 | logger.error("Third login error", err); |
1151 | - var err = new Error("Third login err"); | |
1239 | + | |
1240 | + let err = new Error("Third login err"); | |
1241 | + | |
1152 | 1242 | callback(err, response); |
1153 | 1243 | }) |
1154 | 1244 | .on("fail", function (data) { |
... | ... | @@ -1157,13 +1247,16 @@ exports = module.exports = function (logger, rest, settings) { |
1157 | 1247 | } |
1158 | 1248 | } |
1159 | 1249 | |
1160 | - function getShortToken(req, res) { | |
1161 | - var params = { | |
1250 | + async getShortToken(req, res) { | |
1251 | + const { logger } = this; | |
1252 | + let params = { | |
1162 | 1253 | grant_type: "refresh_token", |
1163 | 1254 | scope: req.session.passport.user.scope, |
1164 | 1255 | refresh_token: req.session.passport.user.refreshToken, |
1165 | 1256 | }; |
1257 | + | |
1166 | 1258 | logger.info("getShortToken:", params); |
1259 | + | |
1167 | 1260 | rest.postJson({ |
1168 | 1261 | baseUrl: "url", |
1169 | 1262 | url: |
... | ... | @@ -1179,61 +1272,13 @@ exports = module.exports = function (logger, rest, settings) { |
1179 | 1272 | options: {}, |
1180 | 1273 | excludeToken: true, |
1181 | 1274 | }); |
1275 | + | |
1182 | 1276 | function _cb(data, response) { |
1183 | - console.log(data); | |
1184 | 1277 | logger.info("back data:", data); |
1278 | + | |
1185 | 1279 | res.send({ code: response.statusCode, access_token: data.access_token }); |
1186 | 1280 | } |
1187 | 1281 | } |
1282 | +} | |
1188 | 1283 | |
1189 | - return { | |
1190 | - index: index, | |
1191 | - indexPrefix, | |
1192 | - register: register, | |
1193 | - signIn: signIn, | |
1194 | - doLogin: doLogin, | |
1195 | - signOut: signOut, | |
1196 | - smsCodes: smsCodes, | |
1197 | - tenants: tenants, | |
1198 | - productDes: productDes, | |
1199 | - resetPass: resetPass, | |
1200 | - updatePassword: updatePassword, | |
1201 | - loadUserInfo: loadUserInfo, | |
1202 | - getUploaderToken: getUploaderToken, | |
1203 | - getObjectTokenByID, | |
1204 | - delOSSObject: delOSSObject, | |
1205 | - healthMonitor, | |
1206 | - smsVerification, | |
1207 | - updateUserRoles, | |
1208 | - getRoles, | |
1209 | - getUserRoles, | |
1210 | - getTenant, | |
1211 | - updateTenant, | |
1212 | - offer, | |
1213 | - onboardStatus, | |
1214 | - dowloadApp, | |
1215 | - mobileRegister, | |
1216 | - mobileRegisterSuccess, | |
1217 | - softwareLicense, | |
1218 | - recharge, | |
1219 | - changePassForRegister, | |
1220 | - changeTenant, | |
1221 | - sendRejectOffer, | |
1222 | - acceptOffer, | |
1223 | - imTokens, | |
1224 | - listChannels, | |
1225 | - filemeta, | |
1226 | - getCustomerQrcode, | |
1227 | - getPositionQrcode, | |
1228 | - getOSSConfig, | |
1229 | - weidianTempLate, | |
1230 | - workaiSecurityOAuth, | |
1231 | - getTastLink, | |
1232 | - freedomJobsEmp, | |
1233 | - getShortToken, | |
1234 | - getImg | |
1235 | - }; | |
1236 | -}; | |
1237 | - | |
1238 | -exports["@singleton"] = true; | |
1239 | -exports["@require"] = ["igloo/logger", "utils/rest", "igloo/settings"]; | |
1284 | +module.exports = AuthController; | ... | ... |
1 | -var express = require("express"); | |
2 | -var payRoll = require("../json/payRoll.json"); | |
1 | +let payRoll = require("../json/payRoll.json"); | |
3 | 2 | |
4 | 3 | module.exports = (app) => { |
5 | 4 | const { router, controller } = app; |
6 | - console.log('hhhhhhhh哈哈哈哈哈哈',app); | |
7 | - // router.get("/index", controller.index); | |
5 | + | |
8 | 6 | router.get("/signOut", controller.signOut); |
9 | 7 | |
10 | 8 | router.get("/img/*", controller.getImg); |
... | ... | @@ -43,16 +41,6 @@ module.exports = (app) => { |
43 | 41 | |
44 | 42 | router.post("/getObjectTokenByID", controller.getObjectTokenByID); |
45 | 43 | |
46 | - // router.get( | |
47 | - // '/healthMonitor', | |
48 | - // controller.healthMonitor | |
49 | - // ) | |
50 | - | |
51 | - // router.head( | |
52 | - // '/healthMonitor', | |
53 | - // controller.healthMonitor | |
54 | - // ) | |
55 | - | |
56 | 44 | router.post("/getUserRoles", controller.getUserRoles); |
57 | 45 | |
58 | 46 | router.post("/getRoles", controller.getRoles); |
... | ... | @@ -111,9 +99,14 @@ module.exports = (app) => { |
111 | 99 | router.get("/getShortToken", controller.getShortToken); |
112 | 100 | |
113 | 101 | router.get("/gainianrenli/*", controller.getImg); |
102 | + | |
114 | 103 | router.get("/waifu_img/*", controller.getImg); |
104 | + | |
115 | 105 | router.get("/my_img/*", controller.getImg); |
106 | + | |
116 | 107 | router.get("/invoice_file_icon/*", controller.getImg); |
108 | + | |
117 | 109 | router.get("/gainianrenli/*", controller.getImg); |
110 | + | |
118 | 111 | router.get("/claim_icons/*", controller.getImg); |
119 | 112 | }; | ... | ... |
请
注册
或
登录
后发表评论