import { Body, Inject, Post } from '@midwayjs/core';
|
import { CoolController, BaseController } from '@cool-midway/core';
|
import { RecycleTransactionEntity } from '../../entity/transaction';
|
import { RecycleTransactionService } from '../../service/transaction';
|
|
/**
|
* 碳积分流水-应用端
|
*/
|
@CoolController({
|
api: ['page'],
|
entity: RecycleTransactionEntity,
|
service: RecycleTransactionService,
|
pageQueryOp: {
|
addOrderBy: {
|
createTime: 'DESC',
|
},
|
},
|
})
|
export class AppRecycleTransactionController extends BaseController {
|
@Inject()
|
recycleTransactionService: RecycleTransactionService;
|
|
@Post('/checkUser', { summary: '校验转赠接收人' })
|
async checkUser(@Body('unionid') unionid: string) {
|
return this.ok(await this.recycleTransactionService.checkUser(unionid));
|
}
|
|
@Post('/transfer', { summary: '碳积分转赠' })
|
async transfer(
|
@Body()
|
body: {
|
fromUnionid: string;
|
toUnionid: string;
|
amount: number;
|
}
|
) {
|
return this.ok(await this.recycleTransactionService.transfer(body));
|
}
|
}
|