|
@@ -0,0 +1,37 @@
|
|
|
+import { forEachAsync } from '../../utils'
|
|
|
+import { DBClient } from '../../singletons'
|
|
|
+import { InitiaClient } from '../../InitiaClient'
|
|
|
+
|
|
|
+async function startCheck(concurrency) {
|
|
|
+ const accountsRaw = await DBClient.instance.randomTask2.findMany({
|
|
|
+ where: {
|
|
|
+ finish: 1,
|
|
|
+ },
|
|
|
+ take: 40000,
|
|
|
+ })
|
|
|
+ await forEachAsync(accountsRaw, concurrency, async (account, index) => {
|
|
|
+ console.log(
|
|
|
+ `${index}/${accountsRaw.length}: processing ${account.address},account id: ${account.id}`,
|
|
|
+ )
|
|
|
+ const client = new InitiaClient(account.mnemonic, true)
|
|
|
+ try {
|
|
|
+ const bool = await client.week2Task2(account.toAddress)
|
|
|
+ console.log(bool)
|
|
|
+ if (bool == `done`) {
|
|
|
+ await DBClient.instance.randomTask2.update({
|
|
|
+ where: { id: account.id },
|
|
|
+ data: { task2: 2 },
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ await DBClient.instance.randomTask2.update({
|
|
|
+ where: { id: account.id },
|
|
|
+ data: { task2: 0 },
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } catch (e) {
|
|
|
+ console.log(e.message)
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+startCheck(100)
|