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.
honor-dd-light-ds-java/doc/move/dao/class.DyCloudPushDao.php

62 lines
2.4 KiB
PHTML

<?php
class DyCloudPushDao {
private $db;
public function __construct() {
$this->db = Zc::getDb();
}
public function getShopDyCloudPushInfo($shopId) {
list($realDbId, $pushInfoTbl) = DbRoute::getDbAndTbl(TblConst::shop_dy_cloud_push_info);
return $this->db->useDbIdOnce($realDbId)->queryFirstRow('select * from %b where shop_id = %i', $pushInfoTbl, $shopId);
}
public function getShopIdAndDyCloudPushInfoMap($shopIds) {
if (!$shopIds) {
return [];
}
list($realDbId, $shopPushInfoTbl) = DbRoute::getDbAndTbl(TblConst::shop_dy_cloud_push_info);
$rows = $this->db->useDbIdOnce($realDbId)->query('select * from %b where shop_id in %li', $shopPushInfoTbl, $shopIds);
return ZcArrayHelper::changeKeyRow($rows, 'shop_id');
}
public function addShopDyCloudPushSubscribeQueue($shopId, $isMultiShop) {
if (empty($shopId)) {
return false;
}
list($realDbId, $subscribeQueueTbl) = DbRoute::getDbAndTbl(TblConst::shop_dy_cloud_push_subscribe_queue);
$queueDo = [
'shop_id' => $shopId,
'is_multi_shop' => $isMultiShop ? 1 : 0,
'locked' => 0,
'gmt_create' => ZcDbEval::now(),
'gmt_modified' => ZcDbEval::now(),
];
$this->db->useDbIdOnce($realDbId)->insert($subscribeQueueTbl, $queueDo);
}
public function getDyCloudOrderPushDataByOrderId($orderId) {
$orderId = CommonTool::filterDdOrderIdSuffix($orderId);
list($realDbId, $ddpDoudianOrderTbl) = DbRoute::getDbAndTbl(TblConst::ddp_doudian_order);
return $this->db->useDbIdOnce($realDbId)->queryFirstRow('select * from %b where order_id = %s', $ddpDoudianOrderTbl, $orderId);
}
public function getDyCloudAfterSalePushDataByAfterSaleId($afterSaleId) {
list($realDbId, $ddpDoudianAfterSaleTbl) = DbRoute::getDbAndTbl(TblConst::ddp_doudian_after_sale);
return $this->db->useDbIdOnce($realDbId)->queryFirstRow('select * from %b where after_sale_id = %i', $ddpDoudianAfterSaleTbl, $afterSaleId);
}
public function getDyCloudOrderByOrderId($orderId) {
$pushData = $this->getDyCloudOrderPushDataByOrderId($orderId);
$ddpResponse = $pushData ? json_decode($pushData['ddp_response'], true) : null;
return $ddpResponse ? $ddpResponse['shop_order_detail'] : null;
}
public function getDyCloudAfterSaleByAfterSaleId($afterSaleId) {
$pushData = $this->getDyCloudAfterSalePushDataByAfterSaleId($afterSaleId);
return $pushData ? json_decode($pushData['ddp_response'], true) : null;
}
}