Explorar o código

feat: 获取银行列表

max hai 7 meses
pai
achega
df62f91ce2
Modificáronse 2 ficheiros con 14 adicións e 14 borrados
  1. 7 3
      src/config/config.max.ts
  2. 7 11
      src/modules/api/controller/banks.ts

+ 7 - 3
src/config/config.max.ts

@@ -9,10 +9,14 @@ export default {
     dataSource: {
       default: {
         type: 'mysql',
-        host: '192.168.2.101',
-        port: 6806,
+        // host: '192.168.2.101',
+        // port: 6806,
+        // username: 'root',
+        // password: 'admin',
+        host: '127.0.0.1',
+        port: 3306,
         username: 'root',
-        password: 'admin',
+        password: '12345678',
         database: 'va',
         // 自动建表 注意:线上部署的时候不要使用,有可能导致数据丢失
         synchronize: true,

+ 7 - 11
src/modules/api/controller/banks.ts

@@ -1,6 +1,7 @@
 import { CoolController, BaseController } from '@cool-midway/core';
-import { ALL, Body, Get, Inject, Post, Provide } from '@midwayjs/decorator';
+import { ALL, Body, Get, Inject, Post, Provide, Query } from '@midwayjs/decorator';
 import { BusinessEntity } from '../../payment/entity/business';
+import { SunPayAdapter } from '../../payment/adapter/sunpay.adapter';
 
 /**
  * 支持银行
@@ -8,19 +9,14 @@ import { BusinessEntity } from '../../payment/entity/business';
 @Provide()
 @CoolController('/api/v1/Fiat')
 export class BanksController extends BaseController {
+  @Inject()
+  sunPayAdapter: SunPayAdapter;
   /**
    * 获取银行列表
    * /api/v3/Fiat/Banks
    */
-  @Post('/Banks', { summary: '获取银行列表' })
-  async getBanks(@Body(ALL) business: BusinessEntity) {
-    // if (!this.allowKeys.includes(key)) {
-    //   return this.fail('非法操作');
-    // }
-    // 关键参数校验
-    // 数据落库
-    // 回调
-    console.log(business);
-    return this.ok('hello, cool-admin!!!');
+  @Get('/Banks', { summary: '获取银行列表' })
+  async getBanks(@Body(ALL) params: any) {
+    return await this.sunPayAdapter.getBanks(params)
   }
 }