新增商家物流取货码
This commit is contained in:
parent
db96e85925
commit
0acbd431d7
@ -1928,6 +1928,31 @@ class StoreOrderRepository extends BaseRepository
|
||||
return $urlCode;
|
||||
}
|
||||
|
||||
public function logisticsQrcode($orderId, $order_sn)
|
||||
{
|
||||
$siteUrl = systemConfig('site_url');
|
||||
$name = md5('logi' . $orderId . date('Ymd')) . '.jpg';
|
||||
$attachmentRepository = app()->make(AttachmentRepository::class);
|
||||
$imageInfo = $attachmentRepository->getWhere(['attachment_name' => $name]);
|
||||
|
||||
if (isset($imageInfo['attachment_src']) && strstr($imageInfo['attachment_src'], 'http') !== false && curl_file_exist($imageInfo['attachment_src']) === false) {
|
||||
$imageInfo->delete();
|
||||
$imageInfo = null;
|
||||
}
|
||||
if (!$imageInfo) {
|
||||
$imageInfo = app()->make(QrcodeService::class)->getQRCodePath($order_sn, $name);
|
||||
if (is_string($imageInfo)) throw new ValidateException('二维码生成失败');
|
||||
$imageInfo['dir'] = tidy_url($imageInfo['dir'], null, $siteUrl);
|
||||
$attachmentRepository->create(systemConfig('upload_type') ?: 1, -2, $orderId, [
|
||||
'attachment_category_id' => 99,
|
||||
'attachment_name' => $imageInfo['name'],
|
||||
'attachment_src' => $imageInfo['dir']
|
||||
]);
|
||||
$urlCode = $imageInfo['dir'];
|
||||
} else $urlCode = $imageInfo['attachment_src'];
|
||||
return $urlCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO 根据商品ID获取订单数
|
||||
* @param int $productId
|
||||
|
@ -282,6 +282,14 @@ class StoreOrder extends BaseController
|
||||
return app('json')->success(['qrcode' => $this->repository->wxQrcode($id, $order->verify_code)]);
|
||||
}
|
||||
|
||||
public function logisticsCode($id)
|
||||
{
|
||||
$order = $this->repository->getWhere(['order_id' => $id, 'uid' => $this->request->uid(), 'is_del' => 0]);
|
||||
if (!$order)
|
||||
return app('json')->fail('订单状态有误');
|
||||
return app('json')->success(['qrcode' => $this->repository->logisticsQrcode($id, $order->order_sn)]);
|
||||
}
|
||||
|
||||
public function del($id)
|
||||
{
|
||||
$this->repository->userDel($id, $this->request->uid());
|
||||
|
@ -139,6 +139,8 @@ class paySuccessOrder
|
||||
//发起物流信息
|
||||
$this->sendLogistics($this->event['order']['order_id'], $this->event['order']['order_sn']);
|
||||
|
||||
//生成商家给的物流取货二维码
|
||||
//生成用户的收货码、发生短信包含收货码
|
||||
}
|
||||
|
||||
//发送物流
|
||||
|
@ -89,6 +89,7 @@ Route::group('api/', function () {
|
||||
Route::post('del/:id', '/del');
|
||||
Route::get('status/:id', '/groupOrderStatus');
|
||||
Route::get('verify_code/:id', '/verifyCode');
|
||||
Route::get('logistics_code/:id', '/logisticsCode');
|
||||
Route::post('receipt/:id', '/createReceipt');
|
||||
Route::get('delivery/:id', '/getOrderDelivery');
|
||||
})->prefix('api.store.order.StoreOrder');
|
||||
|
Loading…
x
Reference in New Issue
Block a user