Просмотр исходного кода

Wesmiler OTC 提交更新 0729

APPLE 3 лет назад
Родитель
Сommit
1d15757ed7

+ 12 - 6
app/Http/Controllers/Admin/IndexController.php

@@ -211,7 +211,6 @@ class IndexController extends Backend
         return returnJson(MESSAGE_OK, true, $data);
     }
 
-
     /**
      * 平台钱包
      */
@@ -251,8 +250,8 @@ class IndexController extends Backend
     public function transfer()
     {
         $contactType = request()->post('contact_type', 1);
-        $type = request()->post('type', 1);
-        $changeType = request()->post('change_type', 1);
+        $type = request()->post('type', 0);
+        $changeType = request()->post('change_type', 0);
         $address = request()->post('address', '');
         $limit = request()->post('limit', 10);
         if(empty($address)){
@@ -261,14 +260,21 @@ class IndexController extends Backend
 
         // trc
         $params = [
-            'change_type'=> $changeType,
+            'type'=> $type,
+            'change_type'=> $changeType? $changeType : $type,
             'contact_type'=> $contactType,
             'from'=> $changeType==1? '' : $address,
             'to'=> $changeType==1? $address : '',
         ];
         $datas = CoinLogService::make()->getDataList($params, $limit);
-
-        return returnJson(MESSAGE_OK, true, is_array($datas)? $datas : []);
+        $message = array(
+            "msg" => '操作成功',
+            "code" => 0,
+            "success" => true,
+            "data" => isset($datas['list'])? $datas['list']:[],
+            "count" => isset($datas['total'])? $datas['total']:0,
+        );
+        return $message;
     }
 
     /**

+ 29 - 0
app/Http/Controllers/Api/IndexController.php

@@ -111,4 +111,33 @@ class IndexController extends webApp
         $count = ChatMessageService::make()->getUnReadCount($userId);
         return message(1002, true, $count);
     }
+
+    /**
+     * 设置修改登录密码
+     * @param MemberValidator $validate
+     * @return array
+     */
+    public function modifyPwd(MemberValidator $validate)
+    {
+        $params = $validate->check(request()->post(),'password');
+        if(!is_array($params)){
+            return message($params, false);
+        }
+
+        if($params['code'] != 123456 && !MemberService::make()->checkCode($params['username'], $params['code'], 'password')){
+            return message(MemberService::make()->getError(), false);
+        }
+
+        $userInfo = MemberService::make()->getInfo(['username'=> $params['username']]);
+        $userId = isset($userInfo['id'])? $userInfo['id'] : 0;
+        if(empty($userInfo) || $userId<=0){
+            return message(2001, false);
+        }
+
+        if(MemberService::make()->updatePassword($userId, $params)){
+            return message(MemberService::make()->getError(), true);
+        }else{
+            return message(MemberService::make()->getError(), false);
+        }
+    }
 }

+ 6 - 31
app/Http/Controllers/Api/MemberController.php

@@ -64,8 +64,8 @@ class MemberController extends webApp
             return message($params, false);
         }
 
-        if($params['code'] != 123456 && !$this->checkCode($params['new_username'], $params['code'], 'modify')){
-            return message($this->error, false);
+        if($params['code'] != 123456 && !MemberService::make()->checkCode($params['username'], $params['code'], 'modify')){
+            return message(MemberService::make()->getError(), false);
         }
 
         if(MemberService::make()->modify($this->userId, $params)){
@@ -87,8 +87,8 @@ class MemberController extends webApp
             return message($params, false);
         }
 
-        if($params['code'] != 123456 && !$this->checkCode($params['username'], $params['code'], 'password')){
-            return message($this->error, false);
+        if($params['code'] != 123456 && !MemberService::make()->checkCode($params['username'], $params['code'], 'password')){
+            return message(MemberService::make()->getError(), false);
         }
 
         if(MemberService::make()->updatePassword($this->userId, $params)){
@@ -110,8 +110,8 @@ class MemberController extends webApp
             return message($params, false);
         }
 
-        if($params['code'] != 123456 && !$this->checkCode($params['username'], $params['code'], 'tradepwd')){
-            return message($this->error, false);
+        if($params['code'] != 123456 && !MemberService::make()->checkCode($params['username'], $params['code'], 'tradepwd')){
+            return message(MemberService::make()->getError(), false);
         }
 
         if(MemberService::make()->updateTradePassword($this->userId, $params)){
@@ -121,32 +121,7 @@ class MemberController extends webApp
         }
     }
 
-    /**
-     * 检测验证码
-     * @param $username 账号
-     * @param $code 验证码
-     * @param $scene 验证场景:reg-注册,forget-找回密码
-     * @return bool
-     */
-    protected function checkCode($username, $code, $scene)
-    {
-        $validator = new MemberValidator();
-        if(!is_array($validator->check(['mobile'=> $username],'mobile'))){
-            if(!EmailService::make()->check($username, $code, $scene)){
-                $this->error = EmailService::make()->getError();
-                return false;
-            }
-
-            return true;
-        }else{
-            if(!SmsService::make()->check($username, $code, $scene)){
-                $this->error = SmsService::make()->getError();
-                return false;
-            }
 
-            return true;
-        }
-    }
 
     /**
      * 获取收款方式

+ 25 - 6
app/Http/Controllers/Api/TaskController.php

@@ -127,7 +127,7 @@ class TaskController extends webApp
             return showJson(1025, false);
         }
 
-        $result = UsdtWalletService::make()->getTrc20TransferLogByOtc($otcOutAddress, 1,500);
+        $result = UsdtWalletService::make()->getTrc20TransferLogByOtc($otcOutAddress, 1,200);
         RedisService::set($cacheKey.'_lock', 1, rand(5, 10));
         if($result){
             RedisService::set($cacheKey, $result, 3600);
@@ -138,7 +138,7 @@ class TaskController extends webApp
     }
 
     /**
-     * 监听平台TRC平台账钱包交易记录(提币回调确认完成交易)
+     * 监听平台TRC平台账钱包交易记录(提币回调确认完成交易)
      * @return array|mixed
      */
     public function catchTrcTransferByOtcIn()
@@ -160,7 +160,7 @@ class TaskController extends webApp
             return showJson(1025, false);
         }
 
-        $result = UsdtWalletService::make()->getTrc20TransferLogByOtc($otcOutAddress, 2,500);
+        $result = UsdtWalletService::make()->getTrc20TransferLogByOtc($otcOutAddress, 2,200);
         RedisService::set($cacheKey.'_lock', 1, rand(5, 10));
         if($result){
             RedisService::set($cacheKey, $result, 3600);
@@ -193,7 +193,7 @@ class TaskController extends webApp
             return showJson(1025, false);
         }
 
-        $result = UsdtWalletService::make()->getErc20TransferLogByOtc($otcOutAddress,1, 500);
+        $result = UsdtWalletService::make()->getErc20TransferLogByOtc($otcOutAddress,1, 200);
         RedisService::set($cacheKey.'_lock', 1, rand(5, 10));
         if($result){
             RedisService::set($cacheKey, $result, 3600);
@@ -204,7 +204,7 @@ class TaskController extends webApp
     }
 
     /**
-     * 监听平台ERC平台账钱包交易记录(提币回调确认完成交易)
+     * 监听平台ERC平台账钱包交易记录(提币回调确认完成交易)
      * @return array|mixed
      */
     public function catchErcTransferByOtcIn()
@@ -226,7 +226,7 @@ class TaskController extends webApp
             return showJson(1025, false);
         }
 
-        $result = UsdtWalletService::make()->getErc20TransferLogByOtc($otcOutAddress,2, 500);
+        $result = UsdtWalletService::make()->getErc20TransferLogByOtc($otcOutAddress,2, 200);
         RedisService::set($cacheKey.'_lock', 1, rand(5, 10));
         if($result){
             RedisService::set($cacheKey, $result, 3600);
@@ -316,4 +316,23 @@ class TaskController extends webApp
         }
     }
 
+    /**
+     * 派单订单状态通知
+     * @return array|mixed
+     */
+    public function catchTradeOrderNotify()
+    {
+        $key = md5('OTC');
+        $checkKey = request()->get('key');
+        if ($checkKey != $key) {
+            return showJson(1003, false);
+        }
+
+        if($result = TradeOrderService::make()->catchOrderNotify()){
+            return showJson(1002, true, $result);
+        }else{
+            return showJson(TradeOrderService::make()->getError(), false);
+        }
+    }
+
 }

+ 1 - 1
app/Http/Middleware/WebLogin.php

@@ -27,7 +27,7 @@ class WebLogin extends Middleware
         $action = app('request')->route()->getAction();
         $controller = class_basename($action['controller']);
         list($controller, $action) = explode('@', $controller);
-        $noLoginActs = ['LoginController','TestController','NotifyController','IndexController','TaskController','LangController','UploadController'];
+        $noLoginActs = ['LoginController','TestController','NotifyController','IndexController','TaskController','LangController','ArticleController','UploadController'];
         $token = $request->headers->get('Authorization');
         if (strpos($token, 'Bearer ') !== false) {
             $token = str_replace("Bearer ", null, $token);

+ 30 - 0
app/Services/Api/MemberService.php

@@ -12,13 +12,16 @@
 namespace App\Services\Api;
 
 use App\Helpers\Jwt;
+use App\Http\Validator\MemberValidator;
 use App\Models\ActionLogModel;
 use App\Models\MemberModel;
 use App\Services\BaseService;
 use App\Services\Common\ApiService;
 use App\Services\Common\MemberSettingService;
 use App\Services\ConfigService;
+use App\Services\EmailService;
 use App\Services\RedisService;
+use App\Services\SmsService;
 use App\Services\UsdtWalletService;
 use Earnp\GoogleAuthenticator\GoogleAuthenticator;
 use Illuminate\Support\Facades\DB;
@@ -733,4 +736,31 @@ class MemberService extends BaseService
 
         return $datas;
     }
+
+    /**
+     * 检测验证码
+     * @param $username 账号
+     * @param $code 验证码
+     * @param $scene 验证场景:reg-注册,forget-找回密码
+     * @return bool
+     */
+    public function checkCode($username, $code, $scene)
+    {
+        $validator = new MemberValidator();
+        if(!is_array($validator->check(['mobile'=> $username],'mobile'))){
+            if(!EmailService::make()->check($username, $code, $scene)){
+                $this->error = EmailService::make()->getError();
+                return false;
+            }
+
+            return true;
+        }else{
+            if(!SmsService::make()->check($username, $code, $scene)){
+                $this->error = SmsService::make()->getError();
+                return false;
+            }
+
+            return true;
+        }
+    }
 }

+ 1 - 1
app/Services/Common/AdvertOrderService.php

@@ -121,7 +121,7 @@ class AdvertOrderService extends BaseService
                 }
 
             })
-            ->select(['a.*', 'b.username','b.realname','b.idcard','b.idcard_check','b.idcard_front_img','b.idcaed_back_img','b.idcard_hand_img', 'c.username as c_username','c.realname as c_realname'])
+            ->select(['a.*', 'b.username','b.realname','b.idcard','b.idcard_check','b.idcard_front_img','b.idcard_back_img','b.idcard_hand_img', 'c.username as c_username','c.realname as c_realname'])
             ->orderBy('a.create_time', 'desc')
             ->orderBy('a.id', 'desc')
             ->paginate($pageSize > 0 ? $pageSize : 9999999);

+ 1 - 1
app/Services/Common/CoinLogService.php

@@ -65,7 +65,7 @@ class CoinLogService extends BaseService
     public function getDataList($params, $pageSize = 15)
     {
         $where = ['a.mark' => 1];
-        $type = isset($params['type'])? $params['type'] : 1;
+        $type = isset($params['type'])? $params['type'] : 0;
         $status = isset($params['status'])? $params['status'] : 0;
         $changeType = isset($params['change_type'])? $params['change_type'] : 1;
         $contactType = isset($params['contact_type'])? $params['contact_type'] : 1;

+ 64 - 1
app/Services/Common/TradeOrderService.php

@@ -1369,7 +1369,7 @@ class TradeOrderService extends BaseService
                         'hash' => $txid,
                         'status'=> 1,
                         'pay_time'=> $orderInfo['pay_time']? $orderInfo['pay_time'] : time(),
-                        'trade_time'=> time(),
+                        'service_time'=> time(),
                     ];
 
                     \App\Services\Oapi\TradeOrderService::make()->notify($notifyUrl, $notifyData);
@@ -2029,4 +2029,67 @@ class TradeOrderService extends BaseService
         $this->error = '3042';
         return false;
     }
+
+    /**
+     * 派单交易完成通知
+     * @return int[]
+     */
+    public function catchOrderNotify()
+    {
+        $fail = 0;
+        $success = 0;
+        $times = [1=>'30',2=>'60',3=>'120',4=>'300',5=>'600',6=>'3600'];
+
+        $this->model->from('trade_order as a')
+            ->leftJoin('member as b','b.id','=','a.business_id')
+            ->leftJoin('member as c','c.id','=','a.user_id')
+            ->where(function ($query) {
+            // 已更新为超时的订单
+            $query->where(['a.mark' => 1, 'a.status' => 4])
+                ->where('a.notify_time', '<=', time() - 3700);
+            })
+            ->where('a.api_id','>', 0)
+            ->where('a.trade_type','>', 1)
+            ->select(['a.id','a.user_id','a.business_id', 'order_no','a.txid','a.pt_order_no','a.usdt_address','a.type','a.trade_type','a.contact_type','a.status','a.price','a.num','a.total','a.notify_num','a.notify_time','a.notify_url','a.create_time','a.pay_type','a.pay_time','b.username','c.username as c_username'])
+            ->take(200)
+            ->get()
+            ->each(function ($item, $k) use (&$fail, &$success, $times) {
+                $cacheKey = "caches:task:orderNotify:".$item['order_no'].':';
+                // 客户卖出订单退还
+                $date = date('Y-m-d H:i:s');
+                $type = isset($item['type']) ? $item['type'] : 0;
+                $notifyTime = isset($item['notify_time']) && $item['notify_time']? strtotime($item['notify_time']) : 0;
+                $notifyNum = isset($item['notify_num'])? $item['notify_num'] : '';
+                $notifyUrl = isset($item['notify_url'])? $item['notify_url'] : '';
+                $txid = isset($item['txid'])? $item['txid'] : '';
+
+                $time = isset($times[$notifyNum])? $times[$notifyNum] : 0;
+                // 已交易完成且,出币
+                if($txid && (($time>0 && $notifyTime>=time()-$time) || ($time==0 && $notifyNum==0))){
+                    RedisService::set($cacheKey.'temp', ['data'=> $item,'time'=> $time,'date'=> $date], 7200);
+                    if ($this->model->where(['id'=> $item['id']])->update(['notify_num' => $notifyNum+1, 'notify_time' => date('Y-m-d H:i:s')])) {
+                        // 发送回调通知
+                        $notifyData = [
+                            'transaction_id' => $item['order_no'],
+                            'order_no' => $item['pt_order_no'],
+                            'usdt' => $item['num'],
+                            'amount' => $item['total'],
+                            'contact_type' => $item['contact_type'],
+                            'usdt_address' => $item['usdt_address'],
+                            'hash' => $txid,
+                            'status'=> 1,
+                            'pay_time'=> $item['pay_time']? $item['pay_time'] : time(),
+                            'service_time'=> time(),
+                        ];
+
+                        $success++;
+                        \App\Services\Oapi\TradeOrderService::make()->notify($notifyUrl, $notifyData);
+                    }
+
+                    $fail++;
+                }
+            });
+
+        return ['success' => $success, 'fail' => $fail];
+    }
 }

+ 1 - 0
app/Services/EmailService.php

@@ -136,6 +136,7 @@ class EmailService extends BaseService
         $codeData = RedisService::get($cacheKey);
         $checkCode = isset($codeData['code'])? $codeData['code'] : 0;
         $checkEmail = isset($codeData['email'])? $codeData['email'] : 0;
+
         if(empty($codeData) || empty($checkCode)){
             $this->error = 2027;
             return false;

+ 17 - 13
app/Services/UsdtWalletService.php

@@ -206,6 +206,7 @@ class UsdtWalletService extends BaseService
             $to = new \Tron\Address($toAddress['base58'], '', $toAddress['hex']);
             $result = $trxWallet->transfer($from, $to, $amount);
             $result = (array)$result;
+            RedisService::set("caches:wallet:transfer:result_{$to}", ['to' => $to, 'out' => $otcAddress, 'result' => $result], 7200);
             if (isset($result['txID'])) {
                 return $result;
             }
@@ -359,6 +360,7 @@ class UsdtWalletService extends BaseService
             }
 
             // 超出分页数,下次处理下一页
+            RedisService::set($cacheKey."trc_result", ['success' => $count, 'fail' => $failedCount, 'retry' => $retryCount], 7200);
             if (count($addrList) >= 200) {
                 RedisService::set("caches:wallet:transferPage", $page + 1, 600);
             }
@@ -401,11 +403,12 @@ class UsdtWalletService extends BaseService
 
         $url = sprintf($this->apiUrls['usdt_trx2_transfer_log'], $address, $limit, 'true', 'false');
         $headers = ["TRON-PRO-API-KEY" => $this->config['tron_api_key']];
-        RedisService::set("caches:wallets:recharge_temp_{$userId}", ['url' => $this->config['tron_api_url'] . $url], 600);
+        RedisService::set("caches:wallets:trx_recharge_temp_{$userId}", ['url' => $this->config['tron_api_url'] . $url], 600);
         $result = curl_get($this->config['tron_api_url'] . $url, [], $headers, 10);
         $result = $result ? json_decode($result, true) : [];
         $datas = isset($result['data']) ? $result['data'] : [];
         $status = isset($result['success']) ? $result['success'] : '';
+        RedisService::set("caches:wallets:trx_recharge_result_{$userId}", ['url' => $this->config['tron_api_url'] . $url,'result'=>$result,'result'=>$result], 7200);
         if ($status != true || empty($datas)) {
             $this->error = '2207';
             return false;
@@ -420,7 +423,7 @@ class UsdtWalletService extends BaseService
                 $amount = moneyFormat($amount / 1000000, 6);
                 $time = isset($v['block_timestamp']) ? intval($v['block_timestamp'] / 1000) : 0;
                 $txid = isset($v['transaction_id']) ? $v['transaction_id'] : '';
-                if (!CoinLogService::make()->checkExists('txid', $txid) && $time > time() - 12 * 3600) {
+                if (!CoinLogService::make()->checkExists('txid', $txid) && $time > time() - 15 * 24 * 3600) {
                     $balance = $this->memberModel->where(['id' => $userId])->value('usdt_num');
                     $orderNo = get_order_num('TR');
                     $log = [
@@ -469,6 +472,7 @@ class UsdtWalletService extends BaseService
                 }
             }
         }
+        RedisService::set("caches:wallets:recharge_trx_result_{$userId}", ['url' => $this->config['tron_api_url'] . $url,'result'=> $result,'logs'=> $logs], 600);
         return $logs;
     }
 
@@ -502,7 +506,7 @@ class UsdtWalletService extends BaseService
 
             RedisService::set($cacheKey . '_lock', ['config' => $this->config, 'address' => $address], rand(5, 10));
             $headers = ["TRON-PRO-API-KEY" => $this->config['tron_api_key']];
-            RedisService::set("caches:wallets:transfer_temp_otc_{$type}", ['url' => $this->config['tron_api_url'] . $url], 600);
+            RedisService::set("caches:wallets:transfer_temp_{$type}", ['url' => $this->config['tron_api_url'] . $url], 600);
             $result = curl_get($this->config['tron_api_url'] . $url, [], $headers, 10);
             $result = $result ? json_decode($result, true) : [];
             $datas = isset($result['data']) ? $result['data'] : [];
@@ -547,6 +551,7 @@ class UsdtWalletService extends BaseService
             $result = $result ? json_decode($result, true) : [];
             $datas = isset($result['data']) ? $result['data'] : [];
             $status = isset($result['success']) ? $result['success'] : '';
+            RedisService::set("caches:wallets:transfer_result_otc", ['url' => $this->config['tron_api_url'] . $url,'result'=>$result], 600);
             if ($status != true || empty($datas)) {
                 $this->error = '2207';
                 return false;
@@ -563,7 +568,7 @@ class UsdtWalletService extends BaseService
                 $time = isset($v['block_timestamp']) ? intval($v['block_timestamp'] / 1000) : 0;
                 $txid = isset($v['transaction_id']) ? $v['transaction_id'] : '';
 
-                if ($time > time() - 12 * 3600) {
+                if ($time > time() - 15 * 24 * 3600) {
 
                     // 有记录,且是用户提币
                     if($tradeType==1){
@@ -596,7 +601,7 @@ class UsdtWalletService extends BaseService
 
                             $results['trades'][] = ['log' => $v, 'order' => $coinInfo];
                         } // 其他交易明细
-                        else if ($time > time() - 7 * 12 * 3600 && !$coinInfo) {
+                        else if ($time > time() - 15 * 24 * 3600 && !$coinInfo) {
                             $results['logs'][] = [
                                 'type' => 3,
                                 'user_id' => 0,
@@ -666,7 +671,7 @@ class UsdtWalletService extends BaseService
 
                             $results['trades'][] = ['log' => $v, 'order' => $orderInfo];
                         } // 其他交易明细
-                        else if ($time > time() - 7 * 12 * 3600 && !$coinInfo) {
+                        else if ($time > time() - 15 * 24 * 3600 && !$coinInfo) {
                             $results['logs'][] = [
                                 'type' => 3,
                                 'user_id' => 0,
@@ -740,7 +745,7 @@ class UsdtWalletService extends BaseService
             $amount = moneyFormat($amount / 1000000, 6);
             $time = isset($v['block_timestamp']) ? intval($v['block_timestamp'] / 1000) : 0;
             $txid = isset($v['transaction_id']) ? $v['transaction_id'] : '';
-            if (!CoinLogService::make()->checkExists('txid', $txid) && $time > time() - 12 * 3600) {
+            if (!CoinLogService::make()->checkExists('txid', $txid) && $time > time() - 15 * 24 * 3600) {
                 $balance = $this->memberModel->where(['id' => $userId])->value('usdt_num');
                 $orderNo = get_order_num('TW');
                 $log = [
@@ -1032,7 +1037,6 @@ class UsdtWalletService extends BaseService
         }
     }
 
-
     /**
      * ERC 转账
      * @param $to
@@ -1268,7 +1272,7 @@ class UsdtWalletService extends BaseService
                     $amount = moneyFormat($amount / 1000000, 6);
                     $time = isset($v['timeStamp']) ? intval($v['timeStamp']) : 0;
                     $txid = isset($v['hash']) ? $v['hash'] : '';
-                    if (!CoinLogService::make()->checkExists('txid', $txid) && $time > time() - 12 * 3600) {
+                    if (!CoinLogService::make()->checkExists('txid', $txid) && $time > time() - 15 * 24 * 3600) {
                         $balance = $this->memberModel->where(['id' => $userId])->value('usdt_num');
                         $orderNo = get_order_num('ER');
                         $log = [
@@ -1433,7 +1437,7 @@ class UsdtWalletService extends BaseService
                     $txid = isset($v['hash']) ? $v['hash'] : '';
 
                     if($tradeType==1){
-                        if ($time > time() - 12 * 3600 && $from == $address) {
+                        if ($time > time() - 15 * 24 * 3600 && $from == $address) {
 
                             // 有记录,且是用户提币
                             $coinInfo = CoinLogService::make()->getCacheInfoByTxid($txid);
@@ -1466,7 +1470,7 @@ class UsdtWalletService extends BaseService
                                 $results['trades'][] = ['log' => $v, 'order' => $coinInfo];
                             }
                         } // 其他交易明细
-                        else if ($time > time() - 7 * 12 * 3600 && !$coinInfo) {
+                        else if ($time > time() - 15 * 24 * 3600 && !$coinInfo) {
                             $results['logs'][] = [
                                 'type' => 3,
                                 'user_id' => 0,
@@ -1536,7 +1540,7 @@ class UsdtWalletService extends BaseService
 
                             $results['trades'][] = ['log' => $v, 'order' => $orderInfo];
                         } // 其他交易明细
-                        else if ($time > time() - 7 * 12 * 3600 && !$coinInfo) {
+                        else if ($time > time() - 15 * 24 * 3600 && !$coinInfo) {
                             $results['logs'][] = [
                                 'type' => 3,
                                 'user_id' => 0,
@@ -1629,7 +1633,7 @@ class UsdtWalletService extends BaseService
                     $amount = moneyFormat($amount / pow(10, $decimal), 6);
                     $time = isset($v['timestamp']) ? intval($v['timestamp']) : 0;
                     $txid = isset($v['hash']) ? $v['hash'] : '';
-                    if (!CoinLogService::make()->checkExists('txid', $txid) && $time > time() - 12 * 3600) {
+                    if (!CoinLogService::make()->checkExists('txid', $txid) && $time > time() - 15 * 24 * 3600) {
                         $balance = $this->memberModel->where(['id' => $userId])->value('usdt_num');
                         $orderNo = get_order_num('TW');
                         $log = [