فهرست منبع

Wesmiler OTC 提交更新 0729

APPLE 3 سال پیش
والد
کامیت
401d8d99f6

+ 0 - 1
app/Http/Controllers/Oapi/TradeController.php

@@ -39,7 +39,6 @@ class TradeController extends webApp
 
         // 额外验证没注册需要前往下载APP注册
 
-
         $params['api_id'] = $this->apiId;
         if($info = TradeOrderService::make()->buy($this->userId, $params)){
             return message(3006, true, $info);

+ 2 - 1
app/Http/Controllers/Oapi/webApp.php

@@ -65,6 +65,7 @@ class webApp extends BaseController
             $token = isset($params['token'])? $params['token'] : '';
             $tokenData = RedisService::get("apis:tokens:{$token}");
             $userId = isset($tokenData['id'])? $tokenData['id'] : 0;
+            $this->apiId = isset($tokenData['api_id'])? $tokenData['api_id'] : 0;
 
             // 请求频率限制
             $clientIp = get_client_ip();
@@ -83,7 +84,7 @@ class webApp extends BaseController
             }else{
                 $this->userId = $userId;
                 $this->userInfo = $userInfo;
-                $this->apiId = isset($userInfo['api_id'])? $userInfo['api_id'] : 0;
+                $this->apiId = isset($userInfo['api_id'])? $userInfo['api_id'] : $this->apiId;
             }
 
             RedisService::set($cacheKey, $requestCount+1, rand(1,2));

+ 2 - 2
app/Http/Validator/TradeValidator.php

@@ -48,9 +48,9 @@ class TradeValidator extends BaseValidator
     public static $scenes = [
         'info'=> ['id'],
         'buy'=> ['trade_type','pay_type','num_type','num'],
-        'trade_buy'=> ['trade_type','contact_type','order_no','num','notify_url','usdt_address'],
+        'trade_buy'=> ['trade_type','order_no','num','notify_url','usdt_address'],
         'sell'=> ['trade_type','payment_id','num_type','num'],
-        'trade_sell'=> ['trade_type','num','contact_type','payment','order_no','notify_url','usdt_address'],
+        'trade_sell'=> ['trade_type','num','payment','order_no','notify_url','usdt_address'],
         'pay'=> ['id','pay_type','pay_img'],
     ];
 

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

@@ -124,7 +124,7 @@ class ApiService extends BaseService
             return $info;
         }
         $info = ApiModel::where(['id'=> $id,'status'=> 1,'mark'=>1])
-            ->select(['id','username','notify_url','user_limits','expired_at'])
+            ->select(['id','username','notify_url','account','user_limits','expired_at'])
             ->first();
         if($info){
             $info['user_limits'] = $info['user_limits']? explode(',', $info['user_limits']) : [];

+ 4 - 3
app/Services/Oapi/TradeOrderService.php

@@ -136,7 +136,7 @@ class TradeOrderService extends BaseService
         $ptOrderNo = isset($params['order_no']) ? trim($params['order_no']) : '';
         $notifyUrl = isset($params['notify_url']) ? trim($params['notify_url']) : '';
         $tradeType = $tradeType? $tradeType : 2;
-       
+
         // 外汇平台需要注册登录
         if ($userId <= 0 && $tradeType == 2) {
             $this->error = '1013';
@@ -154,10 +154,11 @@ class TradeOrderService extends BaseService
         }
 
         if($apiId<=0){
-            $this->error = '2209';
+            $this->error = '6005';
             return false;
         }
 
+
         if(!in_array($contactType, [1,2])){
             $this->error = '2209';
             return false;
@@ -340,7 +341,7 @@ class TradeOrderService extends BaseService
         }
 
         $this->model->commit();
-        return [];
+        return ['token'=> isset($params['token'])? $params['token'] : '', 'order_no'=> $data['order_no']];
     }
 
     /**