新增快递100回调
This commit is contained in:
@@ -11,6 +11,7 @@ use App\Services\MessagePush;
|
||||
use App\Services\OrderPrescriptionService;
|
||||
use App\Services\OrderProductService;
|
||||
use App\Utils\Log;
|
||||
use Extend\Kuaidi100\Kuaidi;
|
||||
use Extend\Prescription\Prescription;
|
||||
use Hyperf\Command\Command as HyperfCommand;
|
||||
use Hyperf\Command\Annotation\Command;
|
||||
@@ -135,8 +136,17 @@ class getPrescriptionOrderStatusCommand extends HyperfCommand
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($result['deliveryTime'])){
|
||||
$result['deliveryTime'] = date('Y-m-d H:i:s',time());
|
||||
}
|
||||
|
||||
// 订阅快递推送
|
||||
$Kuaidi = new Kuaidi();
|
||||
$Kuaidi->subscribe($result['deliveryId'],$logistics_company_code,$item['consignee_tel']);
|
||||
|
||||
// 修改成功时药品订单数据
|
||||
$this->savePreSuccessOrderStatus($item,$result['deliveryId'],$logistics_company_code);
|
||||
$this->savePreSuccessOrderStatus($item,$result['deliveryId'],$logistics_company_code,$result['deliveryTime']);
|
||||
|
||||
}
|
||||
|
||||
$this->line("获取处方平台订单数据结束:处理完毕");
|
||||
@@ -191,6 +201,7 @@ class getPrescriptionOrderStatusCommand extends HyperfCommand
|
||||
'order_prescription_id',
|
||||
'patient_id',
|
||||
'order_product_status',
|
||||
'consignee_tel',
|
||||
];
|
||||
|
||||
$order_product = OrderProduct::getStatusList($params,$order_product_status,$fields);
|
||||
@@ -282,8 +293,9 @@ class getPrescriptionOrderStatusCommand extends HyperfCommand
|
||||
* @param array|object $order_product
|
||||
* @param string $logistics_no // 物流编号
|
||||
* @param string $logistics_company_code // 快递公司编码
|
||||
* @param string $delivery_time
|
||||
*/
|
||||
protected function savePreSuccessOrderStatus(array|object $order_product,string $logistics_no,string $logistics_company_code)
|
||||
protected function savePreSuccessOrderStatus(array|object $order_product,string $logistics_no,string $logistics_company_code,string $delivery_time = "")
|
||||
{
|
||||
$params = array();
|
||||
$params['order_product_id'] = $order_product['order_product_id'];
|
||||
@@ -291,7 +303,8 @@ class getPrescriptionOrderStatusCommand extends HyperfCommand
|
||||
$data['order_product_status'] = 3; // 订单状态(1:待支付 2:待发货 3:已发货 4:已签收 5:已取消)
|
||||
$data['logistics_no'] = $logistics_no; // 物流编号
|
||||
$data['logistics_company_code'] = $logistics_company_code; // 快递公司编码
|
||||
$data['delivery_time'] = date('Y-m-d H:i:s',time()); // 发货时间
|
||||
$data['sub_logistics_status'] = 1; // 快递推送订阅状态(0:未订阅/无需订阅 1:已订阅 2:订阅失败)
|
||||
$data['delivery_time'] = $delivery_time ?: date('Y-m-d H:i:s',time()); // 发货时间
|
||||
OrderProduct::edit($params,$data);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user