Commit c06d7173 authored by shajiaiming's avatar shajiaiming

Merge branch 'feature/log-operation' into develop

parents eb87e28d 660535d1
...@@ -35,6 +35,11 @@ class WalletCoinController extends BaseController ...@@ -35,6 +35,11 @@ class WalletCoinController extends BaseController
$condition[] = [$val_array[0], 'omni']; $condition[] = [$val_array[0], 'omni'];
continue; continue;
} }
//张雄需求
if ('HYS' == strtoupper($val_array[0]) && 'HYSCHAIN' == strtoupper($val_array[1])) {
$condition[] = [$val_array[0], 'COINUN'];
continue;
}
$condition[] = [$val_array[0], $val_array[1]]; $condition[] = [$val_array[0], $val_array[1]];
} else { } else {
$condition[] = $val; $condition[] = $val;
...@@ -86,7 +91,7 @@ class WalletCoinController extends BaseController ...@@ -86,7 +91,7 @@ class WalletCoinController extends BaseController
$ticker = ['low' => 0, 'high' => 0, 'last' => 0, 'open' => 0, 'vol' => 0, 'rmb' => 0, 'usd' => 0]; $ticker = ['low' => 0, 'high' => 0, 'last' => 0, 'open' => 0, 'vol' => 0, 'rmb' => 0, 'usd' => 0];
foreach ($this->data as $key => &$val) { foreach ($this->data as $key => &$val) {
//$val['chain_quotation'] = isset($coin_quotations[strtoupper($val['chain'])]) ? $coin_quotations[strtoupper($val['chain'])] : []; $val['chain_quotation'] = isset($coin_quotations[strtoupper($val['chain'])]) ? $coin_quotations[strtoupper($val['chain'])] : [];
$nickname = json_decode($val['nickname'], true); $nickname = json_decode($val['nickname'], true);
$val['nickname'] = isset($nickname[$this->lang]) ? $nickname[$this->lang] : ''; $val['nickname'] = isset($nickname[$this->lang]) ? $nickname[$this->lang] : '';
$introduce = json_decode($val['introduce'], true); $introduce = json_decode($val['introduce'], true);
...@@ -97,6 +102,7 @@ class WalletCoinController extends BaseController ...@@ -97,6 +102,7 @@ class WalletCoinController extends BaseController
$val['chain_usd'] = isset($val['chain_quotation']['usd']) ? $val['chain_quotation']['usd'] : 0; $val['chain_usd'] = isset($val['chain_quotation']['usd']) ? $val['chain_quotation']['usd'] : 0;
$val['chain_country_rate'] = (float)sprintf("%0.4f", $last[0] * $val['chain_rmb']); $val['chain_country_rate'] = (float)sprintf("%0.4f", $last[0] * $val['chain_rmb']);
$val['country_rate'] = (false == $currency) ? $val['rmb'] : (float)sprintf("%0.4f", $last[0] * $val['rmb']); $val['country_rate'] = (false == $currency) ? $val['rmb'] : (float)sprintf("%0.4f", $last[0] * $val['rmb']);
unset($val['chain_quotation']);
} }
doEnd : doEnd :
......
<?php
namespace common\behaviors;
use Yii;
use linslin\yii2\curl\Curl;
use yii\base\ActionFilter;
use wallet\base\ResponseMsg;
class OperationLogInterceptor extends ActionFilter
{
public function beforeAction($action)
{
if (!parent::beforeAction($action)) {
return false;
}
$method = strtolower(Yii::$app->request->method);
$handerClass = strtolower(Yii::$app->controller->id);
$handlerAction = strtolower(Yii::$app->controller->action->id);
// if (!isset(Yii::$app->params['handleTableAndDesc']['handleTableAndDesc'][$handerClass][$handlerAction][$method])) {
// return false;
// }
switch ($method) {
case "get":
$operation = '查询';
break;
case 'post':
$operation = '增加';
break;
case 'put':
$operation = '更新';
break;
case 'delete':
$operation = '删除';
break;
default:
$operation = '未知';
}
$params = [
'ip' => Yii::$app->request->userIP,
'operation' => $operation,
'business' => Yii::$app->params['handleTableAndDesc']['handleTableAndDesc'][$handerClass][$handlerAction][$method] ?? $handerClass . '-' . $handlerAction,
'table' => Yii::$app->params['handleTableAndDesc']['handleTableAndDesc'][$handerClass][$handlerAction]['table'] ?? '未知'
];
$token_string = Yii::$app->request->headers->get('Token');
$curl = new Curl();
$response = $curl->setRequestBody(json_encode($params))
->setHeaders([
'Content-Type' => 'application/json',
'Token' => $token_string
])
->post(Yii::$app->params['go_biqianbao'] . '/api/log');
$response = json_decode($response, true);
if (!is_array($response) || 0 != $response['code']) {
$msg = '同步日志错误';
$code = -1;
goto doEnd;
}
return true;
doEnd :
// 返回错误
$response_message = new ResponseMsg();
$content = $response_message->jsonError($msg, $code);
$content = $response_message->withHeaders($response_message->getHeaders())->withContent($content);
Yii::$app->response->data = $content;
Yii::$app->response->send();
return false;
}
}
\ No newline at end of file
...@@ -47,7 +47,6 @@ class ExchangeBusiness ...@@ -47,7 +47,6 @@ class ExchangeBusiness
18 => 'Boc', 18 => 'Boc',
//1 => 'Hadax', //不需要 //1 => 'Hadax', //不需要
//2 => 'Bitfinex', //不需要 //2 => 'Bitfinex', //不需要
//3 => 'Bittrex', //不需要 //3 => 'Bittrex', //不需要
...@@ -70,7 +69,7 @@ class ExchangeBusiness ...@@ -70,7 +69,7 @@ class ExchangeBusiness
public static function getquatation($tag = 'btc') public static function getquatation($tag = 'btc')
{ {
$coin_quotation_disable_items = Yii::$app->params['coin_quotation_disable_items']; $coin_quotation_disable_items = Yii::$app->params['coin_quotation_disable_items'];
if (strtoupper($tag) == 'CCNY' || strtoupper($tag) == 'CNYT' || strtoupper($tag) == 'ETC') { if (strtoupper($tag) == 'CCNY' || strtoupper($tag) == 'CNYT' || strtoupper($tag) == 'ETC' || strtoupper($tag) == 'YX') {
$exchange = ExchangeFactory::createExchange("Zhaobi"); $exchange = ExchangeFactory::createExchange("Zhaobi");
if (strtoupper($tag) == 'ETC') { if (strtoupper($tag) == 'ETC') {
$quotation = $exchange->getTicker($tag, 'USDT'); $quotation = $exchange->getTicker($tag, 'USDT');
......
...@@ -21,7 +21,7 @@ class FlashController extends BaseController ...@@ -21,7 +21,7 @@ class FlashController extends BaseController
$group = Yii::$app->request->getGroup(); $group = Yii::$app->request->getGroup();
$platform_id = Yii::$app->request->get('platform_id', 0); $platform_id = Yii::$app->request->get('platform_id', 0);
if (User::AUTH_SUPER !== $group && $platform_id != Yii::$app->request->getPlatformId()) { if ($platform_id != Yii::$app->request->getPlatformId()) {
$msg = '暂无权限'; $msg = '暂无权限';
$code = -1; $code = -1;
goto doEnd; goto doEnd;
...@@ -76,7 +76,7 @@ class FlashController extends BaseController ...@@ -76,7 +76,7 @@ class FlashController extends BaseController
$group = Yii::$app->request->getGroup(); $group = Yii::$app->request->getGroup();
$platform_id = Yii::$app->request->get('platform_id', 0); $platform_id = Yii::$app->request->get('platform_id', 0);
if (User::AUTH_SUPER !== $group && $platform_id != Yii::$app->request->getPlatformId()) { if ($platform_id != Yii::$app->request->getPlatformId()) {
$msg = '暂无权限'; $msg = '暂无权限';
$code = -1; $code = -1;
goto doEnd; goto doEnd;
...@@ -135,7 +135,7 @@ class FlashController extends BaseController ...@@ -135,7 +135,7 @@ class FlashController extends BaseController
if (Yii::$app->request->isPost) { if (Yii::$app->request->isPost) {
$platform_id = Yii::$app->request->post('platform_id', 0); $platform_id = Yii::$app->request->post('platform_id', 0);
if (User::AUTH_SUPER !== $group && $platform_id != Yii::$app->request->getPlatformId()) { if ($platform_id != Yii::$app->request->getPlatformId()) {
$msg = '暂无权限'; $msg = '暂无权限';
$code = -1; $code = -1;
goto doEnd; goto doEnd;
...@@ -187,7 +187,7 @@ class FlashController extends BaseController ...@@ -187,7 +187,7 @@ class FlashController extends BaseController
if (Yii::$app->request->isPut) { if (Yii::$app->request->isPut) {
$platform_id = Yii::$app->request->post('platform_id', 0); $platform_id = Yii::$app->request->post('platform_id', 0);
if (User::AUTH_SUPER !== $group && $platform_id != Yii::$app->request->getPlatformId()) { if ($platform_id != Yii::$app->request->getPlatformId()) {
$msg = '暂无权限'; $msg = '暂无权限';
$code = -1; $code = -1;
goto doEnd; goto doEnd;
...@@ -239,7 +239,7 @@ class FlashController extends BaseController ...@@ -239,7 +239,7 @@ class FlashController extends BaseController
if (Yii::$app->request->isDelete) { if (Yii::$app->request->isDelete) {
$platform_id = Yii::$app->request->get('platform_id', 0); $platform_id = Yii::$app->request->get('platform_id', 0);
if (User::AUTH_SUPER !== $group && $platform_id != Yii::$app->request->getPlatformId()) { if ($platform_id != Yii::$app->request->getPlatformId()) {
$msg = '暂无权限'; $msg = '暂无权限';
$code = -1; $code = -1;
goto doEnd; goto doEnd;
...@@ -292,7 +292,7 @@ class FlashController extends BaseController ...@@ -292,7 +292,7 @@ class FlashController extends BaseController
$group = Yii::$app->request->getGroup(); $group = Yii::$app->request->getGroup();
$platform_id = Yii::$app->request->post('platform_id', 0); $platform_id = Yii::$app->request->post('platform_id', 0);
if (User::AUTH_SUPER !== $group && $platform_id != Yii::$app->request->getPlatformId()) { if ($platform_id != Yii::$app->request->getPlatformId()) {
$msg = '暂无权限'; $msg = '暂无权限';
$code = -1; $code = -1;
goto doEnd; goto doEnd;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment