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",
"cli": {
"analytics": false
},
"version": 1,
"newProjectRoot": "projects",
"projects": {
......
export { Blacklist } from './models/blacklist';
export { BlacklistAccount } from './models/blacklist-account';
export { BlacklistAccountPaginatedReturnMessageDto } from './models/blacklist-account-paginated-return-message-dto';
export { BlacklistAccountBlacklistResultDto } from './models/blacklist-account-blacklist-result-dto';
export { BlacklistAccountResultDto } from './models/blacklist-account-result-dto';
export { BlacklistAccountResultDtoPaginatedReturnMessageDto } from './models/blacklist-account-result-dto-paginated-return-message-dto';
export { Ad } from './models/ad';
export { AdReturnMessageDto } from './models/ad-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 {
* Whether success.
*/
success: boolean;
/**
* Return timestamp
*/
timestamp: string;
}
......@@ -5,20 +5,20 @@ export interface Ad {
/**
* Ad click count
*/
clickCount: number;
clickCount?: number;
/**
* Ad content
*/
content: string;
createTime: string;
deleteTime: string;
createTime?: string;
deleteTime?: string;
/**
* Ad is enabled
*/
enabled: boolean;
id: number;
enabled?: boolean;
id?: number;
/**
* Ad link
......@@ -34,10 +34,10 @@ export interface Ad {
* Records per page.
*/
recordsPerPage?: number;
updateTime: string;
updateTime?: string;
/**
* Ad view count
*/
viewCount: number;
viewCount?: number;
}
/* tslint:disable */
/* eslint-disable */
import { BlacklistAccount } from './blacklist-account';
export interface Blacklist {
accounts: Array<BlacklistAccount>;
export interface BlacklistAccountBlacklistResultDto {
/**
* Tweet content
*/
content: string;
createTime: string;
deleteTime: string;
id: string;
/**
......@@ -17,19 +13,8 @@ export interface Blacklist {
*/
link: string;
/**
* The nth page, starting with 1.
*/
pageCount?: number;
/**
* Records per page.
*/
recordsPerPage?: number;
/**
* Tweet time
*/
time: string;
updateTime: string;
}
/* tslint:disable */
/* eslint-disable */
import { BlacklistAccount } from './blacklist-account';
export interface BlacklistAccountPaginatedReturnMessageDto {
import { BlacklistAccountResultDto } from './blacklist-account-result-dto';
export interface BlacklistAccountResultDtoPaginatedReturnMessageDto {
/**
* Return data.
*/
data?: Array<BlacklistAccount>;
data?: Array<BlacklistAccountResultDto>;
/**
* Return message
......@@ -33,6 +33,11 @@ export interface BlacklistAccountPaginatedReturnMessageDto {
*/
success: boolean;
/**
* Return timestamp
*/
timestamp: string;
/**
* Total record count.
*/
......
/* tslint:disable */
/* eslint-disable */
import { Blacklist } from './blacklist';
export interface BlacklistAccount {
import { BlacklistAccountBlacklistResultDto } from './blacklist-account-blacklist-result-dto';
export interface BlacklistAccountResultDto {
/**
* QQ account number.
*/
account: string;
blacklist: Blacklist;
blacklist?: BlacklistAccountBlacklistResultDto;
/**
* Blacklist ID.
*/
blacklistId: string;
createTime: string;
deleteTime: string;
id: number;
/**
* The nth page, starting with 1.
*/
pageCount?: number;
/**
* Records per page.
*/
recordsPerPage?: number;
updateTime: string;
id?: number;
}
......@@ -21,4 +21,9 @@ export interface StringReturnMessageDto {
* Whether success.
*/
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';
import { map, filter } from 'rxjs/operators';
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 { WhitelistAccountResultDtoPaginatedReturnMessageDto } from '../models/whitelist-account-result-dto-paginated-return-message-dto';
@Injectable({
providedIn: 'root',
......@@ -61,7 +62,7 @@ export class ApiService extends BaseService {
* Blacklist ID.
*/
blacklistId?: string;
}): Observable<StrictHttpResponse<BlacklistAccountPaginatedReturnMessageDto>> {
}): Observable<StrictHttpResponse<BlacklistAccountResultDtoPaginatedReturnMessageDto>> {
const rb = new RequestBuilder(this.rootUrl, ApiService.BlacklistAccountControllerFindAllPath, 'get');
if (params) {
......@@ -78,7 +79,7 @@ export class ApiService extends BaseService {
})).pipe(
filter((r: any) => r instanceof HttpResponse),
map((r: HttpResponse<any>) => {
return r as StrictHttpResponse<BlacklistAccountPaginatedReturnMessageDto>;
return r as StrictHttpResponse<BlacklistAccountResultDtoPaginatedReturnMessageDto>;
})
);
}
......@@ -115,10 +116,10 @@ export class ApiService extends BaseService {
* Blacklist ID.
*/
blacklistId?: string;
}): Observable<BlacklistAccountPaginatedReturnMessageDto> {
}): Observable<BlacklistAccountResultDtoPaginatedReturnMessageDto> {
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 {
);
}
/**
* 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">
<h1 class="title">蔷蔷挂人查询</h1>
<h1 class="title">蔷蔷查询</h1>
</header>
<div class="container">
......@@ -15,16 +15,20 @@
<div class="container">
<div class="row">
<div class="col-lg-12">
<label>要查询的 QQ 号</label>
<input type="text" class="form-control" [(ngModel)]="search" (keyup.enter)="onSearch()">
<label>搜索</label>
<input type="text" class="form-control" [(ngModel)]="search" (keyup.enter)="onBlacklistSearch()">
</div>
</div>
</div>
<div class="container">
<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>
<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>
......@@ -33,13 +37,18 @@
</div>
</div>
<div class="container" *ngIf="result">
<div class="container" *ngIf="blacklistResult || whitelistResult">
<br>
<ul class="list-group">
<li class="list-group-item list-group-item-success" *ngIf="!result!.length">用户 {{displayingAccount}} 是安全的。</li>
<li class="list-group-item list-group-item-danger" *ngIf="result!.length">用户 {{displayingAccount}} 存在风险。</li>
<ul class="list-group" *ngIf="blacklistResult">
<li class="list-group-item list-group-item-success" *ngIf="!blacklistResult.length && whitelistResult?.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>
<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>
<div class="col-lg-12">
<table class="table table-striped">
......@@ -51,12 +60,43 @@
</tr>
</thead>
<tbody>
<tr *ngFor="let item of result">
<td>{{displayDate(item.blacklist.time)}}</td>
<td>{{item.blacklist.content}}</td>
<tr *ngFor="let item of blacklistResult">
<td>{{displayDate(item.blacklist!.time!)}}</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>
<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>{{item.fee || ''}}</td>
<td>{{item.type || ''}}</td>
<td>{{item.forbidden || ''}}</td>
</tr>
</tbody>
</table>
......
import { AfterViewInit, Component } from '@angular/core';
import { ToastService } from './toast.service';
import { BlacklistAccount } from './api/models/blacklist-account';
import { ApiService } from './api/services/api.service';
import { lastValueFrom } from 'rxjs';
import * as moment from 'moment';
import { Ad } from './api/models';
import { ActivatedRoute } from '@angular/router';
import {
Ad,
BlacklistAccountResultDto,
WhitelistAccountResultDto,
} from './api/models';
@Component({
selector: 'app-root',
......@@ -17,7 +19,8 @@ export class AppComponent implements AfterViewInit {
displayingAccount = '';
title = '蔷蔷挂人查询';
ad: Ad | null = null;
result?: BlacklistAccount[];
blacklistResult?: BlacklistAccountResultDto[];
whitelistResult?: WhitelistAccountResultDto[];
constructor(public toast: ToastService, private api: ApiService) {}
ngAfterViewInit() {
......@@ -52,26 +55,55 @@ export class AppComponent implements AfterViewInit {
async onAdClick() {
const clickResult = await lastValueFrom(
this.api.adControllerClickAd({ id: this.ad!.id })
this.api.adControllerClickAd({ id: this.ad!.id! })
);
if (clickResult?.data) {
this.openInNewTab(clickResult.data);
}
}
async onSearch() {
this.result = undefined;
getTwitterLink(twitter: string) {
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();
if (!search) {
if (!search && !allowEmpty) {
this.toast.warn('不能为空。');
return;
return false;
} else if (!search && allowEmpty) {
return true;
}
if (search.length > 10) {
this.toast.warn('不能超过 10 个字符。');
return;
return false;
}
if (!search.match(/^\d+$/)) {
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;
}
try {
......@@ -81,10 +113,37 @@ export class AppComponent implements AfterViewInit {
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;
} catch (e) {
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