Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
services
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tencent
services
Commits
b1ba4950
Commit
b1ba4950
authored
Sep 25, 2018
by
feixiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
单元测试 分表处理
parent
8d64b653
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
4 deletions
+17
-4
src/Common/Entity/Split.php
+5
-3
src/Common/Entity/User.php
+11
-0
src/Common/Enum/TestEnum.php
+1
-1
No files found.
src/Common/Entity/Split.php
View file @
b1ba4950
...
...
@@ -10,6 +10,7 @@ namespace Hdll\Services\Common\Entity;
use
Hdll\Services\Common\Bean\Collector\SplitCollector
;
use
Hdll\Services\Common\Enum\TestEnum
;
use
Hdll\Services\Common\Exception\CommonException
;
use
Swoft\App
;
use
Swoft\Core\RequestContext
;
use
Swoft\Db\Bean\Collector\EntityCollector
;
use
Swoft\Db\QueryBuilder
;
...
...
@@ -71,9 +72,9 @@ class Split
private
function
isTesting
()
{
$data
=
RequestContext
::
getContextData
();
$
storeId
=
$data
[
'userInfo'
][
'storeId'
]
;
/**@var User $user**/
$
user
=
App
::
getBean
(
User
::
class
)
;
return
intval
(
$storeId
)
===
TestEnum
::
TEST_STORE_ID
;
return
$user
->
getTestFlag
(
)
===
TestEnum
::
TEST_STORE_ID
;
}
}
\ No newline at end of file
src/Common/Entity/User.php
View file @
b1ba4950
...
...
@@ -11,6 +11,7 @@
namespace
Hdll\Services\Common\Entity
;
use
Hdll\Services\Auth\Enum\AuthError
;
use
Hdll\Services\Common\Enum\TestEnum
;
use
Hdll\Services\Common\Lib\Redis
;
use
Swoft\Bean\Annotation\Bean
;
use
Swoft\Core\RequestContext
;
...
...
@@ -35,6 +36,16 @@ class User
return
$this
->
getValue
(
'id'
);
}
public
function
setTestFlag
()
{
$this
->
setValue
(
'testFlag'
,
TestEnum
::
TEST_STORE_ID
);
}
public
function
getTestFlag
()
{
return
$this
->
getValue
(
'testFlag'
);
}
public
function
getNickname
()
{
return
$this
->
getValue
(
'nickname'
);
...
...
src/Common/Enum/TestEnum.php
View file @
b1ba4950
...
...
@@ -9,7 +9,7 @@ namespace Hdll\Services\Common\Enum;
class
TestEnum
{
const
TEST_STORE_ID
=
-
3
;
const
TEST_STORE_ID
=
true
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment