|
|
@@ -301,14 +301,16 @@ class Ledger extends Api
|
|
|
* teac天使的转账
|
|
|
* @return void
|
|
|
*/
|
|
|
- public function teacAngelTransfer(UserModel $userModel, LedgerWalletModel $ledgerWalletModel, LedgerTeacAngelChangeModel $LedgerTeacAngelChangeModel)
|
|
|
+ public function teacAngelTransfer(UserModel $userModel, LedgerWalletModel $ledgerWalletModel)
|
|
|
{
|
|
|
$amount = $this->request->post('amount'); // 茶宝
|
|
|
$account= $this->request->post('account', ''); // 账号
|
|
|
if(empty($amount) || empty($account)){
|
|
|
$this->error(__('Parameter error'));
|
|
|
}
|
|
|
+
|
|
|
$real = bcsub($amount, bcmul(getConfig('teac_angel'), $amount, 2), 2) ; // 手续费
|
|
|
+ $data=[];
|
|
|
// 启动事务
|
|
|
Db::startTrans();
|
|
|
try {
|
|
|
@@ -319,10 +321,11 @@ class Ledger extends Api
|
|
|
if(bccomp($amount, $teac, 2) > 0) throw new Exception(__("余额不足请前往充值"), 15001);
|
|
|
|
|
|
// 更新USDT和账变
|
|
|
- $ledgerWalletModel->changeWalletAccount($this->auth->id, Asset::TEAC_ANGEL, -$amount, LedgerTeacAngelChangeModel::GiftPay, $user['id']);
|
|
|
+ $re1=$ledgerWalletModel->changeWalletAccount($this->auth->id, Asset::TEAC_ANGEL, -$amount, LedgerTeacAngelChangeModel::GiftPay, $user['id']);
|
|
|
|
|
|
- $re=$ledgerWalletModel->changeWalletAccount($user['id'], Asset::TEAC_ANGEL, $real, LedgerTeacAngelChangeModel::GiftReceipt, $this->auth->id);
|
|
|
-
|
|
|
+ $re2=$ledgerWalletModel->changeWalletAccount($user['id'], Asset::TEAC_ANGEL, $real, LedgerTeacAngelChangeModel::GiftReceipt, $this->auth->id);
|
|
|
+ $data[]=$re1;
|
|
|
+ $data[]=$re2;
|
|
|
// 提交事务
|
|
|
Db::commit();
|
|
|
} catch (Exception $e) {
|
|
|
@@ -330,21 +333,21 @@ class Ledger extends Api
|
|
|
Db::rollback();
|
|
|
$this->error($e->getMessage(), null, $e->getCode());
|
|
|
}
|
|
|
- $this->success('ok');
|
|
|
+ $this->success('ok',$data);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* teac生态的转账
|
|
|
* @return void
|
|
|
*/
|
|
|
- public function teacEcologyTransfer(UserModel $userModel, LedgerWalletModel $ledgerWalletModel, LedgerTeacEcolyChangeModel $LedgerTeacAngelChangeModel)
|
|
|
+ public function teacEcologyTransfer(UserModel $userModel, LedgerWalletModel $ledgerWalletModel)
|
|
|
{
|
|
|
$amount = $this->request->post('amount'); // 茶宝
|
|
|
$account= $this->request->post('account', ''); // 账号
|
|
|
if(empty($amount) || empty($account)){
|
|
|
$this->error(__('Parameter error'));
|
|
|
}
|
|
|
- $real = bcsub($amount, bcmul(config('teac_ecoly'), $amount, 2), 2) ; // 手续费
|
|
|
+ $real = bcsub($amount, bcmul(getConfig('teac_ecoly'), $amount, 2), 2) ; // 手续费
|
|
|
// 启动事务
|
|
|
Db::startTrans();
|
|
|
try {
|
|
|
@@ -355,9 +358,9 @@ class Ledger extends Api
|
|
|
if(bccomp($amount, $teac, 2) > 0) throw new Exception(__("余额不足请前往充值"), 15001);
|
|
|
|
|
|
// 更新USDT和账变
|
|
|
- $ledgerWalletModel->changeWalletAccount($this->auth->id, Asset::TEAC_ANGEL, -$amount, LedgerTeacEcolyChangeModel::GiftPay, $user['id']);
|
|
|
+ $ledgerWalletModel->changeWalletAccount($this->auth->id, Asset::TEAC_ECOLY, -$amount, LedgerTeacEcolyChangeModel::GiftPay, $user['id']);
|
|
|
|
|
|
- $re=$ledgerWalletModel->changeWalletAccount($user['id'], Asset::TEAC_ANGEL, $real, LedgerTeacEcolyChangeModel::GiftReceipt, $this->auth->id);
|
|
|
+ $ledgerWalletModel->changeWalletAccount($user['id'], Asset::TEAC_ECOLY, $real, LedgerTeacEcolyChangeModel::GiftReceipt, $this->auth->id);
|
|
|
|
|
|
// 提交事务
|
|
|
Db::commit();
|