后台:问卷
This commit is contained in:
@@ -15,10 +15,11 @@ import { ActivityGroupModel } from '@db/ActivityGroup';
|
||||
import { nowSeconds } from '@pubUtils/timeUtil';
|
||||
import { WhiteListModel } from '@db/RegionWhiteList';
|
||||
import { RoleModel } from '@db/Role';
|
||||
import { SearchMarqueeParam, SearchOrderParam } from '@domain/backEndField/search';
|
||||
import { SearchMarqueeParam, SearchOrderParam, SearchSurveyParam } from '@domain/backEndField/search';
|
||||
import { DicServerName } from '@pubUtils/dictionary/DicServerName';
|
||||
import { CreateRegionParam } from '@domain/backEndField/params';
|
||||
import { UserOrderModel } from '@db/UserOrder';
|
||||
import { SurveyModel } from '@db/Survery';
|
||||
|
||||
/**
|
||||
* Test Service
|
||||
@@ -251,4 +252,34 @@ export default class Game extends Service {
|
||||
list, total
|
||||
});
|
||||
}
|
||||
|
||||
public async getSurveylist(page: number, pageSize: number, sortField: string, sortOrder: string, form: SearchSurveyParam) {
|
||||
const { ctx } = this;
|
||||
const list = await SurveyModel.findByCondition(page, pageSize, sortField, sortOrder, form);
|
||||
const total = await SurveyModel.countByCondition( form )
|
||||
return ctx.service.utils.resResult(STATUS.SUCCESS, {
|
||||
list: list.map(cur => {
|
||||
return { ...cur, env: this.app.config.realEnv }
|
||||
}), total
|
||||
});
|
||||
}
|
||||
|
||||
public async updateSurvey(param: any) {
|
||||
const { ctx } = this;
|
||||
try {
|
||||
let reward = JSON.parse(param.goods);
|
||||
|
||||
let result = await SurveyModel.updateSurvey(param.code, {...param, reward});
|
||||
if(!result) return ctx.service.utils.resResult(STATUS.WRONG_PARMS);
|
||||
return ctx.service.utils.resResult(STATUS.SUCCESS);
|
||||
} catch(e) {
|
||||
return ctx.service.utils.resResult(STATUS.WRONG_PARMS);
|
||||
}
|
||||
}
|
||||
|
||||
public async deleteSurvey(code: string) {
|
||||
const { ctx } = this;
|
||||
await SurveyModel.deleteSurvey(code);
|
||||
return ctx.service.utils.resResult(STATUS.SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user