Browse Source

teac天使转

董荣正 1 month ago
parent
commit
261eadd5d9

+ 12 - 9
application/api/controller/Ledger.php

@@ -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();

+ 1 - 0
application/common/model/LedgerWalletModel.php

@@ -109,6 +109,7 @@ class LedgerWalletModel extends Model
         }
         // 更新钱包余额
         $newAmount = $this->changeWalletOnly($uid, $asset, $amount);
+        
         // 创建账变记录
         $insertRs = $changeModel->insert([
             'user_id'        => $uid,

+ 17 - 0
extend/fast/Asset.php

@@ -55,6 +55,21 @@ class Asset
      */
     const FROZEN = 'frozen';
 
+    /**
+     * 服务器算力
+     * @var string
+     */
+    const RENTAL_POWER = 'rental_power';
+
+
+    /**
+     * SMH
+     * @var string
+     */
+    const SMH = 'smh';
+    
+
+
 
     public static function getAssetName($assetType)
     {
@@ -75,6 +90,8 @@ class Asset
                 return 'SMH';
             case self::FROZEN:
                 return '标记金额';
+            case self::TEAC_ECOLY:
+                return '标记金额';
             default:
                 return '未知';
         }