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
364819ef
Commit
364819ef
authored
Nov 22, 2019
by
张晓林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
证照添加接口
parent
b094c9dc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
3 deletions
+58
-3
urlmanager.php
backend/config/urlmanager.php
+1
-0
BranchLicenceController.php
backend/controllers/v1/branch/BranchLicenceController.php
+44
-1
BranchLicence.php
backend/models/v1/branch/BranchLicence.php
+13
-2
No files found.
backend/config/urlmanager.php
View file @
364819ef
...
...
@@ -159,6 +159,7 @@ return [
'extraPatterns'
=>
[
'GET,OPTIONS licence-list'
=>
'licence-list'
,
'GET,OPTIONS licence-detail'
=>
'licence-detail'
,
'POST,OPTIONS licence-insert'
=>
'licence-insert'
,
],
],
//省市区
...
...
backend/controllers/v1/branch/BranchLicenceController.php
View file @
364819ef
...
...
@@ -5,12 +5,55 @@ use Yii;
use
yii\data\ArrayDataProvider
;
use
backend\models\v1\branch\BranchLicence
;
use
backend\controllers\v1\BaseController
;
use
backend\helpers\Func
;
class
BranchLicenceController
extends
BaseController
{
public
$modelClass
=
'backend\models\v1\branch\BranchLicence'
;
/**
* @OA\POST(
* path="/backend/web/v1/branch/branch-licences/licence-insert",
* tags={"门店&DC"},
* summary="证照添加(张晓林)",
* description="证照添加",
* * @OA\RequestBody(
* required=true,
* @OA\MediaType(
* mediaType="application/x-www-form-urlencoded",
* @OA\Schema(
* type="object",
* @OA\Property(property="LICENCE_NAME",description="证照名称",type="string"),
* @OA\Property(property="LICENCE_CODE",description="证照编码",type="string"),
* @OA\Property(property="BRANCH_CODE",description="门店编码",type="string"),
* @OA\Property(property="IS_FROM",description="来源",type="string"),
* @OA\Property(property="LICENCE_EXPIRY_DATE",description="到期时间",type="string"),
* @OA\Property(property="IS_SHOW",description="是否显示在前台",type="string"),
* @OA\Property(property="LICENCE_CONTENT",description="证照说明",type="string"),
* )
* )
* ),
* @OA\Response(response=200,description="success"),
* security={{"Authorization": {}}}
* )
*/
public
function
actionLicenceInsert
(){
$param
=
Yii
::
$app
->
request
->
post
();
$model
=
new
BranchLicence
();
$model
->
scenario
=
'licenceInsert'
;
$model
[
'GUID'
]
=
Func
::
create_guid
();
$model
->
UPDATE_TIME
=
date
(
'Y-m-d H:i:s'
,
time
());
$model
->
attributes
=
$param
;
if
(
$model
->
save
()){
return
[
'CODE'
=>
200
,
'MESSAGE'
=>
'添加成功'
];
}
else
{
return
$model
->
errors
;
}
}
/**
* @OA\GET(
...
...
backend/models/v1/branch/BranchLicence.php
View file @
364819ef
...
...
@@ -13,14 +13,25 @@ class BranchLicence extends ActiveRecord{
public
function
rules
()
{
return
[
[
'GUID'
,
'required'
,
'on'
=>
'licenceDetail'
,
'message'
=>
'缺少参数GUID'
]
[
'GUID'
,
'required'
,
'on'
=>
[
'licenceDetail'
,
'licenceInsert'
],
'message'
=>
'缺少参数GUID'
],
[
'GUID'
,
'unique'
,
'on'
=>
[
'licenceDetail'
,
'licenceInsert'
],
'message'
=>
'GUID不能重复'
],
[[
'LICENCE_CODE'
,
'LICENCE_NAME'
,
'LICENCE_EXPIRY_DATE'
,
'BRANCH_CODE'
,
'LICENCE_CONTENT'
,
'LICENCE_IMG_URL'
],
'trim'
,
'on'
=>
'licenceInsert'
],
[[
'GUID'
,
'LICENCE_CODE'
,
'LICENCE_NAME'
,
'LICENCE_EXPIRY_DATE'
,
'BRANCH_CODE'
],
'required'
,
'on'
=>
'licenceInsert'
,
'message'
=>
'缺少参数'
],
[[
'LICENCE_CONTENT'
,
'LICENCE_IMG_URL'
,
'LICENCE_GRADE'
],
'default'
,
'value'
=>
''
,
'on'
=>
'licenceInsert'
],
[[
'LICENCE_CODE'
,
'LICENCE_NAME'
],
'string'
,
'max'
=>
20
,
'on'
=>
'licenceInsert'
],
[[
'IS_FROM'
,
'IS_SHOW'
],
'default'
,
'value'
=>
1
],
[[
'LICENCE_EXPIRY_DATE'
],
'datetime'
,
'format'
=>
'Y-m-d'
,
'on'
=>
'licenceInsert'
],
];
}
public
function
attributeLabels
()
{
return
[
'GUID'
=>
'门店GUID'
'GUID'
=>
'GUID'
,
'LICENCE_NAME'
=>
'证照名称'
,
'LICENCE_CODE'
=>
'证照编码'
,
'BRANCH_CODE'
=>
'门店编码'
,
'LICENCE_EXPIRY_DATE'
=>
'到期时间'
];
}
}
\ 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