Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
token
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
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
wallet
token
Commits
8c125d65
Commit
8c125d65
authored
Sep 25, 2018
by
rlgy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
1c1229e8
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
108 additions
and
0 deletions
+108
-0
ZhaobiBusiness.php
common/business/ZhaobiBusiness.php
+35
-0
ZhaobiService.php
common/service/zhaobi/ZhaobiService.php
+73
-0
No files found.
common/business/ZhaobiBusiness.php
0 → 100644
View file @
8c125d65
<?php
/**
* Created by PhpStorm.
* User: rlgyzhcn
* Date: 18-7-24
* Time: 下午2:13
*/
namespace
common\business
;
use
common\service\zhaobi\ZhaobiService
;
class
ZhaobiBusiness
{
/**
* @param integer $uid
* @param string $codetype
* @param integer $code
* @param string $type
* @return array
*/
public
static
function
validateCode
(
$uid
,
$codetype
,
$code
,
$type
)
{
$service
=
new
ZhaobiService
();
$params
=
[
'uid'
=>
$uid
,
'codetype'
=>
$codetype
,
'code'
=>
$code
,
'type'
=>
$type
];
return
$service
->
validatecode
(
$params
);
}
}
\ No newline at end of file
common/service/zhaobi/ZhaobiService.php
0 → 100644
View file @
8c125d65
<?php
/**
* Created by PhpStorm.
* User: rlgyzhcn
* Date: 18-7-24
* Time: 下午1:53
*/
namespace
common\service\zhaobi
;
use
Yii
;
use
common\helpers\Curl
;
/**
* Class ZhaobiService
* 找币接口
*
* @package common\service\fzmca
*/
class
ZhaobiService
{
private
$ch
=
null
;
public
function
__construct
()
{
$this
->
ch
=
new
Curl
();
}
public
function
validatecode
(
$params
)
{
$config
=
Yii
::
$app
->
params
[
'service'
][
'ZhaobiService'
][
'validatecode'
];
$url
=
self
::
urlBuild
(
$config
[
'scheme'
],
$config
[
'host'
],
$config
[
'port'
],
$config
[
'path'
]);
return
$this
->
send
(
'POST'
,
$url
,
$params
,
false
);
}
/**
* @param string $method
* @param string $url
* @param array $params
* @param boolean $isRow false:将返回json数据decode
* @return array
*/
private
function
send
(
$method
=
'POST'
,
$url
=
''
,
$params
=
[],
$isRow
=
false
)
{
$result
=
''
;
if
(
strtolower
(
$method
)
==
'post'
)
{
$this
->
ch
->
setPostParams
(
$params
);
$result
=
$this
->
ch
->
post
(
$url
,
$isRow
);
}
else
{
$this
->
ch
->
setGetParams
(
$params
);
$result
=
$this
->
ch
->
get
(
$url
,
$isRow
);
}
if
(
$result
)
{
return
$result
;
}
return
[
'code'
=>
-
1
,
'message'
=>
'请求失败'
];
}
/**
* @param string $scheme
* @param string $host
* @param string $port
* @param string $path
* @return string
*/
private
static
function
urlBuild
(
$scheme
=
'http'
,
$host
=
''
,
$port
=
''
,
$path
=
''
)
{
$base
=
strtolower
(
$scheme
)
==
'http'
?
'http'
:
'https'
;
$base
.=
'://'
.
$host
;
$base
=
ltrim
(
$base
,
'/'
);
return
$port
?
$base
.
':'
.
$port
.
$path
:
$base
.
$path
;
}
}
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