Skip to content

Commit 3cebdf8

Browse files
authored
Update back.php
1 parent ad42ab9 commit 3cebdf8

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

pay/back.php

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,7 @@ function doAction($payRowId, $gateType){
189189
$plan_id = $payParam['plan_id'];
190190
$volume = $payParam['volume'];
191191
$days = $payParam['day'];
192-
// // for buy
193-
// $volumePay = $payParam['volume'];
194-
// $daysPay = $payParam['day'];
195-
// $agentBought = $payParam['agent_bought'];
192+
$agentBought = $payParam['agent_bought'];
196193

197194
if($payType == "BUY_SUB") $payDescription = "خرید اشتراک";
198195
elseif($payType == "RENEW_ACCOUNT") $payDescription = "تمدید اکانت";
@@ -230,8 +227,11 @@ function doAction($payRowId, $gateType){
230227
$expire_microdate = floor(microtime(true) * 1000) + (864000 * $days * 100);
231228
$expire_date = $date + (86400 * $days);
232229
$type = $file_detail['type'];
233-
$volume = $file_detail['volume'];
234-
$protocol = $file_detail['protocol'];
230+
231+
if($volume == 0 && $days == 0){
232+
$volume = $file_detail['volume'];
233+
$days = $file_detail['days'];
234+
}
235235

236236
$server_id = $file_detail['server_id'];
237237
$netType = $file_detail['type'];
@@ -288,7 +288,9 @@ function doAction($payRowId, $gateType){
288288
$stmt = $connection->prepare("SELECT * FROM `server_config` WHERE `id`=?");
289289
$stmt->bind_param("i", $server_id);
290290
$stmt->execute();
291-
$portType = $stmt->get_result()->fetch_assoc()['port_type'];
291+
$server_info = $stmt->get_result()->fetch_assoc();
292+
$serverType = $server_info['type'];
293+
$portType = $server_info['port_type'];
292294
$stmt->close();
293295
include '../phpqrcode/qrlib.php';
294296
define('IMAGE_WIDTH',540);
@@ -325,11 +327,17 @@ function doAction($payRowId, $gateType){
325327
if($inbound_id == 0){
326328
$response = addUser($server_id, $uniqid, $protocol, $port, $expire_microdate, $remark, $volume, $netType, 'none', $rahgozar, $fid);
327329
if(! $response->success){
330+
if(strstr($response->msg, "Duplicate email")) $remark .= RandomString();
331+
elseif(strstr($response->msg, "Port already exists")) $port = rand(1111,65000);
332+
328333
$response = addUser($server_id, $uniqid, $protocol, $port, $expire_microdate, $remark, $volume, $netType, 'none', $rahgozar, $fid);
329334
}
330335
}else {
336+
if($botState['firstUseState'] == "on" && ($serverType == "sanaei" || $serverType == "alireza")) $expire_microdate = $days * -86400000;
337+
331338
$response = addInboundAccount($server_id, $uniqid, $inbound_id, $expire_microdate, $remark, $volume, $limitip, null, $fid);
332339
if(! $response->success){
340+
if(strstr($response->msg, "Duplicate email")) $remark .= RandomString();
333341
$response = addInboundAccount($server_id, $uniqid, $inbound_id, $expire_microdate, $remark, $volume, $limitip, null, $fid);
334342
}
335343
}

0 commit comments

Comments
 (0)