-
-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(wechat, alipay): support multiple keywords in rules (#16)
change viper config `yaml` to `mapstructure`: spf13/viper#385 Signed-off-by: Triple-Z <me@triplez.cn>
- Loading branch information
Showing
12 changed files
with
109 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 20 additions & 16 deletions
36
example/alipay/example-alipay-output.bean → ...le/alipay/example-alipay-output.beancount
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,38 @@ | ||
option "title" "测试" | ||
option "operating_currency" "CNY" | ||
|
||
1970-01-01 open Expenses:Medical | ||
1970-01-01 open Expenses:Test | ||
1970-01-01 open Liabilities:CreditCard:Test | ||
1970-01-01 open Expenses:Food | ||
1970-01-01 open Income:Earnings | ||
1970-01-01 open Assets:Alipay | ||
|
||
2019-09-30 * "肯德基(张江高科餐厅)" "张江高科餐厅" | ||
Expenses:Food 27.00 CNY | ||
Liabilities:CreditCard:Test -27.00 CNY | ||
1970-01-01 open Expenses:Medical | ||
1970-01-01 open Expenses:Test | ||
1970-01-01 open Liabilities:CreditCard:Test | ||
|
||
2019-09-30 * "中欧基金管理有限公司" "余额宝-2019.09.29-收益发放" | ||
Assets:Alipay 0.01 CNY | ||
Income:Earnings -0.01 CNY | ||
|
||
2021-02-06 * "医院" "退款-住院预交金" | ||
Liabilities:CreditCard:Test 2725.42 CNY | ||
Expenses:Medical -2725.42 CNY | ||
2019-09-30 * "肯德基(张江高科餐厅)" "张江高科餐厅" | ||
Expenses:Food 27.00 CNY | ||
Liabilities:CreditCard:Test -27.00 CNY | ||
|
||
2021-02-06 * "医院" "住院预交金" | ||
Expenses:Medical 3000.00 CNY | ||
Liabilities:CreditCard:Test -3000.00 CNY | ||
2019-09-30 * "麦当劳" "麦当劳" | ||
Expenses:Food 27.00 CNY | ||
Liabilities:CreditCard:Test -27.00 CNY | ||
|
||
2020-11-01 * "肯德基会员官方旗舰店" "【狂欢价】电子券码 Y132 肯德基 潮汉堡双人餐兑换券" | ||
Expenses:Food 83.00 CNY | ||
Liabilities:CreditCard:Test -83.00 CNY | ||
|
||
2020-11-01 * "肯德基会员官方旗舰店" "退款-【狂欢价】电子券码 Y132 肯德基 潮汉堡双人餐兑换券" | ||
Liabilities:CreditCard:Test 83.00 CNY | ||
Expenses:Food -83.00 CNY | ||
|
||
2020-11-01 * "肯德基会员官方旗舰店" "【狂欢价】电子券码 Y132 肯德基 潮汉堡双人餐兑换券" | ||
Expenses:Food 83.00 CNY | ||
Liabilities:CreditCard:Test -83.00 CNY | ||
2021-02-06 * "医院" "住院预交金" | ||
Expenses:Medical 3000.00 CNY | ||
Liabilities:CreditCard:Test -3000.00 CNY | ||
|
||
2021-02-06 * "医院" "退款-住院预交金" | ||
Liabilities:CreditCard:Test 2725.42 CNY | ||
Expenses:Medical -2725.42 CNY | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
package huobi | ||
|
||
type Config struct { | ||
Rules []Rule `yaml:"rules,omitempty"` | ||
Rules []Rule `mapstructure:"rules,omitempty"` | ||
} | ||
|
||
type Rule struct { | ||
// Peer *string `yaml:"peer,omitempty"` | ||
Item *string `yaml:"item,omitempty"` // "BTC/USDT" | ||
Type *string `yaml:"type,omitempty"` // "币币交易" | ||
TxType *string `yaml:"txType,omitempty"` // "买入"、"卖出" | ||
Seperator *string `yaml:"sep,omitempty"` // default: , | ||
CashAccount *string `yaml:"cashAccount,omitempty"` | ||
PositionAccount *string `yaml:"positionAccount,omitempty"` | ||
CommissionAccount *string `yaml:"commissionAccount,omitempty"` | ||
PnlAccount *string `yaml:"pnlAccount,omitempty"` | ||
// Peer *string `mapstructure:"peer,omitempty"` | ||
Item *string `mapstructure:"item,omitempty"` // "BTC/USDT" | ||
Type *string `mapstructure:"type,omitempty"` // "币币交易" | ||
TxType *string `mapstructure:"txType,omitempty"` // "买入"、"卖出" | ||
Seperator *string `mapstructure:"sep,omitempty"` // default: , | ||
CashAccount *string `mapstructure:"cashAccount,omitempty"` | ||
PositionAccount *string `mapstructure:"positionAccount,omitempty"` | ||
CommissionAccount *string `mapstructure:"commissionAccount,omitempty"` | ||
PnlAccount *string `mapstructure:"pnlAccount,omitempty"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package util | ||
|
||
import "strings" | ||
|
||
func SplitFindContains(str, target, sep string, match bool) bool { | ||
ss := strings.Split(str, sep) | ||
isContain := false | ||
for _, s := range ss { | ||
if strings.Contains(target, s) { | ||
isContain = true | ||
break | ||
} | ||
} | ||
if !isContain { | ||
return false | ||
} | ||
return match | ||
} |