|
|
|
@ -4,6 +4,27 @@ |
|
|
|
|
import {JSONResponse, Result, TransformData} from "./interface"; |
|
|
|
|
import {ActivityDetail, PageProps, User, UserType} from "./entity"; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 空body响应 |
|
|
|
|
*/ |
|
|
|
|
export enum SimpleMessage { |
|
|
|
|
//操作失败
|
|
|
|
|
ok="ok", |
|
|
|
|
//操作成功
|
|
|
|
|
fail="fail" |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 空body响应 |
|
|
|
|
*/ |
|
|
|
|
export class EmptyBodyTransform extends TransformData<SimpleMessage, JSONResponse<SimpleMessage>>{ |
|
|
|
|
protected newObject(): JSONResponse<SimpleMessage> { |
|
|
|
|
return new JSONResponse<SimpleMessage>(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export abstract class EmptyBodyDiffMsg<T> extends TransformData<T, JSONResponse<T>>{} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 注册响应信息 |
|
|
|
|
*/ |
|
|
|
@ -18,21 +39,13 @@ export enum RegisterMessage { |
|
|
|
|
form_parse_error = "form_parse_error" |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 注册响应实体 |
|
|
|
|
*/ |
|
|
|
|
export class RegisterRes implements JSONResponse<RegisterMessage> { |
|
|
|
|
customResult?: RegisterMessage; |
|
|
|
|
result?: Result; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 注册响应结果转换 |
|
|
|
|
*/ |
|
|
|
|
export class RegisterTransform extends TransformData<RegisterMessage, RegisterRes> { |
|
|
|
|
protected newObject(): RegisterRes { |
|
|
|
|
return new RegisterRes(); |
|
|
|
|
export class RegisterTransform extends EmptyBodyDiffMsg<RegisterMessage>{ |
|
|
|
|
protected newObject(): JSONResponse<RegisterMessage> { |
|
|
|
|
return new JSONResponse<RegisterMessage>(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -74,59 +87,24 @@ export class LoginTransform extends TransformData<LoginResMessage,LoginRes>{ |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 发布求助信息结果 |
|
|
|
|
*/ |
|
|
|
|
export enum ActivityMessage { |
|
|
|
|
//发布成功
|
|
|
|
|
ok="ok", |
|
|
|
|
//发布失败请联系管理员
|
|
|
|
|
fail="fail" |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 发布求助信息响应实体 |
|
|
|
|
*/ |
|
|
|
|
export class SendHelpRes extends JSONResponse<ActivityMessage>{ |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 发布求助信息响应结果转换 |
|
|
|
|
*/ |
|
|
|
|
export class SendHelpTransform extends TransformData<ActivityMessage, SendHelpRes>{ |
|
|
|
|
protected newObject(): SendHelpRes { |
|
|
|
|
return new SendHelpRes(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 查询活动列表结果 |
|
|
|
|
* 分页数据转换 |
|
|
|
|
*/ |
|
|
|
|
export enum FindActivityMessage { |
|
|
|
|
export enum PageDataMessage { |
|
|
|
|
ok="ok", |
|
|
|
|
fail="fail", |
|
|
|
|
// 空数据
|
|
|
|
|
//空数据
|
|
|
|
|
empty="empty" |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 查询活动列表响应实体 |
|
|
|
|
*/ |
|
|
|
|
export class FindActivityRes extends JSONResponse<FindActivityMessage>{ |
|
|
|
|
dataList?:Array<Array<ActivityDetail>> |
|
|
|
|
page?:PageProps |
|
|
|
|
export abstract class PageDataRes extends JSONResponse<PageDataMessage>{ |
|
|
|
|
dataList?:any; |
|
|
|
|
page?:PageProps; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 活动列表数据转换 |
|
|
|
|
*/ |
|
|
|
|
export class FindActivityTransform extends TransformData<FindActivityMessage, FindActivityRes>{ |
|
|
|
|
protected newObject(): FindActivityRes { |
|
|
|
|
return new FindActivityRes(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export abstract class PageDataTransform<T extends PageDataRes> extends TransformData<PageDataMessage, T>{ |
|
|
|
|
|
|
|
|
|
protected transformBody(data: any) { |
|
|
|
|
if(data.body!==null){ |
|
|
|
@ -141,19 +119,29 @@ export class FindActivityTransform extends TransformData<FindActivityMessage, Fi |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 查询活动 |
|
|
|
|
* 查询活动列表响应实体 |
|
|
|
|
*/ |
|
|
|
|
export enum FindUserMessage { |
|
|
|
|
ok="ok", |
|
|
|
|
fail="fail", |
|
|
|
|
empty="empty" |
|
|
|
|
export class FindActivityRes extends PageDataRes{ |
|
|
|
|
dataList?:Array<Array<ActivityDetail>> |
|
|
|
|
page?:PageProps |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 活动列表数据转换 |
|
|
|
|
*/ |
|
|
|
|
export class FindActivityTransform extends PageDataTransform<FindActivityRes>{ |
|
|
|
|
protected newObject(): FindActivityRes { |
|
|
|
|
return new FindActivityRes(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 用户信息实体 |
|
|
|
|
*/ |
|
|
|
|
export class FindUserRes extends JSONResponse<FindUserMessage>{ |
|
|
|
|
export class FindUserRes extends PageDataRes{ |
|
|
|
|
dataList?:Array<Array<User>> |
|
|
|
|
page?:PageProps |
|
|
|
|
} |
|
|
|
@ -161,42 +149,27 @@ export class FindUserRes extends JSONResponse<FindUserMessage>{ |
|
|
|
|
/** |
|
|
|
|
* 用户数据转换 |
|
|
|
|
*/ |
|
|
|
|
export class FindUserTransform extends TransformData<FindUserMessage, FindUserRes>{ |
|
|
|
|
export class FindUserTransform extends PageDataTransform<FindUserRes>{ |
|
|
|
|
protected newObject(): FindUserRes { |
|
|
|
|
return new FindUserRes(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected transformBody(data: any) { |
|
|
|
|
if(data.body!==null){ |
|
|
|
|
this.target.dataList=data.body.body |
|
|
|
|
this.target.page={ |
|
|
|
|
currentPage:data.body.currentPage, |
|
|
|
|
totalPage:data.body.totalPage, |
|
|
|
|
pageSize:data.body.pageSize |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export enum ActivityDetailMessage { |
|
|
|
|
ok="ok", |
|
|
|
|
fail="fail" |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export class ActivityDetailRes extends JSONResponse<ActivityDetailMessage>{ |
|
|
|
|
export class ActivityDetailRes extends JSONResponse<SimpleMessage>{ |
|
|
|
|
activity?:ActivityDetail |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export class ActivityDetailTransform extends TransformData<ActivityDetailMessage, ActivityDetailRes>{ |
|
|
|
|
export class ActivityDetailTransform extends TransformData<SimpleMessage, ActivityDetailRes>{ |
|
|
|
|
protected newObject(): ActivityDetailRes { |
|
|
|
|
return new ActivityDetailRes(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected transformBody(data: any) { |
|
|
|
|
this.target.activity=data.body |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|