采购配置相关

20230922-ljl-fixBug
wangchaoxu 1 year ago
parent 1ac5daa55e
commit dbe6eee946

@ -0,0 +1,75 @@
<?php
class DoudianMsgController extends ZcController {
/**
* @var DoudianMsgService
*/
private $doudianMsgService;
private $doudianMsgLog;
public function __construct($route) {
parent::__construct($route);
$this->doudianMsgService = Zc::singleton(DoudianMsgService::class);
$this->doudianMsgLog = Zc::getLog('open/doudian_msg/msg_body', ZcLog::INFO);
}
private function checkCurrentApp($requestAppId, $eventSign, $msgBody) {
if (CommonTool::anyEmpty($requestAppId, $eventSign, $msgBody)) {
return false;
}
if ($requestAppId != Zc::C('appKey')) {
return false;
}
$md5 = md5(Zc::C('appKey') . $msgBody . Zc::C('appSecret'));
if ($eventSign != $md5) {
return false;
}
return true;
}
private function responseFail() {
return $this->renderJSON([
'code' => 1,
'msg' => 'fail',
]);
}
private function responseSuccess() {
return $this->renderJSON([
'code' => 0,
'msg' => 'success',
]);
}
public function ReceiveMessagePush() {
$msgBody = file_get_contents('php://input');
$isCurrentApp = $this->checkCurrentApp($_SERVER['HTTP_APP_ID'], $_SERVER['HTTP_EVENT_SIGN'], $msgBody);
if (!$isCurrentApp) {
$this->doudianMsgService->addDoudianFailMsg($msgBody);
$this->recordFailLog($msgBody);
return $this->responseFail();
}
$addRet = $this->doudianMsgService->addDoudianMsg($msgBody);
if (!$addRet) {
$this->recordFailLog($msgBody);
$this->doudianMsgService->addDoudianFailMsg($msgBody);
return $this->responseFail();
}
return $this->responseSuccess();
}
private function recordFailLog($msgBody) {
$this->doudianMsgLog->info(sprintf('HTTP_APP_ID[%s] HTTP_EVENT_SIGN[%s] msgBody: %s', $_SERVER['HTTP_APP_ID'], $_SERVER['HTTP_EVENT_SIGN'], $msgBody));
}
public function testDebug() {
exit('hello word');
}
}

@ -843,6 +843,10 @@ public class PurchaseOrderServiceImpl implements PurchaseOrderService {
List<AppendVenderRemarkTplItemDTO> appendShopNoteTpl = purchaseSettingDTO.getAppendShopNoteTpl();
List<AppendVenderRemarkTplItemDTO> autoFillRemarkTpl = purchaseSettingDTO.getAutoFillRemarkTpl();
List<AppendVenderRemarkTplItemDTO> autoFillOrderMemoTpl = purchaseSettingDTO.getAutoFillOrderMemoTpl();
if (appendShopRemarkTpl == null) appendShopRemarkTpl = new ArrayList<>();
if (appendShopNoteTpl == null) appendShopNoteTpl = new ArrayList<>();
if (autoFillRemarkTpl == null) autoFillRemarkTpl = new ArrayList<>();
if (autoFillOrderMemoTpl == null) autoFillOrderMemoTpl = new ArrayList<>();
PurchaseSetting setting = new PurchaseSetting();
setting.setShopId(shopId);

Loading…
Cancel
Save