从"Blog"仓库中分离出来

This commit is contained in:
小海
2019-11-28 19:26:45 +08:00
commit c2aaf280db
616 changed files with 104128 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
import { TestBed } from '@angular/core/testing';
import { WebUpdateService } from './web-update.service';
describe('WebUpdateService', () => {
beforeEach(() => TestBed.configureTestingModule({}));
it('should be created', () => {
const service: WebUpdateService = TestBed.get(WebUpdateService);
expect(service).toBeTruthy();
});
});

View File

@@ -0,0 +1,48 @@
import {Injectable} from '@angular/core';
import {HttpService} from '../http.service';
import {UpdateInfo} from '../../classes/updateInfo';
import {Page} from '../../classes/page';
@Injectable({
providedIn: 'root'
})
export class WebUpdateService {
constructor(public http: HttpService) {
}
public updateInfoList: Page<UpdateInfo>;
public lastestUpdateTime: string;
getUpdateInfo(pageNum: number, pageSize: number) {
const observable = this.http.get(`/webUpdate/pages?page=${pageNum}&count=${pageSize}`);
observable.subscribe((data: any) => {
if (data.code === 0) {
this.updateInfoList = data.result;
}
});
return observable;
}
getLastestUpdateTime() {
this.http.get('/lastestUpdateTime').subscribe(data => {
if (data.code === 0) {
this.lastestUpdateTime = data.result;
}
})
}
update(submitBody: { id: number, info: string }) {
return this.http.put('/admin/webUpdate/update', submitBody, false);
}
create(infoStr: string) {
return this.http.post('/admin/webUpdate/create', {info: infoStr}, false);
}
delete(id: number) {
return this.http.delete(`/admin/webUpdate/del/${id}`);
}
}