Commit 2252cc1f authored by nanahira's avatar nanahira

new

parent d2b363e8
Pipeline #36479 passed with stages
in 3 minutes and 50 seconds
{ {
"$schema": "./node_modules/@angular/cli/lib/config/schema.json", "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"cli": {
"analytics": false
},
"version": 1, "version": 1,
"newProjectRoot": "projects", "newProjectRoot": "projects",
"projects": { "projects": {
......
export { Blacklist } from './models/blacklist'; export { BlacklistAccountBlacklistResultDto } from './models/blacklist-account-blacklist-result-dto';
export { BlacklistAccount } from './models/blacklist-account'; export { BlacklistAccountResultDto } from './models/blacklist-account-result-dto';
export { BlacklistAccountPaginatedReturnMessageDto } from './models/blacklist-account-paginated-return-message-dto'; export { BlacklistAccountResultDtoPaginatedReturnMessageDto } from './models/blacklist-account-result-dto-paginated-return-message-dto';
export { Ad } from './models/ad'; export { Ad } from './models/ad';
export { AdReturnMessageDto } from './models/ad-return-message-dto'; export { AdReturnMessageDto } from './models/ad-return-message-dto';
export { StringReturnMessageDto } from './models/string-return-message-dto'; export { StringReturnMessageDto } from './models/string-return-message-dto';
export { WhitelistAccountResultDto } from './models/whitelist-account-result-dto';
export { WhitelistAccountResultDtoPaginatedReturnMessageDto } from './models/whitelist-account-result-dto-paginated-return-message-dto';
...@@ -22,4 +22,9 @@ export interface AdReturnMessageDto { ...@@ -22,4 +22,9 @@ export interface AdReturnMessageDto {
* Whether success. * Whether success.
*/ */
success: boolean; success: boolean;
/**
* Return timestamp
*/
timestamp: string;
} }
...@@ -5,20 +5,20 @@ export interface Ad { ...@@ -5,20 +5,20 @@ export interface Ad {
/** /**
* Ad click count * Ad click count
*/ */
clickCount: number; clickCount?: number;
/** /**
* Ad content * Ad content
*/ */
content: string; content: string;
createTime: string; createTime?: string;
deleteTime: string; deleteTime?: string;
/** /**
* Ad is enabled * Ad is enabled
*/ */
enabled: boolean; enabled?: boolean;
id: number; id?: number;
/** /**
* Ad link * Ad link
...@@ -34,10 +34,10 @@ export interface Ad { ...@@ -34,10 +34,10 @@ export interface Ad {
* Records per page. * Records per page.
*/ */
recordsPerPage?: number; recordsPerPage?: number;
updateTime: string; updateTime?: string;
/** /**
* Ad view count * Ad view count
*/ */
viewCount: number; viewCount?: number;
} }
/* tslint:disable */ /* tslint:disable */
/* eslint-disable */ /* eslint-disable */
import { BlacklistAccount } from './blacklist-account'; export interface BlacklistAccountBlacklistResultDto {
export interface Blacklist {
accounts: Array<BlacklistAccount>;
/** /**
* Tweet content * Tweet content
*/ */
content: string; content: string;
createTime: string;
deleteTime: string;
id: string; id: string;
/** /**
...@@ -17,19 +13,8 @@ export interface Blacklist { ...@@ -17,19 +13,8 @@ export interface Blacklist {
*/ */
link: string; link: string;
/**
* The nth page, starting with 1.
*/
pageCount?: number;
/**
* Records per page.
*/
recordsPerPage?: number;
/** /**
* Tweet time * Tweet time
*/ */
time: string; time: string;
updateTime: string;
} }
/* tslint:disable */ /* tslint:disable */
/* eslint-disable */ /* eslint-disable */
import { BlacklistAccount } from './blacklist-account'; import { BlacklistAccountResultDto } from './blacklist-account-result-dto';
export interface BlacklistAccountPaginatedReturnMessageDto { export interface BlacklistAccountResultDtoPaginatedReturnMessageDto {
/** /**
* Return data. * Return data.
*/ */
data?: Array<BlacklistAccount>; data?: Array<BlacklistAccountResultDto>;
/** /**
* Return message * Return message
...@@ -33,6 +33,11 @@ export interface BlacklistAccountPaginatedReturnMessageDto { ...@@ -33,6 +33,11 @@ export interface BlacklistAccountPaginatedReturnMessageDto {
*/ */
success: boolean; success: boolean;
/**
* Return timestamp
*/
timestamp: string;
/** /**
* Total record count. * Total record count.
*/ */
......
/* tslint:disable */ /* tslint:disable */
/* eslint-disable */ /* eslint-disable */
import { Blacklist } from './blacklist'; import { BlacklistAccountBlacklistResultDto } from './blacklist-account-blacklist-result-dto';
export interface BlacklistAccount { export interface BlacklistAccountResultDto {
/** /**
* QQ account number. * QQ account number.
*/ */
account: string; account: string;
blacklist: Blacklist; blacklist?: BlacklistAccountBlacklistResultDto;
/** /**
* Blacklist ID. * Blacklist ID.
*/ */
blacklistId: string; blacklistId: string;
createTime: string; id?: number;
deleteTime: string;
id: number;
/**
* The nth page, starting with 1.
*/
pageCount?: number;
/**
* Records per page.
*/
recordsPerPage?: number;
updateTime: string;
} }
...@@ -21,4 +21,9 @@ export interface StringReturnMessageDto { ...@@ -21,4 +21,9 @@ export interface StringReturnMessageDto {
* Whether success. * Whether success.
*/ */
success: boolean; success: boolean;
/**
* Return timestamp
*/
timestamp: string;
} }
/* tslint:disable */
/* eslint-disable */
import { WhitelistAccountResultDto } from './whitelist-account-result-dto';
export interface WhitelistAccountResultDtoPaginatedReturnMessageDto {
/**
* Return data.
*/
data?: Array<WhitelistAccountResultDto>;
/**
* Return message
*/
message: string;
/**
* Current page.
*/
pageCount: number;
/**
* Records per page.
*/
recordsPerPage: number;
/**
* Return code
*/
statusCode: number;
/**
* Whether success.
*/
success: boolean;
/**
* Return timestamp
*/
timestamp: string;
/**
* Total record count.
*/
total: number;
/**
* Total page count.
*/
totalPages: number;
}
/* tslint:disable */
/* eslint-disable */
export interface WhitelistAccountResultDto {
/**
* QQ account number.
*/
account: string;
/**
* false => not active
*/
enabled?: boolean;
/**
* Fee
*/
fee?: string;
/**
* forbidden
*/
forbidden?: string;
id?: number;
/**
* name
*/
name: string;
/**
* Twitter ID
*/
twitter: string;
/**
* type
*/
type?: string;
}
...@@ -10,8 +10,9 @@ import { Observable } from 'rxjs'; ...@@ -10,8 +10,9 @@ import { Observable } from 'rxjs';
import { map, filter } from 'rxjs/operators'; import { map, filter } from 'rxjs/operators';
import { AdReturnMessageDto } from '../models/ad-return-message-dto'; import { AdReturnMessageDto } from '../models/ad-return-message-dto';
import { BlacklistAccountPaginatedReturnMessageDto } from '../models/blacklist-account-paginated-return-message-dto'; import { BlacklistAccountResultDtoPaginatedReturnMessageDto } from '../models/blacklist-account-result-dto-paginated-return-message-dto';
import { StringReturnMessageDto } from '../models/string-return-message-dto'; import { StringReturnMessageDto } from '../models/string-return-message-dto';
import { WhitelistAccountResultDtoPaginatedReturnMessageDto } from '../models/whitelist-account-result-dto-paginated-return-message-dto';
@Injectable({ @Injectable({
providedIn: 'root', providedIn: 'root',
...@@ -61,7 +62,7 @@ export class ApiService extends BaseService { ...@@ -61,7 +62,7 @@ export class ApiService extends BaseService {
* Blacklist ID. * Blacklist ID.
*/ */
blacklistId?: string; blacklistId?: string;
}): Observable<StrictHttpResponse<BlacklistAccountPaginatedReturnMessageDto>> { }): Observable<StrictHttpResponse<BlacklistAccountResultDtoPaginatedReturnMessageDto>> {
const rb = new RequestBuilder(this.rootUrl, ApiService.BlacklistAccountControllerFindAllPath, 'get'); const rb = new RequestBuilder(this.rootUrl, ApiService.BlacklistAccountControllerFindAllPath, 'get');
if (params) { if (params) {
...@@ -78,7 +79,7 @@ export class ApiService extends BaseService { ...@@ -78,7 +79,7 @@ export class ApiService extends BaseService {
})).pipe( })).pipe(
filter((r: any) => r instanceof HttpResponse), filter((r: any) => r instanceof HttpResponse),
map((r: HttpResponse<any>) => { map((r: HttpResponse<any>) => {
return r as StrictHttpResponse<BlacklistAccountPaginatedReturnMessageDto>; return r as StrictHttpResponse<BlacklistAccountResultDtoPaginatedReturnMessageDto>;
}) })
); );
} }
...@@ -115,10 +116,10 @@ export class ApiService extends BaseService { ...@@ -115,10 +116,10 @@ export class ApiService extends BaseService {
* Blacklist ID. * Blacklist ID.
*/ */
blacklistId?: string; blacklistId?: string;
}): Observable<BlacklistAccountPaginatedReturnMessageDto> { }): Observable<BlacklistAccountResultDtoPaginatedReturnMessageDto> {
return this.blacklistAccountControllerFindAll$Response(params).pipe( return this.blacklistAccountControllerFindAll$Response(params).pipe(
map((r: StrictHttpResponse<BlacklistAccountPaginatedReturnMessageDto>) => r.body as BlacklistAccountPaginatedReturnMessageDto) map((r: StrictHttpResponse<BlacklistAccountResultDtoPaginatedReturnMessageDto>) => r.body as BlacklistAccountResultDtoPaginatedReturnMessageDto)
); );
} }
...@@ -230,4 +231,94 @@ export class ApiService extends BaseService { ...@@ -230,4 +231,94 @@ export class ApiService extends BaseService {
); );
} }
/**
* Path part for operation whitelistAccountControllerFindAll
*/
static readonly WhitelistAccountControllerFindAllPath = '/api/whitelist-account';
/**
* Find all WhitelistAccount.
*
*
*
* This method provides access to the full `HttpResponse`, allowing access to response headers.
* To access only the response body, use `whitelistAccountControllerFindAll()` instead.
*
* This method doesn't expect any request body.
*/
whitelistAccountControllerFindAll$Response(params?: {
/**
* The nth page, starting with 1.
*/
pageCount?: number;
/**
* Records per page.
*/
recordsPerPage?: number;
id?: number;
/**
* QQ account number.
*/
account?: string;
random?: number;
}): Observable<StrictHttpResponse<WhitelistAccountResultDtoPaginatedReturnMessageDto>> {
const rb = new RequestBuilder(this.rootUrl, ApiService.WhitelistAccountControllerFindAllPath, 'get');
if (params) {
rb.query('pageCount', params.pageCount, {});
rb.query('recordsPerPage', params.recordsPerPage, {});
rb.query('id', params.id, {});
rb.query('account', params.account, {});
rb.query('random', params.random, {});
}
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<WhitelistAccountResultDtoPaginatedReturnMessageDto>;
})
);
}
/**
* Find all WhitelistAccount.
*
*
*
* This method provides access to only to the response body.
* To access the full response (for headers, for example), `whitelistAccountControllerFindAll$Response()` instead.
*
* This method doesn't expect any request body.
*/
whitelistAccountControllerFindAll(params?: {
/**
* The nth page, starting with 1.
*/
pageCount?: number;
/**
* Records per page.
*/
recordsPerPage?: number;
id?: number;
/**
* QQ account number.
*/
account?: string;
random?: number;
}): Observable<WhitelistAccountResultDtoPaginatedReturnMessageDto> {
return this.whitelistAccountControllerFindAll$Response(params).pipe(
map((r: StrictHttpResponse<WhitelistAccountResultDtoPaginatedReturnMessageDto>) => r.body as WhitelistAccountResultDtoPaginatedReturnMessageDto)
);
}
} }
<header class="container"> <header class="container">
<h1 class="title">蔷蔷挂人查询</h1> <h1 class="title">蔷蔷查询</h1>
</header> </header>
<div class="container"> <div class="container">
...@@ -15,16 +15,20 @@ ...@@ -15,16 +15,20 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-lg-12"> <div class="col-lg-12">
<label>要查询的 QQ 号</label> <label>搜索</label>
<input type="text" class="form-control" [(ngModel)]="search" (keyup.enter)="onSearch()"> <input type="text" class="form-control" [(ngModel)]="search" (keyup.enter)="onBlacklistSearch()">
</div> </div>
</div> </div>
</div> </div>
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-lg-12"> <div class="col-lg-6">
<br>
<button class="btn btn-danger" style="width: 100%" (click)="onBlacklistSearch()">黑名单查询</button>
</div>
<div class="col-lg-6">
<br> <br>
<button class="btn btn-primary" style="width: 100%" (click)="onSearch()">查询</button> <button class="btn btn-success" style="width: 100%" (click)="onWhitelistSearch()">白名单查询</button>
</div> </div>
</div> </div>
</div> </div>
...@@ -33,13 +37,18 @@ ...@@ -33,13 +37,18 @@
</div> </div>
</div> </div>
<div class="container" *ngIf="result"> <div class="container" *ngIf="blacklistResult || whitelistResult">
<br> <br>
<ul class="list-group"> <ul class="list-group" *ngIf="blacklistResult">
<li class="list-group-item list-group-item-success" *ngIf="!result!.length">用户 {{displayingAccount}} 是安全的。</li> <li class="list-group-item list-group-item-success" *ngIf="!blacklistResult.length && whitelistResult?.length">用户 {{displayingAccount}} 处在白名单内,是安全的。</li>
<li class="list-group-item list-group-item-danger" *ngIf="result!.length">用户 {{displayingAccount}} 存在风险。</li> <li class="list-group-item list-group-item-info" *ngIf="!blacklistResult.length && !whitelistResult?.length">用户 {{displayingAccount}} 是安全的。</li>
<li class="list-group-item list-group-item-danger" *ngIf="blacklistResult.length">用户 {{displayingAccount}} 存在风险。</li>
</ul> </ul>
<div class="row grid" *ngIf="result!.length"> <ul class="list-group" *ngIf="!blacklistResult && whitelistResult && displayingAccount">
<li class="list-group-item list-group-item-warning" *ngIf="!whitelistResult.length">用户 {{displayingAccount}} 不在白名单内。</li>
<li class="list-group-item list-group-item-success" *ngIf="whitelistResult.length">用户 {{displayingAccount}} 处在白名单内。</li>
</ul>
<div class="row grid" *ngIf="blacklistResult?.length">
<br> <br>
<div class="col-lg-12"> <div class="col-lg-12">
<table class="table table-striped"> <table class="table table-striped">
...@@ -51,12 +60,43 @@ ...@@ -51,12 +60,43 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr *ngFor="let item of result"> <tr *ngFor="let item of blacklistResult">
<td>{{displayDate(item.blacklist.time)}}</td> <td>{{displayDate(item.blacklist!.time!)}}</td>
<td>{{item.blacklist.content}}</td> <td>{{item.blacklist!.content}}</td>
<td>
<a class="btn btn-outline-primary" [href]="item.blacklist!.link" target="_blank">查看</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="row grid" *ngIf="whitelistResult?.length">
<br>
<div class="col-lg-12">
<table class="table table-striped">
<thead>
<tr>
<th width="15%">昵称</th>
<th width="15%">QQ号</th>
<th width="10%">Twitter帐号</th>
<th width="15%">费用</th>
<th width="22.5%">营业类型</th>
<th width="22.5%">禁忌项</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let item of whitelistResult">
<td>{{item.name || ''}}</td>
<td>{{item.account || ''}}</td>
<td> <td>
<a class="btn btn-outline-primary" [href]="item.blacklist.link" target="_blank">查看</a> <a *ngIf="item.twitter" [href]="getTwitterLink(item.twitter)" target="_blank">
{{ truncateMiddle(item.twitter, 15) }}
</a>
</td> </td>
<td>{{item.fee || ''}}</td>
<td>{{item.type || ''}}</td>
<td>{{item.forbidden || ''}}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
......
import { AfterViewInit, 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 { ApiService } from './api/services/api.service'; import { ApiService } from './api/services/api.service';
import { lastValueFrom } from 'rxjs'; import { lastValueFrom } from 'rxjs';
import * as moment from 'moment'; import * as moment from 'moment';
import { Ad } from './api/models'; import {
import { ActivatedRoute } from '@angular/router'; Ad,
BlacklistAccountResultDto,
WhitelistAccountResultDto,
} from './api/models';
@Component({ @Component({
selector: 'app-root', selector: 'app-root',
...@@ -17,7 +19,8 @@ export class AppComponent implements AfterViewInit { ...@@ -17,7 +19,8 @@ export class AppComponent implements AfterViewInit {
displayingAccount = ''; displayingAccount = '';
title = '蔷蔷挂人查询'; title = '蔷蔷挂人查询';
ad: Ad | null = null; ad: Ad | null = null;
result?: BlacklistAccount[]; blacklistResult?: BlacklistAccountResultDto[];
whitelistResult?: WhitelistAccountResultDto[];
constructor(public toast: ToastService, private api: ApiService) {} constructor(public toast: ToastService, private api: ApiService) {}
ngAfterViewInit() { ngAfterViewInit() {
...@@ -52,26 +55,55 @@ export class AppComponent implements AfterViewInit { ...@@ -52,26 +55,55 @@ export class AppComponent implements AfterViewInit {
async onAdClick() { async onAdClick() {
const clickResult = await lastValueFrom( const clickResult = await lastValueFrom(
this.api.adControllerClickAd({ id: this.ad!.id }) this.api.adControllerClickAd({ id: this.ad!.id! })
); );
if (clickResult?.data) { if (clickResult?.data) {
this.openInNewTab(clickResult.data); this.openInNewTab(clickResult.data);
} }
} }
async onSearch() { getTwitterLink(twitter: string) {
this.result = undefined; const urlObj = new URL('https://x.com');
urlObj.pathname = `/${twitter}`;
return urlObj.toString();
}
async searchWhitelist(account?: string) {
this.whitelistResult = undefined;
const { data } = await lastValueFrom(
this.api.whitelistAccountControllerFindAll({
recordsPerPage: 5,
account: account || undefined,
random: account ? 0 : 1,
})
);
this.whitelistResult = data;
}
async checkSearch(allowEmpty = false) {
const search = this.search.trim(); const search = this.search.trim();
if (!search) { if (!search && !allowEmpty) {
this.toast.warn('不能为空。'); this.toast.warn('不能为空。');
return; return false;
} else if (!search && allowEmpty) {
return true;
} }
if (search.length > 10) { if (search.length > 10) {
this.toast.warn('不能超过 10 个字符。'); this.toast.warn('不能超过 10 个字符。');
return; return false;
} }
if (!search.match(/^\d+$/)) { if (!search.match(/^\d+$/)) {
this.toast.warn('只能输入数字。'); this.toast.warn('只能输入数字。');
return false;
}
return true;
}
async onBlacklistSearch() {
this.blacklistResult = undefined;
this.whitelistResult = undefined;
const search = this.search.trim();
if (!(await this.checkSearch())) {
return; return;
} }
try { try {
...@@ -81,10 +113,37 @@ export class AppComponent implements AfterViewInit { ...@@ -81,10 +113,37 @@ export class AppComponent implements AfterViewInit {
account: search, account: search,
}) })
); );
this.result = data; this.blacklistResult = data;
if (!data?.length) {
await this.searchWhitelist(search);
}
this.displayingAccount = this.search;
} catch (e) {
this.toast.error(`查询失败:${(e as Error).toString()}`);
}
}
async onWhitelistSearch() {
this.blacklistResult = undefined;
this.whitelistResult = undefined;
const search = this.search.trim();
if (!(await this.checkSearch(true))) {
return;
}
try {
await this.searchWhitelist(search);
this.displayingAccount = this.search; this.displayingAccount = this.search;
} catch (e) { } catch (e) {
this.toast.error(`查询失败:${(e as Error).toString()}`); this.toast.error(`查询失败:${(e as Error).toString()}`);
} }
} }
truncateMiddle(text: string, maxLength: number): string {
if (!text || text.length <= maxLength) {
return text;
}
const keep = Math.floor((maxLength - 3) / 2); // -3 for '...'
return text.slice(0, keep) + '...' + text.slice(-keep);
}
} }
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