File tree Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -25,4 +25,9 @@ export default class LogsController {
2525 //
2626 }
2727
28+ static async test ( ctx : Context ) {
29+ console . log ( 'ctx.path: ' , ctx . path . length , ctx . params )
30+ ctx . body = ctx . params . id . length
31+ }
32+
2833}
Original file line number Diff line number Diff line change @@ -52,6 +52,18 @@ export default class DoubleColorBallController {
5252 return pages
5353 }
5454
55+ /***
56+ * batch insert(test)
57+ */
58+ static async batchInsert ( ctx : Context ) {
59+ const list = ctx . fields as object [ ]
60+ console . log ( list , '----9999' , ctx . state )
61+ for ( let i = list . length - 1 ; i >= 0 ; i -- ) {
62+ await DoubleColorBallController . insert ( list [ i ] , ctx )
63+ }
64+ ctx . Json ( { data : 999 } )
65+ }
66+
5567 static async insert ( args : any , ctx : Context ) {
5668 const ball = await getRepository ( Balls ) . findOne ( { issue : args . issue } )
5769 if ( ball ) {
Original file line number Diff line number Diff line change @@ -6,16 +6,19 @@ import AccountCtrl from '../controllers/AccountController'
66import FileCtrl from '../controllers/FileController'
77import LogsCtrl from '../controllers/LogsController'
88import ServerAPI from '../controllers/ServerAPIController'
9+ import DoubleColorBallController from '../controllers/DoubleColorBallController'
910
1011const _PROD_ = process . env . NODE_ENV === 'production'
1112
1213const router = new Router ( ) ;
1314
1415router
16+ . post ( '/api/testInsert' , DoubleColorBallController . batchInsert )
1517 . post ( '/api/login' , AccountCtrl . login )
1618 . post ( '/api/logout' , AccountCtrl . logout )
1719 . get ( '/view/:site' , DemoCtrl . views )
1820 . post ( '/api/compose' , DemoCtrl . compose )
21+ . get ( '/api/test/:id' , DemoCtrl . test )
1922 . post ( '/platform/*' , ServerAPI . KDJZ )
2023 . get ( '/api/log-api' , LogsCtrl . apiPages )
2124 . get ( '/api/log-errors' , LogsCtrl . errorsPages )
You can’t perform that action at this time.
0 commit comments