add command transaction-tag-index-fix-transaction-time to fix transaction tag index which does not have transaction time

This commit is contained in:
MaysWind
2024-07-09 00:53:22 +08:00
parent 9eaac329b9
commit f151eb6197
6 changed files with 131 additions and 0 deletions
+36
View File
@@ -230,6 +230,19 @@ var UserData = &cli.Command{
},
},
},
{
Name: "transaction-tag-index-fix-transaction-time",
Usage: "fix the transaction tag index data which does not have transaction time",
Action: fixTransactionTagIndexNotHaveTransactionTime,
Flags: []cli.Flag{
&cli.StringFlag{
Name: "username",
Aliases: []string{"n"},
Required: true,
Usage: "Specific user name",
},
},
},
{
Name: "transaction-export",
Usage: "Export user all transactions to file",
@@ -553,6 +566,29 @@ func checkUserTransactionAndAccount(c *cli.Context) error {
return nil
}
func fixTransactionTagIndexNotHaveTransactionTime(c *cli.Context) error {
_, err := initializeSystem(c)
if err != nil {
return err
}
username := c.String("username")
log.BootInfof("[user_data.fixTransactionTagIndexNotHaveTransactionTime] starting fixing user \"%s\" transaction tag index data", username)
_, err = clis.UserData.FixTransactionTagIndexWithTransactionTime(c, username)
if err != nil {
log.BootErrorf("[user_data.fixTransactionTagIndexNotHaveTransactionTime] error occurs when fixing user data")
return err
}
log.BootInfof("[user_data.fixTransactionTagIndexNotHaveTransactionTime] user transaction tag index data has been fixed successfully")
return nil
}
func exportUserTransaction(c *cli.Context) error {
_, err := initializeSystem(c)