|
|
@ -4,6 +4,27 @@ |
|
|
|
import {JSONResponse, Result, TransformData} from "./interface"; |
|
|
|
import {JSONResponse, Result, TransformData} from "./interface"; |
|
|
|
import {ActivityDetail, PageProps, User, UserType} from "./entity"; |
|
|
|
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" |
|
|
|
form_parse_error = "form_parse_error" |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 注册响应实体 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
export class RegisterRes implements JSONResponse<RegisterMessage> { |
|
|
|
|
|
|
|
customResult?: RegisterMessage; |
|
|
|
|
|
|
|
result?: Result; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 注册响应结果转换 |
|
|
|
* 注册响应结果转换 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
export class RegisterTransform extends TransformData<RegisterMessage, RegisterRes> { |
|
|
|
export class RegisterTransform extends EmptyBodyDiffMsg<RegisterMessage>{ |
|
|
|
protected newObject(): RegisterRes { |
|
|
|
protected newObject(): JSONResponse<RegisterMessage> { |
|
|
|
return new RegisterRes(); |
|
|
|
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", |
|
|
|
ok="ok", |
|
|
|
fail="fail", |
|
|
|
fail="fail", |
|
|
|
//空数据
|
|
|
|
//空数据
|
|
|
|
empty="empty" |
|
|
|
empty="empty" |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
export abstract class PageDataRes extends JSONResponse<PageDataMessage>{ |
|
|
|
* 查询活动列表响应实体 |
|
|
|
dataList?:any; |
|
|
|
*/ |
|
|
|
page?:PageProps; |
|
|
|
export class FindActivityRes extends JSONResponse<FindActivityMessage>{ |
|
|
|
|
|
|
|
dataList?:Array<Array<ActivityDetail>> |
|
|
|
|
|
|
|
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) { |
|
|
|
protected transformBody(data: any) { |
|
|
|
if(data.body!==null){ |
|
|
|
if(data.body!==null){ |
|
|
@ -141,19 +119,29 @@ export class FindActivityTransform extends TransformData<FindActivityMessage, Fi |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 查询活动 |
|
|
|
* 查询活动列表响应实体 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
export enum FindUserMessage { |
|
|
|
export class FindActivityRes extends PageDataRes{ |
|
|
|
ok="ok", |
|
|
|
dataList?:Array<Array<ActivityDetail>> |
|
|
|
fail="fail", |
|
|
|
page?:PageProps |
|
|
|
empty="empty" |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 活动列表数据转换 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
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>> |
|
|
|
dataList?:Array<Array<User>> |
|
|
|
page?:PageProps |
|
|
|
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 { |
|
|
|
protected newObject(): FindUserRes { |
|
|
|
return new 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 |
|
|
|
activity?:ActivityDetail |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export class ActivityDetailTransform extends TransformData<ActivityDetailMessage, ActivityDetailRes>{ |
|
|
|
export class ActivityDetailTransform extends TransformData<SimpleMessage, ActivityDetailRes>{ |
|
|
|
protected newObject(): ActivityDetailRes { |
|
|
|
protected newObject(): ActivityDetailRes { |
|
|
|
return new ActivityDetailRes(); |
|
|
|
return new ActivityDetailRes(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected transformBody(data: any) { |
|
|
|
protected transformBody(data: any) { |
|
|
|
this.target.activity=data.body |
|
|
|
this.target.activity=data.body |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|