Commit ae2eaf20 by feixiang

获取表明支持任意分表数量

parent db9686dc
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
*/ */
namespace Hdll\Services\Common\Entity; namespace Hdll\Services\Common\Entity;
use Hdll\Services\Common\Bean\Collector\SplitCollector;
use Swoft\App; use Swoft\App;
use Swoft\Core\RequestContext; use Swoft\Core\RequestContext;
use Swoft\Db\Bean\Collector\EntityCollector; use Swoft\Db\Bean\Collector\EntityCollector;
...@@ -78,7 +79,7 @@ class CommonEntity extends Model ...@@ -78,7 +79,7 @@ class CommonEntity extends Model
/** /**
* 获取分库表名 * 获取分库表名
* *
* @return string|void * @return string
* @throws Exception * @throws Exception
* @throws \ReflectionException * @throws \ReflectionException
*/ */
...@@ -89,8 +90,6 @@ class CommonEntity extends Model ...@@ -89,8 +90,6 @@ class CommonEntity extends Model
return; return;
} }
$request = RequestContext::getRequest();
//获取注解里的table //获取注解里的table
$res = new \ReflectionClass(static::class); $res = new \ReflectionClass(static::class);
$commentString = $res->getDocComment(); $commentString = $res->getDocComment();
...@@ -127,7 +126,10 @@ class CommonEntity extends Model ...@@ -127,7 +126,10 @@ class CommonEntity extends Model
throw new Exception("店铺id获取失败"); throw new Exception("店铺id获取失败");
} }
return $store % 100; $splitCollector = SplitCollector::getCollector();
$splitNum = $splitCollector[static::class]['num'];
return $store % $splitNum;
} }
......
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