import {CreateCustomerDTO} from "../dto/customer"; import { CoolController, BaseController } from '@cool-midway/core'; import { ALL, Body, Get, Inject, Param, Post, Provide, Put, } from '@midwayjs/decorator'; import { BusinessEntity } from '../../payment/entity/business'; import {Validate} from "@midwayjs/validate"; import {BusinessService} from "../../payment/service/business"; import {PaymentService} from "../../payment/service/payment"; /** * 客户管理 */ @Provide() @CoolController('/api/v1/Fiat') export class CustomerController extends BaseController { @Inject() businessService: BusinessService; /** * 创建客户 */ @Post('/CreateCustomer', { summary: '创建客户' }) @Validate({ errorStatus: 422, }) async createCustomer(@Body() params: CreateCustomerDTO) { return this.ok(params); // return this.ok(await this.businessService.add(params)); } /** * 获取创建客户必填字段 */ @Get('/CustomerRequiredFields', { summary: '获取创建客户必填字段' }) async getCustomerRequiredFields(@Body(ALL) business: BusinessEntity) { // if (!this.allowKeys.includes(key)) { // return this.fail('非法操作'); // } // 关键参数校验 // 数据落库 // 回调 console.log(business); return this.ok('hello, cool-admin!!!'); } /** * 验证客户必填字段 * /api/v3/Fiat/Customer/Validate */ @Post('/Customer/Validate', { summary: '验证客户必填字段' }) async param(@Body(ALL) business: BusinessEntity) { // if (!this.allowKeys.includes(key)) { // return this.fail('非法操作'); // } // 关键参数校验 // 数据落库 // 回调 console.log(business); return this.ok('hello, cool-admin!!!'); } /** * 修改客户 * /api/v3/Fiat/Customer */ @Put('/updateCustomer', { summary: '修改客户' }) async updateCustomer(@Body(ALL) business: BusinessEntity) { // if (!this.allowKeys.includes(key)) { // return this.fail('非法操作'); // } // 关键参数校验 // 数据落库 // 回调 console.log(business); return this.ok('hello, cool-admin!!!'); } /** * TODO 创建客户回调通知 * */ @Post('/callback', { summary: '创建客户回调通知' }) async createCustomerCallback(@Body(ALL) business: BusinessEntity) { // if (!this.allowKeys.includes(key)) { // return this.fail('非法操作'); // } // 关键参数校验 // 数据落库 // 回调 console.log(business); return this.ok('hello, cool-admin!!!'); } }