Files
ZYZ/web-server/app/controller/sdk.ts
2021-11-10 17:28:11 +08:00

47 lines
1.3 KiB
TypeScript

import { STATUS } from '@consts';
import { httpRequest } from 'app/pubUtils/httpUtil';
import { Controller } from 'egg';
import { PayCallback37Data } from '../domain/sdk';
export default class SdkController extends Controller {
public async pay37Callback() {
const { ctx } = this;
const params: PayCallback37Data = ctx.request.body;
ctx.body = await ctx.service.sdk.pay37Callback(params);
return;
}
public async treatRoleName() {
const { ctx } = this;
let test = await httpRequest('http://127.0.0.1:7001/cb/treatguildname', "POST", {}, null);
console.log('result: ', typeof test, test);
ctx.body = ctx.service.utils.resResult(STATUS.SUCCESS, '');
return;
}
public async treatGuildName() {
const { ctx } = this;
let promiseFun = () => {
return new Promise(resolve => {
setTimeout(() => {
resolve(ctx.service.utils.resResult(STATUS.SUCCESS, ''));
}, 1000)
})
}
ctx.body = await promiseFun();
return;
}
public async getGuildByUser() {
const { ctx } = this;
ctx.body = ctx.service.utils.resResult(STATUS.SUCCESS, '');
return;
}
}