Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
meibuyu-rpc
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
without authentication
meibuyu-rpc
Commits
0f12d14e
Commit
0f12d14e
authored
Jun 11, 2020
by
jiangkebao
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of git.huaperfect.com:hwq/micro
parents
62eb3da4
3a163dec
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
38 additions
and
21 deletions
+38
-21
README.md
README.md
+3
-3
PermAnnotationAspect.php
src/Aspect/PermAnnotationAspect.php
+3
-2
MakeModelCommand.php
src/Command/MakeModelCommand.php
+3
-3
UploadManager.php
src/Manager/UploadManager.php
+2
-2
BaseInfoServiceInterface.php
src/Service/Interfaces/BaseInfoServiceInterface.php
+0
-1
PlatformProductServiceInterface.php
...ce/Interfaces/Product/PlatformProductServiceInterface.php
+5
-2
UserServiceInterface.php
src/Service/Interfaces/UserServiceInterface.php
+10
-0
ExcelImporter.php
src/Tools/ExcelImporter.php
+9
-5
Exporter.php
src/Tools/Exporter.php
+2
-2
functions.php
src/functions.php
+1
-1
No files found.
README.md
View file @
0f12d14e
...
...
@@ -26,7 +26,7 @@ composer require meibuyu/micro @dev
> 权限名会拼接env文件中的APP_NAME属性,请注意唯一性
> 所有权限必须存在于用户服务的权限表中,若不存在,请联系管理员添加权限
##### 1、@AutoPerm
在控制器头部添加@AutoPerm注解,为该控制器下所有的方法添加鉴权功能,生成的权限名为
`蛇形
命名空间_蛇形
控制名_蛇形方法名`
在控制器头部添加@AutoPerm注解,为该控制器下所有的方法添加鉴权功能,生成的权限名为
`蛇形控制名_蛇形方法名`
```
/**
* @AutoPerm()
...
...
@@ -34,7 +34,7 @@ composer require meibuyu/micro @dev
class UserInfoController {}
```
参数:
> 1. prefix, 前缀(字符串),默认为蛇形
命名空间_蛇形
控制名(user_info)
> 1. prefix, 前缀(字符串),默认为蛇形控制名(user_info)
> 2. exclude, 要排除的方法名(字符串数组),默认为空
```
/**
...
...
@@ -44,7 +44,7 @@ class UserInfoController {}
```
##### 2、@Perm
在控制器中的方法头部添加@Perm注解,为当前方法添加鉴权功能,生成权限名为
`蛇形
命名空间_蛇形
控制名_蛇形方法名`
在控制器中的方法头部添加@Perm注解,为当前方法添加鉴权功能,生成权限名为
`蛇形控制名_蛇形方法名`
```
/**
* @Perm()
...
...
src/Aspect/PermAnnotationAspect.php
View file @
0f12d14e
...
...
@@ -91,8 +91,9 @@ class PermAnnotationAspect extends AbstractAspect
protected
function
genPrefix
(
string
$className
)
:
string
{
$handledNamespace
=
Str
::
replaceFirst
(
'Controller'
,
''
,
Str
::
after
(
$className
,
'\\Controller\\'
));
$handledNamespace
=
str_replace
(
'\\'
,
'_'
,
$handledNamespace
);
$prefix
=
Str
::
snake
(
$handledNamespace
);
$namespaceLength
=
strrpos
(
$handledNamespace
,
'\\'
);
$prefix
=
$namespaceLength
?
substr
(
$handledNamespace
,
$namespaceLength
+
1
)
:
$handledNamespace
;
$prefix
=
Str
::
snake
(
$prefix
);
$prefix
=
str_replace
(
'__'
,
'_'
,
$prefix
);
return
$prefix
;
}
...
...
src/Command/MakeModelCommand.php
View file @
0f12d14e
...
...
@@ -377,7 +377,7 @@ class MakeModelCommand extends HyperfCommand
$relation
.=
"
\n\t
/**
\n\t
* 属于"
.
$v
[
'relation_model_name'
]
.
"的关联
\n\t
*/"
;
$relation
.=
"
\n\t
public function "
.
$v
[
'function'
]
.
"()"
;
$relation
.=
"
\n\t
{"
;
$relation
.=
"
\n\t\t
"
.
'return $this->belongsTo('
.
$v
[
'relation_model_name'
]
.
"::class
,'"
.
$v
[
'local_table_key'
]
.
"','
{
$v
[
'relation_table_key'
]
}
'
);"
;
$relation
.=
"
\n\t\t
"
.
'return $this->belongsTo('
.
$v
[
'relation_model_name'
]
.
"::class);"
;
$relation
.=
"
\n\t
}"
;
$properties
.=
" * @property "
.
$v
[
'relation_model_name'
]
.
" $"
.
$v
[
'function'
]
.
"
\n
"
;
}
...
...
@@ -390,7 +390,7 @@ class MakeModelCommand extends HyperfCommand
$relation
.=
"
\n\t
public function "
.
$v
[
'function'
]
.
"()"
;
$relation
.=
"
\n\t
{"
;
$relation
.=
"
\n\t\t
"
.
'return $this->belongsToMany('
.
$v
[
'relation_model_name'
]
.
"::class,'"
.
$v
[
'relation_table'
]
.
"'
,'
{
$v
[
'constraint_table_key'
]
}
','
{
$v
[
'local_table_key'
]
}
'
);"
;
.
$v
[
'relation_table'
]
.
"');"
;
$relation
.=
"
\n\t
}"
;
$properties
.=
" * @property "
.
$v
[
'relation_model_name'
]
.
"[] $"
.
$v
[
'function'
]
.
"
\n
"
;
}
...
...
@@ -402,7 +402,7 @@ class MakeModelCommand extends HyperfCommand
$relation
.=
"
\n\t
**/"
;
$relation
.=
"
\n\t
public function "
.
$v
[
'function'
]
.
"()"
;
$relation
.=
"
\n\t
{"
;
$relation
.=
"
\n\t\t
"
.
'return $this->hasMany('
.
$v
[
'relation_model_name'
]
.
"::class
,'"
.
$v
[
'relation_table_key'
]
.
"','"
.
$v
[
'local_table_key'
]
.
"'
);"
;
$relation
.=
"
\n\t\t
"
.
'return $this->hasMany('
.
$v
[
'relation_model_name'
]
.
"::class);"
;
$relation
.=
"
\n\t
}"
;
$properties
.=
" * @property "
.
$v
[
'relation_model_name'
]
.
"[] $"
.
$v
[
'function'
]
.
"
\n
"
;
}
...
...
src/Manager/UploadManager.php
View file @
0f12d14e
...
...
@@ -172,8 +172,8 @@ class UploadManager
*/
public
static
function
parsePath
(
$options
,
$documentRoot
)
{
if
(
isset
(
$options
[
'temp'
])
&&
$options
[
'temp'
]
&&
!
isset
(
$options
[
'path'
])
)
{
// 如果是临时文件,
且没有指定保存路径,
修改保存路径为临时路径
if
(
isset
(
$options
[
'temp'
])
&&
$options
[
'temp'
])
{
// 如果是临时文件,修改保存路径为临时路径
$options
[
'path'
]
=
'temp'
;
}
$path
=
$documentRoot
.
self
::
$pathPrefix
.
$options
[
'path'
]
.
'/'
.
date
(
'Y-m-d'
);
...
...
src/Service/Interfaces/BaseInfoServiceInterface.php
View file @
0f12d14e
...
...
@@ -137,5 +137,4 @@ interface BaseInfoServiceInterface
*/
public
function
sites
(
array
$relations
=
[],
array
$columns
=
[
'id'
,
"name"
])
:
array
;
}
src/Service/Interfaces/Product/PlatformProductServiceInterface.php
View file @
0f12d14e
...
...
@@ -14,7 +14,8 @@ interface PlatformProductServiceInterface
/**
* 获取单个数据
* @param int $id 平台产品id
* @param array $relations 平台产品的关联关系,支持:["status","product","amazon_warehouse","platform_product_children"]
* @param array $relations 平台产品的关联关系,
* 支持:["status","product","amazon_warehouse","platform_product_children","brand","category","ingredient","product_name","images","price_info","property"]
* @param array $columns 平台产品表的字段,默认全部字段
* ['id', 'sku', 'product_id', 'name', 'team_id', 'site_id', 'price', 'currency_id', 'platform_product_status_id', 'creator_id', 'asin', 'amazon_warehouse_id', 'info_completed']
* @return array|null
...
...
@@ -24,7 +25,8 @@ interface PlatformProductServiceInterface
/**
* 通过id列表获取平台产品数组
* @param array $idList 平台产品id的列表
* @param array $relations 平台产品的关联关系,支持["status","product","amazon_warehouse","platform_product_children"]
* @param array $relations 平台产品的关联关系,
* 支持:["status","product","amazon_warehouse","platform_product_children","brand","category","ingredient","product_name","images","price_info","property"]
* @param array $columns 平台产品表的字段,默认全部字段
* ['id', 'sku', 'product_id', 'name', 'team_id', 'site_id', 'price', 'currency_id', 'platform_product_status_id', 'creator_id', 'asin', 'amazon_warehouse_id', 'info_completed']
* @return array
...
...
@@ -37,4 +39,5 @@ interface PlatformProductServiceInterface
* @return array
*/
public
function
platformProductStatus
(
array
$columns
=
[
'id'
,
'name'
])
:
array
;
}
src/Service/Interfaces/UserServiceInterface.php
View file @
0f12d14e
...
...
@@ -97,4 +97,14 @@ interface UserServiceInterface
*/
public
function
getListWithLeader
(
int
$userId
,
array
$idList
=
[],
array
$columns
=
[
'id'
,
'name'
])
:
array
;
/**
* 更新用户考核方案
* @param $userId
* @param array $attributes
* 'review_users' => '1,2,3' // 点评人
* 'cc_person' => '1,2,3' // 抄送人
* @return int
*/
public
function
updateAssessmentPlan
(
$userId
,
array
$attributes
);
}
src/Tools/ExcelImporter.php
View file @
0f12d14e
...
...
@@ -55,7 +55,7 @@ class ExcelImporter
$this
->
config
=
container
(
ConfigInterface
::
class
);
$this
->
fileType
=
ucfirst
(
$file
->
getExtension
());
$this
->
rootPath
=
$this
->
config
->
get
(
'server.settings.document_root'
,
BASE_PATH
.
'/public'
);
$path
=
UploadManager
::
uploadExcelGetRealPath
(
$file
);
$path
=
UploadManager
::
uploadExcelGetRealPath
(
$file
,
[
'temp'
=>
true
]
);
$this
->
reader
=
IOFactory
::
createReaderForFile
(
$path
)
->
load
(
$path
);
$this
->
filePath
=
$path
;
$this
->
sheet
=
$this
->
reader
->
getSheet
(
$sheetIndex
);
...
...
@@ -141,9 +141,13 @@ class ExcelImporter
public
function
checkNumeric
(
$data
,
&
$errorCount
)
{
foreach
(
$data
as
$k
=>
$v
)
{
if
(
!
is_numeric
(
$v
))
{
$this
->
setErrorMessage
(
"
{
$k
}
只能是数字"
,
$errorCount
);
return
false
;
if
(
!
$v
||
$v
===
''
)
{
continue
;
}
else
{
if
(
!
is_numeric
(
$v
))
{
$this
->
setErrorMessage
(
"
{
$k
}
只能是数字"
,
$errorCount
);
return
false
;
}
}
}
return
true
;
...
...
@@ -245,7 +249,7 @@ class ExcelImporter
return
true
;
}
}
else
{
if
(
$list
[
$key
]
!=
=
$data
[
$key
])
{
if
(
$list
[
$key
]
!=
$data
[
$key
])
{
return
true
;
}
}
...
...
src/Tools/Exporter.php
View file @
0f12d14e
...
...
@@ -237,7 +237,7 @@ class Exporter
if
(
isset
(
$data
[
$v
]))
{
$result
[]
=
$data
[
$v
];
}
else
{
new
\Exception
(
"key为
{
$v
}
的数据不存在"
)
;
$result
[]
=
''
;
}
}
else
{
$separate
=
explode
(
"|"
,
$v
);
...
...
@@ -246,7 +246,7 @@ class Exporter
$t
=
count
(
$list
)
-
1
;
$b
=
$data
;
foreach
(
$list
as
$lk
=>
$lv
)
{
if
(
isset
(
$b
[
$lv
]))
{
if
(
isset
(
$b
[
$lv
])
&&
$b
[
$lv
]
)
{
$b
=
$b
[
$lv
];
}
else
{
$b
=
""
;
...
...
src/functions.php
View file @
0f12d14e
...
...
@@ -616,7 +616,7 @@ if (!function_exists('make_belong_relation_function')) {
* @param callable|null $callback 内嵌级联调用
* @return Closure 返回关联关系的匿名函数
*/
function
make_belong_lation_function
(
$relationName
,
array
&
$mainModelColumns
,
$relationColumns
=
[
'id'
,
'name'
],
$mainModelRelationKey
=
""
,
callable
$callback
=
null
)
function
make_belong_
re
lation_function
(
$relationName
,
array
&
$mainModelColumns
,
$relationColumns
=
[
'id'
,
'name'
],
$mainModelRelationKey
=
""
,
callable
$callback
=
null
)
{
$key
=
$mainModelRelationKey
?
$mainModelRelationKey
:
$relationName
.
"_id"
;
if
(
!
in_array
(
$key
,
$mainModelColumns
))
array_push
(
$mainModelColumns
,
$key
);
...
...
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