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
1dd9be5f
Commit
1dd9be5f
authored
Dec 05, 2019
by
侯贺政
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
获取指定省级 和 运费模板删除
Signed-off-by:
houhezheng
<
houhezheng@romens.cn
>
parent
0f466f9b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
191 additions
and
48 deletions
+191
-48
urlmanager.php
backend/config/urlmanager.php
+4
-1
BranchScoreController.php
backend/controllers/v1/branch/BranchScoreController.php
+3
-2
TransportSettingController.php
...d/controllers/v1/transport/TransportSettingController.php
+83
-1
ShopBranch.php
backend/models/v1/branch/ShopBranch.php
+99
-42
ShopPackagingcostsBranches.php
backend/models/v1/transport/ShopPackagingcostsBranches.php
+2
-2
No files found.
backend/config/urlmanager.php
View file @
1dd9be5f
...
@@ -220,7 +220,7 @@ return [
...
@@ -220,7 +220,7 @@ return [
'GET,OPTIONS template-file'
=>
'template-file'
,
'GET,OPTIONS template-file'
=>
'template-file'
,
],
],
],
],
//
运费模板
//
快递配送价格
[
[
'class'
=>
'yii\rest\UrlRule'
,
'class'
=>
'yii\rest\UrlRule'
,
'controller'
=>
[
'controller'
=>
[
...
@@ -229,7 +229,10 @@ return [
...
@@ -229,7 +229,10 @@ return [
'extraPatterns'
=>
[
'extraPatterns'
=>
[
'GET,OPTIONS transport-templates'
=>
'transport-templates'
,
'GET,OPTIONS transport-templates'
=>
'transport-templates'
,
'GET,OPTIONS transport-fee-details'
=>
'transport-fee-details'
,
'GET,OPTIONS transport-fee-details'
=>
'transport-fee-details'
,
'GET,OPTIONS get-branches-packaging'
=>
'get-branches-packaging'
,
'PUT,OPTIONS transport-fee-update'
=>
'transport-fee-update'
,
'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起送价设置
//o2o起送价设置
...
...
backend/controllers/v1/branch/BranchScoreController.php
View file @
1dd9be5f
...
@@ -189,7 +189,7 @@ class BranchScoreController extends BaseController
...
@@ -189,7 +189,7 @@ class BranchScoreController extends BaseController
* @OA\Parameter(
* @OA\Parameter(
* description="要删除的门店服务评价GUID",
* description="要删除的门店服务评价GUID",
* in="query",
* in="query",
* name="
guid
",
* name="
GUID
",
* required=true,
* required=true,
* @OA\Schema(
* @OA\Schema(
* type="string",
* type="string",
...
@@ -202,8 +202,9 @@ class BranchScoreController extends BaseController
...
@@ -202,8 +202,9 @@ class BranchScoreController extends BaseController
* security={{"Authorization":{}}},
* security={{"Authorization":{}}},
* )
* )
*/
*/
public
function
actionScoreInfoDel
(
$guid
)
public
function
actionScoreInfoDel
()
{
{
$guid
=
Yii
::
$app
->
request
->
get
(
'GUID'
);
$model
=
ShopBranchScore
::
findOne
(
$guid
);
$model
=
ShopBranchScore
::
findOne
(
$guid
);
if
(
!
$model
)
{
if
(
!
$model
)
{
throw
new
BadRequestHttpException
(
"Requested resource does not exist !"
);
throw
new
BadRequestHttpException
(
"Requested resource does not exist !"
);
...
...
backend/controllers/v1/transport/TransportSettingController.php
View file @
1dd9be5f
...
@@ -138,7 +138,7 @@ class TransportSettingController extends BaseController
...
@@ -138,7 +138,7 @@ class TransportSettingController extends BaseController
* path="/backend/web/v1/transport/transport-settings/transport-fee-update",
* path="/backend/web/v1/transport/transport-settings/transport-fee-update",
* tags={"配送管理"},
* tags={"配送管理"},
* summary="更新运费模板信息详情(侯贺政)",
* summary="更新运费模板信息详情(侯贺政)",
* description="更新
(
运费模板信息详情",
* description="更新运费模板信息详情",
* @OA\RequestBody(
* @OA\RequestBody(
* required=true,
* required=true,
* description="注:模板GUID、配送方式、是否启用必填,其他根据需要选填;限制人群、配送城市、指定省级多项使用英文逗号隔开。",
* description="注:模板GUID、配送方式、是否启用必填,其他根据需要选填;限制人群、配送城市、指定省级多项使用英文逗号隔开。",
...
@@ -167,6 +167,10 @@ class TransportSettingController extends BaseController
...
@@ -167,6 +167,10 @@ class TransportSettingController extends BaseController
* response=200,
* response=200,
* description="更新成功!"
* description="更新成功!"
* ),
* ),
* @OA\Response(
* response=422,
* description="数据验证错误,错误信息(数组)。",
* ),
* security={{"Authorization":{}}},
* security={{"Authorization":{}}},
* )
* )
*/
*/
...
@@ -249,4 +253,82 @@ class TransportSettingController extends BaseController
...
@@ -249,4 +253,82 @@ class TransportSettingController extends BaseController
}
}
throw
new
HttpException
(
200
,
"更新成功!"
);
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 @
1dd9be5f
...
@@ -7,6 +7,8 @@ use Yii;
...
@@ -7,6 +7,8 @@ use Yii;
use
yii\data\ActiveDataProvider
;
use
yii\data\ActiveDataProvider
;
use
yii\helpers\ArrayHelper
;
use
yii\helpers\ArrayHelper
;
use
app\models\v1\branch\ShopCityDistributionSetting
;
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".
* This is the model class for table "shop_branch".
...
@@ -104,6 +106,7 @@ class ShopBranch extends BaseModel
...
@@ -104,6 +106,7 @@ class ShopBranch extends BaseModel
public
$IS_TWO_HOUR_DELIVERY
;
//是否2小时达
public
$IS_TWO_HOUR_DELIVERY
;
//是否2小时达
public
$IS_DAY_DELIVERY
;
//是否当日定时达
public
$IS_DAY_DELIVERY
;
//是否当日定时达
public
$SERVICE_TYPE_CODE
;
//服务门店CODE
public
$SERVICE_TYPE_CODE
;
//服务门店CODE
public
$search
;
//门店编码或名称搜索
/**
/**
* 场景值的重写
* 场景值的重写
...
@@ -123,7 +126,7 @@ class ShopBranch extends BaseModel
...
@@ -123,7 +126,7 @@ class ShopBranch extends BaseModel
public
function
rules
()
public
function
rules
()
{
{
return
[
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'
],
[[
'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'
],
[[
'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'
],
[[
'DELIVERY_LIMIT'
,
'PICKUP_LIMIT'
,
'TRANSFERS_RATE'
],
'number'
],
...
@@ -134,31 +137,37 @@ class ShopBranch extends BaseModel
...
@@ -134,31 +137,37 @@ class ShopBranch extends BaseModel
[[
'SUPPORT_SEND_PLATFORM'
],
'string'
,
'max'
=>
10
],
[[
'SUPPORT_SEND_PLATFORM'
],
'string'
,
'max'
=>
10
],
[[
'HY_CODE'
,
'STATUS'
,
'BRANCH_NAME'
],
'string'
,
'max'
=>
30
],
[[
'HY_CODE'
,
'STATUS'
,
'BRANCH_NAME'
],
'string'
,
'max'
=>
30
],
[[
'COMP_TEXT'
,
'SALESDIST_TEXT'
,
'ZCBZIRK_TEXT'
],
'string'
,
'max'
=>
200
],
[[
'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
'
,
'
CODE'
,
'DESCRIPTION'
,
'CONTACT_NAME'
,
'PHONE'
,
'NAME'
,
'LAT'
,
'LNG'
,
'IS_DELIVERY'
,
'DELIVERY_TIME'
,
'WORK_TIME'
,
'IS_CARE'
,
'IS_RESERV
'
,
'IS_
BRANCH_SELF_MENTION'
,
'IS_BRANCH_EXPRESS_DELIVERY'
,
'IS_DELIVERS_GOODS'
,
'IS_EXPRESS_DELIVERY'
,
'IS_BRANCH_SELF_DELIVERY
'
,
'IS_
O2O'
,
'IS_BOIL_MEDICINE'
,
'IS_POINTS_SHOP'
,
'IS_VIRTUAL_BRANCH'
,
'IS_DELIVERY_CODECHAIN_GOODS'
,
'IS_SHELVE
'
,
'IS_
HAFL_HOUR_DELIVERY'
,
'IS_ONE_HOUR_DELIVERY'
,
'IS_TWO_HOUR_DELIVERY'
,
'IS_DAY_DELIVERY'
],
'required'
,
'on'
=>
[
'import'
]
,
'message'
=>
'{attribute}不能为空'
]
,
'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'
[[
'DESCRIPTION'
,
'NAME'
],
'string'
,
'max'
=>
100
,
'on'
=>
[
'import'
],
'tooLong'
=>
'最大长度不能超过100
'
],
],
'required'
,
'on'
=>
[
'import'
],
'message'
=>
'{attribute}不能为空
'
],
[[
'
CONTACT_NAME'
,
'PHONE'
,
'DELIVERY_TIME'
,
'WORK_TIME'
,
'LAT'
,
'LNG'
],
'string'
,
'max'
=>
50
,
'on'
=>
[
'import'
],
'tooLong'
=>
'{attribute}最大长度不能超过5
0'
],
[[
'
DESCRIPTION'
,
'NAME'
],
'string'
,
'max'
=>
100
,
'on'
=>
[
'import'
],
'tooLong'
=>
'最大长度不能超过10
0'
],
[[
'IS_CARE'
,
'IS_DELIVERY'
,
'IS_RESERV'
,
'IS_O2O'
,
'IS_BOIL_MEDICINE'
,
'IS_POINTS_SHOP'
,
'IS_VIRTUAL_BRANCH'
,
[[
'CONTACT_NAME'
,
'PHONE'
,
'DELIVERY_TIME'
,
'WORK_TIME'
,
'LAT'
,
'LNG'
],
'string'
,
'max'
=>
50
,
'on'
=>
[
'import'
],
'tooLong'
=>
'{attribute}最大长度不能超过50'
],
'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_CARE'
,
'IS_DELIVERY'
,
'IS_RESERV'
,
'IS_O2O'
,
'IS_BOIL_MEDICINE'
,
'IS_POINTS_SHOP'
,
'IS_VIRTUAL_BRANCH'
,
'IS_DAY_DELIVERY'
],
'in'
,
'range'
=>
[
0
,
1
],
'on'
=>
[
'import'
],
'message'
=>
'{attribute}只能为0或1'
],
'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'
],
[[
'SERVICE_TYPE_CODE'
],
'validateEffective'
],
//如果影响性能就注释掉
[[
'SERVICE_TYPE_CODE'
],
'validateEffective'
],
//如果影响性能就注释掉
[[
'BRANCH_NAME'
,
'NAME'
,
'BRANCH_TYPE'
],
'required'
,
'on'
=>
[
self
::
SCENARIO_DCUPDATE
]],
[[
'BRANCH_NAME'
,
'NAME'
,
'BRANCH_TYPE'
],
'required'
,
'on'
=>
[
self
::
SCENARIO_DCUPDATE
]],
[[
'BRANCH_TYPE'
],
'in'
,
'range'
=>
[
1
,
2
],
'on'
=>
[
self
::
SCENARIO_DCUPDATE
]],
[[
'BRANCH_TYPE'
],
'in'
,
'range'
=>
[
1
,
2
],
'on'
=>
[
self
::
SCENARIO_DCUPDATE
]],
[[
'search'
],
'string'
,
'on'
=>
'search'
],
];
];
}
}
//验证服务类目的有效性
//验证服务类目的有效性
public
function
validateEffective
(
$attribute
){
public
function
validateEffective
(
$attribute
)
$importArr
=
explode
(
','
,
$this
->
$attribute
);
{
$importArr
=
explode
(
','
,
$this
->
$attribute
);
$codeArr
=
$this
::
find
()
$codeArr
=
$this
::
find
()
->
select
(
'CODE'
)
->
select
(
'CODE'
)
->
from
(
'SHOP_BRANCH_SERVICE_TYPE'
)
->
from
(
'SHOP_BRANCH_SERVICE_TYPE'
)
...
@@ -169,9 +178,9 @@ class ShopBranch extends BaseModel
...
@@ -169,9 +178,9 @@ class ShopBranch extends BaseModel
foreach
(
$codeArr
as
$value
)
{
foreach
(
$codeArr
as
$value
)
{
$tempArr
[]
=
$value
[
'CODE'
];
$tempArr
[]
=
$value
[
'CODE'
];
}
}
$diff
=
array_diff
(
$importArr
,
$tempArr
);
$diff
=
array_diff
(
$importArr
,
$tempArr
);
if
(
!
empty
(
$diff
))
{
if
(
!
empty
(
$diff
))
{
$this
->
addError
(
$attribute
,
'服务类目CODE为'
.
implode
(
','
,
$diff
)
.
'不存在.'
);
$this
->
addError
(
$attribute
,
'服务类目CODE为'
.
implode
(
','
,
$diff
)
.
'不存在.'
);
}
}
}
}
/**
/**
...
@@ -259,8 +268,8 @@ class ShopBranch extends BaseModel
...
@@ -259,8 +268,8 @@ class ShopBranch extends BaseModel
{
{
return
$this
->
hasMany
(
ShopCityDistributionSetting
::
className
(),
[
'BRANCH_GUID'
=>
'GUID'
]);
return
$this
->
hasMany
(
ShopCityDistributionSetting
::
className
(),
[
'BRANCH_GUID'
=>
'GUID'
]);
}
}
/**
/**
* 查询门店列表
* 查询门店列表
* @params array $params 查询参数数组
* @params array $params 查询参数数组
* @return array|null 返回查询结果
* @return array|null 返回查询结果
...
@@ -270,7 +279,7 @@ class ShopBranch extends BaseModel
...
@@ -270,7 +279,7 @@ class ShopBranch extends BaseModel
$query
=
static
::
find
()
->
alias
(
'sb'
)
$query
=
static
::
find
()
->
alias
(
'sb'
)
->
select
(
"sb.GUID,sb.NAME,sb.CONTACT_NAME,sb.PARENT_GUID,sb.CODE,sb.ADDRESS,sb.PHONE,sb.LAT,
->
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.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,
// ->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.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" )
// sb.`ADDRESS`) as DETAIL_ADDRESS,sb.IS_CARE" )
...
@@ -301,7 +310,7 @@ class ShopBranch extends BaseModel
...
@@ -301,7 +310,7 @@ class ShopBranch extends BaseModel
}
}
//门店名称或编码
//门店名称或编码
if
(
isset
(
$params
[
'CODE'
]))
{
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'
]))
{
if
(
isset
(
$params
[
'RECIVER_PROVINCE'
]))
{
...
@@ -316,9 +325,9 @@ class ShopBranch extends BaseModel
...
@@ -316,9 +325,9 @@ class ShopBranch extends BaseModel
$query
->
andfilterWhere
([
'like'
,
'sb.RECIVER_REGION'
,
$params
[
'RECIVER_REGION'
]]);
$query
->
andfilterWhere
([
'like'
,
'sb.RECIVER_REGION'
,
$params
[
'RECIVER_REGION'
]]);
}
}
//门店guid 权限
//门店guid 权限
if
(
isset
(
$params
[
'where_branch'
])
&&
!
empty
(
$params
[
'where_branch'
]))
{
if
(
isset
(
$params
[
'where_branch'
])
&&
!
empty
(
$params
[
'where_branch'
]))
{
$branch_arr
=
explode
(
','
,
$params
[
'where_branch'
]);
$branch_arr
=
explode
(
','
,
$params
[
'where_branch'
]);
$query
->
andfilterWhere
([
'sb.GUID'
=>
$branch_arr
]);
$query
->
andfilterWhere
([
'sb.GUID'
=>
$branch_arr
]);
}
}
return
new
ActiveDataProvider
([
return
new
ActiveDataProvider
([
...
@@ -344,25 +353,25 @@ class ShopBranch extends BaseModel
...
@@ -344,25 +353,25 @@ class ShopBranch extends BaseModel
->
select
(
'GUID,NAME,CODE,LICENCE_IMAGE_PATH,RECIVER_PROVINCE,RECIVER_CITY,RECIVER_REGION,ADDRESS,PARENT_GUID,
->
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,
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'
)
IS_O2O,IS_DELIVERY_CODECHAIN_GOODS,IS_SHELVE,WORK_TIME,DELIVERY_TIME,TRANSPORT_TYPE,RETURN_ADDRESS'
)
->
where
([
'GUID'
=>
$GUID
])
->
where
([
'GUID'
=>
$GUID
])
->
asArray
()
->
asArray
()
->
one
();
->
one
();
return
$query
;
return
$query
;
}
}
//获取门店(权限下的)
//获取门店(权限下的)
public
function
GetBranch
(
$GUID
,
$SUPPROVINCE_GUID
)
public
function
GetBranch
(
$GUID
,
$SUPPROVINCE_GUID
)
{
{
$query
=
static
::
find
()
$query
=
static
::
find
()
->
select
(
'GUID,SUPPROVINCE_GUID'
)
->
select
(
'GUID,SUPPROVINCE_GUID'
)
->
where
([
'GUID'
=>
$GUID
])
->
where
([
'GUID'
=>
$GUID
])
->
andWhere
([
'like'
,
'SUPPROVINCE_GUID'
,
$SUPPROVINCE_GUID
])
->
andWhere
([
'like'
,
'SUPPROVINCE_GUID'
,
$SUPPROVINCE_GUID
])
->
asArray
()
->
asArray
()
->
one
();
->
one
();
return
$query
;
return
$query
;
}
}
/**
/**
* 查询DC列表
* 查询DC列表
* @params array $params 查询参数数组
* @params array $params 查询参数数组
* @return array|null 返回查询结果
* @return array|null 返回查询结果
...
@@ -371,29 +380,77 @@ class ShopBranch extends BaseModel
...
@@ -371,29 +380,77 @@ class ShopBranch extends BaseModel
{
{
//根据条件查询门店
//根据条件查询门店
$branch_query
=
ShopBranch
::
find
()
->
alias
(
'sb'
)
$branch_query
=
ShopBranch
::
find
()
->
alias
(
'sb'
)
->
select
(
"vwb.PROVINCE,vwb.CITY,vwb.REGION,sb.NAME,sb.PHONE,sb.GUID,sb.LAT,sb.LNG,sb.CODE,sb.ADDRESS"
)
->
select
(
"vwb.PROVINCE,vwb.CITY,vwb.REGION,sb.NAME,sb.PHONE,sb.GUID,sb.LAT,sb.LNG,sb.CODE,sb.ADDRESS"
)
->
leftJoin
(
'VW_BRANCH_ADDRESS vwb'
,
'vwb.GUID=sb.GUID'
)
->
leftJoin
(
'VW_BRANCH_ADDRESS vwb'
,
'vwb.GUID=sb.GUID'
)
->
asArray
();
->
asArray
();
//门店名称或编码
//门店名称或编码
if
(
isset
(
$params
[
'code'
]))
{
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'
]))
{
if
(
isset
(
$params
[
'province'
]))
{
$branch_query
->
andfilterWhere
([
'sb.RECIVER_PROVINCE'
=>
$params
[
'province'
]]);
$branch_query
->
andfilterWhere
([
'sb.RECIVER_PROVINCE'
=>
$params
[
'province'
]]);
}
}
if
(
isset
(
$params
[
'city'
]))
{
if
(
isset
(
$params
[
'city'
]))
{
$branch_query
->
andfilterWhere
([
'sb.RECIVER_CITY'
=>
$params
[
'city'
]]);
$branch_query
->
andfilterWhere
([
'sb.RECIVER_CITY'
=>
$params
[
'city'
]]);
}
}
if
(
isset
(
$params
[
'region'
]))
{
if
(
isset
(
$params
[
'region'
]))
{
$branch_query
->
andfilterWhere
([
'sb.RECIVER_REGION'
=>
$params
[
'region'
]]);
$branch_query
->
andfilterWhere
([
'sb.RECIVER_REGION'
=>
$params
[
'region'
]]);
}
}
//DC类型
//DC类型
if
(
isset
(
$params
[
'dcType'
]))
{
if
(
isset
(
$params
[
'dcType'
]))
{
$branch_query
->
andfilterWhere
([
'sb.BRANCH_TYPE'
=>
$params
[
'dcType'
]]);
$branch_query
->
andfilterWhere
([
'sb.BRANCH_TYPE'
=>
$params
[
'dcType'
]]);
}
else
{
}
else
{
$branch_query
->
andfilterWhere
([
'in'
,
'BRANCH_TYPE'
,[
0
,
1
,
2
]]);
$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'
];
}
}
return
$branch_query
;
$dataProvider
->
setModels
(
$temp
);
return
$dataProvider
;
}
}
}
}
backend/models/v1/transport/ShopPackagingcostsBranches.php
View file @
1dd9be5f
...
@@ -33,10 +33,10 @@ class ShopPackagingcostsBranches extends \app\models\v1\BaseModel
...
@@ -33,10 +33,10 @@ class ShopPackagingcostsBranches extends \app\models\v1\BaseModel
public
function
rules
()
public
function
rules
()
{
{
return
[
return
[
[[
'GUID'
],
'required'
],
[[
'GUID'
],
'required'
,
'on'
=>
[
'creation'
]
],
[[
'CREATE_TIME'
],
'safe'
],
[[
'CREATE_TIME'
],
'safe'
],
[[
'GUID'
,
'ORG_GUID'
,
'ACTIVITY_GUID'
,
'BRANCH_GUID'
,
'ACTIVITY_TYPE'
,
'YGROUP_CODE'
],
'string'
,
'max'
=>
50
],
[[
'GUID'
,
'ORG_GUID'
,
'ACTIVITY_GUID'
,
'BRANCH_GUID'
,
'ACTIVITY_TYPE'
,
'YGROUP_CODE'
],
'string'
,
'max'
=>
50
],
[[
'GUID'
],
'unique'
],
[[
'GUID'
],
'unique'
,
'on'
=>
[
'creation'
]
],
];
];
}
}
...
...
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