Commit f1593aa5 authored by rlgy's avatar rlgy

上架交易所

parent 4130d346
...@@ -25,9 +25,9 @@ return [ ...@@ -25,9 +25,9 @@ return [
'baseUrl' => '/interface', 'baseUrl' => '/interface',
'cookieValidationKey' => '123456', 'cookieValidationKey' => '123456',
'enableCsrfValidation' => false, 'enableCsrfValidation' => false,
// 'parsers' => [ 'parsers' => [
// 'application/json' => 'yii\web\JsonParser', 'application/json' => 'yii\web\JsonParser',
// ], ],
], ],
'response' => [ 'response' => [
'class' => 'api\base\BaseResponse', 'class' => 'api\base\BaseResponse',
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
namespace backend\controllers; namespace backend\controllers;
use backend\controllers\BaseController;
use Yii; use Yii;
use common\models\pwallet\Coin; use common\models\pwallet\Coin;
use backend\models\coin\CoinForm; use backend\models\coin\CoinForm;
...@@ -16,6 +15,7 @@ use yii\base\InvalidConfigException; ...@@ -16,6 +15,7 @@ use yii\base\InvalidConfigException;
use yii\db\Exception; use yii\db\Exception;
use yii\web\UploadedFile; use yii\web\UploadedFile;
use yii\validators\ImageValidator; use yii\validators\ImageValidator;
use common\business\CoinBusiness;
/** /**
* 币种管理控制器 * 币种管理控制器
...@@ -27,14 +27,22 @@ class CoinController extends BaseController ...@@ -27,14 +27,22 @@ class CoinController extends BaseController
public function actionIndex() public function actionIndex()
{ {
if (Yii::$app->request->isAjax) { if (Yii::$app->request->isAjax) {
$request = Yii::$app->request; $request = Yii::$app->request;
$page = $request->get('page', 1); $page = $request->get('page', 1);
$limit = $request->get('limit', 10); $limit = $request->get('limit', 10);
$name = $request->get('name', null); $name = $request->get('name', null);
$platform = $request->get('platform', null);
$condition = [];
if ($name) {
$condition[] = ['like', 'name', $name];
}
if ($platform) {
$condition[] = ['platform' => $platform];
}
$data = CoinBusiness::getList($page, $limit, $condition);
$data['code'] = 0;
//ajax return //ajax return
Yii::$app->response->format = 'json'; Yii::$app->response->format = 'json';
$data = Coin::getList($page, $limit, ['like', 'name', $name]);
$data['code'] = 0;
return $data; return $data;
} }
return $this->render('index'); return $this->render('index');
...@@ -129,4 +137,9 @@ class CoinController extends BaseController ...@@ -129,4 +137,9 @@ class CoinController extends BaseController
return ['code' => $exception->getCode(), 'msg' => $exception->getMessage()]; return ['code' => $exception->getCode(), 'msg' => $exception->getMessage()];
} }
} }
public function actionCost()
{
return '';
}
} }
\ No newline at end of file
...@@ -28,18 +28,28 @@ ...@@ -28,18 +28,28 @@
</div> </div>
</div> </div>
<div class="layui-inline"> <div class="layui-inline">
<label class="layui-form-label" style="margin-bottom: 0; width: 100px;">平台</label>
<div class="layui-input-inline">
<select name="platform">
<option>all</option>
<option value="ethereum">eth</option>
</select>
</div>
</div>
<div class="layui-inline">
<button class="layui-btn" lay-submit lay-filter="form1">搜索</button> <button class="layui-btn" lay-submit lay-filter="form1">搜索</button>
</div> </div>
</form> </form>
</div> </div>
</div> </div>
<div class="layui-row"> <div class="layui-row">
<table class="layui-table" id="table1"></table> <table class="layui-table" id="table1" lay-filter="table1"></table>
</div> </div>
<script> <script>
var table = layui.table; var table = layui.table;
var form = layui.form; var form = layui.form;
var layer = layui.layer; var layer = layui.layer;
form.render();
table.render({ table.render({
elem: "#table1", elem: "#table1",
url: '/admin/coin/index', url: '/admin/coin/index',
...@@ -55,6 +65,13 @@ ...@@ -55,6 +65,13 @@
{field: 'official', title: '官网', templet: "#officialTpl"}, {field: 'official', title: '官网', templet: "#officialTpl"},
{field: 'paper', title: '白皮书', templet: "#paperTpl"}, {field: 'paper', title: '白皮书', templet: "#paperTpl"},
{field: 'platform', title: '平台'}, {field: 'platform', title: '平台'},
{
field: 'exchange',
title: '上架交易所',
templet: "#exchangeTpl",
style: 'cursor: pointer;',
event: 'getExchange'
},
{field: 'price', title: '众筹价格'}, {field: 'price', title: '众筹价格'},
{field: 'release', title: '发行时间'}, {field: 'release', title: '发行时间'},
{field: 'id', title: '操作', templet: '#operationTpl'} {field: 'id', title: '操作', templet: '#operationTpl'}
...@@ -68,6 +85,23 @@ ...@@ -68,6 +85,23 @@
}); });
return false; return false;
}); });
//监听单元格事件
table.on('tool(table1)', function (obj) {
var data = obj.data;
console.log(data);
if (obj.event === 'getExchange') {
var content = '';
$.each(data.exchange.data, function (index, item) {
content += '<li>' + item + '</li>';
});
layer.open({
type: 0,
title: '上架交易所列表',
content: content,
tips: 3
});
}
});
</script> </script>
<script type="text/html" id="iconTpl"> <script type="text/html" id="iconTpl">
<img src="{{d.icon}}" style="max-width: 32px; max-height: 32px;"/> <img src="{{d.icon}}" style="max-width: 32px; max-height: 32px;"/>
...@@ -94,4 +128,7 @@ ...@@ -94,4 +128,7 @@
<a href="/admin/coin/edit?id={{d.id}}"> <a href="/admin/coin/edit?id={{d.id}}">
<button class="layui-btn layui-btn-sm"><i class="layui-icon">&#xe642;</i></button> <button class="layui-btn layui-btn-sm"><i class="layui-icon">&#xe642;</i></button>
</a> </a>
</script>
<script type="text/html" id="exchangeTpl">
{{d.exchange.count}}
</script> </script>
\ No newline at end of file
...@@ -2,30 +2,38 @@ ...@@ -2,30 +2,38 @@
$chain_url = "121.196.205.182:45656"; $chain_url = "121.196.205.182:45656";
return [ return [
'adminEmail' => 'admin@example.com', 'adminEmail' => 'admin@example.com',
'supportEmail' => 'support@example.com', 'supportEmail' => 'support@example.com',
'user.passwordResetTokenExpire' => 3600, 'user.passwordResetTokenExpire' => 3600,
'admin' => 1, 'admin' => 1,
/* 后台页面属性配置 */ /* 后台页面属性配置 */
'config_page' => [ 'config_page' => [
'add' => '添加', 'add' => '添加',
'delete' => '删除', 'delete' => '删除',
'update' => '更新', 'update' => '更新',
'tool_bar' => '工具箱', 'tool_bar' => '工具箱',
'export' => '导出Excel', 'export' => '导出Excel',
'others' => '其它', 'others' => '其它',
'details' => '详情', 'details' => '详情',
'color_opt' => 'btn-primary', 'color_opt' => 'btn-primary',
'color_bar' => 'btn-primary', 'color_bar' => 'btn-primary',
], ],
'pager' => [ 'pager' => [
'options' => ['class'=>'pagination','style'=>'visibility: visible;'], 'options' => ['class' => 'pagination', 'style' => 'visibility: visible;'],
'firstPageLabel' => "首页", 'firstPageLabel' => "首页",
'prevPageLabel' => '上一页', 'prevPageLabel' => '上一页',
'nextPageLabel' => '下一页', 'nextPageLabel' => '下一页',
'lastPageLabel' => '末页', 'lastPageLabel' => '末页',
], ],
/** 非小号数据爬取地址 */
'feixiaohao_domain' => 'https://www.feixiaohao.com',
'feixiaohao_page' => [
'assets' => '/assets/',//代币
'currencies' => '/currencies/',//币种详情
'coinmarket' => '/coinmarket/',//上市交易所
],
]; ];
...@@ -28,13 +28,17 @@ class Coin extends BaseActiveRecord ...@@ -28,13 +28,17 @@ class Coin extends BaseActiveRecord
* 获取币种信息列表 * 获取币种信息列表
* @param int $page * @param int $page
* @param int $limit * @param int $limit
* @param array $config * @param array $condition
* @return array|\yii\db\ActiveRecord[] * @return array|\yii\db\ActiveRecord[]
*/ */
public static function getList($page = 1, $limit = 10, $config = []) public static function getList($page = 1, $limit = 10, $condition = [])
{ {
$count = self::find()->filterWhere($config)->count(); $query = self::find();
$data = self::find()->offset(($page - 1) * 10)->limit($limit)->filterWhere($config)->asArray()->all(); foreach ($condition as $item) {
$query = $query->andFilterWhere($item);
}
$count = $query->count();
$data = $query->offset(($page - 1) * 10)->limit($limit)->asArray()->all();
foreach ($data as $key => $item) { foreach ($data as $key => $item) {
$data[$key]['price'] = sprintf("%0.6f", $item['price']); $data[$key]['price'] = sprintf("%0.6f", $item['price']);
// $data[$key]['release'] = date('Y-m-d', $item['release']); // $data[$key]['release'] = date('Y-m-d', $item['release']);
......
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