zan-proxy
Version:
39 lines (33 loc) • 916 B
text/typescript
import { Inject, Service } from 'typedi';
import { ProfileService } from '../../services';
/**
* Created by tsxuehu on 4/11/17.
*/
()
export class ProfileController {
()
private profileService: ProfileService;
public regist(router) {
router.post('/profile/savefile', async ctx => {
const userId = ctx.userId;
await this.profileService.setProfile(userId, ctx.request.body);
ctx.body = {
code: 0,
};
});
router.post('/profile/setRuleState', async ctx => {
const userId = ctx.userId;
await this.profileService.setEnableRule(userId, !!ctx.query.rulestate);
ctx.body = {
code: 0,
};
});
router.post('/profile/setHostState', async ctx => {
const userId = ctx.userId;
await this.profileService.setEnableHost(userId, !!ctx.query.hoststate);
ctx.body = {
code: 0,
};
});
}
}