afa 4 сар өмнө
parent
commit
4cfda5a4bb

+ 6 - 13
application/api/controller/Ledger.php

@@ -120,12 +120,9 @@ class Ledger extends Api
     {
         $amount = $this->request->post('amount'); // 茶宝
         $account= $this->request->post('account', ''); // 账号
-        $type    = (substr($account, 0, 2) == '0x')? 0: 1;    // type: 0地址 1uid
-        if(empty($amount) || empty($account)){
-            $this->error(__('Parameter error'));
-        }
-        // 
-       
+        $type   = (substr($account, 0, 2) == '0x')? 0: 1;    // type: 0地址 1uid
+        if(empty($amount) || empty($account)) $this->error(__('Parameter error'));
+        
         $real   = bcsub($amount, bcmul(getConfig('frozen_transfer'), $amount, 2), 2) ; // 手续费
         // 启动事务
         Db::startTrans();
@@ -174,13 +171,9 @@ class Ledger extends Api
         $amount = $this->request->post('amount'); // 茶宝
         $account= $this->request->post('account', ''); // 账号
         $type    = (substr($account, 0, 2) == '0x')? 0: 1;    // type: 0地址 1uid
-        if(empty($amount) || empty($account)){
-            $this->error(__('Parameter error'));
-        }
-        // 验证地址是否以0x开头
-        if($type == 0 && substr($account, 0, 2) !== '0x'){
-            $this->error(__('Invalid address format, must start with 0x'));
-        }
+        if(empty($amount) || empty($account)) $this->error(__('Parameter error'));
+        
+      
         $real   = bcsub($amount, bcmul(getConfig('chabao_giveaway'), $amount, 2), 2) ; // 手续费
 
         // 启动事务