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
1e0ee20d
Commit
1e0ee20d
authored
Apr 12, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
生成二维码中间带logo
parent
a7264d59
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
4 deletions
+14
-4
GenerateCodeUntils.php
application/api/untils/GenerateCodeUntils.php
+10
-2
Broker.php
application/api_broker/controller/Broker.php
+4
-2
No files found.
application/api/untils/GenerateCodeUntils.php
View file @
1e0ee20d
...
@@ -13,10 +13,12 @@ class GenerateCodeUntils {
...
@@ -13,10 +13,12 @@ class GenerateCodeUntils {
*
*
* @param $param
* @param $param
* @param $file_name
* @param $file_name
* @param int $type
* @return string
* @return string
* @throws \Endroid\QrCode\Exception\InvalidPathException
* @throws \Endroid\QrCode\Exception\InvalidWriterException
* @throws \Endroid\QrCode\Exception\InvalidWriterException
*/
*/
public
function
getCode
(
$param
,
$file_name
)
{
public
function
getCode
(
$param
,
$file_name
,
$type
=
1
)
{
$path
=
'static'
.
DS
.
'qrcode'
.
DS
.
date
(
'Ymd'
);
$path
=
'static'
.
DS
.
'qrcode'
.
DS
.
date
(
'Ymd'
);
if
(
!
file_exists
(
$path
))
{
if
(
!
file_exists
(
$path
))
{
...
@@ -24,13 +26,19 @@ class GenerateCodeUntils {
...
@@ -24,13 +26,19 @@ class GenerateCodeUntils {
}
}
$qrCode
=
new
QrCode
(
$param
);
$qrCode
=
new
QrCode
(
$param
);
$qrCode
->
setSize
(
3
00
);
$qrCode
->
setSize
(
4
00
);
$qrCode
->
setWriterByName
(
'png'
);
$qrCode
->
setWriterByName
(
'png'
);
$qrCode
->
setMargin
(
10
);
$qrCode
->
setMargin
(
10
);
$qrCode
->
setEncoding
(
'UTF-8'
);
$qrCode
->
setEncoding
(
'UTF-8'
);
$qrCode
->
setForegroundColor
([
'r'
=>
0
,
'g'
=>
0
,
'b'
=>
0
]);
$qrCode
->
setForegroundColor
([
'r'
=>
0
,
'g'
=>
0
,
'b'
=>
0
]);
$qrCode
->
setBackgroundColor
([
'r'
=>
255
,
'g'
=>
255
,
'b'
=>
255
]);
$qrCode
->
setBackgroundColor
([
'r'
=>
255
,
'g'
=>
255
,
'b'
=>
255
]);
$qrCode
->
setValidateResult
(
false
);
$qrCode
->
setValidateResult
(
false
);
if
(
$type
==
2
)
{
$qrCode
->
setLogoPath
(
ROOT_PATH
.
'/public/static/qrcode/agent_app_logo.png'
);
$qrCode
->
setLogoWidth
(
80
);
$qrCode
->
setValidateResult
(
false
);
}
$path
=
$path
.
DS
.
$file_name
.
'.png'
;
$path
=
$path
.
DS
.
$file_name
.
'.png'
;
$qrCode
->
writeFile
(
$path
);
$qrCode
->
writeFile
(
$path
);
return
$path
;
return
$path
;
...
...
application/api_broker/controller/Broker.php
View file @
1e0ee20d
...
@@ -517,6 +517,8 @@ class Broker extends Basic
...
@@ -517,6 +517,8 @@ class Broker extends Basic
* 生成邀请二维码
* 生成邀请二维码
*
*
* @return \think\Response
* @return \think\Response
* @throws \Endroid\QrCode\Exception\InvalidPathException
* @throws \Endroid\QrCode\Exception\InvalidWriterException
*/
*/
public
function
qrCode
()
{
public
function
qrCode
()
{
...
@@ -534,8 +536,8 @@ class Broker extends Basic
...
@@ -534,8 +536,8 @@ class Broker extends Basic
}
}
$code
=
new
GenerateCodeUntils
();
$code
=
new
GenerateCodeUntils
();
$url
=
$this
->
request
->
domain
()
.
'/app
.php/app
/share_register?referrer_source=20&id='
.
$this
->
agentId
;
$url
=
$this
->
request
->
domain
()
.
'/app/share_register?referrer_source=20&id='
.
$this
->
agentId
;
$path
=
$code
->
getCode
(
$url
,
$this
->
agentId
);
$path
=
$code
->
getCode
(
$url
,
$this
->
agentId
,
2
);
$data
[
'data'
]
=
[
'path'
=>
$this
->
request
->
domain
()
.
'/'
.
$path
];
$data
[
'data'
]
=
[
'path'
=>
$this
->
request
->
domain
()
.
'/'
.
$path
];
$data
[
'status'
]
=
200
;
$data
[
'status'
]
=
200
;
return
$this
->
response
(
$data
[
'status'
],
$data
[
'msg'
],
$data
[
'data'
]);
return
$this
->
response
(
$data
[
'status'
],
$data
[
'msg'
],
$data
[
'data'
]);
...
...
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