Skip to content

Commit

Permalink
v0.3.0 (#185)
Browse files Browse the repository at this point in the history
v0.3.0

Co-authored-by: Kang Huquan <[email protected]>
Co-authored-by: Ataraxia <[email protected]>
Co-authored-by: null <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
4 people authored Aug 1, 2019
2 parents 5cdc21e + 9d582b6 commit 0587e06
Show file tree
Hide file tree
Showing 102 changed files with 15,925 additions and 238 deletions.
3 changes: 1 addition & 2 deletions admin-frontend/src/app/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ export class AuthService {
//JWTTokenModely
this.tokenService.set(res);
const jwt :JWTTokenModel = this.tokenService.get<JWTTokenModel>(JWTTokenModel);
console.log(jwt);
if(jwt.payload.role !== 10) {
this.logout();
console.log( 'not admin');
console.log('error! not admin');
}
}

Expand Down
7 changes: 3 additions & 4 deletions admin-frontend/src/app/dashboard/dashboard.component.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<!--<nz-card nzTitle="系统状态">
<nz-card nzTitle="系统状态">
<div nz-row [nzGutter]="8">
<div nz-col [nzSpan]="8">
<nz-card *ngIf="userNum" nzType="inner" nzTitle="总用户数">
<p>{{userNum}}</p>
<nz-card nzType="inner" nzTitle="进行交易数">
<p>{{rsInfoNum}}</p>
</nz-card>
</div>
<div nz-col [nzSpan]="8">
Expand All @@ -17,7 +17,6 @@
</div>
</div>
</nz-card>
-->


<nz-card *ngIf="hst" nzTitle="站点通知">
Expand Down
30 changes: 20 additions & 10 deletions admin-frontend/src/app/dashboard/dashboard.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,41 @@ import { InfoService } from '../info.service';
import { sellInfo } from './../entity/info';
import { getCurrencySymbol } from '@angular/common';
import { trigger, transition, style, state, animate } from '@angular/animations';
import { Route } from '@angular/compiler/src/core';

@Component({
selector: 'app-dashboard',
templateUrl: './dashboard.component.html',
styleUrls: ['./dashboard.component.css']
})
export class DashboardComponent implements OnInit {
constructor(private ifService: InfoService, private wbService: WebsiteService,private usService: UserService) { }
constructor(
private ifService: InfoService, private wbService: WebsiteService,private usService: UserService) { }

site : any;
hst: any[];
/*
userNum: number;

rsInfoNum: number;
infoNum: number;
acInfoNum: number;
*/

ngOnInit() {
this.getHistory();
this.wbService.getSite().subscribe(s => this.site= s);
//this.usService.getUsers().subscribe( e =>this.userNum = e.user.length);
//this.ifService.getSellInfos().subscribe( e => {
// this.infoNum = e.sellInfo.length;
//this.acInfoNum = e.sellInfo.filter( e => e.status < 3).length;
//}
// );
this.ifService.getAllBuyInfo();
this.ifService.getAllSellInfo();
this.infoNum = this.ifService.getInfoNum()
this.acInfoNum = this.ifService.getAcInfo();
this.rsInfoNum = this.ifService.getReserveInfoNum();
this.getInfo();
}
getInfo(){
setTimeout(() => {
this.infoNum = this.ifService.getInfoNum()
this.acInfoNum = this.ifService.getAcInfo();
this.rsInfoNum = this.ifService.getReserveInfoNum();
this.getInfo();
},10000);
}
getHistory(){
this.wbService.getSiteHistory().subscribe( s =>this.hst =s.sort((a,b)=> a.time-b.time));
Expand Down
9 changes: 9 additions & 0 deletions admin-frontend/src/app/entity/transaction.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export class Transaction{
public transactionID:number;
public infoID: number;
public category:number;
public fromUserID: number;
public toUserID: number;
public createTime: number;
public status: number;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

<div class='outer-div' id='fdg'>
<div echarts theme="dark" class= 'tpc'[loading]="true" [options]="fdgoption"></div>
<div echarts (chartDblClick)="clickForce($event)" theme="dark" class= 'tpc'[loading]="true" [options]="fdgoption"></div>
</div>
<div class='outer-div' id='good'>
<div echarts theme="dark" class= 'tpc'[loading]="true" [options]="goodoption"></div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { LoginComponent } from '../login/login.component';
import { InfoDetailComponent } from '../infodetail/infodetail.component';
import { WebsiteComponent } from '../website/website.component';
import { ActivityComponent } from '../activity/activity.component';
import { InfoStatisticComponent } from './info-statistic.component';
import { InfoStatisticComponent, fdgFormatter } from './info-statistic.component';
import { NgxEchartsModule } from 'ngx-echarts';
import { HttpClientModule } from '@angular/common/http';
import { HttpClientInMemoryWebApiModule } from 'angular-in-memory-web-api';
Expand All @@ -25,6 +25,7 @@ import { CallbackComponent } from '../callback/callback.component';
import { SellInfoComponent } from '../info/sell-info/sell-info.component';
import { BuyInfoComponent } from '../info/buy-info/buy-info.component';
import { buyInfo, sellInfo } from '../entity/info';
import { Transaction } from '../entity/transaction';
describe('InfoStatisticComponent', () => {
let component: InfoStatisticComponent;
let fixture: ComponentFixture<InfoStatisticComponent>;
Expand Down Expand Up @@ -75,5 +76,27 @@ describe('InfoStatisticComponent', () => {
component.bi = [ new buyInfo()];
component.si = [ new sellInfo()];
expect(component.fmt(new Date(1563134054000))).toEqual('2019/7/15');
component.pl=false;
component.pauseLine();
expect(component.pl).toEqual(true);
component.clickForce({dataType: 'node', data:{name: '1'}});
component.tr= [new Transaction()];
component.bi = [new buyInfo()];
component.si = [new sellInfo()];
expect(fdgFormatter({dataType: 'node',data:{name: '1', value: '2'}})).toEqual('1 has completed 2 transaction');
expect(fdgFormatter({dataType: 'edge',data:{source: '1', target: '2', value: '2'}})).
toEqual('1 has selled 2 goods to 2');
component.tr= [
{transactionID: 2, infoID: 1, category: 2, fromUserID: 10003, toUserID: 3,createTime :1 ,status:6},
{transactionID: 3, infoID: 1, category: 3, fromUserID: 10003, toUserID: 3,createTime :1 ,status:6},
{transactionID: 4, infoID: 2, category: 2, fromUserID: 10003, toUserID: 3,createTime :1 ,status:6},
{transactionID: 5, infoID: 6, category: 2, fromUserID: 10003, toUserID: 10002,createTime :1 ,status:6},
{transactionID: 6, infoID: 6, category: 1, fromUserID: 10003, toUserID: 1366,createTime :1 ,status:6},
{transactionID: 7, infoID: 200001, category: 1, fromUserID: 3, toUserID: 10003,createTime :1 ,status:6},
{transactionID: 8, infoID: 200002, category: 1, fromUserID: 10002, toUserID: 10003,createTime :1 ,status:6},
{transactionID: 9, infoID: 200003, category: 1, fromUserID: 1366, toUserID: 10003,createTime :1 ,status:6},
{transactionID: 10, infoID: 16473, category: 1, fromUserID: 1366, toUserID: 9368,createTime :1 ,status:6}]
component.forceGraph();

});
});
Loading

0 comments on commit 0587e06

Please sign in to comment.