Commit 8c172da7 authored by nanahira's avatar nanahira

add ad

parent 780e4a9e
Pipeline #17952 passed with stages
in 2 minutes and 6 seconds
export { Blacklist } from './models/blacklist'; export { Blacklist } from './models/blacklist';
export { BlacklistAccount } from './models/blacklist-account'; export { BlacklistAccount } from './models/blacklist-account';
export { BlacklistAccountPaginatedReturnMessageDto } from './models/blacklist-account-paginated-return-message-dto'; export { BlacklistAccountPaginatedReturnMessageDto } from './models/blacklist-account-paginated-return-message-dto';
export { StringReturnMessageDto } from './models/string-return-message-dto';
/* tslint:disable */
/* eslint-disable */
export interface StringReturnMessageDto {
/**
* Return data.
*/
data?: string;
/**
* Return message
*/
message: string;
/**
* Return code
*/
statusCode: number;
/**
* Whether success.
*/
success: boolean;
}
...@@ -10,6 +10,7 @@ import { Observable } from 'rxjs'; ...@@ -10,6 +10,7 @@ import { Observable } from 'rxjs';
import { map, filter } from 'rxjs/operators'; import { map, filter } from 'rxjs/operators';
import { BlacklistAccountPaginatedReturnMessageDto } from '../models/blacklist-account-paginated-return-message-dto'; import { BlacklistAccountPaginatedReturnMessageDto } from '../models/blacklist-account-paginated-return-message-dto';
import { StringReturnMessageDto } from '../models/string-return-message-dto';
@Injectable({ @Injectable({
providedIn: 'root', providedIn: 'root',
...@@ -120,4 +121,55 @@ export class ApiService extends BaseService { ...@@ -120,4 +121,55 @@ export class ApiService extends BaseService {
); );
} }
/**
* Path part for operation adControllerGetAd
*/
static readonly AdControllerGetAdPath = '/api/ad';
/**
* Get ad.
*
*
*
* This method provides access to the full `HttpResponse`, allowing access to response headers.
* To access only the response body, use `adControllerGetAd()` instead.
*
* This method doesn't expect any request body.
*/
adControllerGetAd$Response(params?: {
}): Observable<StrictHttpResponse<StringReturnMessageDto>> {
const rb = new RequestBuilder(this.rootUrl, ApiService.AdControllerGetAdPath, 'get');
if (params) {
}
return this.http.request(rb.build({
responseType: 'json',
accept: 'application/json'
})).pipe(
filter((r: any) => r instanceof HttpResponse),
map((r: HttpResponse<any>) => {
return r as StrictHttpResponse<StringReturnMessageDto>;
})
);
}
/**
* Get ad.
*
*
*
* This method provides access to only to the response body.
* To access the full response (for headers, for example), `adControllerGetAd$Response()` instead.
*
* This method doesn't expect any request body.
*/
adControllerGetAd(params?: {
}): Observable<StringReturnMessageDto> {
return this.adControllerGetAd$Response(params).pipe(
map((r: StrictHttpResponse<StringReturnMessageDto>) => r.body as StringReturnMessageDto)
);
}
} }
...@@ -3,6 +3,12 @@ ...@@ -3,6 +3,12 @@
</header> </header>
<div class="container"> <div class="container">
<div class="row" *ngIf="ad">
<ul class="list-group">
<li class="list-group-item list-group-item-info" [innerHTML]="ad"></li>
</ul>
</div>
<br *ngIf="ad">
<div class="row"> <div class="row">
<div class="col-lg-3"></div> <div class="col-lg-3"></div>
<div class="col-lg-6"> <div class="col-lg-6">
......
import { Component } from '@angular/core'; import { AfterViewInit, Component } from '@angular/core';
import { ToastService } from './toast.service'; import { ToastService } from './toast.service';
import { BlacklistAccount } from './api/models/blacklist-account'; import { BlacklistAccount } from './api/models/blacklist-account';
import { ApiService } from './api/services/api.service'; import { ApiService } from './api/services/api.service';
...@@ -10,17 +10,31 @@ import * as moment from 'moment'; ...@@ -10,17 +10,31 @@ import * as moment from 'moment';
templateUrl: './app.component.html', templateUrl: './app.component.html',
styleUrls: ['./app.component.css'], styleUrls: ['./app.component.css'],
}) })
export class AppComponent { export class AppComponent implements AfterViewInit {
search = ''; search = '';
displayingAccount = ''; displayingAccount = '';
title = '蔷蔷挂人查询'; title = '蔷蔷挂人查询';
ad = '';
result?: BlacklistAccount[]; result?: BlacklistAccount[];
constructor(public toast: ToastService, private api: ApiService) {} constructor(public toast: ToastService, private api: ApiService) {}
ngAfterViewInit() {
this.initAd();
}
displayDate(date: string) { displayDate(date: string) {
return moment(date).format('YYYY-MM-DD HH:mm:ss'); return moment(date).format('YYYY-MM-DD HH:mm:ss');
} }
async initAd() {
try {
const ad = await lastValueFrom(this.api.adControllerGetAd());
this.ad = ad.data!;
} catch (e) {
console.log(`Failed to load ad: ${(e as Error).toString()}`);
}
}
async onSearch() { async onSearch() {
this.result = undefined; this.result = undefined;
const search = this.search.trim(); const search = this.search.trim();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment