|
@@ -165,8 +165,10 @@ class HandleEnergyOrder
|
|
|
'permissionid' => $v1->permission_id
|
|
|
];
|
|
|
$dlres = Get_Pay(base64_decode('aHR0cHM6Ly90cm9ud2Vibm9kZWpzLndhbGxldGltLnZpcC9kZWxlZ2VhbmR1bmRlbGV0ZQ=='),$params);
|
|
|
+
|
|
|
+ }
|
|
|
//trongas.io平台
|
|
|
- }elseif($v1->platform_name == 4){
|
|
|
+ elseif($v1->platform_name == 4){
|
|
|
//0:一小时,1:一天,3:三天
|
|
|
switch ($energy_day) {
|
|
|
case 1:
|
|
@@ -192,8 +194,10 @@ class HandleEnergyOrder
|
|
|
|
|
|
$balance_url = 'https://trongas.io/api/pay';
|
|
|
$dlres = Get_Pay($balance_url,$param);
|
|
|
+
|
|
|
+ }
|
|
|
//机器人开发代理
|
|
|
- }elseif($v1->platform_name == 5){
|
|
|
+ elseif($v1->platform_name == 5){
|
|
|
$balance_url = env('THIRD_URL');
|
|
|
if(empty($balance_url)){
|
|
|
$errorMessage = $errorMessage."使用开发者能量代理时,env中url为空";
|
|
@@ -238,7 +242,24 @@ class HandleEnergyOrder
|
|
|
$balance_url = $balance_url.'/api/thirdpart/shanzuorder';
|
|
|
$dlres = Get_Pay($balance_url,$param);
|
|
|
}
|
|
|
-
|
|
|
+ // MeFree.NET 平台
|
|
|
+ elseif($v1->platform_name == 6){
|
|
|
+
|
|
|
+ // API 配置信息
|
|
|
+ $base_url = "https://api.mefree.net"; // Mefree API 基础地址
|
|
|
+ $api_key = $v1->platform_uid; // 替换为实际的 API Key
|
|
|
+ $secret_key = $signstr; // 替换为实际的 Secret Key
|
|
|
+
|
|
|
+ // 代理的周期,值可能为:0,1,2,3,4...30。其中0:速充;1:一小时;2:1天;3:3天;4:4天...最多30天。
|
|
|
+ $period = 1;
|
|
|
+
|
|
|
+ $tron_address = $v->transferfrom_address ; // 接收资源地址(请勿输入合约地址或没激活地址)
|
|
|
+
|
|
|
+ // 创建订单
|
|
|
+ $request_path = "/api/order?quantity=$energy_amount&target_address=$tron_address&period=$period"; // API 请求路径
|
|
|
+ $response = send_request("POST", $request_path, $base_url, $api_key, $secret_key);
|
|
|
+ $dlres = $response;
|
|
|
+ }
|
|
|
if(empty($dlres)){
|
|
|
// $save_data = [];
|
|
|
// $save_data['process_status'] = 4; //下单失败
|
|
@@ -260,7 +281,14 @@ class HandleEnergyOrder
|
|
|
}else{
|
|
|
$dlres = json_decode($dlres,true);
|
|
|
|
|
|
- if((isset($dlres['status']) && $dlres['status'] == 200 && $v1->platform_name == 1) || (isset($dlres['status']) && $dlres['status'] == 'success' && $v1->platform_name == 2) || (isset($dlres['code']) && $dlres['code'] == 200 && $v1->platform_name == 3) || (isset($dlres['code']) && $dlres['code'] == 10000 && $v1->platform_name == 4) || (isset($dlres['code']) && $dlres['code'] == 200 && $v1->platform_name == 5)){
|
|
|
+ if(
|
|
|
+ (isset($dlres['status']) && $dlres['status'] == 200 && $v1->platform_name == 1) ||
|
|
|
+ (isset($dlres['status']) && $dlres['status'] == 'success' && $v1->platform_name == 2) ||
|
|
|
+ (isset($dlres['code']) && $dlres['code'] == 200 && $v1->platform_name == 3) ||
|
|
|
+ (isset($dlres['code']) && $dlres['code'] == 10000 && $v1->platform_name == 4) ||
|
|
|
+ (isset($dlres['code']) && $dlres['code'] == 200 && $v1->platform_name == 5) ||
|
|
|
+ (isset($dlres['status_code']) && $dlres['status_code'] == 200 && $v1->platform_name == 6)
|
|
|
+ ){
|
|
|
if($v1->platform_name == 1){
|
|
|
$orderNo = $dlres['data']['order_no'];
|
|
|
$use_trx = 0;
|
|
@@ -276,6 +304,9 @@ class HandleEnergyOrder
|
|
|
}elseif($v1->platform_name == 5){
|
|
|
$orderNo = $dlres['data']['orderId'];
|
|
|
$use_trx = $dlres['data']['orderMoney'];
|
|
|
+ }elseif($v1->platform_name == 6){
|
|
|
+ $orderNo = $dlres['data']['client_order_id'];
|
|
|
+ $use_trx = $dlres['data']['amount_sun'];
|
|
|
}
|
|
|
$insert_data = [];
|
|
|
$insert_data['energy_platform_rid'] = $v1->rid;
|
|
@@ -314,6 +345,9 @@ class HandleEnergyOrder
|
|
|
$msg = ' 下单失败,接口返回:'.json_encode($dlres);
|
|
|
}elseif($v1->platform_name == 5){
|
|
|
$msg = ' 下单失败,接口返回:'.json_encode($dlres);
|
|
|
+ }elseif($v1->platform_name == 6){
|
|
|
+ $msg = ' 下单失败,接口返回:'.json_encode($dlres);
|
|
|
+ $msg = ' 下单失败,接口返回-aaaa:'.$signstr;
|
|
|
}
|
|
|
$errorMessage = $errorMessage."能量平台:".$v1->platform_name.$msg;
|
|
|
$save_data = [];
|
|
@@ -332,7 +366,7 @@ class HandleEnergyOrder
|
|
|
}else{
|
|
|
$save_data = [];
|
|
|
$save_data['process_status'] = 4; //下单失败
|
|
|
- $save_data['process_comments'] = "机器人无可用能量平台,请质押或者充值平台"; //处理备注
|
|
|
+ $save_data['process_comments'] = "机器人无可用能量平台,请质押或者充值平台"; //处理备注
|
|
|
$save_data['process_time'] = $time; //处理时间
|
|
|
EnergyWalletTradeList::where('rid',$v->rid)->update($save_data);
|
|
|
}
|
|
@@ -378,7 +412,7 @@ class HandleEnergyOrder
|
|
|
$query1->where('platform_name', 3)->where('platform_balance', '>=', $energy_amount);
|
|
|
});
|
|
|
$query->orwhere(function ($query2) {
|
|
|
- $query2->orwhereIn('platform_name', [1,2,4,5])->where('platform_balance', '>', '0');
|
|
|
+ $query2->orwhereIn('platform_name', [1,2,4,5,6])->where('platform_balance', '>', '0');
|
|
|
});
|
|
|
})
|
|
|
->orderBy('seq_sn','desc')
|
|
@@ -468,8 +502,9 @@ class HandleEnergyOrder
|
|
|
'permissionid' => $v1->permission_id
|
|
|
];
|
|
|
$dlres = Get_Pay(base64_decode('aHR0cHM6Ly90cm9ud2Vibm9kZWpzLndhbGxldGltLnZpcC9kZWxlZ2VhbmR1bmRlbGV0ZQ=='),$params);
|
|
|
+ }
|
|
|
//trongas.io平台
|
|
|
- }elseif($v1->platform_name == 4){
|
|
|
+ elseif($v1->platform_name == 4){
|
|
|
//0:一小时,1:一天,3:三天
|
|
|
switch ($energy_day) {
|
|
|
case 1:
|
|
@@ -495,8 +530,9 @@ class HandleEnergyOrder
|
|
|
|
|
|
$balance_url = 'https://trongas.io/api/pay';
|
|
|
$dlres = Get_Pay($balance_url,$param);
|
|
|
+ }
|
|
|
//机器人开发代理
|
|
|
- }elseif($v1->platform_name == 5){
|
|
|
+ elseif($v1->platform_name == 5){
|
|
|
$balance_url = env('THIRD_URL');
|
|
|
if(empty($balance_url)){
|
|
|
$errorMessage = $errorMessage."使用开发者能量代理时,env中url为空";
|
|
@@ -541,7 +577,24 @@ class HandleEnergyOrder
|
|
|
$balance_url = $balance_url.'/api/thirdpart/shanzuorder';
|
|
|
$dlres = Get_Pay($balance_url,$param);
|
|
|
}
|
|
|
-
|
|
|
+ // MeFree.NET 平台
|
|
|
+ elseif($v1->platform_name == 6){
|
|
|
+
|
|
|
+ // API 配置信息
|
|
|
+ $base_url = "https://api.mefree.net"; // Mefree API 基础地址
|
|
|
+ $api_key = $v1->platform_uid; // 替换为实际的 API Key
|
|
|
+ $secret_key = $signstr; // 替换为实际的 Secret Key
|
|
|
+
|
|
|
+ // 代理的周期,值可能为:0,1,2,3,4...30。其中0:速充;1:一小时;2:1天;3:3天;4:4天...最多30天。
|
|
|
+ $period = 1;
|
|
|
+
|
|
|
+ $tron_address = $v->wallet_addr ; // 接收资源地址(请勿输入合约地址或没激活地址)
|
|
|
+
|
|
|
+ // 创建订单
|
|
|
+ $request_path = "/api/order?quantity=$energy_amount&target_address=$tron_address&period=$period"; // API 请求路径
|
|
|
+ $response = send_request("POST", $request_path, $base_url, $api_key, $secret_key);
|
|
|
+ $dlres = $response['response']; // $dlres 为json格式,与其他统一共用
|
|
|
+ }
|
|
|
if(empty($dlres)){
|
|
|
$errorMessage = $errorMessage."能量平台:".$v1->platform_name." 能量平台接口返回为空。";
|
|
|
$save_data = [];
|
|
@@ -553,7 +606,14 @@ class HandleEnergyOrder
|
|
|
}else{
|
|
|
$dlres = json_decode($dlres,true);
|
|
|
|
|
|
- if((isset($dlres['status']) && $dlres['status'] == 200 && $v1->platform_name == 1) || (isset($dlres['status']) && $dlres['status'] == 'success' && $v1->platform_name == 2) || (isset($dlres['code']) && $dlres['code'] == 200 && $v1->platform_name == 3) || (isset($dlres['code']) && $dlres['code'] == 10000 && $v1->platform_name == 4) || (isset($dlres['code']) && $dlres['code'] == 200 && $v1->platform_name == 5)){
|
|
|
+ if(
|
|
|
+ (isset($dlres['status']) && $dlres['status'] == 200 && $v1->platform_name == 1) ||
|
|
|
+ (isset($dlres['status']) && $dlres['status'] == 'success' && $v1->platform_name == 2) ||
|
|
|
+ (isset($dlres['code']) && $dlres['code'] == 200 && $v1->platform_name == 3) ||
|
|
|
+ (isset($dlres['code']) && $dlres['code'] == 10000 && $v1->platform_name == 4) ||
|
|
|
+ (isset($dlres['code']) && $dlres['code'] == 200 && $v1->platform_name == 5) ||
|
|
|
+ (isset($response['status_code']) && $response['status_code'] == 200 && $v1->platform_name == 6)
|
|
|
+ ){
|
|
|
if($v1->platform_name == 1){
|
|
|
$orderNo = $dlres['data']['order_no'];
|
|
|
$use_trx = 0;
|
|
@@ -569,6 +629,9 @@ class HandleEnergyOrder
|
|
|
}elseif($v1->platform_name == 5){
|
|
|
$orderNo = $dlres['data']['orderId'];
|
|
|
$use_trx = $dlres['data']['orderMoney'];
|
|
|
+ }elseif($v1->platform_name == 6){
|
|
|
+ $orderNo = $dlres['data']['client_order_id'];
|
|
|
+ $use_trx = $dlres['data']['amount_sun'];
|
|
|
}
|
|
|
$insert_data = [];
|
|
|
$insert_data['energy_platform_rid'] = $v1->rid;
|
|
@@ -605,8 +668,10 @@ class HandleEnergyOrder
|
|
|
$msg = ' 下单失败,接口返回:'.json_encode($dlres);
|
|
|
}elseif($v1->platform_name == 5){
|
|
|
$msg = ' 下单失败,接口返回:'.json_encode($dlres);
|
|
|
+ }elseif($v1->platform_name == 6){
|
|
|
+ $msg = ' 下单失败,接口返回:'.$response['response'];
|
|
|
}
|
|
|
- $errorMessage = $errorMessage."能量平台:".$v1->platform_name.$msg;
|
|
|
+ $errorMessage = "能量平台:".$v1->platform_name.$msg;
|
|
|
$save_data = [];
|
|
|
$save_data['status'] = 4; //下单失败
|
|
|
$save_data['comments'] = $errorMessage; //处理备注
|
|
@@ -756,8 +821,9 @@ class HandleEnergyOrder
|
|
|
'permissionid' => $v1->permission_id
|
|
|
];
|
|
|
$dlres = Get_Pay(base64_decode('aHR0cHM6Ly90cm9ud2Vibm9kZWpzLndhbGxldGltLnZpcC9kZWxlZ2VhbmR1bmRlbGV0ZQ=='),$params);
|
|
|
+ }
|
|
|
//trongas.io平台
|
|
|
- }elseif($v1->platform_name == 4){
|
|
|
+ elseif($v1->platform_name == 4){
|
|
|
//0:一小时,1:一天,3:三天
|
|
|
switch ($energy_day) {
|
|
|
case 1:
|
|
@@ -784,7 +850,25 @@ class HandleEnergyOrder
|
|
|
$balance_url = 'https://trongas.io/api/pay';
|
|
|
$dlres = Get_Pay($balance_url,$param);
|
|
|
}
|
|
|
-
|
|
|
+ // MeFree.NET 平台
|
|
|
+ elseif($v1->platform_name == 6){
|
|
|
+
|
|
|
+ // API 配置信息
|
|
|
+ $base_url = "https://api.mefree.net"; // Mefree API 基础地址
|
|
|
+ $api_key = $v1->platform_uid; // 替换为实际的 API Key
|
|
|
+ $secret_key = $v1->platform_apikey; // 替换为实际的 Secret Key
|
|
|
+
|
|
|
+ // 代理的周期,值可能为:0,1,2,3,4...30。其中0:速充;1:一小时;2:1天;3:3天;4:4天...最多30天。
|
|
|
+ $period = 1;
|
|
|
+
|
|
|
+ $tron_address = $v->transferfrom_address ; // 接收资源地址(请勿输入合约地址或没激活地址)
|
|
|
+
|
|
|
+ // 创建订单
|
|
|
+ $request_path = "/api/order?quantity=$energy_amount&target_address=$tron_address&period=$period"; // API 请求路径
|
|
|
+ $response = send_request("POST", $request_path, $base_url, $api_key, $secret_key);
|
|
|
+ $dlres = $response;
|
|
|
+ }
|
|
|
+
|
|
|
if(empty($dlres)){
|
|
|
$errorMessage = $errorMessage."能量平台:".$v1->platform_name." 能量平台接口返回为空。";
|
|
|
$save_data = [];
|
|
@@ -796,7 +880,13 @@ class HandleEnergyOrder
|
|
|
}else{
|
|
|
$dlres = json_decode($dlres,true);
|
|
|
|
|
|
- if((isset($dlres['status']) && $dlres['status'] == 200 && $v1->platform_name == 1) || (isset($dlres['status']) && $dlres['status'] == 'success' && $v1->platform_name == 2) || (isset($dlres['code']) && $dlres['code'] == 200 && $v1->platform_name == 3) || (isset($dlres['code']) && $dlres['code'] == 10000 && $v1->platform_name == 4)){
|
|
|
+ if(
|
|
|
+ (isset($dlres['status']) && $dlres['status'] == 200 && $v1->platform_name == 1) ||
|
|
|
+ (isset($dlres['status']) && $dlres['status'] == 'success' && $v1->platform_name == 2) ||
|
|
|
+ (isset($dlres['code']) && $dlres['code'] == 200 && $v1->platform_name == 3) ||
|
|
|
+ (isset($dlres['code']) && $dlres['code'] == 10000 && $v1->platform_name == 4) ||
|
|
|
+ (isset($dlres['status_code']) && $dlres['status_code'] == 200 && $v1->platform_name == 6)
|
|
|
+ ){
|
|
|
if($v1->platform_name == 1){
|
|
|
$orderNo = $dlres['data']['order_no'];
|
|
|
$use_trx = 0;
|
|
@@ -809,6 +899,9 @@ class HandleEnergyOrder
|
|
|
}elseif($v1->platform_name == 4){
|
|
|
$orderNo = $dlres['data']['orderId'];
|
|
|
$use_trx = $dlres['data']['orderMoney'];
|
|
|
+ }elseif($v1->platform_name == 6){
|
|
|
+ $orderNo = $dlres['data']['client_order_id'];
|
|
|
+ $use_trx = $dlres['data']['amount_sun'];
|
|
|
}
|
|
|
$insert_data = [];
|
|
|
$insert_data['energy_platform_rid'] = $v1->rid;
|
|
@@ -842,6 +935,8 @@ class HandleEnergyOrder
|
|
|
$msg = '下单失败,检查质押是否足够';
|
|
|
}elseif($v1->platform_name == 4){
|
|
|
$msg = ' 下单失败,接口返回:'.json_encode($dlres);
|
|
|
+ }elseif($v1->platform_name == 6){
|
|
|
+ $msg = ' 下单失败,接口返回:'.json_encode($dlres);
|
|
|
}
|
|
|
$errorMessage = $errorMessage."能量平台:".$v1->platform_name.$msg;
|
|
|
$save_data = [];
|