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
19ca082c
Commit
19ca082c
authored
Jun 27, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/ticker' into feature/ucenter
parents
095af285
f94f4f0f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
11 deletions
+35
-11
CoinController.php
api/controllers/CoinController.php
+2
-0
ApplicationController.php
backend/controllers/ApplicationController.php
+6
-2
ExchangeBusiness.php
common/business/ExchangeBusiness.php
+27
-9
No files found.
api/controllers/CoinController.php
View file @
19ca082c
...
...
@@ -160,11 +160,13 @@ class CoinController extends BaseController
$value
[
'high'
]
=
$coin_quotations
[
$temp_key
][
'high'
];
$value
[
'last'
]
=
$coin_quotations
[
$temp_key
][
'last'
];
$value
[
'rmb'
]
=
$coin_quotations
[
$temp_key
][
'rmb'
];
$value
[
'usd'
]
=
$coin_quotations
[
$temp_key
][
'usd'
]
??
0
;
}
else
{
$value
[
'low'
]
=
0
;
$value
[
'high'
]
=
0
;
$value
[
'last'
]
=
0
;
$value
[
'rmb'
]
=
0
;
$value
[
'usd'
]
=
0
;
}
}
$value
[
'id'
]
=
$value
[
'cid'
];
...
...
backend/controllers/ApplicationController.php
View file @
19ca082c
...
...
@@ -57,7 +57,9 @@ class ApplicationController extends BaseController
Yii
::
$app
->
response
->
format
=
'json'
;
$category_id
=
Yii
::
$app
->
request
->
get
(
'category_id'
);
$fields
=
[
'category_id'
,
'h5_icon'
,
'official_url'
,
'introduce_image'
,
'show_width'
,
'show_height'
,
'open_type'
,
'open_type_app'
,
'name'
,
'sort'
,
'icon'
,
'type'
,
'native_url'
,
'native_login_url'
,
'h5_url'
,
'android_url'
,
'ios_url'
,
'app_store_url'
,
'advertise'
,
'description'
,
'redirect_type'
,
'platform_id'
];
$params
=
array_merge
(
Yii
::
$app
->
request
->
post
(),[
'category_id'
=>
$category_id
,
'platform_id'
=>
Yii
::
$app
->
user
->
identity
->
platform_id
]);
$data
=
Yii
::
$app
->
request
->
post
();
$data
[
'open_type_app'
]
=
(
0
==
$data
[
'open_type_app'
])
?
1
:
$data
[
'open_type_app'
];
$params
=
array_merge
(
$data
,[
'category_id'
=>
$category_id
,
'platform_id'
=>
Yii
::
$app
->
user
->
identity
->
platform_id
]);
$params
=
$this
->
initParams
(
$params
,
$fields
);
$coin_applicateion_form
=
new
CoinApplicationForm
();
$coin_applicateion_form
->
setScenario
(
CoinApplicationForm
::
SCENARIO_ADD
);
...
...
@@ -81,7 +83,9 @@ class ApplicationController extends BaseController
if
(
Yii
::
$app
->
request
->
isPost
)
{
Yii
::
$app
->
response
->
format
=
'json'
;
$fields
=
[
'category_id'
,
'id'
,
'h5_icon'
,
'official_url'
,
'introduce_image'
,
'show_width'
,
'show_height'
,
'open_type'
,
'open_type_app'
,
'name'
,
'sort'
,
'icon'
,
'type'
,
'native_url'
,
'native_login_url'
,
'h5_url'
,
'android_url'
,
'ios_url'
,
'app_store_url'
,
'advertise'
,
'description'
,
'redirect_type'
,
'platform_id'
];
$params
=
array_merge
(
Yii
::
$app
->
request
->
post
(),[
'platform_id'
=>
Yii
::
$app
->
user
->
identity
->
platform_id
]);
$data
=
Yii
::
$app
->
request
->
post
();
$data
[
'open_type_app'
]
=
(
0
==
$data
[
'open_type_app'
])
?
1
:
$data
[
'open_type_app'
];
$params
=
array_merge
(
$data
,[
'platform_id'
=>
Yii
::
$app
->
user
->
identity
->
platform_id
]);
$params
=
$this
->
initParams
(
$params
,
$fields
);
$coin_applicateion_form
=
new
CoinApplicationForm
();
$coin_applicateion_form
->
setScenario
(
CoinApplicationForm
::
SCENARIO_EDIT
);
...
...
common/business/ExchangeBusiness.php
View file @
19ca082c
...
...
@@ -59,7 +59,7 @@ class ExchangeBusiness
$quotation
[
'low'
]
=
1.00
;
$quotation
[
'high'
]
=
1.00
;
$quotation
[
'last'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$quotation
[
'rmb'
]
/
$rate
);
return
$quotation
;
goto
doEnd
;
}
if
(
strtoupper
(
$tag
)
==
'BOSS'
){
$quotation
=
[
...
...
@@ -68,7 +68,7 @@ class ExchangeBusiness
'last'
=>
2000
,
'rmb'
=>
2000
,
];
return
$quotation
;
goto
doEnd
;
}
if
(
strtoupper
(
$tag
)
==
'CPF'
){
...
...
@@ -78,7 +78,7 @@ class ExchangeBusiness
'last'
=>
3.4
,
'rmb'
=>
3.4
,
];
return
$quotation
;
goto
doEnd
;
}
if
(
in_array
(
$tag
,
$coin_quotation_disable_items
)){
...
...
@@ -91,42 +91,54 @@ class ExchangeBusiness
$exchange
=
ExchangeFactory
::
createExchange
(
"Token7"
);
$quotation
=
$exchange
->
getTicker
(
$tag
,
'HA'
);
$quotation
[
'rmb'
]
=
(
float
)
sprintf
(
"%0.2f"
,
$quotation
[
'last'
]);
return
$quotation
;
goto
doEnd
;
}
if
(
in_array
(
strtoupper
(
$tag
),[
'BECC'
])){
$exchange
=
ExchangeFactory
::
createExchange
(
"S"
);
$quotation
=
$exchange
->
getTicker
(
$tag
,
'ST'
);
$quotation
[
'rmb'
]
=
(
float
)
sprintf
(
"%0.2f"
,
$quotation
[
'last'
]);
return
$quotation
;
goto
doEnd
;
}
if
(
in_array
(
strtoupper
(
$tag
),[
'GHP'
])){
$exchange
=
ExchangeFactory
::
createExchange
(
"Zg"
);
$quotation
=
$exchange
->
getTicker
(
$tag
,
'CNZ'
);
$quotation
[
'rmb'
]
=
(
float
)
sprintf
(
"%0.2f"
,
$quotation
[
'last'
]);
return
$quotation
;
goto
doEnd
;
}
if
(
in_array
(
strtoupper
(
$tag
),[
'SFT'
])){
$exchange
=
ExchangeFactory
::
createExchange
(
"Zhaobi"
);
$quotation
=
$exchange
->
getTicker
(
$tag
,
'CNY'
);
$quotation
[
'rmb'
]
=
(
float
)
sprintf
(
"%0.2f"
,
$quotation
[
'last'
]);
return
$quotation
;
goto
doEnd
;
}
if
(
in_array
(
strtoupper
(
$tag
),[
'CTG'
])){
$exchange
=
ExchangeFactory
::
createExchange
(
"Gdpro"
);
$quotation
=
$exchange
->
getTicker
(
$tag
,
'CNY'
);
$quotation
[
'rmb'
]
=
(
float
)
sprintf
(
"%0.2f"
,
$quotation
[
'last'
]);
return
$quotation
;
goto
doEnd
;
}
if
(
in_array
(
strtoupper
(
$tag
),[
'USDT'
])){
$exchange
=
ExchangeFactory
::
createExchange
(
"Go"
);
$quotation
=
$exchange
->
getTicker
(
'CNY'
,
'USD'
);
$quotation
[
'rmb'
]
=
(
float
)
sprintf
(
"%0.2f"
,
$quotation
[
'last'
]);
return
$quotation
;
goto
doEnd
;
}
if
(
in_array
(
strtoupper
(
$tag
),[
'SJPY'
])){
$exchange
=
ExchangeFactory
::
createExchange
(
"Boc"
);
$quotation
=
$exchange
->
getTicker
(
'CNY'
,
'JPY'
);
$quotation
=
[
'low'
=>
(
float
)
sprintf
(
"%0.4f"
,
$quotation
[
'low'
]
/
100
),
'high'
=>
(
float
)
sprintf
(
"%0.4f"
,
$quotation
[
'high'
]
/
100
),
'last'
=>
(
float
)
sprintf
(
"%0.4f"
,
$quotation
[
'last'
]
/
100
),
'rmb'
=>
(
float
)
sprintf
(
"%0.4f"
,
$quotation
[
'last'
]
/
100
),
];
goto
doEnd
;
}
foreach
(
self
::
$exchanges
as
$exchange
)
{
...
...
@@ -182,6 +194,11 @@ class ExchangeBusiness
}
$quotation
[
'rmb'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$rate
*
$quotation
[
'last'
]);
doEnd
:
$exchange
=
ExchangeFactory
::
createExchange
(
"Go"
);
$rate
=
$exchange
->
getTicker
(
"CNY"
,
"USD"
);
$cny_usd_rate
=
1
/
$rate
[
'last'
];
$quotation
[
'usd'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$quotation
[
'rmb'
]
*
$cny_usd_rate
);
return
$quotation
;
}
...
...
@@ -253,6 +270,7 @@ class ExchangeBusiness
$rows
[
$key
][
'last'
]
=
0
;
$rows
[
$key
][
'low'
]
=
0
;
$rows
[
$key
][
'high'
]
=
0
;
$rows
[
$key
][
'usd'
]
=
0
;
}
}
if
(
strtoupper
(
$row
[
'platform'
])
==
'GUODUN'
)
{
...
...
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