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
40c2ae78
Commit
40c2ae78
authored
Dec 13, 2019
by
孙磊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
导入优化
Signed-off-by:
sunlei
<
sunlei@romens.cn
>
parent
1d5c1244
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
18 deletions
+35
-18
BranchServiceTypeController.php
...end/controllers/v1/branch/BranchServiceTypeController.php
+5
-1
TransportInitialPriceController.php
...trollers/v1/transport/TransportInitialPriceController.php
+30
-17
No files found.
backend/controllers/v1/branch/BranchServiceTypeController.php
View file @
40c2ae78
...
...
@@ -251,7 +251,7 @@ class BranchServiceTypeController extends BaseController
*/
public
function
actionBranchServiceImport
()
{
$model
=
new
UploadFiles
();
$model
=
new
UploadFiles
(
[
'xlsx'
,
'xls'
]
);
if
(
Yii
::
$app
->
request
->
isPost
)
{
//多文件用getInstances
$model
->
uploadFiles
=
UploadedFile
::
getInstance
(
$model
,
'uploadFile'
);
...
...
@@ -298,6 +298,10 @@ class BranchServiceTypeController extends BaseController
throw
$e
;
}
}
else
{
Yii
::
$app
->
response
->
statusCode
=
422
;
if
(
$fileInfo
[
'INFO'
][
'uploadFiles'
][
0
]
==
"类型不对"
)
{
$fileInfo
[
'INFO'
][
'uploadFiles'
][
0
]
=
'文件类型要求97-2003工作簿 xls格式!'
;
}
return
$fileInfo
[
'INFO'
];
}
}
...
...
backend/controllers/v1/transport/TransportInitialPriceController.php
View file @
40c2ae78
...
...
@@ -168,7 +168,7 @@ class TransportInitialPriceController extends BaseController
*/
public
function
actionInitialPriceImport
()
{
$model
=
new
UploadFiles
();
$model
=
new
UploadFiles
(
[
'xlsx'
,
'xls'
]
);
if
(
Yii
::
$app
->
request
->
isPost
)
{
//多文件用getInstances
$model
->
uploadFiles
=
UploadedFile
::
getInstance
(
$model
,
'uploadFile'
);
...
...
@@ -179,6 +179,15 @@ class TransportInitialPriceController extends BaseController
// 文件上传成功
$rows
=
Helper
::
newSpreadsheet
(
$fileInfo
[
'INFO'
][
0
])
->
getRows
();
$tempArr
=
array_slice
(
$rows
,
2
);
//批量验证门店
$branchModel
=
new
ShopBranch
();
$branch_info
=
$branchModel
->
validateBranch
(
$tempArr
,
0
);
//若不存在的门店 则返回相关信息
if
(
isset
(
$branch_info
[
'CODE'
]))
{
@
unlink
(
$fileInfo
[
'INFO'
][
0
]);
Yii
::
$app
->
response
->
statusCode
=
422
;
return
$branch_info
[
'list'
];
}
$citydisregion
=
new
$this
->
modelClass
();
$citydisregion
->
scenario
=
'import'
;
$transaction
=
$citydisregion
->
getDb
()
->
beginTransaction
();
...
...
@@ -189,24 +198,24 @@ class TransportInitialPriceController extends BaseController
$_citydisregion
=
$citydisregion
->
getBranchInitialPrice
(
''
,
$CS_BRANCH_GUID
);
// $_citydisregion = $citydisregion->getBranchInitialPrice('', 003);
//权限信息
$rbac
=
new
ShopRbacUser
();
$userGuid
=
Yii
::
$app
->
user
->
identity
->
GUID
;
$userinfo
=
$rbac
->
getRbacUserInfo
(
$userGuid
);
//
$rbac = new ShopRbacUser();
//
$userGuid = Yii::$app->user->identity->GUID;
//
$userinfo = $rbac->getRbacUserInfo($userGuid);
//return $userinfo;
//判断当前账号是省级还是门店还是总部
if
(
$userinfo
[
'ROLE_ID'
]
==
USER_ROLE_REGION_ADMIN
)
{
//如果是省级,查询出该门店是否是该省级下的
$branchModel
=
new
ShopBranch
();
$isbrancharr
=
$branchModel
->
GetBranch
(
$CS_BRANCH_GUID
,
$userinfo
[
'BRANCH_GUID'
]);
// $isbrancharr = $branchModel->GetBranch(003, 003);
if
(
!
$isbrancharr
)
{
continue
;
}
}
else
if
(
$userinfo
[
'ROLE_ID'
]
==
USER_ROLE_STORE_ADMIN
)
{
//如果是门店
if
(
$userinfo
[
'BRANCH_GUID'
]
!=
$CS_BRANCH_GUID
)
{
continue
;
}
}
//
if ($userinfo['ROLE_ID'] == USER_ROLE_REGION_ADMIN) {
//
//如果是省级,查询出该门店是否是该省级下的
//
$branchModel = new ShopBranch();
//
$isbrancharr = $branchModel->GetBranch($CS_BRANCH_GUID, $userinfo['BRANCH_GUID']);
//
// $isbrancharr = $branchModel->GetBranch(003, 003);
//
if (!$isbrancharr) {
//
continue;
//
}
//
} else if ($userinfo['ROLE_ID'] == USER_ROLE_STORE_ADMIN) { //如果是门店
//
if ($userinfo['BRANCH_GUID'] != $CS_BRANCH_GUID) {
//
continue;
//
}
//
}
//修改已有的起送价设置
if
(
!
$list
=
$_citydisregion
->
getModels
())
{
continue
;
...
...
@@ -237,6 +246,10 @@ class TransportInitialPriceController extends BaseController
throw
$e
;
}
}
else
{
Yii
::
$app
->
response
->
statusCode
=
422
;
if
(
$fileInfo
[
'INFO'
][
'uploadFiles'
][
0
]
==
"类型不对"
)
{
$fileInfo
[
'INFO'
][
'uploadFiles'
][
0
]
=
'文件类型要求97-2003工作簿 xls格式!'
;
}
return
$fileInfo
[
'INFO'
];
}
}
...
...
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