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
0f466f9b
Commit
0f466f9b
authored
Dec 05, 2019
by
姚书霞
🐘
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DC仓编辑
parent
982577b0
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
137 additions
and
7 deletions
+137
-7
urlmanager.php
backend/config/urlmanager.php
+2
-0
BranchController.php
backend/controllers/v1/branch/BranchController.php
+96
-0
CompanyController.php
backend/controllers/v1/transport/CompanyController.php
+20
-4
ShopBranch.php
backend/models/v1/branch/ShopBranch.php
+17
-1
ShopTransportCompany.php
backend/models/v1/transport/ShopTransportCompany.php
+2
-2
No files found.
backend/config/urlmanager.php
View file @
0f466f9b
...
...
@@ -49,6 +49,8 @@ return [
'GET,OPTIONS export-branch'
=>
'export-branch'
,
'GET,OPTIONS dc-branch-list'
=>
'dc-branch-list'
,
'GET,OPTIONS dc-branch-export'
=>
'dc-branch-export'
,
'GET,OPTIONS dc-branch-detail'
=>
'dc-branch-detail'
,
'PUT,OPTIONS dc-branch-revise'
=>
'dc-branch-revise'
,
],
],
//门店评分
...
...
backend/controllers/v1/branch/BranchController.php
View file @
0f466f9b
...
...
@@ -886,4 +886,100 @@ class BranchController extends BaseController
->
addRows
(
$export_result
)
->
output
(
"DC仓列表"
,
"Csv"
);
}
/**
* @OA\Get(
* path="/backend/web/v1/branch/branches/dc-branch-detail",
* tags={"门店&DC"},
* description="DC仓详情接口",
* summary="DC仓详情(姚书侠)",
* @OA\Parameter(name="guid",in="query",description="DC仓GUID",@OA\Schema(type="string")),
* @OA\Response(response="200",description="success"),
* security={{"Authorization": {}}}
* )
*/
public
function
actionDcBranchDetail
()
{
$model
=
new
$this
->
modelClass
();
$guid
=
Yii
::
$app
->
request
->
getQueryParam
(
'guid'
);
$info
=
$model
->
BranchDetail
(
$guid
);
if
(
!
$info
)
{
throw
new
BadRequestHttpException
(
'未找到符合的DC信息'
);
}
return
$info
;
}
/**
* @OA\PUT(
* path="/backend/web/v1/branch/branches/dc-branch-revise",
* tags={"门店&DC"},
* summary="修改DC接口(姚书侠)",
* description="修改DC接口",
* @OA\RequestBody(
* required=true,
* @OA\MediaType(
* mediaType="application/x-www-form-urlencoded",
* @OA\Schema(
* type="object",
* @OA\Property(property="GUID",description="要修改的DC的GUID",type="string"),
* @OA\Property(property="NAME",description="DC名称,最长20字",type="string"),
* @OA\Property(property="BRANCH_NAME",description="DC简称",type="string"),
* @OA\Property(property="RECIVER_PROVINCE",description="省份编号",type="string"),
* @OA\Property(property="RECIVER_CITY",description="城市编号",type="string"),
* @OA\Property(property="RECIVER_REGION",description="区域编号",type="string"),
* @OA\Property(property="ADDRESS",description="详细地址",type="string"),
* @OA\Property(property="PHONE",description="电话/手机号",type="string"),
* @OA\Property(property="CONTACT_NAME",description="联系人姓名",type="string"),
* @OA\Property(property="BRANCH_TYPE",description="DC仓类型 1分公司 2区域",type="string"),
* @OA\Property(property="LAT",description="坐标LAT",type="string"),
* @OA\Property(property="LNG",description="坐标LNG",type="string"),
* @OA\Property(property="IS_SHELVE",description="是否营业",type="int"),
* @OA\Property(property="WORK_TIME_START",description="开始营业时间",type="string"),
* @OA\Property(property="WORK_TIME_END",description="结束营业时间",type="string"),
* @OA\Property(property="DELIVERY_TIME_START",description="开始配送时间",type="string"),
* @OA\Property(property="DELIVERY_TIME_END",description="结束配送时间",type="string"),
* @OA\Property(property="RETURN_ADDRESS",description="退货地址",type="string"),
* @OA\Property(property="DESCRIPTION",description="描述",type="string")
* )
* )
* ),
* @OA\Response(response=200,description="success"),
* security={{"Authorization": {}}}
* )
*/
public
function
actionDcBranchRevise
()
{
$param
=
Yii
::
$app
->
request
->
getBodyParams
();
$guid
=
Yii
::
$app
->
request
->
getBodyParam
(
'GUID'
);
$model
=
$this
->
modelClass
::
findOne
(
$guid
);
if
(
!
$model
){
throw
new
BadRequestHttpException
(
'没有找到要修改的记录'
);
}
//营业时间
if
(
!
empty
(
$param
[
'WORK_TIME_START'
])
&&
!
empty
(
$param
[
'WORK_TIME_END'
])){
$WORK_TIME
=
$param
[
'WORK_TIME_START'
]
.
'-'
.
$param
[
'WORK_TIME_END'
];
}
else
{
$WORK_TIME
=
''
;
}
//配送时间
if
(
!
empty
(
$param
[
'DELIVERY_TIME_START'
])
&&
!
empty
(
$param
[
'DELIVERY_TIME_END'
])){
$DELIVERY_TIME
=
$param
[
'DELIVERY_TIME_START'
]
.
'-'
.
$param
[
'DELIVERY_TIME_END'
];
}
else
{
$DELIVERY_TIME
=
''
;
}
//门店信息修改
$model
->
scenario
=
'dcUpdate'
;
//创建的场景
$other_param
=
array
(
'UPDATE_TIME'
=>
date
(
'Y-m-d H:i:s'
,
time
()),
'WORK_TIME'
=>
$WORK_TIME
,
'DELIVERY_TIME'
=>
$DELIVERY_TIME
,
);
$model
->
setAttributes
(
$other_param
);
$model
->
setAttributes
(
Yii
::
$app
->
getRequest
()
->
post
());
if
(
$model
->
save
()
===
false
&&
!
$model
->
hasErrors
())
{
throw
new
ServerErrorHttpException
(
'Failed to update the object for unknown reason.'
);
}
return
$model
;
}
}
backend/controllers/v1/transport/CompanyController.php
View file @
0f466f9b
...
...
@@ -21,7 +21,15 @@ class CompanyController extends BaseController
* description="快递方式列表接口",
* @OA\Parameter(in = "query",name = "page",description = "分页页码",required = false,@OA\Schema(type="string")),
* @OA\Parameter(in = "query",name = "pageSize",description = "分页大小",required = false,@OA\Schema(type="string")),
* @OA\Response(response = 200,description = "success"),
* @OA\Response(response = 200,description = "
* GUID:快递方式GUID,
* CODE:快递方式CODE,
* NAME:快递方式名称,
* PHONE:手机号,
* SORT:排序,
* DESCRIPTION:描述,
* IS_DEFAULT:是否默认 1是0否
* "),
* security={{"Authorization": {}}}
* )
*/
...
...
@@ -47,7 +55,15 @@ class CompanyController extends BaseController
* summary="快递方式详情接口(姚书侠)",
* description="快递方式详情接口",
* @OA\Parameter(name="guid",in="query",required=true,description="快递方式id",@OA\Schema(type="string")),
* @OA\Response(response = 200,description = "success"),
* @OA\Response(response = 200,description = "
* GUID:快递方式GUID,
* CODE:快递方式CODE,
* NAME:快递方式名称,
* PHONE:手机号,
* SORT:排序,
* DESCRIPTION:描述,
* IS_DEFAULT:是否默认 1是0否
* "),
* security={{"Authorization": {}}}
* )
*/
...
...
@@ -123,7 +139,7 @@ class CompanyController extends BaseController
* )
* )
* ),
* @OA\Response(response=200,description="
成功时返回access-token
"),
* @OA\Response(response=200,description="
success
"),
* security={{"Authorization": {}}}
* )
*/
...
...
@@ -161,7 +177,7 @@ class CompanyController extends BaseController
* )
* )
* ),
* @OA\Response(response=20
0,description="成功时返回access-token
"),
* @OA\Response(response=20
4,description="success
"),
* security={{"Authorization": {}}}
* )
*/
...
...
backend/models/v1/branch/ShopBranch.php
View file @
0f466f9b
...
...
@@ -92,6 +92,7 @@ class ShopBranch extends BaseModel
{
return
'shop_branch'
;
}
const
SCENARIO_DCUPDATE
=
'dcUpdate'
;
public
$IS_BRANCH_SELF_MENTION
;
//是否门店自提
public
$IS_BRANCH_EXPRESS_DELIVERY
;
//是否门店快递配送
...
...
@@ -103,6 +104,19 @@ class ShopBranch extends BaseModel
public
$IS_TWO_HOUR_DELIVERY
;
//是否2小时达
public
$IS_DAY_DELIVERY
;
//是否当日定时达
public
$SERVICE_TYPE_CODE
;
//服务门店CODE
/**
* 场景值的重写
* {@inheritdoc}
*/
public
function
scenarios
()
{
$scenarios
=
parent
::
scenarios
();
$scenarios
[
self
::
SCENARIO_DCUPDATE
]
=
[
'NAME'
,
'BRANCH_NAME'
,
'RECIVER_PROVINCE'
,
'RECIVER_CITY'
,
'RECIVER_REGION'
,
'ADDRESS'
,
'PHONE'
,
'CONTACT_NAME'
,
'BRANCH_TYPE'
,
'LAT'
,
'LNG'
,
'IS_SHELVE'
,
'WORK_TIME'
,
'DELIVERY_TIME'
,
'RETURN_ADDRESS'
,
'DESCRIPTION'
,
'UPDATE_TIME'
];
return
$scenarios
;
}
/**
* {@inheritdoc}
*/
...
...
@@ -138,6 +152,8 @@ class ShopBranch extends BaseModel
'IS_DAY_DELIVERY'
],
'in'
,
'range'
=>
[
0
,
1
],
'on'
=>
[
'import'
],
'message'
=>
'{attribute}只能为0或1'
],
[[
'SERVICE_TYPE_CODE'
],
'validateEffective'
],
//如果影响性能就注释掉
[[
'BRANCH_NAME'
,
'NAME'
,
'BRANCH_TYPE'
],
'required'
,
'on'
=>
[
self
::
SCENARIO_DCUPDATE
]],
[[
'BRANCH_TYPE'
],
'in'
,
'range'
=>
[
1
,
2
],
'on'
=>
[
self
::
SCENARIO_DCUPDATE
]],
];
}
//验证服务类目的有效性
...
...
@@ -167,7 +183,7 @@ class ShopBranch extends BaseModel
'GUID'
=>
'主键'
,
'ORG_GUID'
=>
'组织机构号'
,
'CODE'
=>
'门店编码'
,
'NAME'
=>
'门店
简
称'
,
'NAME'
=>
'门店
名
称'
,
'PARENT_GUID'
=>
'上级GUID'
,
'DESCRIPTION'
=>
'描述'
,
'ADDRESS'
=>
'地址'
,
...
...
backend/models/v1/transport/ShopTransportCompany.php
View file @
0f466f9b
...
...
@@ -50,8 +50,8 @@ class ShopTransportCompany extends BaseModel
public
function
rules
()
{
return
[
[[
'GUID'
,
'ORG_GUID'
,
'CODE'
,
'IS_DEFAULT'
,
'NAME'
],
'required'
,
'message'
=>
'{attribute}为必填项'
,
'on'
=>
[
'create'
]
],
[[
'CODE'
,
'IS_DEFAULT'
,
'NAME'
],
'required'
,
'message'
=>
'{attribute}为必填项'
,
'on'
=>
[
'update'
]
],
[[
'GUID'
,
'ORG_GUID'
,
'CODE'
,
'IS_DEFAULT'
,
'NAME'
],
'required'
,
'message'
=>
'{attribute}为必填项'
,
'on'
=>
self
::
SCENARIO_CREATE
],
[[
'CODE'
,
'IS_DEFAULT'
,
'NAME'
],
'required'
,
'message'
=>
'{attribute}为必填项'
,
'on'
=>
self
::
SCENARIO_UPDATE
],
[[
'PHONE'
],
'match'
,
'pattern'
=>
'/^1\d{10}$/'
,
'message'
=>
'手机号格式不正确'
],
[[
'IS_DEFAULT'
],
'boolean'
,
'message'
=>
'{attribute}传值错误'
],
];
...
...
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