Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
Details
Activity
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
hujun
tl_estate
Commits
ce83d919
Commit
ce83d919
authored
Oct 18, 2019
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
给身份证加水印
parent
6b3c5f52
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
0 deletions
+69
-0
UploadFileService.php
application/api_broker/service/UploadFileService.php
+22
-0
route.php
application/route.php
+1
-0
AgentIdCardTask.php
application/task/controller/AgentIdCardTask.php
+46
-0
No files found.
application/api_broker/service/UploadFileService.php
View file @
ce83d919
...
@@ -9,6 +9,7 @@ namespace app\api_broker\service;
...
@@ -9,6 +9,7 @@ namespace app\api_broker\service;
*/
*/
use
think\File
;
use
think\File
;
use
think\Image
;
class
UploadFileService
class
UploadFileService
{
{
...
@@ -145,6 +146,10 @@ class UploadFileService
...
@@ -145,6 +146,10 @@ class UploadFileService
$data
[
'code'
]
=
101
;
$data
[
'code'
]
=
101
;
$data
[
"msg"
][
$k
][
'error'
]
=
$_file
->
getError
();
$data
[
"msg"
][
$k
][
'error'
]
=
$_file
->
getError
();
}
}
if
(
$type
==
'user_id_card'
)
{
$this
->
water
(
$path
.
'/'
.
$name_str
.
'.'
.
$file_info
[
'extension'
],
'static/logo_copy_2@3x.png'
);
}
}
}
}
else
{
}
else
{
...
@@ -153,6 +158,9 @@ class UploadFileService
...
@@ -153,6 +158,9 @@ class UploadFileService
$file_info
=
pathinfo
(
$_upload_file
[
'name'
]);
$file_info
=
pathinfo
(
$_upload_file
[
'name'
]);
$info
=
$_file
->
validate
(
$valid_date
)
->
move
(
$path
,
$name_str
.
'.'
.
$file_info
[
'extension'
]);
$info
=
$_file
->
validate
(
$valid_date
)
->
move
(
$path
,
$name_str
.
'.'
.
$file_info
[
'extension'
]);
if
(
$info
)
{
if
(
$info
)
{
if
(
$type
==
'user_id_card'
)
{
$this
->
water
(
$path
.
'/'
.
$name_str
.
'.'
.
$file_info
[
'extension'
],
'static/logo_copy_2@3x.png'
);
}
$data
[
'code'
]
=
200
;
$data
[
'code'
]
=
200
;
$data
[
"msg"
][
'img_path'
]
=
$date
.
'/'
.
$info
->
getSaveName
();
//生成的图片路径
$data
[
"msg"
][
'img_path'
]
=
$date
.
'/'
.
$info
->
getSaveName
();
//生成的图片路径
$data
[
"msg"
][
'internet_img_name'
]
=
$internet_path
.
$data
[
"msg"
][
'img_path'
];
$data
[
"msg"
][
'internet_img_name'
]
=
$internet_path
.
$data
[
"msg"
][
'img_path'
];
...
@@ -213,4 +221,17 @@ class UploadFileService
...
@@ -213,4 +221,17 @@ class UploadFileService
return
$data
;
return
$data
;
}
}
/**
* 居中水印
*
* @param $file_path
* @param $water_image
* @return $this
*/
public
function
water
(
$file_path
,
$water_image
)
{
$image
=
Image
::
open
(
$file_path
);
return
$image
->
water
(
$water_image
,
Image
::
WATER_CENTER
,
70
)
->
save
(
$file_path
);
}
}
}
\ No newline at end of file
application/route.php
View file @
ce83d919
...
@@ -834,6 +834,7 @@ Route::group('task', [
...
@@ -834,6 +834,7 @@ Route::group('task', [
'saveLookUser'
=>
[
'task/SaveLookUserHistoryTask/saveLookUser'
,
[
'method'
=>
'get'
]],
//保存经纪人看客户的记录
'saveLookUser'
=>
[
'task/SaveLookUserHistoryTask/saveLookUser'
,
[
'method'
=>
'get'
]],
//保存经纪人看客户的记录
'getNoSettlementList'
=>
[
'task/AmercementTask/getNoSettlementList'
,
[
'method'
=>
'get'
]],
//保存经纪人看客户的记录
'getNoSettlementList'
=>
[
'task/AmercementTask/getNoSettlementList'
,
[
'method'
=>
'get'
]],
//保存经纪人看客户的记录
'waterImage'
=>
[
'task/AgentIdCardTask/waterImage'
,
[
'method'
=>
'get'
]]
//给身份证加水印
]);
]);
Route
::
group
(
'broker'
,
[
Route
::
group
(
'broker'
,
[
...
...
application/task/controller/AgentIdCardTask.php
0 → 100644
View file @
ce83d919
<?php
/**
* Created by PhpStorm.
* User: 43897
* Date: 2019/10/18
* Time: 14:03
*/
namespace
app\task\controller
;
use
app\api_broker\service\UploadFileService
;
use
app\model\AAgentsBank
;
use
think\Response
;
class
AgentIdCardTask
{
/**
* 给身份证加水印
*
* @return Response|\think\response\Json|\think\response\Jsonp|\think\response\Redirect|\think\response\View|\think\response\Xml
*/
public
function
waterImage
()
{
set_time_limit
(
0
);
$s_upload
=
new
UploadFileService
();
$m_bank
=
new
AAgentsBank
();
$where
[]
=
[
'EXP'
,
'id_card_image_front <> "" OR id_card_image_back <> ""'
];
$total
=
$m_bank
->
getTotal
(
$where
);
$size
=
100
;
$total_size
=
round
(
$total
/
$size
);
$total_size
=
$total_size
>
0
?
$total_size
:
1
;
$num
=
0
;
for
(
$i
=
1
;
$i
<=
$total_size
;
$i
++
)
{
$data
=
$m_bank
->
getList
(
$i
,
$size
,
''
,
'id_card_image_front,id_card_image_back'
,
$where
);
foreach
(
$data
as
$v
)
{
$s_upload
->
water
(
'static/user_id_card/'
.
$v
[
'id_card_image_front'
],
'static/logo_copy_2@3x.png'
);
$s_upload
->
water
(
'static/user_id_card/'
.
$v
[
'id_card_image_back'
],
'static/logo_copy_2@3x.png'
);
$num
++
;
}
}
return
Response
::
create
([
'code'
=>
200
,
'msg'
=>
''
,
'num'
=>
$num
],
'json'
);
}
}
\ No newline at end of file
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