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
d14e7516
Commit
d14e7516
authored
Dec 26, 2019
by
孙磊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
变量规范
Signed-off-by:
sunlei
<
sunlei@romens.cn
>
parent
aac74497
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
63 additions
and
63 deletions
+63
-63
AuthorityNodeController.php
backend/controllers/v1/authority/AuthorityNodeController.php
+10
-10
AuthorityRoleController.php
backend/controllers/v1/authority/AuthorityRoleController.php
+5
-5
BranchController.php
backend/controllers/v1/branch/BranchController.php
+18
-18
ImportGoodsInfoController.php
...nd/controllers/v1/shopgoods/ImportGoodsInfoController.php
+22
-22
ShopBranchService.php
backend/models/v1/branch/ShopBranchService.php
+4
-4
shopGoodsBrand.php
backend/models/v1/shopgoods/shopGoodsBrand.php
+2
-2
shopGoodsProperty.php
backend/models/v1/shopgoods/shopGoodsProperty.php
+2
-2
No files found.
backend/controllers/v1/authority/AuthorityNodeController.php
View file @
d14e7516
...
...
@@ -336,20 +336,20 @@ class AuthorityNodeController extends BaseController
//获取登陆用户节点信息
$userGuid
=
Yii
::
$app
->
user
->
identity
->
GUID
;
$userinfo
=
$rbac
->
getRbacUserInfo
(
$userGuid
);
$cur
_role_i
d
=
$userinfo
[
'ROLE_ID'
];
$cur
_auth_all
=
$roleAcessModel
->
getRoleAuthorities
(
$cur_role_i
d
);
if
(
!
$cur
_auth_a
ll
)
{
$cur
RoleI
d
=
$userinfo
[
'ROLE_ID'
];
$cur
AuthAll
=
$roleAcessModel
->
getRoleAuthorities
(
$curRoleI
d
);
if
(
!
$cur
AuthA
ll
)
{
throw
new
BadRequestHttpException
(
'没有找到登陆用户的权限信息,请核查'
);
}
//获取登陆用户节点ID
$cur
_role_n
odes
=
array
();
foreach
(
$cur
_auth_a
ll
as
$k
=>
$v
)
{
$cur
_role_n
odes
[]
=
$v
[
'NODE_ID'
];
$cur
RoleN
odes
=
array
();
foreach
(
$cur
AuthA
ll
as
$k
=>
$v
)
{
$cur
RoleN
odes
[]
=
$v
[
'NODE_ID'
];
}
if
(
$cur
_role_n
odes
)
{
$cur
_role_authorities
=
$nodeModel
->
getRoleAuthrities
(
$cur_role_n
odes
);
if
(
$cur
RoleN
odes
)
{
$cur
RoleAuthorities
=
$nodeModel
->
getRoleAuthrities
(
$curRoleN
odes
);
}
else
{
$cur
_role_a
uthorities
=
''
;
$cur
RoleA
uthorities
=
''
;
}
//每个角色拥有的节点信息获取
$params
=
Yii
::
$app
->
request
->
queryParams
;
...
...
@@ -375,7 +375,7 @@ class AuthorityNodeController extends BaseController
}
//拼装数组
$roleNodeInfo
=
array
(
'cur_role_nodes'
=>
$cur
_role_a
uthorities
,
'cur_role_nodes'
=>
$cur
RoleA
uthorities
,
'every_role_node_ids'
=>
$roleHasAuthInfo
,
'every_role_name'
=>
$name
);
...
...
backend/controllers/v1/authority/AuthorityRoleController.php
View file @
d14e7516
...
...
@@ -202,14 +202,14 @@ class AuthorityRoleController extends BaseController
}
$nodes_arr
=
explode
(
','
,
$params
[
'NODE_ID'
]);
//拼装信息
$role
_a
ccess
=
array
();
$role
A
ccess
=
array
();
foreach
(
$nodes_arr
as
$k
=>
$v
)
{
$role
_a
ccess
[
$k
][
'ROLE_ID'
]
=
$params
[
'ROLE_ID'
];
$role
_a
ccess
[
$k
][
'NODE_ID'
]
=
$v
;
$role
_a
ccess
[
$k
][
'ORG_GUID'
]
=
Yii
::
$app
->
user
->
identity
->
ORG_GUID
;
$role
A
ccess
[
$k
][
'ROLE_ID'
]
=
$params
[
'ROLE_ID'
];
$role
A
ccess
[
$k
][
'NODE_ID'
]
=
$v
;
$role
A
ccess
[
$k
][
'ORG_GUID'
]
=
Yii
::
$app
->
user
->
identity
->
ORG_GUID
;
}
//保存信息
foreach
(
$role
_a
ccess
as
$attributes
)
{
foreach
(
$role
A
ccess
as
$attributes
)
{
$_model
=
clone
$model
;
$_model
->
setAttributes
(
$attributes
);
if
(
!
$_model
->
save
())
{
...
...
backend/controllers/v1/branch/BranchController.php
View file @
d14e7516
...
...
@@ -111,8 +111,8 @@ class BranchController extends BaseController
{
$model
=
new
$this
->
modelClass
();
$params
=
Yii
::
$app
->
request
->
queryParams
;
$branch
_s
ervice
=
new
ShopBranchService
();
$branch
_service_t
ype
=
new
BranchServiceType
();
$branch
S
ervice
=
new
ShopBranchService
();
$branch
ServiceT
ype
=
new
BranchServiceType
();
$model
->
attributes
=
$params
;
if
(
$model
->
validate
())
{
...
...
@@ -122,24 +122,24 @@ class BranchController extends BaseController
throw
new
BadRequestHttpException
(
'未找到符合的门店列表信息'
);
}
//获取门店服务类目关系信息
$branch
_service_relation
=
$branch_s
ervice
->
BranchSeviceRelation
(
$params
[
'GUID'
]);
$branch
ServiceRelation
=
$branchS
ervice
->
BranchSeviceRelation
(
$params
[
'GUID'
]);
//获取门店服务类目名称
if
(
$branch
_service_r
elation
)
{
foreach
(
$branch
_service_r
elation
as
$k
=>
$v
)
{
$branch
_s_type
=
$branch_service_t
ype
->
BranchServiceInfo
(
''
,
''
,
$v
[
'SERVICE_TYPE_GUID'
]);
$branch
_ser_type
=
$branch_s_t
ype
->
getModels
();
if
(
$branch
ServiceR
elation
)
{
foreach
(
$branch
ServiceR
elation
as
$k
=>
$v
)
{
$branch
SType
=
$branchServiceT
ype
->
BranchServiceInfo
(
''
,
''
,
$v
[
'SERVICE_TYPE_GUID'
]);
$branch
SerType
=
$branchST
ype
->
getModels
();
//获取服务类目信息
if
(
$branch
_ser_t
ype
)
{
$branch
_service_relation
[
$k
][
'BRANCH_SERVICE_TYPE_NAME'
]
=
$branch_ser_t
ype
[
0
][
'NAME'
];
// unset($branch
_service_r
elation[$k]['GUID']);
// unset($branch
_service_r
elation[$k]['BRANCH_GUID']);
if
(
$branch
SerT
ype
)
{
$branch
ServiceRelation
[
$k
][
'BRANCH_SERVICE_TYPE_NAME'
]
=
$branchSerT
ype
[
0
][
'NAME'
];
// unset($branch
ServiceR
elation[$k]['GUID']);
// unset($branch
ServiceR
elation[$k]['BRANCH_GUID']);
}
else
{
$branch
_service_r
elation
[
$k
][
'SERVICE_TYPE_GUID'
]
=
''
;
$branch
_service_r
elation
[
$k
][
'BRANCH_SERVICE_TYPE_NAME'
]
=
''
;
$branch
ServiceR
elation
[
$k
][
'SERVICE_TYPE_GUID'
]
=
''
;
$branch
ServiceR
elation
[
$k
][
'BRANCH_SERVICE_TYPE_NAME'
]
=
''
;
}
}
}
$info
[
'BRANCH_SERVICE_TYPE'
]
=
$branch
_service_r
elation
;
$info
[
'BRANCH_SERVICE_TYPE'
]
=
$branch
ServiceR
elation
;
return
$info
;
}
else
{
//验证失败:$errors 是一个包含错误信息的数组
...
...
@@ -356,7 +356,7 @@ class BranchController extends BaseController
$rbac
=
new
ShopRbacUser
();
$userGuid
=
Yii
::
$app
->
user
->
identity
->
GUID
;
$userinfo
=
$rbac
->
getRbacUserInfo
(
$userGuid
);
$auth
_r
ole
=
$userinfo
[
'ROLE_ID'
];
$auth
R
ole
=
$userinfo
[
'ROLE_ID'
];
$model
=
new
$this
->
modelClass
();
$SUPPROVINCE_GUID
=
$model
->
SUPPROVINCE_GUID
=
Yii
::
$app
->
request
->
get
(
'SUPPROVINCE_GUID'
);
...
...
@@ -367,7 +367,7 @@ class BranchController extends BaseController
if
(
!
$info
)
{
throw
new
BadRequestHttpException
(
'未找到符合的门店区域信息'
);
}
$info
[
0
][
'ROLE_ID'
]
=
$auth
_r
ole
;
$info
[
0
][
'ROLE_ID'
]
=
$auth
R
ole
;
return
$info
;
}
else
{
//验证失败:$errors 是一个包含错误信息的数组
...
...
@@ -395,7 +395,7 @@ class BranchController extends BaseController
$rbac
=
new
ShopRbacUser
();
$userGuid
=
Yii
::
$app
->
user
->
identity
->
GUID
;
$userinfo
=
$rbac
->
getRbacUserInfo
(
$userGuid
);
$auth
_r
ole
=
$userinfo
[
'ROLE_ID'
];
$auth
R
ole
=
$userinfo
[
'ROLE_ID'
];
$model
=
new
$this
->
modelClass
();
$SUPPROVINCE_GUID
=
$model
->
SUPPROVINCE_GUID
=
Yii
::
$app
->
request
->
get
(
'SUPPROVINCE_GUID'
);
...
...
@@ -406,7 +406,7 @@ class BranchController extends BaseController
if
(
!
$info
)
{
throw
new
BadRequestHttpException
(
'未找到符合的门店区域信息'
);
}
$info
[
0
][
'ROLE_ID'
]
=
$auth
_r
ole
;
$info
[
0
][
'ROLE_ID'
]
=
$auth
R
ole
;
return
$info
;
}
else
{
//验证失败:$errors 是一个包含错误信息的数组
...
...
backend/controllers/v1/shopgoods/ImportGoodsInfoController.php
View file @
d14e7516
...
...
@@ -67,21 +67,21 @@ class ImportGoodsInfoController extends BaseController
$subsidiaryModel
=
new
ShopGoodsSubsidiary
();
$ORG_GUID
=
Yii
::
$app
->
user
->
identity
->
ORG_GUID
;
//图片相关
$host
_n
ame
=
YUNUO_YUN_URL
;
$pic
_e
xt
=
PIC_EXTENSIONS
;
$host
N
ame
=
YUNUO_YUN_URL
;
$pic
E
xt
=
PIC_EXTENSIONS
;
//批量处理商品标签、品牌
$all
_t
ag
=
array
();
$all
_b
rand
=
array
();
$all
T
ag
=
array
();
$all
B
rand
=
array
();
foreach
(
$tempArr
as
$k
=>
$v
)
{
$all
_b
rand
[]
=
$v
[
3
];
$all
_t
ag
[]
=
$v
[
18
];
$all
B
rand
[]
=
$v
[
3
];
$all
T
ag
[]
=
$v
[
18
];
}
//查看商品品牌表是否有值,没有则添加
if
(
$all
_b
rand
)
{
$goods
_brand_info
=
$brandModel
->
validateBrand
(
$all_b
rand
);
if
(
$all
B
rand
)
{
$goods
BrandInfo
=
$brandModel
->
validateBrand
(
$allB
rand
);
//存在则添加
if
(
$goods
_brand_i
nfo
)
{
foreach
(
$goods
_brand_i
nfo
as
$k
=>
$v
)
{
if
(
$goods
BrandI
nfo
)
{
foreach
(
$goods
BrandI
nfo
as
$k
=>
$v
)
{
$_brandModel
=
clone
$brandModel
;
$_brandModel
->
GUID
=
Func
::
create_guid
();
$_brandModel
->
ORG_GUID
=
$ORG_GUID
;
...
...
@@ -94,12 +94,12 @@ class ImportGoodsInfoController extends BaseController
}
}
//查看商品标签表是否有值,没有则添加
if
(
$all
_t
ag
)
{
foreach
(
$all
_t
ag
as
$k
=>
$v
)
{
if
(
$all
T
ag
)
{
foreach
(
$all
T
ag
as
$k
=>
$v
)
{
$v
=
preg_replace
(
"/,/"
,
","
,
$v
);
$all
_t
ag
[
$k
]
=
explode
(
','
,
$v
);
$all
T
ag
[
$k
]
=
explode
(
','
,
$v
);
}
$setgoodstag
=
$propertyModel
->
validateProperty
(
$all
_t
ag
);
$setgoodstag
=
$propertyModel
->
validateProperty
(
$all
T
ag
);
//存在则添加
if
(
$setgoodstag
)
{
foreach
(
$setgoodstag
as
$val
)
{
...
...
@@ -181,8 +181,8 @@ class ImportGoodsInfoController extends BaseController
$_shopModel
->
BRAND_GUID
=
$brandInfo
[
0
][
'GUID'
];
}
//添加或更新
$_shopModel
->
HOST_NAME
=
$host
_n
ame
;
//图品域名
$_shopModel
->
PIC_EXTENSIONS
=
$pic
_e
xt
;
//图品后缀
$_shopModel
->
HOST_NAME
=
$host
N
ame
;
//图品域名
$_shopModel
->
PIC_EXTENSIONS
=
$pic
E
xt
;
//图品后缀
$_shopModel
->
CODE
=
$value
[
0
];
//商品编码
$_shopModel
->
NAME
=
$value
[
1
];
//药品名
$_shopModel
->
APPROVAL_NUMBER
=
$value
[
2
];
//批准文号
...
...
@@ -367,9 +367,9 @@ class ImportGoodsInfoController extends BaseController
$fileLoadPath
=
$supCompanyGuid
.
'/'
.
$value
[
0
]
.
'/'
.
$value
[
0
];
//条件验证
if
(
$value
[
3
]
==
1
)
{
$host
_n
ame
=
YUNUO_YUN_URL
;
$host
N
ame
=
YUNUO_YUN_URL
;
$picFilePath
=
$fileLoadPath
.
'-1.jpg'
;
$imgUrl
=
$host
_n
ame
.
$picFilePath
;
$imgUrl
=
$host
N
ame
.
$picFilePath
;
$value
[
3
]
=
$imgUrl
;
//商品图片
}
else
{
$value
[
3
]
=
''
;
...
...
@@ -433,7 +433,7 @@ class ImportGoodsInfoController extends BaseController
$_attachModel
->
GOODS_CODE
=
$value
[
0
];
//商品编码
$_attachModel
->
GOODS_TITLE
=
$value
[
1
];
//商品标题
$_attachModel
->
GOODS_ABSTRACT
=
$value
[
2
];
//商品摘要
$_attachModel
->
HOST_NAME
=
$host
_n
ame
;
//商品图片 域名
$_attachModel
->
HOST_NAME
=
$host
N
ame
;
//商品图片 域名
$_attachModel
->
URI
=
$value
[
3
];
//商品图片 路径
$_attachModel
->
TRANSPORT_TYPE
=
$value
[
5
];
//配送方式
$_attachModel
->
STOCK_REDUCE_TYPE
=
$value
[
6
];
//支付前减库存
...
...
@@ -498,7 +498,7 @@ class ImportGoodsInfoController extends BaseController
public
function
BatchUpdateGoodsExteninfo
(
$GoodAttachGuid
,
$AttachInfoNum
,
$goodCode
)
{
$ORG_GUID
=
Yii
::
$app
->
user
->
identity
->
ORG_GUID
;
$host
_n
ame
=
YUNUO_YUN_URL
;
$host
N
ame
=
YUNUO_YUN_URL
;
//先删除原有 子图信息
$SAttachModel
=
new
ShopSAttach
();
$SAttachModel
->
deleteByGoodsGuid
(
$GoodAttachGuid
);
...
...
@@ -514,14 +514,14 @@ class ImportGoodsInfoController extends BaseController
$fileLoadPath
=
$supCompanyGuid
.
'/'
.
$goodCode
.
'/'
.
$goodCode
.
'-'
;
for
(
$i
=
2
;
$i
<=
$AttachInfoNum
;
$i
++
)
{
$imgsNewId
=
Func
::
create_guid
();
// $filePath = $host
_n
ame . $fileLoadPath . $i . '.jpg';
// $filePath = $host
N
ame . $fileLoadPath . $i . '.jpg';
$filesPath
=
$fileLoadPath
.
$i
.
'.jpg'
;
//验证
$_SAttachModel
=
clone
$SAttachModel
;
$_SAttachModel
->
GUID
=
$imgsNewId
;
$_SAttachModel
->
ORG_GUID
=
$ORG_GUID
;
$_SAttachModel
->
GOODS_GUID
=
$GoodAttachGuid
;
$_SAttachModel
->
HOST_NAME
=
$host
_n
ame
;
$_SAttachModel
->
HOST_NAME
=
$host
N
ame
;
$_SAttachModel
->
URI
=
$filesPath
;
$_SAttachModel
->
ORDER_INDEX
=
(
string
)
$i
;
$_SAttachModel
->
TYPE
=
1
;
...
...
backend/models/v1/branch/ShopBranchService.php
View file @
d14e7516
...
...
@@ -55,19 +55,19 @@ class ShopBranchService extends BaseModel
//删除门店原有服务类目
public
function
BranchServiceDel
(
$b_guid
)
{
$branch
_s
ervice
=
static
::
deleteAll
([
'BRANCH_GUID'
=>
$b_guid
]);
return
$branch
_s
ervice
;
$branch
S
ervice
=
static
::
deleteAll
([
'BRANCH_GUID'
=>
$b_guid
]);
return
$branch
S
ervice
;
}
//获取门店服务类目关系
public
function
BranchSeviceRelation
(
$b_guid
)
{
$branch
_s
ervice
=
static
::
find
()
$branch
S
ervice
=
static
::
find
()
->
select
(
'GUID,BRANCH_GUID,SERVICE_TYPE_GUID'
)
->
where
([
'STATE'
=>
1
])
->
andwhere
([
'BRANCH_GUID'
=>
$b_guid
])
->
asArray
()
->
all
();
return
$branch
_s
ervice
;
return
$branch
S
ervice
;
}
}
backend/models/v1/shopgoods/shopGoodsBrand.php
View file @
d14e7516
...
...
@@ -73,7 +73,7 @@ class ShopGoodsBrand extends BaseModel
/**
* 获取商品品牌是否存在
*/
public
function
validateBrand
(
$all
_b
rand
)
public
function
validateBrand
(
$all
B
rand
)
{
$query
=
static
::
find
()
->
select
(
'GUID,NAME'
)
...
...
@@ -81,7 +81,7 @@ class ShopGoodsBrand extends BaseModel
//获取所有品牌名
$brandsName
=
array_column
(
$query
,
'NAME'
);
$list
=
array
();
foreach
(
$all
_b
rand
as
$key
=>
$value
)
{
foreach
(
$all
B
rand
as
$key
=>
$value
)
{
if
(
!
in_array
(
$value
,
$brandsName
))
{
$list
[]
=
$value
;
}
...
...
backend/models/v1/shopgoods/shopGoodsProperty.php
View file @
d14e7516
...
...
@@ -57,7 +57,7 @@ class ShopGoodsProperty extends BaseModel
/**
* 获取商品标签信息
*/
public
function
validateProperty
(
$all
_t
ag
)
public
function
validateProperty
(
$all
T
ag
)
{
$query
=
static
::
find
()
->
select
(
'GUID,NAME'
)
...
...
@@ -65,7 +65,7 @@ class ShopGoodsProperty extends BaseModel
//获取所有标签名
$tagsName
=
array_column
(
$query
,
'NAME'
);
$list
=
array
();
foreach
(
$all
_t
ag
as
$key
=>
$value
)
{
foreach
(
$all
T
ag
as
$key
=>
$value
)
{
foreach
(
$value
as
$k
=>
$v
)
{
if
(
!
in_array
(
$v
,
$tagsName
))
{
$list
[]
=
$v
;
...
...
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