martianatwork / roowallet
适用于Laravel的数字钱包
1.1.0
2018-12-01 12:59 UTC
Requires
- ext-curl: *
This package is auto-updated.
Last update: 2024-09-26 10:03:03 UTC
README
为Laravel提供的钱包包,允许您维护用户的信用。
它支持多种货币,您还可以添加自己的货币。基于
composer require patosmack/roowallet
版本 1.1
安装
要安装此包,请在您的composer.json中包含以下内容。
composer require martianatwork/roowallet
然后,在您的app.php中包含以下服务提供者。
martianatwork\RooWallet\Providers\RooWalletServiceProvider::class,
同时添加别名。
'RooWallet' => martianatwork\RooWallet\Facades\RooWallet::class,
最后,发布配置。
php artisan vendor:publish --provider="martianatwork\RooWallet\Providers\RooWalletServiceProvider"
注意:在发布前删除数据库迁移文件
- create_wallet_currencies_table.php
- create_wallets_table.php
- create_wallet_transactions_table.php
方法
货币
getCurrencyList()
- 响应: 货币ISO数组
getCurrency($iso)
- 响应: WalletCurrency模型或null
addCurrency($iso, $name, $symbol, $conversion_rate, $enabled = 0)
- 响应: True或False
updateCurrency($iso, $name, $symbol, $conversion_rate, $enabled = 0)
- 响应: True或False
钱包
getWallet($user_id,$currency_iso)
- 响应: Wallet模型或null
createWallet($user_id, $currency_iso)
- 响应: True或False
交易
getTransactions($user_id,$currency_iso)
- 响应: WalletTransaction模型或array()
funds($user_id,$currency_iso)
- 响应: 用户余额 -> decimal(13, 4)
deposit($user_id,$currency_iso, $amount, $refence_id = null, $reference_description = null, $token = '')
- 响应: True或False
canWithdraw($user_id,$currency_iso, $amount)
- 响应: True或False
withdraw($user_id,$currency_iso, $amount, $refence_id = null, $reference_description = null, $token = '')
- 响应: True或False
getCredits($user_id,$currency_iso)
- 响应: decimal(13, 4)
getDebits($user_id,$currency_iso)
- 响应: decimal(13, 4)