Commit a6c9882f by feixiang

分表对照组编写

parent a15bfbfa
...@@ -64,12 +64,25 @@ class Split ...@@ -64,12 +64,25 @@ class Split
$splitNum = $splitCollector[$className]['num']; $splitNum = $splitCollector[$className]['num'];
$data = RequestContext::getContextData(); $data = RequestContext::getContextData();
$dbId = $data['userInfo']['dbId'] ?? 0;
$storeId = $data['userInfo']['storeId']; $storeId = $data['userInfo']['storeId'];
if ( empty($storeId) ) { if ( empty($storeId) ) {
throw new CommonException(["msg" => "参数异常,获取店铺信息失败。"]); throw new CommonException(["msg" => "参数异常,获取店铺信息失败。"]);
} }
return $storeId % $splitNum;
//原始数据
$num = $storeId % $splitNum;
//对照数据
$dbNum = $dbId % $splitNum;
if ( $dbId > 0 && $num !== $dbNum ) {
App::debug('[分表异常][dbId与storeId分表不一致]'. json_encode($data['userInfo']));
}
return $num;
} }
private function isTesting() private function isTesting()
......
...@@ -24,6 +24,7 @@ use Swoft\Core\ResultInterface; ...@@ -24,6 +24,7 @@ use Swoft\Core\ResultInterface;
* @method ResultInterface deferGetOtherInfo(int $storeId, string $orderSn, array $consigneeFields = [], array $itemFields = []) * @method ResultInterface deferGetOtherInfo(int $storeId, string $orderSn, array $consigneeFields = [], array $itemFields = [])
* @method ResultInterface deferGetList(int $storeId,array $ids) * @method ResultInterface deferGetList(int $storeId,array $ids)
* @method ResultInterface deferUnconfirmedCount(int $storeId) * @method ResultInterface deferUnconfirmedCount(int $storeId)
* @method ResultInterface deferGetOrder(int $dbId, $orderSn)
*/ */
interface OrderInterface interface OrderInterface
{ {
...@@ -241,4 +242,6 @@ interface OrderInterface ...@@ -241,4 +242,6 @@ interface OrderInterface
*/ */
public function unconfirmedCount(int $storeId); public function unconfirmedCount(int $storeId);
public function getOrder(int $dbId, $orderSn);
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment