diff --git a/index/src/app/api/api.service.ts b/index/src/app/api/api.service.ts index 369d73e..1933630 100644 --- a/index/src/app/api/api.service.ts +++ b/index/src/app/api/api.service.ts @@ -6,7 +6,7 @@ import {HttpService} from './http/http.service'; import {PageList} from '../class/HttpReqAndResp'; import {ErrDispatch} from '../class/ErrDispatch'; import {ArticleReq} from '../class/Article'; -import {Tag} from '../class/Tag'; +import {Category, Tag} from '../class/Tag'; import {Comment} from '../class/Comment'; import {CommentReq} from '../class/Comment'; import {Link} from '../class/Link'; @@ -14,6 +14,8 @@ import {User} from '../class/User'; import {LoginReq} from '../class/User'; import {LocalStorageService} from '../services/local-storage.service'; +import {Visitor} from '../class/Visitor'; +import {UpdateInfo} from '../class/UpdateInfo'; @Injectable({ providedIn: 'root' @@ -39,6 +41,14 @@ export class ApiService extends HttpService { }); } + deleteArticle(id: number) { + return super.Service({ + path: '/admin/article/del', + method: 'DELETE', + queryParam: {articleID: id} + }) + } + articles(pageNumber: number = 1, pageSize: number = 5) { return super.Service>({ path: '/articles', @@ -50,6 +60,17 @@ export class ApiService extends HttpService { }); } + adminArticles(pageNumber: number = 1, pageSize: number = 10) { + return super.Service>({ + path: '/admin/articles', + method: 'GET', + queryParam: { + page: pageNumber, + count: pageSize + } + }); + } + updateArticle(article: ArticleReq) { return super.Service
({ path: '/admin/article/update', @@ -96,6 +117,30 @@ export class ApiService extends HttpService { }); } + createCategory(nameStr: string) { + return super.Service({ + path: '/admin/category/create', + method: 'POST', + queryParam: {name: nameStr} + }); + } + + deleteCategory(categoryId: number) { + return super.Service({ + path: '/admin/category/del', + method: 'DELETE', + queryParam: {id: categoryId} + }); + } + + updateCategory(categoryId: number, nameStr: string) { + return super.Service({ + path: '/admin/category/update', + method: 'PUT', + queryParam: {id: categoryId, name: nameStr} + }); + } + tags(pageNumber: number = 1, pageSize: number = 10) { return super.Service({ path: '/tags', @@ -114,8 +159,33 @@ export class ApiService extends HttpService { }); } + createTag(nameStr: string) { + return super.Service({ + path: '/admin/tag/create', + method: 'POST', + queryParam: {name: nameStr} + }); + } + + deleteTag(TagId: number) { + return super.Service({ + path: '/admin/tag/del', + method: 'DELETE', + queryParam: {id: TagId} + }); + } + + updateTag(TagId: number, nameStr: string) { + return super.Service({ + path: '/admin/tag/update', + method: 'PUT', + queryParam: {id: TagId, name: nameStr} + }); + } + + getCommentByPid(pid: number, pageNumber: number = 1, pageSize: number = 10) { - return super.Service[]>({ + return super.Service({ path: `/comment/pid/${pid}`, method: 'GET', queryParam: { @@ -125,6 +195,45 @@ export class ApiService extends HttpService { }); } + getCommentByTypeForAdmin(isComment: boolean, pageNumber: number = 1, pageSize: number = 10) { + return super.Service>({ + path: `/admin/comment/type/${isComment ? 1 : 0}`, + method: 'GET', + queryParam: { + page: pageNumber, + count: pageSize + } + }); + } + + getCommentByTypeForUser(isComment: boolean, pageNumber: number = 1, pageSize: number = 10) { + return super.Service>({ + path: `/user/comment/type/${isComment ? 1 : 0}`, + method: 'GET', + queryParam: { + page: pageNumber, + count: pageSize + } + }); + } + + deleteComment(idNumer: number) { + return super.Service({ + path: `/user/comment/del`, + method: 'DELETE', + queryParam: {id: idNumer} + }); + } + + updateComment(commentReq: CommentReq) { + return super.Service({ + path: `/user/comment/update`, + method: 'PUT', + data: commentReq, + contentType: 'application/json' + }); + } + comments(articleID: number, pageSize: number = 10, pageNumber: number = 1) { return super.Service>({ path: '/comments', @@ -172,6 +281,42 @@ export class ApiService extends HttpService { }); } + adminLinks(pageSize: number = 10, pageNumber: number = 1) { + return super.Service>({ + path: '/admin/links', + method: 'GET', + queryParam: { + count: pageSize, + page: pageNumber + } + }); + } + + createLink(linkReq: Link) { + return super.Service({ + path: '/admin/links/create', + method: 'POST', + data: linkReq, + contentType: 'application/json' + }); + } + + deleteLink(idNumber: number) { + return super.Service({ + path: `/admin/links/del/${idNumber}`, + method: 'DELETE', + }); + } + + updateLink(linkReq: Link) { + return super.Service({ + path: '/admin/links/update', + method: 'PUT', + data: linkReq, + contentType: 'application/json' + }); + } + applyLink(link: Link) { return super.Service({ path: '/apply', @@ -273,10 +418,105 @@ export class ApiService extends HttpService { }); } - visit() { + adminUpdateUser(user: User) { return super.Service({ + path: '/admin/user', + method: 'PUT', + data: user, + contentType: 'application/json' + }) + } + + deleteUser(id: number) { + return super.Service({ + path: `/admin/user/del/${id}`, + method: 'DELETE', + }); + } + + multipleDeleteUser(idArray: number[]) { + return super.Service<{ id: number; msg: string; status: boolean }[]>({ + path: `/admin/user/delete`, + method: 'DELETE', + data: idArray, + contentType: 'application/json' + }); + } + + // 获取邮件是否已注册 + emailStatus(email: string) { + return super.Service({ + path: `/emailStatus/${email}`, + method: 'GET' + }) + } + + updateUserInfo(descStr: string, disPlayNameStr: string) { + return super.Service({ + path: '/user/userInfo/update', + method: 'PUT', + queryParam: { + desc: descStr, + displayName: disPlayNameStr + } + }); + } + + adminUsers(pageSize: number = 10, pageNumber: number = 1) { + return super.Service>({ + path: '/admin/users', + method: 'GET', + queryParam: { + count: pageSize, + page: pageNumber + } + }); + } + + visit() { + return super.Service({ path: '/visit', - method: 'POST', + method: 'POST' + }); + } + + adminVisitors(location: boolean = false, pageSize: number = 10, pageNumber: number = 1) { + return super.Service>({ + path: '/admin/visitor/page', + method: 'GET', + queryParam: { + count: pageSize, + page: pageNumber, + showLocation: location + } + }); + } + + dayVisitCount() { + return super.Service({ + path: '/dayVisitCount', + method: 'GET', + }); + } + + getLocalIp() { + return super.Service({ + path: '/ip', + method: 'GET', + }); + } + + getIpLocation(ip: string) { + return super.Service({ + path: `/ip/${ip}`, + method: 'GET', + }); + } + + visitorCount() { + return super.Service({ + path: `/visitor/count`, + method: 'GET', }); } @@ -301,6 +541,29 @@ export class ApiService extends HttpService { }); } + createWebUpdateInfo(infoStr: string) { + return super.Service({ + path: '/admin/webUpdate/create', + method: 'POST', + queryParam: {info: infoStr} + }); + } + + deleteWebUpdateInfo(idNumber: number) { + return super.Service({ + path: `/admin/webUpdate/del/${idNumber}`, + method: 'DELETE', + }); + } + + updateWebUpdateInfo(idNumber: number, infoStr: string) { + return super.Service({ + path: '/admin/webUpdate/update', + method: 'PUT', + queryParam: {id: idNumber, info: infoStr} + }); + } + bingPic() { return super.Service({ path: '/bingPic', diff --git a/index/src/app/class/Link.ts b/index/src/app/class/Link.ts index 782ccf6..a44c984 100644 --- a/index/src/app/class/Link.ts +++ b/index/src/app/class/Link.ts @@ -2,4 +2,5 @@ export class Link { id?: number; name: string; url: string; -} \ No newline at end of file + open?: boolean; +} diff --git a/index/src/app/class/UpdateInfo.ts b/index/src/app/class/UpdateInfo.ts new file mode 100644 index 0000000..f937b24 --- /dev/null +++ b/index/src/app/class/UpdateInfo.ts @@ -0,0 +1,5 @@ +export class UpdateInfo { + id: number; + info: string; + time: string; +} diff --git a/index/src/app/class/User.ts b/index/src/app/class/User.ts index 09c84c3..4fe382d 100644 --- a/index/src/app/class/User.ts +++ b/index/src/app/class/User.ts @@ -3,10 +3,11 @@ export class User { email: string; displayName: string; emailStatus: boolean; - avatarImgUrl: string; + avatarImgUrl?: string; desc: string; role: string; token?: string; + pwd?: string; } export class LoginReq { @@ -19,4 +20,4 @@ export class LoginReq { this.isRememberMe = isRememberMe; this.password = password; } -} \ No newline at end of file +} diff --git a/index/src/app/class/Visitor.ts b/index/src/app/class/Visitor.ts new file mode 100644 index 0000000..5e498a5 --- /dev/null +++ b/index/src/app/class/Visitor.ts @@ -0,0 +1,9 @@ +export class Visitor { + id: number; + ip: string; + date: string; + browserName: string; + browserVersion: string; + osname: string; + location: string; +}