CAFECA-IO / BAIFA-web-crawling

BAIFA conducts web crawling from iSunCloud in frequence
0 stars 0 forks source link

部署爬蟲到測試環境 #15

Closed gibbs-shih closed 9 months ago

gibbs-shih commented 10 months ago

推一版 crawler + parser 程式碼至遠端 server, 並建立pm2執行

gibbs-shih commented 9 months ago
gibbs-shih commented 9 months ago
gibbs-shih commented 9 months ago

model review_datas { id Int @id @default(autoincrement()) target String? @unique target_type String? created_timestamp DateTime? content String? stars Int? author_address String? addresses addresses? @relation(fields:[target], references: [address], map: "review_datas_addresses_fkey") transactions transactions? @relation(fields:[target], references: [hash], map: "review_datas_transactions_fkey") }

model transactions { id Int @id @default(autoincrement()) chain_id Int? created_timestamp DateTime? hash String? @unique type String? status String? block_hash String? from_address String? to_address String? evidence_id String? value Int? fee BigInt? related_addresses String[] chains chains? @relation(fields: [chain_id], references: [id]) blocks blocks? @relation(fields: [block_hash], references: [hash]) review_datas review_datas[]
}

- [x] red_flags 新增欄位 currency_id, 及建立關聯至currencies id, 多對一
![CleanShot 2024-01-29 at 17 32 17](https://github.com/CAFECA-IO/BAIFA-web-crawling/assets/73210852/27c02a7b-7fa4-4b13-9728-5f4036b208ea)

model red_flags { id Int @id @default(autoincrement()) chain_id Int? created_timestamp DateTime? red_flag_type String? total_amount Int? symbol String? related_addresses String[] related_transactions String[] currency_id String? currencies currencies? @relation(fields: [currency_id], references: [id])
chains chains? @relation(fields: [chain_id], references: [id])
}

model currencies { id String @id risk_level String? price Int? volume_in_24h Int? symbol String? total_amount Int? holder_count Int? total_transfers Int? chain_id Int? name String? token_transfers token_transfers[] red_flags red_flags[] token_balances token_balances? chains chains? @relation(fields: [chain_id], references: [id])
}



- 修改bug:
![CleanShot 2024-01-29 at 16 33 13](https://github.com/CAFECA-IO/BAIFA-web-crawling/assets/73210852/061ef402-3187-4eba-855e-1ae997370a97)

- 相依性問題, 需調整function順序
![CleanShot 2024-01-29 at 17 52 15](https://github.com/CAFECA-IO/BAIFA-web-crawling/assets/73210852/14cecd0a-e40a-484c-bf90-3db5911b8bc8)
gibbs-shih commented 9 months ago
gibbs-shih commented 9 months ago

CleanShot 2024-01-31 at 14 10 01

model contracts {
  id                  Int      @id @default(autoincrement())
  chain_id            Int?
  contract_address    String? 
  source_code         String?
  creator_address     String?
  created_timestamp   Int?
  chains              chains? @relation(fields: [chain_id], references: [id])     
}

model evidences {
  id                  Int      @id @default(autoincrement())
  evidence_id         String?      
  chain_id            Int? 
  created_timestamp   Int?
  contract_address    String?
  state               String?
  content             String?
  creator_address     String?
  token_id            String?
  chains              chains? @relation(fields: [chain_id], references: [id])
}

model transactions {
  id                  Int      @id @default(autoincrement())
  chain_id            Int? 
  created_timestamp   Int?
  hash                String? @unique
  type                String?
  status              String?
  block_hash          String? 
  from_address        String?
  to_address          String?
  evidence_id         String?
  value               String?
  fee                 String?
  related_addresses   String[]
  chains              chains? @relation(fields: [chain_id], references: [id])
  blocks              blocks? @relation(fields: [block_hash], references: [hash])
  review_datas        review_datas[]       
}

model black_lists {
  id                  Int      @id @default(autoincrement())
  chain_id            Int? 
  created_timestamp   Int?
  address_id          Int? @unique
  public_tag          String?
  chains              chains? @relation(fields: [chain_id], references: [id])
  addresses           addresses? @relation(fields: [address_id], references: [id])              
}

model review_datas {
  id                  Int      @id @default(autoincrement())
  target              String? @unique
  target_type         String?
  created_timestamp   Int?
  content             String?
  stars               Int?
  author_address      String?
  addresses           addresses? @relation(fields:[target], references: [address], map: "review_datas_addresses_fkey")
  transactions        transactions? @relation(fields:[target], references: [hash], map: "review_datas_transactions_fkey")
}

model red_flags {
  id                  Int      @id @default(autoincrement())
  chain_id            Int? 
  created_timestamp   Int?
  red_flag_type       String?
  total_amount        String?
  symbol              String?
  related_addresses   String[]
  related_transactions String[]
  currency_id         String?
  currencies          currencies? @relation(fields: [currency_id], references: [id])                
  chains               chains? @relation(fields: [chain_id], references: [id])                
}

model blocks {
  id                  Int      @id @default(autoincrement())
  chain_id            Int? 
  created_timestamp   Int?
  miner               String?
  reward              String?
  size                Int?
  symbol              String?
  transaction_count   Int?
  parent_hash         String?
  burnt_fees          String?   
  hash                String? @unique
  number              Int? @unique
  transactions        transactions[]
  chains              chains? @relation(fields: [chain_id], references: [id])     
}

model token_balances {
  id                  Int      @id @default(autoincrement())
  address             String?
  value               String?
  chain_id            Int?
  currency_id         String? @unique
  chains              chains? @relation(fields: [chain_id], references: [id])
  currencies          currencies? @relation(fields: [currency_id], references: [id])  
}

model token_transfers {
  id                  Int      @id @default(autoincrement())
  from_address        String?
  to_address          String?
  value               String?
  chain_id            Int?
  currency_id         String? 
  transaction_hash    String?
  index               Int?
  chains              chains? @relation(fields: [chain_id], references: [id])
  currencies          currencies? @relation(fields: [currency_id], references: [id])      
}

model currencies {
  id                  String      @id 
  risk_level          String?
  price               Int?
  volume_in_24h       String?
  symbol              String?
  total_amount        String?
  holder_count        Int?
  total_transfers     Int?
  chain_id            Int?
  name                String?
  token_transfers     token_transfers[]
  red_flags           red_flags[]
  token_balances      token_balances?
  chains              chains? @relation(fields: [chain_id], references: [id])           
}

model addresses {
  id                  Int      @id @default(autoincrement())
  chain_id            Int? 
  created_timestamp   Int?
  address             String? @unique
  score               Int?
  latest_active_time  Int?
  risk_records        risk_records[]
  black_lists         black_lists?
  chains              chains? @relation(fields: [chain_id], references: [id])
  review_datas        review_datas[]    
}

model risk_records {
  id                  Int      @id @default(autoincrement())
  name                String?
  address_id          Int? 
  created_timestamp   Int?
  addresses           addresses? @relation(fields: [address_id], references: [id])              
}
gibbs-shih commented 9 months ago
gibbs-shih commented 9 months ago
gibbs-shih commented 9 months ago
gibbs-shih commented 9 months ago
gibbs-shih commented 9 months ago
gibbs-shih commented 9 months ago
gibbs-shih commented 9 months ago

takes about 11-12 hrs