修改物流

This commit is contained in:
2023-05-19 16:39:08 +08:00
parent 593ca490ec
commit 029c6249fd
6 changed files with 111 additions and 25 deletions
+20 -5
View File
@@ -46,14 +46,14 @@ class ReportRegulatoryCommand extends HyperfCommand
{
$this->line("开始");
// 获取需执行总数
$order_prescription_count = $this->getOrderPrescriptionCount();
if ($order_prescription_count <= 0) {
// 获取未上传监管平台订单数量
$report_regulatory_count = $this->getNotReportRegulatoryCount();
if ($report_regulatory_count <= 0) {
$this->line("结束:无可执行订单");
return;
}
for ($i = 0; $i < $order_prescription_count; $i++) {
for ($i = 0; $i < $report_regulatory_count; $i++) {
// 获取待上报订单
$order_prescription = $this->getOrderPrescription($i);
if (empty($order_prescription)) {
@@ -218,6 +218,21 @@ class ReportRegulatoryCommand extends HyperfCommand
return OrderPrescription::getStatusCount($params, $prescription_status_params);
}
/**
* 获取符合条件的订单
*/
private function getNotReportRegulatory(int $offset = 0,int $limit = 10)
{
$params = array();
$params[] = ['report_inquiry_int','<',4];
$params[] = ['report_prescription_int','<',4];
$or_params = array();
$or_params['report_inquiry_status'] = 0;
$or_params['report_prescription_status'] = 0;
return ReportRegulatory::getOrStatusLimit($params,$or_params,['*'],$offset,$limit);
}
/**
* 获取符合条件的处方订单
* @param int $offset 起始位置
@@ -255,7 +270,7 @@ class ReportRegulatoryCommand extends HyperfCommand
$redis_key = "ReportRegulatoryInquiry" . $order_prescription_id;
$redis_value = $redis->get($redis_key);
if (empty($redis_value)) {
$redis->set($redis_key, 1, 60 * 60 * 24 * 5);
$redis->set($redis_key, 1, 60 * 60 * 24 * 6);
return true;
}
@@ -125,6 +125,7 @@ class getPrescriptionOrderStatusCommand extends HyperfCommand
// 获取对应快递公司编码
$logistics_company_code = $this->getLogisticsCompanyCode($result['logisticsCompany']);
if (empty($logistics_company_code)){
Db::rollBack();
$this->line("处方平台已发货,快递公司编码识别失败!");
continue;
}
@@ -135,7 +136,7 @@ class getPrescriptionOrderStatusCommand extends HyperfCommand
// 检测物流编号是否已经存在并订阅
if (empty($item['logistics_no']) || $item['logistics_no'] != $result['deliveryId']){
$this->line("开始推送消息");
$this->line("开始订阅快递推送");
// 订阅快递推送
$Kuaidi = new Kuaidi();