You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pdd-order-api/app/libs/controller/order/class.CustomPrintController...

283 lines
12 KiB
PHP

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<?php
use Service\CustomPrint\CustomPrintService;
use Service\CustomPrint\CustomReceiverService;
class CustomPrintController extends AbstractApiController {
private $customPrintService;
private $customReceiverService;
public function __construct($route) {
parent::__construct($route);
$this->customPrintService = CustomPrintService::instance();
$this->customReceiverService = CustomReceiverService::instance();
}
/**
* @api GET 自由打印订单列表
* @param string bizOrderNum 自由打印订单号
* @param string pin 买家昵称
* @param string fullname 收件人姓名
* @param string mobile 收件人手机号
* @param string skuName 商品标题
* @param string searchTimeType 时间查询类型:orderCreateTime(默认)orderPrintTime
* @param string orderStartTime 开始时间
* @param string orderEndTime 结束时间
* @param string venderRemark 商家备注
* @param string orderRemark 买家备注
* @param string provinceIds 省份ID逗号拼接
* @param string pExpressStatus 打印状态:express_printed,express_no_printed
* @param string pInvoiceStatus 打印状态:invoice_printed,invoice_no_printed
* @param string cpCode 物流
* @param string waybillCode 运单号
* @param int[] venderRemarkFlag 商家备注等级
* @param int hasOrderRemark 是否有买家备注(0/1)
* @param int hasVenderRemark 是否有商家备注(0/1)
* @param int hasVenderNote 是否有本地备注(0/1)
* @param int freeFreight 是否包邮(0/1)
* @param int isTown 是否村镇(0/1)
* @param string remarkKeyword 商家备注或买家备注
* @param int[] orderSource 订单来源(1 PC端订单 2 移动端订单 3 手Q订单 4 微信订单)
* @param string sortType 排序方式orderStartTimeDesc默认、orderStartTimeAsc、orderAmountDesc、orderAmountAsc、itemTotalDesc、itemTotalAsc
* @param int page 第几页
* @param int pageSize 每页条数
*/
public function searchCustomOrderList() {
$data = $this->customPrintService->searchCustomOrderList($_GET, CommonTool::getOperatorInfo());
return $this->renderSuccess($data);
}
/**
* @api POST 修改买家备注
* @param array customOrderId * 自由打印订单号
* @param string remark * 备注内容
*/
public function saveCustomOrderRemark() {
$data = $this->customPrintService->saveCustomBuyerMemo($this->mallId, $_POST['customOrderId'], $_POST['remark']);
return $this->renderSuccess($data);
}
/**
* @api POST 修改商家备注
* @param string customOrderId * 内部订单id
* @param string remark * 备注内容
*/
public function saveCustomVenderRemark() {
$data = $this->customPrintService->saveCustomSellerMemo($this->mallId, $_POST['customOrderId'], $_POST['remark']);
return $this->renderSuccess($data);
}
/**
* @api GET 查询快速插入
* @param string orderSns * 订单编号,多个逗号分隔
*/
public function getCustomOrderInfoByOrderSns() {
$data = $this->customPrintService->getCustomOrderInfoByOrderSns($_GET['orderSns'], CommonTool::getOperatorInfo());
return $this->renderSuccess($data);
}
/**
* @api POST 删除订单
* @param array customOrderIds * 自由打印订单ID
*/
public function deleteCustomOrders() {
$this->customPrintService->deleteCustomOrders($this->mallId, $_POST['customOrderIds']);
return $this->renderSuccess();
}
/**
* @api POST 自动生成订单号
*/
public function autoMakeCustomOrderBizOrderNum() {
$bizOrderNum = $this->customPrintService->autoMakeCustomOrderBizOrderNum();
CheckClient::checkEmpty($bizOrderNum, null, '获取失败');
return $this->renderSuccess(['bizOrderNum' => $bizOrderNum]);
}
/**
* @api POST 自动生成订单号
* @param array orderSns * 订单编号\
* @param array bizOrderNumType * 单号类型1系统生成2原订单号
*/
public function addCustomOrderByOrderSns() {
$this->customPrintService->addCustomOrderByOrderSns($_POST['orderSns'], $_POST['bizOrderNumType'], CommonTool::getOperatorInfo());
return $this->renderSuccess();
}
/**
* @api POST 保存自由打印订单
* @param object order * 订单信息
* @param string order.pin 昵称
* @param string order.consignee.fullname * 收件人姓名
* @param string order.consignee.mobile * 收件人电话
* @param string order.consignee.telephone * 收件人固话
* @param string order.consignee.province * 收件人省名称
* @param string order.consignee.provinceAreaId * 收件人省ID
* @param string order.consignee.city * 收件人市名称
* @param string order.consignee.cityAreaId * 收件人市ID
* @param string order.consignee.county * 收件人区名称
* @param string order.consignee.countyAreaId * 收件人区ID
* @param string order.consignee.town 街道名称
* @param string order.consignee.townAreaId 收件人街道ID
* @param string order.consignee.address * 收件人详细地址
* @param string order.consignee.fullAddress 收件人地址
* @param string order.bizOrderNum * 自定义单号
* @param string order.selfOrderNum 自定义单号
* @param string order.orderRemark 买家留言
* @param string order.venderRemark 卖家备注
* @param string order.venderRemarkFlag 旗帜
* @param string order.freightPrice 运费
* @param string order.orderTotalWeight 总重量
* @param string order.orderItemTotal 总商品数量
* @param string order.orderTotalPrice 订单价格orderPayment+sellerDiscount
* @param string order.sellerDiscount 总优惠金额
* @param string order.orderSellerPrice * 付款金额orderPayment-freightPrice
* @param string order.orderPayment * 订单付款金额:实付+运费\
* @param int order.senderAddressId 发货地址id
* @param string order.waybill 运单号
* @param array order.items 商品信息
* @param array order.items.skuName 标题
* @param array order.items.logo 图片地址
* @param array order.items.itemNum 货号
* @param array order.items.outerSkuId 商家skuId
* @param array order.items.skuSubName 规格
* @param array order.items.weight 重量
* @param array order.items.jdPrice * 单价
* @param array order.items.itemTotal * 数量
* @param array order.items.couponPrice 优惠
* @param array order.items.totalPrice 实付
* @param array order.items.skuId skuId
*/
public function saveCustomOrder() {
$data = $this->customPrintService->saveCustomOrder($this->mallId, $_POST['order']);
return $this->renderSuccess($data);
}
/**
* @api GET 收件人列表
* @param string page * 页码
* @param string pageSize * 页数
*/
public function searchCustomReceiverList() {
$data = $this->customReceiverService->searchCustomReceiverList($_GET, CommonTool::getOperatorInfo());
return $this->renderSuccess($data);
}
/**
* @api POST 保存收件人信息
* @param string customReceiverId 收件人信息id
* @param string fullname * 姓名
* @param string pin 昵称
* @param string mobile * 手机号
* @param string telephone * 固话
* @param string provinceId * 省id
* @param string cityId * 市id
* @param string countyId * 区id
* @param string address * 详细地址
*/
public function saveCustomReceiver() {
$this->customReceiverService->saveCustomReceiver($_POST, CommonTool::getOperatorInfo());
return $this->renderSuccess();
}
/**
* @api POST 删除收件人信息
* @param string[] customReceiverIds 收件人信息id
*/
public function delCustomReceiver() {
$this->customReceiverService->delCustomReceivers($_POST, CommonTool::getOperatorInfo());
return $this->renderSuccess();
}
/**
* @api POST 下载导入收件人信息模板
*/
public function downloadImportCustomReceiverTpl() {
$this->customReceiverService->downloadImportCustomReceiverTpl();
}
/**
* @api POST 导入发件人信息
* @param file importCustomReceiverTpl * 收件人模板
*/
public function importCustomReceiver() {
$file = CommonTool::uploadFileSafe('importCustomReceiverTpl');
$data = $this->customReceiverService->importCustomReceiver($file, CommonTool::getOperatorInfo());
return $this->renderSuccess($data);
}
/**
* @api GET 下载导入订单模板
* @param string type * 模板类型:1收件人省市区分开模板,2收件人省市区合并模板,3收件人信息合并模板收件人、手机、收件地址需用逗号分隔
*/
public function downloadImportCustomOrderTpl() {
$this->customPrintService->downloadImportCustomOrderTpl($_GET['type']);
}
/**
* @api POST 导入订单
* @param file importCustomOrderTpl * 模板文件
*/
public function importCustomOrderTpl() {
$file = CommonTool::uploadFileSafe('importCustomOrderTpl');
$data = $this->customPrintService->importCustomOrderTpl($file, $this->mallId);
return $this->renderSuccess($data);
}
/**
* @api POST 修改收件人地址
* @param int customOrderId * 自由打印订单ID
* @param string fullname * 收件人姓名
* @param string mobile * 收件人电话
* @param string telephone * 收件人固话
* @param string provinceAreaId * 收件人省ID
* @param string cityAreaId * 收件人市ID
* @param string countyAreaId * 收件人区ID
* @param string address * 收件人详细地址
*/
public function updateOrderReceiveAddress() {
$data = $this->customPrintService->updateOrderReceiveAddress($this->mallId, $_POST);
return $this->renderSuccess($data);
}
/**
* @api POST 更新收件人信息
* @param string customOrderId * 自由打印订单
* @param string fullname * 姓名
* @param string mobile * 手机号
* @param string telephone * 固话
* @param string provinceAreaId * 省id
* @param string cityAreaId * 市id
* @param string countyAreaId * 区id
* @param string address * 详细地址
*/
public function updateReceiveAddress() {
$this->customPrintService->updateReceiveAddress($_POST, CommonTool::getOperatorInfo());
return $this->renderSuccess();
}
/**
* @api POST 保存快递单历史
* @param string expressTplId * 模板id
* @param object printRet * 打印结果
* @param string printRet.result 打印状态fail/success
* @param string printRet.reason 打印失败原因
* @param string isPreview * 是否预览
* @param array tradeList * 订单列表
*/
public function savePrintExpressLog() {
$orderIdAndRetMap = $this->customPrintService->savePrintExpressLog($this->mallId, $_POST);
return $this->renderSuccess(['updateRet' => $orderIdAndRetMap]);
}
/**
* @api POST 保存发货单历史
* @param object printRet * 打印结果
* @param string isPreview * 是否预览
* @param array tradeList * 订单列表
*/
public function savePrintInvoiceLog() {
$data = $this->customPrintService->savePrintInvoiceLog($this->mallId, $_POST);
return $this->renderSuccess($data);
}
}