Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
newShopBack
Project
Project
Details
Activity
Releases
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
newshop
newShopBack
Commits
4bb9368f
Commit
4bb9368f
authored
Nov 18, 2019
by
张晓林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
证照管理
parent
a45aee4b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
179 additions
and
0 deletions
+179
-0
urlmanager.php
backend/config/urlmanager.php
+3
-0
BranchLicenceController.php
backend/controllers/v1/branch/BranchLicenceController.php
+150
-0
BranchLicence.php
backend/models/v1/branch/BranchLicence.php
+26
-0
No files found.
backend/config/urlmanager.php
View file @
4bb9368f
...
@@ -21,6 +21,7 @@ return [
...
@@ -21,6 +21,7 @@ return [
'v1/branch/branch-service-type'
,
'v1/branch/branch-service-type'
,
'v1/branch/shop-city-distribution-setting'
,
'v1/branch/shop-city-distribution-setting'
,
'v1/shopuser/shop-user-list'
,
'v1/shopuser/shop-user-list'
,
'v1/branch/branch-licence'
,
],
],
'extraPatterns'
=>
[
'extraPatterns'
=>
[
'GET,OPTIONS test'
=>
'test'
,
'GET,OPTIONS test'
=>
'test'
,
...
@@ -49,6 +50,8 @@ return [
...
@@ -49,6 +50,8 @@ return [
'GET,OPTIONS user-detail'
=>
'user-detail'
,
'GET,OPTIONS user-detail'
=>
'user-detail'
,
'GET,OPTIONS user-update'
=>
'user-update'
,
'GET,OPTIONS user-update'
=>
'user-update'
,
'GET,OPTIONS user-delete'
=>
'user-delete'
,
'GET,OPTIONS user-delete'
=>
'user-delete'
,
'GET,OPTIONS licence-list'
=>
'licence-list'
,
'GET,OPTIONS licence-detail'
=>
'licence-detail'
,
],
],
],
],
'GET swaggers/swagger/<id>'
=>
'swagger/swagger'
,
'GET swaggers/swagger/<id>'
=>
'swagger/swagger'
,
...
...
backend/controllers/v1/branch/BranchLicenceController.php
0 → 100644
View file @
4bb9368f
<?php
namespace
backend\controllers\v1\branch
;
use
Yii
;
use
yii\data\ArrayDataProvider
;
use
backend\models\v1\branch\BranchLicence
;
use
backend\controllers\v1\BaseController
;
class
BranchLicenceController
extends
BaseController
{
public
$modelClass
=
'backend\models\v1\branch\BranchLicence'
;
/**
* @OA\GET(
* path="/backend/web/v1/branch/branch-licences/licence-list",
* tags={"门店&DC"},
* summary="证照管理(张晓林)",
* description="证照管理列表",
* @OA\Parameter(name="BRANCHCODE", description="门店编号",in="query",@OA\Schema(type="string")),
* @OA\Parameter(name="ISFROM", description="证照来源",in="query",@OA\Schema(type="string")),
* @OA\Parameter(name="LICENCEEXPIRYDATE", description="到期时间",in="query",@OA\Schema(type="string")),
* @OA\Parameter(name="UPDATETIME", description="更新时间",in="query",@OA\Schema(type="string")),
* @OA\Response(response="200",description="
* GUID:证照GUID,
* BRANCH_CODE:门店编码,
* NAME:门店名称,
* LICENCE_NAME:证照名称,
* IS_FROM:来源,
* IS_SHOW:是否显示,
* LICENCE_EXPIRY_DATE:到期时间,
* UPDATE_TIME:更新时间,
* color:列表颜色,
*
* "),
* security={{"Authorization": {}}}
* )
*/
//证照列表
public
function
actionLicenceList
(){
$param
=
Yii
::
$app
->
request
->
get
();
$model
=
new
BranchLicence
();
$model
->
scenario
=
'licenceList'
;
$query
=
$model
::
find
();
$query
->
select
([
'sbl.GUID'
,
'sbl.BRANCH_CODE'
,
'sbl.LICENCE_NAME'
,
'sbl.IS_FROM'
,
'sbl.IS_SHOW'
,
'sbl.UPDATE_TIME'
,
'sbl.LICENCE_EXPIRY_DATE'
,
'sb.NAME'
]);
$query
->
from
(
'shop_branch_licence sbl'
)
->
leftJoin
(
'shop_branch as sb'
,
'sb.CODE=sbl.BRANCH_CODE'
);
$query
->
orderBy
([
'sbl.LICENCE_EXPIRY_DATE'
=>
SORT_ASC
]);
if
(
isset
(
$param
[
'BRANCHCODE'
])
&&
!
empty
(
$param
[
'BRANCHCODE'
])){
$query
->
andWhere
([
'='
,
'sbl.BRANCH_CODE'
,
$param
[
'BRANCHCODE'
]]);
}
if
(
isset
(
$param
[
'ISFROM'
])
&&
$param
[
'ISFROM'
]
!=
''
){
$query
->
andWhere
([
'='
,
'sbl.IS_FROM'
,
$param
[
'ISFROM'
]]);
}
if
(
isset
(
$param
[
'LICENCEEXPIRYDATE'
])
&&
$param
[
'LICENCEEXPIRYDATE'
]
==
0
){
$query
->
andWhere
([
'<='
,
"datediff(date_format(sbl.LICENCE_EXPIRY_DATE, '%Y-%m-%d' ),date_format( now(), '%Y-%m-%d' ))"
,
'0'
]);
}
if
(
isset
(
$param
[
'LICENCEEXPIRYDATE'
])
&&
!
empty
(
$param
[
'LICENCEEXPIRYDATE'
])
&&
$param
[
'LICENCEEXPIRYDATE'
]
==
1
){
$query
->
andWhere
([
'and'
,
"datediff(date_format(sbl.LICENCE_EXPIRY_DATE, '%Y-%m-%d' ),date_format( now(), '%Y-%m-%d' )) > 0"
,
"datediff(date_format(sbl.LICENCE_EXPIRY_DATE, '%Y-%m-%d' ),date_format( now(), '%Y-%m-%d' )) <= 30"
]);
}
if
(
isset
(
$param
[
'UPDATETIME'
])
&&
!
empty
(
$param
[
'UPDATETIME'
])
&&
$param
[
'LICENCEEXPIRYDATE'
]
==
1
){
$query
->
andWhere
([
'='
,
'sbl.UPDATE_TIME'
,
$param
[
'UPDATETIME'
]]);
}
$list
=
$query
->
asArray
()
->
all
();
foreach
(
$list
as
$listKey
=>
$listValue
){
//判断证照的到期时间
$startdate
=
time
();
$enddate
=
strtotime
(
$listValue
[
'LICENCE_EXPIRY_DATE'
]);
$days
=
round
((
$enddate
-
$startdate
)
/
3600
/
24
)
;
if
(
empty
(
$listValue
[
'LICENCE_EXPIRY_DATE'
])){
$list
[
$listKey
][
'color'
]
=
'blue'
;
}
elseif
(
$days
>
0
&&
$days
<=
30
){
$list
[
$listKey
][
'color'
]
=
'yellow'
;
}
elseif
(
$days
<=
0
){
$list
[
$listKey
][
'color'
]
=
'red'
;
}
else
{
$list
[
$listKey
][
'color'
]
=
''
;
}
//判断是否显示
if
(
isset
(
$listValue
[
'IS_SHOW'
])
&&
$listValue
[
'IS_SHOW'
]
==
1
){
$list
[
$listKey
][
'IS_SHOW'
]
=
'前台显示'
;
}
elseif
(
isset
(
$listValue
[
'IS_SHOW'
])
&&
$listValue
[
'IS_SHOW'
]
==
0
){
$list
[
$listKey
][
'IS_SHOW'
]
=
'前台不显示'
;
}
//证照来源
if
(
isset
(
$listValue
[
'IS_FROM'
])
&&
$listValue
[
'IS_FROM'
]
==
1
){
$list
[
$listKey
][
'IS_FROM'
]
=
'商城'
;
}
elseif
(
isset
(
$listValue
[
'IS_FROM'
])
&&
$listValue
[
'IS_FROM'
]
==
0
){
$list
[
$listKey
][
'IS_FROM'
]
=
'OA系统'
;
}
}
return
new
ArrayDataProvider
([
'allModels'
=>
$list
,
'pagination'
=>
[
'pageSize'
=>
15
,
]
]);
}
/**
* @OA\GET(
* path="/backend/web/v1/branch/branch-licences/licence-detail",
* tags={"门店&DC"},
* summary="证照管理(张晓林)",
* description="证照详情页",
* @OA\Parameter(name="GUID", description="证照GUID",in="query",@OA\Schema(type="string")),
* @OA\Response(response="200",description="
* CODE:状态
* GUID:证照GUID,
* BRANCH_CODE:门店编码,
* NAME:门店名称,
* LICENCE_NAME:证照名称,
* IS_FROM:来源, 0 OA系统 1 商城
* IS_SHOW:是否显示, 0 不显示
* LICENCE_EXPIRY_DATE:到期时间,
* LICENCE_CONTENT:证照文本说明,
* LICENCE_IMG_URL:证照图片
*
* "),
* security={{"Authorization": {}}}
* )
*/
public
function
actionLicenceDetail
(){
$param
=
Yii
::
$app
->
request
->
get
();
$model
=
new
BranchLicence
;
$model
->
GUID
=
$param
[
'GUID'
];
$model
->
scenario
=
'licenceDetail'
;
if
(
$model
->
validate
()){
$query
=
$model
::
find
();
$query
->
select
([
'sbl.GUID'
,
'sbl.LICENCE_EXPIRY_DATE'
,
'sbl.LICENCE_IMG_URL'
,
'sbl.LICENCE_CONTENT'
,
'sbl.BRANCH_CODE'
,
'sbl.LICENCE_NAME'
,
'sbl.IS_FROM'
,
'sbl.IS_SHOW'
,
'sb.NAME'
]);
$query
->
from
(
'shop_branch_licence sbl'
)
->
leftJoin
(
'shop_branch as sb'
,
'sb.CODE=sbl.BRANCH_CODE'
);
$query
->
where
([
'='
,
'sbl.GUID'
,
$param
[
'GUID'
]]);
return
[
'data'
=>
$query
->
asArray
()
->
all
(),
'CODE'
=>
200
];
}
else
{
return
[
'CODE'
=>
'200'
,
'data'
=>
$model
->
errors
];
}
}
}
\ No newline at end of file
backend/models/v1/branch/BranchLicence.php
0 → 100644
View file @
4bb9368f
<?php
namespace
backend\models\v1\branch
;
use
yii\db\ActiveRecord
;
class
BranchLicence
extends
ActiveRecord
{
public
static
function
tableName
()
{
return
'shop_branch_licence'
;
}
public
function
rules
()
{
return
[
[
'GUID'
,
'required'
,
'on'
=>
'licenceDetail'
,
'message'
=>
'缺少参数GUID'
]
];
}
public
function
attributeLabels
()
{
return
[
'GUID'
=>
'门店GUID'
];
}
}
\ No newline at end of file
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