nickatwork / roowallet
Laravel 数字钱包
1.1
2018-03-09 13:58 UTC
Requires
- ext-curl: *
This package is not auto-updated.
Last update: 2019-03-13 23:12:36 UTC
README
为 Laravel 提供钱包包,允许您为用户维护信用。
它支持多种货币,您还可以添加自己的货币。 Fork of
composer require patosmack/roowallet
版本 1.1
安装
要安装此包,请在您的 composer.json 中包含以下内容。
composer require nickatwork/roowallet
然后在您的 app.php 中包含以下服务提供者。
nickatwork\RooWallet\Providers\RooWalletServiceProvider::class,
同时添加别名。
'RooWallet' => nickatwork\RooWallet\Facades\RooWallet::class,
最后,发布配置。
php artisan vendor:publish --provider="nickatwork\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 模型或空数组
funds($user_id,$currency_iso)
- 响应: 用户余额 -> 十进制(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)
- 响应: 十进制(13, 4)
getDebits($user_id,$currency_iso)
- 响应: 十进制(13, 4)