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
32882ff8
Commit
32882ff8
authored
Dec 06, 2019
by
孙磊
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'development' of
http://gitlab-ebiz.yiyao365.cn/newshop/newshopback
into development
parents
2a84691f
1dd9be5f
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
348 additions
and
83 deletions
+348
-83
urlmanager.php
backend/config/urlmanager.php
+6
-1
BranchController.php
backend/controllers/v1/branch/BranchController.php
+96
-0
BranchScoreController.php
backend/controllers/v1/branch/BranchScoreController.php
+3
-2
CompanyController.php
backend/controllers/v1/transport/CompanyController.php
+20
-4
ShopTransportTypeController.php
.../controllers/v1/transport/ShopTransportTypeController.php
+0
-12
TransportSettingController.php
...d/controllers/v1/transport/TransportSettingController.php
+90
-9
ShopBranch.php
backend/models/v1/branch/ShopBranch.php
+116
-43
ShopPackagingcostsBranches.php
backend/models/v1/transport/ShopPackagingcostsBranches.php
+2
-2
ShopTransportCompany.php
backend/models/v1/transport/ShopTransportCompany.php
+2
-2
TransportSetting.php
backend/models/v1/transport/TransportSetting.php
+13
-8
No files found.
backend/config/urlmanager.php
View file @
32882ff8
...
...
@@ -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'
,
],
],
//门店评分
...
...
@@ -218,7 +220,7 @@ return [
'GET,OPTIONS template-file'
=>
'template-file'
,
],
],
//
运费模板
//
快递配送价格
[
'class'
=>
'yii\rest\UrlRule'
,
'controller'
=>
[
...
...
@@ -227,7 +229,10 @@ return [
'extraPatterns'
=>
[
'GET,OPTIONS transport-templates'
=>
'transport-templates'
,
'GET,OPTIONS transport-fee-details'
=>
'transport-fee-details'
,
'GET,OPTIONS get-branches-packaging'
=>
'get-branches-packaging'
,
'PUT,OPTIONS transport-fee-update'
=>
'transport-fee-update'
,
'DELETE,OPTIONS transport-fee-del'
=>
'transport-fee-del'
,
'POST,OPTIONS transport-fee-add'
=>
'transport-fee-add'
,
],
],
//o2o起送价设置
...
...
backend/controllers/v1/branch/BranchController.php
View file @
32882ff8
...
...
@@ -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/branch/BranchScoreController.php
View file @
32882ff8
...
...
@@ -189,7 +189,7 @@ class BranchScoreController extends BaseController
* @OA\Parameter(
* description="要删除的门店服务评价GUID",
* in="query",
* name="
guid
",
* name="
GUID
",
* required=true,
* @OA\Schema(
* type="string",
...
...
@@ -202,8 +202,9 @@ class BranchScoreController extends BaseController
* security={{"Authorization":{}}},
* )
*/
public
function
actionScoreInfoDel
(
$guid
)
public
function
actionScoreInfoDel
()
{
$guid
=
Yii
::
$app
->
request
->
get
(
'GUID'
);
$model
=
ShopBranchScore
::
findOne
(
$guid
);
if
(
!
$model
)
{
throw
new
BadRequestHttpException
(
"Requested resource does not exist !"
);
...
...
backend/controllers/v1/transport/CompanyController.php
View file @
32882ff8
...
...
@@ -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/controllers/v1/transport/ShopTransportTypeController.php
deleted
100644 → 0
View file @
2a84691f
<?php
namespace
backend\controllers\v1\transport
;
use
app\models\v1\branch\ShopBranch
;
use
Yii
;
use
backend\controllers\v1\BaseController
;
class
ShopTransportTypeController
extends
BaseController
{
public
$modelClass
=
'app\models\v1\transport\ShopTransportType'
;
}
backend/controllers/v1/transport/TransportSettingController.php
View file @
32882ff8
...
...
@@ -92,7 +92,7 @@ class TransportSettingController extends BaseController
* GUID:指定省级guid,
* CODE:门店编码,
* NAME:门店名称,
* IS_PERMIT:是否准许
保存编辑(1:准许保存编辑,0:不准许保存编辑
)"),
* IS_PERMIT:是否准许
编辑(0:禁止保存编辑,1:准许保存编辑,2:只准编辑保存省级
)"),
* security={{"Authorization":{}}}
* )
*/
...
...
@@ -120,17 +120,16 @@ class TransportSettingController extends BaseController
//权限
$permit
=
1
;
$branchInfo
=
ShopBranch
::
find
()
->
select
([
'BRANCH_TYPE'
,
'SUPPROVINCE_GUID'
])
->
where
([
'GUID'
=>
$info
[
'GROUP_GUID'
]]);
$userInfo
=
(
new
ShopRbacUser
)
->
getRbacUserInfo
(
Yii
::
$app
->
user
->
identity
->
GUID
);
//总部权限管理员1,分部管理员权限2。非权限内不可保存编辑
if
(
!
in_array
(
$userInfo
[
'ROLE_ID'
],
[
USER_ROLE_REGION_ADMIN
,
USER_ROLE_HEADQUARTERS_ADMIN
]))
{
$permit
=
0
;
}
//分部管理员权限2,
分部管理员所属上级与运送模板创建所属上级不一致时不准保存编辑
if
(
$userInfo
[
'ROLE_ID'
]
==
USER_ROLE_REGION_ADMIN
&&
$userInfo
[
'
SUPPROVINCE_GUID'
]
!=
$branchInfo
[
'SUPPROVINCE
_GUID'
])
{
$permit
=
0
;
//分部管理员权限2,
if
(
$userInfo
[
'ROLE_ID'
]
==
USER_ROLE_REGION_ADMIN
&&
$userInfo
[
'
PARENT_BRANCH_GUID'
]
==
$info
[
'GROUP
_GUID'
])
{
$permit
=
2
;
}
$info
[
'IS_PERMIT'
]
=
$permit
;
//是否准许编辑保存,
1:准许保存编辑,0:禁止保存编辑
$info
[
'IS_PERMIT'
]
=
$permit
;
//是否准许编辑保存,
0:禁止保存编辑,1:准许保存编辑,2:只准编辑保存省级
return
$info
;
}
...
...
@@ -139,7 +138,7 @@ class TransportSettingController extends BaseController
* path="/backend/web/v1/transport/transport-settings/transport-fee-update",
* tags={"配送管理"},
* summary="更新运费模板信息详情(侯贺政)",
* description="更新
(
运费模板信息详情",
* description="更新运费模板信息详情",
* @OA\RequestBody(
* required=true,
* description="注:模板GUID、配送方式、是否启用必填,其他根据需要选填;限制人群、配送城市、指定省级多项使用英文逗号隔开。",
...
...
@@ -168,6 +167,10 @@ class TransportSettingController extends BaseController
* response=200,
* description="更新成功!"
* ),
* @OA\Response(
* response=422,
* description="数据验证错误,错误信息(数组)。",
* ),
* security={{"Authorization":{}}},
* )
*/
...
...
@@ -203,10 +206,10 @@ class TransportSettingController extends BaseController
//删除条件:总部权限删除所有,省级只能删除自己。
switch
(
$userInfo
[
'ROLE_ID'
])
{
case
'1'
:
case
USER_ROLE_HEADQUARTERS_ADMIN
:
$where
=
[
'ACTIVITY_GUID'
=>
$params
[
'GUID'
]];
break
;
case
'2'
:
case
USER_ROLE_REGION_ADMIN
:
$where
=
[
'ACTIVITY_GUID'
=>
$params
[
'GUID'
],
'BRANCH_GUID'
=>
$userInfo
[
'BRANCH_GUID'
]];
break
;
default
:
...
...
@@ -250,4 +253,82 @@ class TransportSettingController extends BaseController
}
throw
new
HttpException
(
200
,
"更新成功!"
);
}
/**
* @OA\GET(
* path="/backend/web/v1/transport/transport-settings/get-branches-packaging",
* tags={"配送管理"},
* summary="获取指定省级列表(侯贺政)",
* description="添加指定省级时,先获取的指定省级列表。",
* @OA\Parameter(name="page",in="query",description="页码",@OA\schema(type="int")),
* @OA\Parameter(name="search",in="query",description="门店名称或编码",@OA\schema(type="string")),
* @OA\Response(response="200",description="
* GUID:门店GUID,
* NAME:门店名称,
* CODE:门店编码,
* RECIVER_PROVINCE:所在省,
* RECIVER_CITY:所在市,
* RECIVER_REGION:所在区"),
* security={{"Authorization":{}}}
* )
*/
public
function
actionGetBranchesPackaging
()
{
$params
=
Yii
::
$app
->
request
->
queryParams
;
$model
=
new
ShopBranch
();
$model
->
scenario
=
'search'
;
$model
->
attributes
=
$params
;
if
(
!
$model
->
validate
())
{
Yii
::
$app
->
response
->
statusCode
=
422
;
return
$model
->
errors
;
}
$list
=
$model
->
provinceBranches
(
$model
->
search
);
if
(
!
$list
->
getModels
())
{
throw
new
BadRequestHttpException
(
'未找到符合条件的数据'
);
}
return
$list
;
}
/**
* @OA\Delete(
* path="/backend/web/v1/transport/transport-settings/transport-fee-del",
* tags={"配送管理"},
* summary="删除运费模板信息(侯贺政)",
* description="更新运费模板信息",
* @OA\Parameter(
* description="要删除的运费模板GUID",
* in="query",
* name="GUID",
* required=true,
* @OA\Schema(
* type="string",
* )
* ),
* @OA\Response(
* response=200,
* description="删除成功!"
* ),
* security={{"Authorization":{}}},
* )
*/
public
function
actionTransportFeeDel
()
{
$guid
=
Yii
::
$app
->
request
->
get
(
'GUID'
);
$model
=
new
$this
->
modelClass
();
$_model
=
$model
::
findOne
(
$guid
);
if
(
!
$_model
)
{
throw
new
BadRequestHttpException
(
"Requested resource does not exist !"
);
}
$userInfo
=
(
new
ShopRbacUser
)
->
getRbacUserInfo
(
Yii
::
$app
->
user
->
identity
->
GUID
);
if
(
$userInfo
[
'ROLE_ID'
]
==
USER_ROLE_REGION_ADMIN
&&
(
$userInfo
[
'BRANCH_GUID'
]
!=
$_model
[
'GROUP_GUID'
])
&&
(
$userInfo
[
'PARENT_BRANCH_GUID'
]
!=
$_model
[
'GROUP_GUID'
]))
{
throw
new
BadRequestHttpException
(
'不能删除总部或其他省级的运费模板!'
);
}
if
(
!
$_model
->
delete
())
{
throw
new
ServerErrorHttpException
(
'删除失败!'
);
}
throw
new
HttpException
(
200
,
"删除成功!"
);
}
}
backend/models/v1/branch/ShopBranch.php
View file @
32882ff8
...
...
@@ -7,6 +7,8 @@ use Yii;
use
yii\data\ActiveDataProvider
;
use
yii\helpers\ArrayHelper
;
use
app\models\v1\branch\ShopCityDistributionSetting
;
use
app\models\v1\common\ShopTransportArea
;
use
app\models\v1\rbacuser\ShopRbacUser
;
/**
* This is the model class for table "shop_branch".
...
...
@@ -92,6 +94,7 @@ class ShopBranch extends BaseModel
{
return
'shop_branch'
;
}
const
SCENARIO_DCUPDATE
=
'dcUpdate'
;
public
$IS_BRANCH_SELF_MENTION
;
//是否门店自提
public
$IS_BRANCH_EXPRESS_DELIVERY
;
//是否门店快递配送
...
...
@@ -103,13 +106,27 @@ class ShopBranch extends BaseModel
public
$IS_TWO_HOUR_DELIVERY
;
//是否2小时达
public
$IS_DAY_DELIVERY
;
//是否当日定时达
public
$SERVICE_TYPE_CODE
;
//服务门店CODE
public
$search
;
//门店编码或名称搜索
/**
* 场景值的重写
* {@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}
*/
public
function
rules
()
{
return
[
[[
'GUID'
,
'ORG_GUID'
,
'CODE'
,
'NAME'
],
'required'
,
'on'
=>
[
'create'
,
'update'
]],
[[
'GUID'
,
'ORG_GUID'
,
'CODE'
,
'NAME'
],
'required'
,
'on'
=>
[
'create'
,
'update'
]],
[[
'ADDRESS'
,
'BRANCH_IMAGE_PATH'
,
'LICENCE_IMAGE_PATH'
,
'NOTICE_USER'
,
'CONTACTS_WXID'
,
'TRANSPORT_TYPE'
,
'RETURN_ADDRESS'
],
'string'
],
[[
'IS_DELIVERY'
,
'IS_CARE'
,
'IS_RESERV'
,
'IS_O2O'
,
'IS_BOIL_MEDICINE'
,
'IS_POINTS_SHOP'
,
'IS_PICK_UP_STATION'
,
'IS_VIRTUAL_BRANCH'
,
'IS_SHELVE'
,
'BRANCH_TYPE'
,
'IS_DELIVERY_CODECHAIN_GOODS'
,
'SCORE'
,
'GOODS_TYPE'
,
'IS_B2C'
,
'TOTAL_VOLUME'
],
'integer'
],
[[
'DELIVERY_LIMIT'
,
'PICKUP_LIMIT'
,
'TRANSFERS_RATE'
],
'number'
],
...
...
@@ -120,29 +137,37 @@ class ShopBranch extends BaseModel
[[
'SUPPORT_SEND_PLATFORM'
],
'string'
,
'max'
=>
10
],
[[
'HY_CODE'
,
'STATUS'
,
'BRANCH_NAME'
],
'string'
,
'max'
=>
30
],
[[
'COMP_TEXT'
,
'SALESDIST_TEXT'
,
'ZCBZIRK_TEXT'
],
'string'
,
'max'
=>
200
],
[[
'GUID'
],
'unique'
,
'on'
=>
[
'create'
]],
[[
'GUID'
],
'unique'
,
'on'
=>
[
'create'
]],
[[
'CODE'
,
'DESCRIPTION'
,
'CONTACT_NAME'
,
'PHONE'
,
'NAME'
,
'LAT'
,
'LNG'
,
'IS_DELIVERY'
,
'DELIVERY_TIME'
,
'WORK_TIME'
,
'IS_CARE'
,
'IS_RESERV'
,
'IS_O2O'
,
'IS_BOIL_MEDICINE'
,
'IS_POINTS_SHOP'
,
'IS_VIRTUAL_BRANCH'
,
'IS_DELIVERY_CODECHAIN_GOODS'
,
'IS_SHELVE'
,
'IS_BRANCH_SELF_MENTION'
,
'IS_BRANCH_EXPRESS_DELIVERY'
,
'IS_DELIVERS_GOODS'
,
'IS_EXPRESS_DELIVERY'
,
'IS_BRANCH_SELF_DELIVERY'
,
'IS_HAFL_HOUR_DELIVERY'
,
'IS_ONE_HOUR_DELIVERY'
,
'IS_TWO_HOUR_DELIVERY'
,
'IS_DAY_DELIVERY'
],
'required'
,
'on'
=>
[
'import'
]
,
'message'
=>
'{attribute}不能为空'
],
[[
'CODE'
,
'DESCRIPTION'
,
'CONTACT_NAME'
,
'PHONE'
,
'NAME'
,
'LAT'
,
'LNG'
,
'IS_DELIVERY'
,
'DELIVERY_TIME'
,
'WORK_TIME'
,
'IS_CARE'
,
'IS_RESERV'
,
'IS_O2O'
,
'IS_BOIL_MEDICINE'
,
'IS_POINTS_SHOP'
,
'IS_VIRTUAL_BRANCH'
,
'IS_DELIVERY_CODECHAIN_GOODS'
,
'IS_SHELVE'
,
'IS_BRANCH_SELF_MENTION'
,
'IS_BRANCH_EXPRESS_DELIVERY'
,
'IS_DELIVERS_GOODS'
,
'IS_EXPRESS_DELIVERY'
,
'IS_BRANCH_SELF_DELIVERY'
,
'IS_HAFL_HOUR_DELIVERY'
,
'IS_ONE_HOUR_DELIVERY'
,
'IS_TWO_HOUR_DELIVERY'
,
'IS_DAY_DELIVERY'
],
'required'
,
'on'
=>
[
'import'
],
'message'
=>
'{attribute}不能为空'
],
[[
'DESCRIPTION'
,
'NAME'
],
'string'
,
'max'
=>
100
,
'on'
=>
[
'import'
],
'tooLong'
=>
'最大长度不能超过100'
],
[[
'DESCRIPTION'
,
'NAME'
],
'string'
,
'max'
=>
100
,
'on'
=>
[
'import'
],
'tooLong'
=>
'最大长度不能超过100'
],
[[
'CONTACT_NAME'
,
'PHONE'
,
'DELIVERY_TIME'
,
'WORK_TIME'
,
'LAT'
,
'LNG'
],
'string'
,
'max'
=>
50
,
'on'
=>
[
'import'
],
'tooLong'
=>
'{attribute}最大长度不能超过50'
],
[[
'CONTACT_NAME'
,
'PHONE'
,
'DELIVERY_TIME'
,
'WORK_TIME'
,
'LAT'
,
'LNG'
],
'string'
,
'max'
=>
50
,
'on'
=>
[
'import'
],
'tooLong'
=>
'{attribute}最大长度不能超过50'
],
[[
'IS_CARE'
,
'IS_DELIVERY'
,
'IS_RESERV'
,
'IS_O2O'
,
'IS_BOIL_MEDICINE'
,
'IS_POINTS_SHOP'
,
'IS_VIRTUAL_BRANCH'
,
[[
'IS_CARE'
,
'IS_DELIVERY'
,
'IS_RESERV'
,
'IS_O2O'
,
'IS_BOIL_MEDICINE'
,
'IS_POINTS_SHOP'
,
'IS_VIRTUAL_BRANCH'
,
'IS_DELIVERY_CODECHAIN_GOODS'
,
'IS_SHELVE'
,
'IS_BRANCH_SELF_MENTION'
,
'IS_BRANCH_EXPRESS_DELIVERY'
,
'IS_DELIVERS_GOODS'
,
'IS_EXPRESS_DELIVERY'
,
'IS_BRANCH_SELF_DELIVERY'
,
'IS_HAFL_HOUR_DELIVERY'
,
'IS_ONE_HOUR_DELIVERY'
,
'IS_TWO_HOUR_DELIVERY'
,
'IS_DAY_DELIVERY'
],
'in'
,
'range'
=>
[
0
,
1
],
'on'
=>
[
'import'
],
'message'
=>
'{attribute}只能为0或1'
],
'IS_DELIVERS_GOODS'
,
'IS_EXPRESS_DELIVERY'
,
'IS_BRANCH_SELF_DELIVERY'
,
'IS_HAFL_HOUR_DELIVERY'
,
'IS_ONE_HOUR_DELIVERY'
,
'IS_TWO_HOUR_DELIVERY'
,
'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
]],
[[
'search'
],
'string'
,
'on'
=>
'search'
],
];
}
//验证服务类目的有效性
public
function
validateEffective
(
$attribute
){
$importArr
=
explode
(
','
,
$this
->
$attribute
);
public
function
validateEffective
(
$attribute
)
{
$importArr
=
explode
(
','
,
$this
->
$attribute
);
$codeArr
=
$this
::
find
()
->
select
(
'CODE'
)
->
from
(
'SHOP_BRANCH_SERVICE_TYPE'
)
...
...
@@ -153,9 +178,9 @@ class ShopBranch extends BaseModel
foreach
(
$codeArr
as
$value
)
{
$tempArr
[]
=
$value
[
'CODE'
];
}
$diff
=
array_diff
(
$importArr
,
$tempArr
);
$diff
=
array_diff
(
$importArr
,
$tempArr
);
if
(
!
empty
(
$diff
))
{
$this
->
addError
(
$attribute
,
'服务类目CODE为'
.
implode
(
','
,
$diff
)
.
'不存在.'
);
$this
->
addError
(
$attribute
,
'服务类目CODE为'
.
implode
(
','
,
$diff
)
.
'不存在.'
);
}
}
/**
...
...
@@ -167,7 +192,7 @@ class ShopBranch extends BaseModel
'GUID'
=>
'主键'
,
'ORG_GUID'
=>
'组织机构号'
,
'CODE'
=>
'门店编码'
,
'NAME'
=>
'门店
简
称'
,
'NAME'
=>
'门店
名
称'
,
'PARENT_GUID'
=>
'上级GUID'
,
'DESCRIPTION'
=>
'描述'
,
'ADDRESS'
=>
'地址'
,
...
...
@@ -254,7 +279,7 @@ class ShopBranch extends BaseModel
$query
=
static
::
find
()
->
alias
(
'sb'
)
->
select
(
"sb.GUID,sb.NAME,sb.CONTACT_NAME,sb.PARENT_GUID,sb.CODE,sb.ADDRESS,sb.PHONE,sb.LAT,
sb.RECIVER_PROVINCE,sb.RECIVER_CITY,sb.RECIVER_REGION,sb.LNG,vwb.PROVINCE,vwb.CITY,vwb.REGION,
sb.ADDRESS,sb.IS_CARE"
)
sb.ADDRESS,sb.IS_CARE"
)
// ->select("sb.GUID,sb.NAME,sb.CONTACT_NAME,sb.PARENT_GUID,sb.CODE,sb.ADDRESS,sb.PHONE,sb.LAT,
// sb.RECIVER_PROVINCE,sb.RECIVER_CITY,sb.RECIVER_REGION,sb.LNG,concat(vwb.PROVINCE,vwb.CITY,vwb.REGION,
// sb.`ADDRESS`) as DETAIL_ADDRESS,sb.IS_CARE" )
...
...
@@ -285,7 +310,7 @@ class ShopBranch extends BaseModel
}
//门店名称或编码
if
(
isset
(
$params
[
'CODE'
]))
{
$query
->
andfilterWhere
([
'or'
,
[
'like'
,
'sb.CODE'
,
$params
[
'CODE'
]],
[
'like'
,
'sb.NAME'
,
$params
[
'CODE'
]]]);
$query
->
andfilterWhere
([
'or'
,
[
'like'
,
'sb.CODE'
,
$params
[
'CODE'
]],
[
'like'
,
'sb.NAME'
,
$params
[
'CODE'
]]]);
}
//省份
if
(
isset
(
$params
[
'RECIVER_PROVINCE'
]))
{
...
...
@@ -300,9 +325,9 @@ class ShopBranch extends BaseModel
$query
->
andfilterWhere
([
'like'
,
'sb.RECIVER_REGION'
,
$params
[
'RECIVER_REGION'
]]);
}
//门店guid 权限
if
(
isset
(
$params
[
'where_branch'
])
&&
!
empty
(
$params
[
'where_branch'
]))
{
$branch_arr
=
explode
(
','
,
$params
[
'where_branch'
]);
$query
->
andfilterWhere
([
'sb.GUID'
=>
$branch_arr
]);
if
(
isset
(
$params
[
'where_branch'
])
&&
!
empty
(
$params
[
'where_branch'
]))
{
$branch_arr
=
explode
(
','
,
$params
[
'where_branch'
]);
$query
->
andfilterWhere
([
'sb.GUID'
=>
$branch_arr
]);
}
return
new
ActiveDataProvider
([
...
...
@@ -328,18 +353,18 @@ class ShopBranch extends BaseModel
->
select
(
'GUID,NAME,CODE,LICENCE_IMAGE_PATH,RECIVER_PROVINCE,RECIVER_CITY,RECIVER_REGION,ADDRESS,PARENT_GUID,
LAT,LNG,IS_POINTS_SHOP,DESCRIPTION,BRANCH_NAME,BRANCH_IMAGE_PATH,PHONE,CONTACT_NAME,SCORE,IS_CARE,
IS_O2O,IS_DELIVERY_CODECHAIN_GOODS,IS_SHELVE,WORK_TIME,DELIVERY_TIME,TRANSPORT_TYPE,RETURN_ADDRESS'
)
->
where
([
'GUID'
=>
$GUID
])
->
where
([
'GUID'
=>
$GUID
])
->
asArray
()
->
one
();
return
$query
;
}
//获取门店(权限下的)
public
function
GetBranch
(
$GUID
,
$SUPPROVINCE_GUID
)
public
function
GetBranch
(
$GUID
,
$SUPPROVINCE_GUID
)
{
$query
=
static
::
find
()
->
select
(
'GUID,SUPPROVINCE_GUID'
)
->
where
([
'GUID'
=>
$GUID
])
->
where
([
'GUID'
=>
$GUID
])
->
andWhere
([
'like'
,
'SUPPROVINCE_GUID'
,
$SUPPROVINCE_GUID
])
->
asArray
()
->
one
();
...
...
@@ -360,24 +385,72 @@ class ShopBranch extends BaseModel
->
asArray
();
//门店名称或编码
if
(
isset
(
$params
[
'code'
]))
{
$branch_query
->
andfilterWhere
([
'or'
,
[
'='
,
'sb.CODE'
,
$params
[
'code'
]],
[
'like'
,
'sb.NAME'
,
$params
[
'code'
]]]);
$branch_query
->
andfilterWhere
([
'or'
,
[
'='
,
'sb.CODE'
,
$params
[
'code'
]],
[
'like'
,
'sb.NAME'
,
$params
[
'code'
]]]);
}
//省市区
if
(
isset
(
$params
[
'province'
]))
{
$branch_query
->
andfilterWhere
([
'sb.RECIVER_PROVINCE'
=>
$params
[
'province'
]]);
$branch_query
->
andfilterWhere
([
'sb.RECIVER_PROVINCE'
=>
$params
[
'province'
]]);
}
if
(
isset
(
$params
[
'city'
]))
{
$branch_query
->
andfilterWhere
([
'sb.RECIVER_CITY'
=>
$params
[
'city'
]]);
$branch_query
->
andfilterWhere
([
'sb.RECIVER_CITY'
=>
$params
[
'city'
]]);
}
if
(
isset
(
$params
[
'region'
]))
{
$branch_query
->
andfilterWhere
([
'sb.RECIVER_REGION'
=>
$params
[
'region'
]]);
$branch_query
->
andfilterWhere
([
'sb.RECIVER_REGION'
=>
$params
[
'region'
]]);
}
//DC类型
if
(
isset
(
$params
[
'dcType'
]))
{
$branch_query
->
andfilterWhere
([
'sb.BRANCH_TYPE'
=>
$params
[
'dcType'
]]);
}
else
{
$branch_query
->
andfilterWhere
([
'in'
,
'BRANCH_TYPE'
,[
0
,
1
,
2
]]);
$branch_query
->
andfilterWhere
([
'sb.BRANCH_TYPE'
=>
$params
[
'dcType'
]]);
}
else
{
$branch_query
->
andfilterWhere
([
'in'
,
'BRANCH_TYPE'
,
[
0
,
1
,
2
]]);
}
return
$branch_query
;
}
/**
* 获取省级门店
*/
public
function
provinceBranches
(
$search
=
''
)
{
$userInfo
=
(
new
ShopRbacUser
)
->
getRbacUserInfo
(
Yii
::
$app
->
user
->
identity
->
GUID
);
//权限
$where
=
[];
switch
(
$userInfo
[
'ROLE_ID'
])
{
case
USER_ROLE_HEADQUARTERS_ADMIN
:
$where
=
[];
break
;
case
USER_ROLE_REGION_ADMIN
:
$where
=
[
'GUID'
=>
$userInfo
[
'BRANCH_GUID'
]];
break
;
default
:
$where
=
[
'>'
,
1
,
2
];
break
;
}
$query
=
static
::
find
()
->
select
([
'GUID'
,
'NAME'
,
'CODE'
,
'RECIVER_PROVINCE as PROVINCE'
,
'RECIVER_CITY as CITY'
,
'RECIVER_REGION as REGION'
])
->
where
(
'BRANCH_TYPE=1'
)
->
andFilterWhere
(
$where
)
->
andfilterWhere
([
'or'
,
[
'like'
,
'CODE'
,
$search
],
[
'like'
,
'NAME'
,
$search
]]);
$dataProvider
=
new
ActiveDataProvider
([
'query'
=>
$query
->
asArray
(),
'pagination'
=>
[
'pageSize'
=>
PAGE_SIZE
],
'sort'
=>
[
'attributes'
=>
[
'CODE'
]
]
]);
$temp
=
$dataProvider
->
getModels
();
foreach
(
$temp
as
$key
=>
$value
)
{
$province
=
ShopTransportArea
::
findOne
([
'GUID'
=>
$value
[
'PROVINCE'
]]);
$temp
[
$key
][
'PROVINCE'
]
=
$province
[
'NAME'
];
$city
=
ShopTransportArea
::
findOne
([
'GUID'
=>
$value
[
'CITY'
]]);
$temp
[
$key
][
'CITY'
]
=
$city
[
'NAME'
];
$region
=
ShopTransportArea
::
findOne
([
'GUID'
=>
$value
[
'REGION'
]]);
$temp
[
$key
][
'REGION'
]
=
$region
[
'NAME'
];
}
$dataProvider
->
setModels
(
$temp
);
return
$dataProvider
;
}
}
backend/models/v1/transport/ShopPackagingcostsBranches.php
View file @
32882ff8
...
...
@@ -33,10 +33,10 @@ class ShopPackagingcostsBranches extends \app\models\v1\BaseModel
public
function
rules
()
{
return
[
[[
'GUID'
],
'required'
],
[[
'GUID'
],
'required'
,
'on'
=>
[
'creation'
]
],
[[
'CREATE_TIME'
],
'safe'
],
[[
'GUID'
,
'ORG_GUID'
,
'ACTIVITY_GUID'
,
'BRANCH_GUID'
,
'ACTIVITY_TYPE'
,
'YGROUP_CODE'
],
'string'
,
'max'
=>
50
],
[[
'GUID'
],
'unique'
],
[[
'GUID'
],
'unique'
,
'on'
=>
[
'creation'
]
],
];
}
...
...
backend/models/v1/transport/ShopTransportCompany.php
View file @
32882ff8
...
...
@@ -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}传值错误'
],
];
...
...
backend/models/v1/transport/TransportSetting.php
View file @
32882ff8
...
...
@@ -87,20 +87,25 @@ class TransportSetting extends \app\models\v1\BaseModel
public
function
templates
(
$platform_type
)
{
$userInfo
=
(
new
ShopRbacUser
)
->
getRbacUserInfo
(
Yii
::
$app
->
user
->
identity
->
GUID
);
//省级权限,只展示省级所属的信息
$activityGUID
=
[];
if
(
$userInfo
[
'ROLE_ID'
]
==
USER_ROLE_REGION_ADMIN
)
{
$array
=
ShopPackagingcostsBranches
::
transportSetting
(
$userInfo
[
'BRANCH_GUID'
]);
foreach
(
$array
as
$key
=>
$value
)
{
$activityGUID
[]
=
$value
[
'ACTIVITY_GUID'
];
}
//权限
$where
=
[];
switch
(
$userInfo
[
'ROLE_ID'
])
{
case
USER_ROLE_HEADQUARTERS_ADMIN
:
$where
=
[];
break
;
case
USER_ROLE_REGION_ADMIN
:
$where
=
[
'or'
,
[
'ts.GROUP_GUID'
=>
$userInfo
[
'PARENT_BRANCH_GUID'
]],
[
'ts.GROUP_GUID'
=>
$userInfo
[
'BRANCH_GUID'
]]];
break
;
default
:
$where
=
[
'>'
,
1
,
2
];
break
;
}
$query
=
static
::
find
()
->
alias
(
'ts'
)
->
select
([
'ts.GUID'
,
'stt.NAME as TRANSPORT_NAME'
,
'ts.BASE_FEE'
,
'ts.BASE_WEIGHT'
,
'ts.BASE_WEIGHT_FEE'
,
'ts.IS_USED'
,
'ts.SELECT_AREA'
])
->
leftJoin
(
'shop_transport_type stt'
,
'ts.TRANSPOR_TTYPE=stt.GUID'
)
->
where
([
'ts.PLATFORM_TYPE'
=>
$platform_type
])
->
andFilterWhere
(
[
'ts.GUID'
=>
$activityGUID
]
);
->
andFilterWhere
(
$where
);
$dataProvider
=
new
ActiveDataProvider
([
'query'
=>
$query
->
asArray
(),
...
...
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