mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-30 06:20:50 +00:00
fix: 修改拆单返货bug 添加默认快递公司,打开小程序服务检测接口
This commit is contained in:
parent
8f95aaa79c
commit
c63a31067d
@ -980,6 +980,6 @@ class StoreOrderDao extends BaseDao
|
||||
|
||||
public function getSubOrderNotSend(int $pid, int $order_id)
|
||||
{
|
||||
return $this->getModel()->where('id', $pid)->where('status', '0')->where('id', '<>', $order_id)->count();
|
||||
return $this->getModel()->where('pid', $pid)->where('status', '0')->where('id', '<>', $order_id)->count();
|
||||
}
|
||||
}
|
||||
|
||||
@ -24,12 +24,16 @@ class OrderShippingListener implements ListenerInterface
|
||||
$delivery_mode = 1;
|
||||
$is_all_delivered = true;
|
||||
if ($order['pid'] > 0) {
|
||||
$order = '';
|
||||
$delivery_mode = 2;
|
||||
// 判断订单是否全部发货
|
||||
/** @var StoreOrderServices $orderServices */
|
||||
$orderServices = app()->make(StoreOrderServices::class);
|
||||
$is_all_delivered = $orderServices->checkSubOrderNotSend((int)$order['pid'], (int)$order['id']);
|
||||
$p_order = $orderServices->get((int)$order['pid']);
|
||||
if (!$p_order) {
|
||||
throw new AdminException('拆单异常');
|
||||
}
|
||||
$out_trade_no = $p_order['order_id'];
|
||||
}
|
||||
|
||||
// 整理商品信息
|
||||
|
||||
@ -2498,7 +2498,7 @@ HTML;
|
||||
}
|
||||
// 判断是否开启小程序订单管理
|
||||
$orderData['order_shipping_open'] = false;
|
||||
if (sys_config('order_shipping_open', 0) && MiniOrderService::isManaged()) {
|
||||
if (sys_config('order_shipping_open', 0) && MiniOrderService::isManaged() && $order['channel_type'] == 'routine') {
|
||||
$orderData['order_shipping_open'] = true;
|
||||
}
|
||||
return $orderData;
|
||||
@ -2654,15 +2654,15 @@ HTML;
|
||||
|
||||
/**
|
||||
* 取消商家寄件
|
||||
* @author 等风来
|
||||
* @email 136327134@qq.com
|
||||
* @date 2023/5/15
|
||||
* @param int $id
|
||||
* @param string $msg
|
||||
* @return array|mixed
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 等风来
|
||||
* @email 136327134@qq.com
|
||||
* @date 2023/5/15
|
||||
*/
|
||||
public function shipmentCancelOrder(int $id, string $msg)
|
||||
{
|
||||
|
||||
@ -111,9 +111,8 @@ class MiniOrderService
|
||||
* 判断是否开通
|
||||
* @return bool
|
||||
* @throws HttpException
|
||||
* @throws \Psr\SimpleCache\InvalidArgumentException
|
||||
*
|
||||
* @date 2023/05/09
|
||||
* @date 2023/05/17
|
||||
* @author yyw
|
||||
*/
|
||||
public static function isManaged()
|
||||
|
||||
@ -13,6 +13,8 @@ class OrderClient extends BaseOrder
|
||||
{
|
||||
const redis_prefix = 'mimi_order';
|
||||
|
||||
const express_company = 'ZTO'; // 默认发货快递公司为(中通快递)
|
||||
|
||||
|
||||
/**
|
||||
* @var \Redis
|
||||
@ -70,13 +72,9 @@ class OrderClient extends BaseOrder
|
||||
*/
|
||||
public function shippingByTradeNo(string $out_trade_no, int $logistics_type, array $shipping_list, string $payer_openid, int $delivery_mode = 1, bool $is_all_delivered = true)
|
||||
{
|
||||
// $this->setMesJumpPath('demo');
|
||||
|
||||
// if (!$this->checkManaged()) {
|
||||
// throw new AdminException('开通小程序订单管理服务后重试');
|
||||
// }
|
||||
|
||||
|
||||
if (!$this->checkManaged()) {
|
||||
throw new AdminException('开通小程序订单管理服务后重试');
|
||||
}
|
||||
$params = [
|
||||
'order_key' => [
|
||||
'order_number_type' => 1,
|
||||
@ -264,14 +262,15 @@ class OrderClient extends BaseOrder
|
||||
if (!$this->getRedis()->exists($key)) {
|
||||
$date = $this->setDeliveryList();
|
||||
if (!isset($date[$company_name])) {
|
||||
throw new AdminException('物流公司异常1');
|
||||
// throw new AdminException('物流公司异常1');
|
||||
}
|
||||
$express_company = $date[$company_name];
|
||||
} else {
|
||||
$express_company = $this->getRedis()->hMGet($key, [$company_name])[$company_name] ?? '';
|
||||
}
|
||||
if (empty($express_company)) {
|
||||
throw new AdminException('物流公司异常2');
|
||||
// throw new AdminException('物流公司异常2');
|
||||
$express_company = self::express_company;
|
||||
}
|
||||
|
||||
return $express_company;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user