diff --git a/app/channel/service/system/Jiujiufu.php b/app/channel/service/system/Jiujiufu.php index b1747e7..2c50894 100644 --- a/app/channel/service/system/Jiujiufu.php +++ b/app/channel/service/system/Jiujiufu.php @@ -309,9 +309,10 @@ class Jiujiufu extends Core $request['day'] = $day; $request['appid'] = $this->mid; $request['api_product'] = 'query'; - $request = $this->getParam($request, $this->token, 2); + $request = $this->getParam($request, $this->token); $url = $this->host . 'gateway/api.handle/accountByDay'; $response = $this->curl('post', $url, $request); +// var_dump($response);die; $response = $this->response($response); return $response['array']['data']; diff --git a/app/openapi/controller/Test.php b/app/openapi/controller/Test.php index ad741ba..b7f8f61 100644 --- a/app/openapi/controller/Test.php +++ b/app/openapi/controller/Test.php @@ -348,7 +348,7 @@ class Test extends Core if(isset($response['kami'])){ $cardno=$response['kami']['cardno']; $cardpwd=$response['kami']['cardpwd']; - $cash = $vo['cash']; + $cash = $order['cash']; $expire_time = $response['kami']['expired']; $group_id = '70059'; @@ -359,7 +359,7 @@ class Test extends Core if(isset($json['kami'])){ $cardno=$json['kami']['cardno']; $cardpwd=$json['kami']['cardpwd']; - $cash = $vo['cash']; + $cash = $order['cash']; $expire_time = $json['kami']['expired']; $group_id = '70059'; } diff --git a/app/setting/service/AccountLogService.php b/app/setting/service/AccountLogService.php index 4d15aad..30f8be3 100644 --- a/app/setting/service/AccountLogService.php +++ b/app/setting/service/AccountLogService.php @@ -43,10 +43,12 @@ use app\setting\service\MerchantAccountService; if (!$cid) { $cid = 10040; } + $channelService = ChannelService::instance(); $accountService = AccountService::instance(); $account_data = $channelService->call('account', $cid, $day); +// var_dump($account_data);die; if ($account_data) { $v['add'] = $account_data['add']; $v['dong'] = $account_data['dong']; diff --git a/app/task/controller/api/Core.php b/app/task/controller/Core.php similarity index 99% rename from app/task/controller/api/Core.php rename to app/task/controller/Core.php index 22d7183..f9f6d63 100644 --- a/app/task/controller/api/Core.php +++ b/app/task/controller/Core.php @@ -1,22 +1,21 @@ /dev/null 2>&1 &'; + $command = 'php /www/wwwroot/reapi/public/index.php task/task/runOne ' . $order . ' 1>/dev/null 2>&1 &'; exec($command); } @@ -101,7 +97,7 @@ class Task extends Core # 获取当前执行的子进程数量 public function getNum() { - $command = 'ps -ef | grep task/api.task/runOne | grep -v grep | wc -l'; + $command = 'ps -ef | grep task/task/runOne | grep -v grep | wc -l'; $num = exec($command); return $num; } @@ -137,23 +133,7 @@ class Task extends Core exit('ok'); } - # 直接对数据库中的订单数据进行处理 如果队列失效,就使用这个方法进行操作,谨慎使用该方法,会和队列同时执行,已取消 - /* - public function runAll() - { - $orderService = OrderService::instance(); - $data = $orderService->getData(); - if ($data) { - foreach ($data as $k => $v) { - if ($v['request']) { - $v['request'] = json_decode($v['request'], true); - $this->run($v['request']); - } - } - } - } - */ # 检测当前订单表里的status=1的订单,如果超过时间5分钟还有status=1,就直接执行,可以每5分钟执行一次,取代上述的runAll方法 public function runOther() @@ -167,12 +147,6 @@ class Task extends Core $this->run($v['request'], true); } } - /* - if ($state && $state > 0) { - //$this->restart(); - //$this->runAll(); - } - */ } @@ -231,35 +205,11 @@ class Task extends Core } } } - -// public function checkorederqd() -// { -// #= -// -// -// $orderService = OrderService::instance(); -// foreach ($data as $k1 => $v1) { -// $result = $orderService->getTimeOrder($v1['id'], false, false, $v1['order_limit']); -// -// if ($result) { -// foreach ($result as $k => $v) { -// if ($v['request']) { -// $v['request'] = json_decode($v['request'], true); -// if ($v['request']) { -// $v['request']['order'] .= '_nq'; -// $this->run($v['request'], true); -// } -// } -// } -// } -// } -// -// } # 对暂停的的订单重新下单 status = -5 - public function runStopOrder() + public function runStopOrderQueue() { $orderService = OrderService::instance(); - $result = $orderService->getStopOrder(); + $result = $orderService->getStopOrderQueue(); if ($result) { $data = $result; @@ -278,49 +228,6 @@ class Task extends Core } } } - #删除日志 - public function delLog() - { - #.extend/data/logs/gateway/2023/10/1/xxx.log - $currentTimes=strtotime(date("Y-m-d",time())); - $delTimes=strtotime('-4 months', $currentTimes); - - $mounth=date('m',$delTimes); - $year=date("Y",$delTimes); - #TODO 换服务器修改地址 - - $path='/www/wwwroot/reapi/extend/data/logs/gateway/'.$year.'/'.$mounth; - - - $result=$this->delete_directory($path); - - } - #删除目录文件夹 - public function delete_directory($dir) - { - #file_exists(): open_basedir restriction in effect. File(/www/wwroot/bao111/extend/data/logs/gateway/2023/09) is not within the allowed path(s): (/www/wwwroot/bao111/:/tmp/) - - - if(!file_exists($dir)){ - - return true; - } - if(!is_dir($dir)){ - - return unlink($dir); - } -// var_dump(1111);die; - #rm -rf /www/www/bao111/gateway/ - foreach(scandir($dir) as $item){ - if($item =="."||$item ==".."){ - continue; - } - if(!$this->delete_directory($dir .DIRECTORY_SEPARATOR.$item)){ - return false; - } - } - return rmdir($dir); - } # 对需要复冲下单的订单下单 status = -4 可以加入到计划任务中,每分钟执行一次 public function runFcOrder() @@ -351,8 +258,6 @@ class Task extends Core { $orderService = OrderService::instance(); $data = $orderService->getErrorData(); -// var_dump($data);die; - if ($data) { foreach ($data as $k => $v) { $this->callSend($v, 1); @@ -390,43 +295,6 @@ class Task extends Core sysconf('settingUpdate', 2); } - # 对完成订单进行处理,转移成历史订单,可以每天凌晨1点进行执行,默认迁移前一天的数据 - public function finish() - { - $day = input('day'); - MerchantService::instance()->init($day); - /* - if (!$day) { - $day = date('Y-m-d', strtotime('-1 day')); - } - */ - $page = 1; - while($this->finishOne($day, $page)) { - $page++; - } - } - - public function finishOne($day, $page) - { - $orderService = OrderService::instance(); - $orderHistoryService = OrderHistoryService::instance(); - $data = $orderService->getFinishData($day, $page); - - if ($data) { - foreach ($data as $k => $v) { - # 先插入一条历史数据 - $id = $v['id']; - unset($v['id']); - $state = $orderHistoryService->up($v); - if ($state) { - $orderService->del($id); - } - } - return true; - } else { - return false; - } - } @@ -475,7 +343,7 @@ class Task extends Core { $num = $this->getErrorNum(); if ($num < 1) { - $command = 'php /www/wwwroot/reapi/public/index.php task/api.task/runErrorOrder 1>/dev/null 2>&1 &'; + $command = 'php /www/wwwroot/reapi/public/index.php task/task/runErrorOrder 1>/dev/null 2>&1 &'; #修改地址 exec($command); @@ -487,7 +355,7 @@ class Task extends Core # 获取当前执行的错误的子进程数量 public function getErrorNum() { - $command = 'ps -ef | grep task/api.task/runErrorOrder | grep -v grep | wc -l'; + $command = 'ps -ef | grep task/task/runErrorOrder | grep -v grep | wc -l'; $num = exec($command); return $num; } @@ -512,18 +380,6 @@ class Task extends Core } } - /* - public function not() - { - $MerchantService = MerchantService::instance(); - $data['status'] = 3; - $data['cash'] = 100; - $data['order_id'] = 'Q202010284980886664664866'; - $data['merchant_order_id'] = '1603849810460200838'; - $data['notify_num'] = 1; - $MerchantService->up(5, $data); - } - */ # 对账统计 每天0点10分统计吧 public function account() @@ -557,6 +413,7 @@ class Task extends Core if (!$day) { $day = date('Y-m-d', strtotime('-1 day')); } +// var_dump($_SERVER["argv"]);die; if (isset($_SERVER["argv"][2]) && $_SERVER["argv"][2]) { $cid = $_SERVER["argv"][2]; } else { @@ -602,8 +459,4 @@ class Task extends Core } - - - - } \ No newline at end of file diff --git a/daemon_query.py b/daemon_query.py index 456584f..b5bd2fc 100644 --- a/daemon_query.py +++ b/daemon_query.py @@ -20,7 +20,7 @@ def popen(command, bg=False): # 定时执行进程 def process(): - command = 'php /www/wwwroot/reapi/public/index.php openapi/orderTask/cron 1>/dev/null 2>&1 &' + command = 'php /www/wwwroot/reapi/public/index.php task/api.orderTask/cron 1>/dev/null 2>&1 &' check = 'ps -ef | grep orderTask/orderTask/cron | grep -v grep | wc -l' i = 0 while 1: