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
012667a2
Commit
012667a2
authored
Oct 21, 2020
by
王源
🎧
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'test'
parents
0dcffa46
3eb57671
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
100 additions
and
12 deletions
+100
-12
MessageHandler.php
src/Handler/MessageHandler.php
+17
-0
AppServiceInterface.php
src/Service/Interfaces/AppServiceInterface.php
+9
-0
ProcessFormServiceInterface.php
src/Service/Interfaces/Flow/ProcessFormServiceInterface.php
+5
-4
Drawer.php
src/Tools/Drawer.php
+69
-8
No files found.
src/Handler/MessageHandler.php
View file @
012667a2
...
...
@@ -131,4 +131,21 @@ class MessageHandler
$this
->
messageService
->
SendMarkDownMessage
(
$receiverIds
,
$application
,
0
,
$sendUserId
,
[],
$content
,
$title
);
}
/**
* 自动发送markdown 文本消息
* @param $receiverIds
* @param $content
* @param $title
* @throws HttpResponseException
*/
public
function
sendAutoMarkDownText
(
$receiverIds
,
$content
,
$title
)
{
$application
=
$this
->
config
->
get
(
'app_name'
);
if
(
!
$application
)
{
throw
new
HttpResponseException
(
"请设置应用名app_name"
);
}
$receiverIds
=
is_array
(
$receiverIds
)
?
$receiverIds
:
[
$receiverIds
];
$this
->
messageService
->
SendMarkDownMessage
(
$receiverIds
,
$application
,
0
,
0
,
[],
$content
,
$title
);
}
}
src/Service/Interfaces/AppServiceInterface.php
View file @
012667a2
...
...
@@ -37,4 +37,13 @@ interface AppServiceInterface
*/
public
function
getByIdList
(
array
$idList
,
array
$relations
=
[],
array
$columns
=
[
'id'
,
'title'
])
:
array
;
/**
* 通过name列表获取应用数组
* @param array $nameList 默认去重
* @param array $relations 关联关系只有['group']
* @param array $columns 默认展示id和title,可传['title', 'name', 'entry', 'prefix', 'group_id', 'is_inside', 'is_active', 'icon', 'desc', 'weight']
* @return array 默认keyBy('id')
*/
public
function
getByNameList
(
array
$nameList
,
array
$relations
=
[],
array
$columns
=
[
'id'
,
'title'
,
'name'
])
:
array
;
}
src/Service/Interfaces/Flow/ProcessFormServiceInterface.php
View file @
012667a2
...
...
@@ -8,10 +8,11 @@ interface ProcessFormServiceInterface
{
/**
* 创建流程申请
* @param $processId 流程id
* @param $url 表单图片地址
* @param $data 表单详细内容
* @param integer $processId 流程id
* @param string $url 表单图片地址
* @param array $data 表单详细内容
* @param string $user 当前用户信息
* @return mixed
*/
public
function
createProcessForm
(
$processId
,
$url
,
$data
);
public
function
createProcessForm
(
$processId
,
$url
,
array
$data
,
$user
);
}
\ No newline at end of file
src/Tools/Drawer.php
View file @
012667a2
...
...
@@ -46,11 +46,12 @@ class Drawer
*/
public
function
downloadWebImage
(
$url
,
$path
=
null
)
{
$url
=
$this
->
parseUrl
(
$url
);
// excel画图中下载图片时对图片名做urlencode处理,防止中文名不能正常画图片的bug
$filename
=
urlencode
(
trim
(
pathinfo
(
$url
,
PATHINFO_FILENAME
)
));
$filename
=
trim
(
pathinfo
(
$url
,
PATHINFO_FILENAME
));
$ext
=
strtolower
(
pathinfo
(
$url
,
PATHINFO_EXTENSION
));
$filename
=
"
$filename
.
$ext
"
;
$url
=
$this
->
parseUrl
(
$url
);
$path
=
$this
->
rootPath
.
'/download/images/'
.
(
$path
?:
$this
->
savePath
);
if
(
!
is_dir
(
$path
))
{
// 判断路径是否存在,不存在,则创建
...
...
@@ -65,8 +66,7 @@ class Drawer
curl_setopt
(
$ch
,
CURLOPT_CONNECTTIMEOUT
,
30
);
$file
=
curl_exec
(
$ch
);
curl_close
(
$ch
);
$resource
=
fopen
(
$path
.
'/'
.
$filename
,
'a'
);
$resource
=
fopen
(
$filePath
,
'a'
);
fwrite
(
$resource
,
$file
);
fclose
(
$resource
);
}
...
...
@@ -75,9 +75,12 @@ class Drawer
private
function
parseUrl
(
$url
)
{
if
(
!
preg_match
(
'/%[0-9A-Z]{2}/'
,
$url
))
{
$url
=
rawurlencode
(
$url
);
$url
=
str_replace
(
"%3A"
,
":"
,
$url
);
return
str_replace
(
"%2F"
,
"/"
,
$url
);
$url
=
str_replace
(
"%2F"
,
"/"
,
$url
);
}
return
$url
;
}
/**
...
...
@@ -151,6 +154,64 @@ class Drawer
return
$res
?
$imgNewPath
:
false
;
}
/**
* 拼图
* @param $imgPathList
* @return bool|string
*/
public
function
mergeImages
(
$imgPathList
)
{
$maxW
=
$maxH
=
0
;
$filenameList
=
[];
$imageList
=
[];
foreach
(
$imgPathList
as
$k
=>
$path
)
{
$path
=
$this
->
parseImagePath
(
$path
);
$imgPathInfo
=
pathinfo
(
$path
);
$filename
=
$imgPathInfo
[
'filename'
];
// 图片名称
$ext
=
$imgPathInfo
[
'extension'
];
// 图片扩展名
[
$w
,
$h
]
=
getimagesize
(
$path
);
// 图片大小
$imageList
[
$k
]
=
[
'path'
=>
$path
,
'filename'
=>
$filename
,
'ext'
=>
$ext
,
'w'
=>
$w
,
'h'
=>
$h
,
];
$filenameList
[]
=
$filename
;
$maxW
+=
$w
;
if
(
$maxH
<
$h
)
{
$maxH
=
$h
;
}
}
$filenameList
=
collect
(
$filenameList
)
->
unique
()
->
sort
()
->
toArray
();
$filename
=
implode
(
'_'
,
$filenameList
);
$savePath
=
$this
->
rootPath
.
'/download/merge/'
.
$this
->
savePath
;
if
(
!
is_dir
(
$savePath
))
{
// 判断路径是否存在,不存在,则创建
mkdir
(
$savePath
,
0777
,
true
);
}
$imgNewPath
=
$savePath
.
'/'
.
$filename
.
'.png'
;
if
(
file_exists
(
$imgNewPath
))
{
return
$imgNewPath
;
}
// 黑色背景图片
$im
=
@
imagecreatetruecolor
(
$maxW
,
$maxH
)
or
die
(
"Cannot Initialize new GD image stream"
);
// 为真彩色画布创建背景,再设置为透明
$color
=
imagecolorallocate
(
$im
,
0
,
0
,
0
);
imagefill
(
$im
,
0
,
0
,
$color
);
imageColorTransparent
(
$im
,
$color
);
// 循环画图片
$dstX
=
0
;
foreach
(
$imageList
as
$item
)
{
$resource
=
imagecreatefromstring
(
file_get_contents
(
$item
[
'path'
]));
imagecopy
(
$im
,
$resource
,
$dstX
,
0
,
0
,
0
,
$item
[
'w'
],
$item
[
'h'
]);
$dstX
+=
$item
[
'w'
];
}
$res
=
imagepng
(
$im
,
$imgNewPath
);
imagedestroy
(
$im
);
return
$res
?
$imgNewPath
:
false
;
}
/**
* 画图片
* @param string $path 图片路径
...
...
@@ -167,7 +228,7 @@ class Drawer
$path
=
$this
->
addBoard
(
$path
,
$boardPx
);
}
$drawing
=
new
Drawing
();
$drawing
->
setPath
(
$path
)
->
setCoordinates
(
$p
)
->
setHeight
(
$h
)
->
setWorksheet
(
$sheet
);
$drawing
->
setPath
(
$path
)
->
setCoordinates
(
$p
)
->
setHeight
(
$h
)
->
set
OffsetX
(
1
)
->
setOffsetY
(
1
)
->
set
Worksheet
(
$sheet
);
}
catch
(
Exception
$e
)
{
put_log
(
$e
->
getMessage
());
}
...
...
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