Commit cd538ca7 authored by shajiaiming's avatar shajiaiming

Merge branch 'master' into feature/airdrop

parents 83880703 bb2e349a
<?php
/**
* Created By Sublime Text 3
*
* @authors rlgy <rlgyzhcn@qq.com>
* @date 2018-09-07 17:41:04
*/
namespace backend\assets\platformCoins;
use yii\web\AssetBundle;
use yii\web\View;
class IndexAsset extends AssetBundle
{
public $sourcePath = '@backend/web/js/platform-coins';
public $js = [
'index.js',
];
public $jsOptions = [
'position' => View::POS_END,
];
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: ZCY
* Date: 2018/12/17
* Time: 10:13
*/
namespace backend\controllers;
use backend\models\coin\CoinPlatformForm;
use common\models\psources\CoinPlatform;
use common\models\psources\CoinPlatformCoins;
use Yii;
class PlatformCoinsController extends BaseController
{
public function actionList()
{
if (Yii::$app->request->isAjax) {
Yii::$app->response->format = 'json';
$request = Yii::$app->request;
$page = $request->get('page', 1);
$limit = $request->get('limit', 10);
$coins_address = $request->get('coins_address', '**');
$where = [];
if ($coins_address) {
$where[] = ['coins_address' => $coins_address];
}
$data = CoinPlatformCoins::getList($page, $limit, $where);
foreach ($data['data'] as &$val){
unset($val['id']);
unset($val['coins_name']);
unset($val['type']);
unset($val['platform_id']);
unset($val['update_time']);
}
$data['code'] = 0;
Yii::$app->response->format = 'json';
return $data;
}
return $this->render('index');
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: rlgyzhcn
* Date: 18-5-31
* Time: 上午9:59
*/
use backend\assets\platformCoins\IndexAsset;
IndexAsset::register($this);
?>
<style>
.layui-table-tips-c {
padding: 0px;
}
</style>
<div class="layui-row">
<div class="layui-col-md8">
<form class="layui-form" method="get" action="">
<div class="layui-inline">
<label class="layui-form-label" style="margin-bottom: 0; width: 100px;">按地址搜索</label>
<div class="layui-input-inline">
<input class="layui-input" name="coins_address" style="width: 400px;">
</div>
</div>
<div class="layui-inline">
<button class="layui-btn" lay-submit lay-filter="form1">搜索</button>
</div>
</form>
</div>
</div>
<div class="layui-row">
<table class="layui-table" id="table1" lay-filter="table1"></table>
</div>
<script type="text/html" id="operationTpl">
<a lay-event="edit">
<button class="layui-btn layui-btn-sm"><i class="layui-icon">&#xe642;</i></button>
</a>
<a lay-event="delete">
<button class="layui-btn layui-btn-sm layui-btn-danger"><i class="layui-icon">&#xe640;</i></button>
</a>
</script>
/**
* @author rlgyzhcn@qq.com
*/
var table = layui.table;
var form = layui.form;
var layer = layui.layer;
form.render();
var tableIns = table.render({
elem: "#table1",
url: '/admin/platform-coins/list',
limit: 10,
page: 1,
loading: true,
cols: [[
{field: 'coins_address', title: '地址'},
{field: 'deviceCode', title: '设备唯一码'},
{field: 'create_time', title: '添加时间'},
]],
});
form.on('submit(form1)', function (data) {
table.reload("table1", {
where: data.field,
page: {curr: 1},
});
return false;
});
//监听单元格事件
table.on('tool(table1)', function (obj) {
var data = obj.data;
if (obj.event == 'delete') {
layer.confirm('真的要删除' + data.name + '吗?', {icon: 3, title: '删除'}, function (index) {
layer.close(index);
//向服务端发送删除指令
$.get('/admin/wallet/delete?id=' + obj.data.id, function (data, status) {
if (data.code == 0) {
obj.del(); //删除对应行(tr)的DOM结构
}
layer.msg(data.msg);
});
});
} else if (obj.event == 'edit') {
$.get('/admin/wallet/edit', {id: data.id}, function (str) {
var editIndex = layer.open({
type: 1,
title: '编辑: ' + data.name,
area: '625px',
content: str,
btn: ['保存', '取消'],
btn1: function () {
// console.log();
$.post('/admin/wallet/edit', $("#walletEdit").serialize(), function (rev) {
layer.msg(rev.msg);
if (rev.code == 0) {
table.reload("table1", {
where: data.field,
});
layer.close(editIndex);
}
});
}
});
});
}
});
\ No newline at end of file
......@@ -82,7 +82,7 @@ class ExchangeBusiness
goto doEnd;
}
if (strtoupper($tag) == 'TSC' || strtoupper($tag) == 'WL' || strtoupper($tag) == 'ETS' || strtoupper($tag) == 'LIMS' || strtoupper($tag) == 'AT' || strtoupper($tag) == 'BTJ') {
if (strtoupper($tag) == 'CIC' || strtoupper($tag) == 'RYH' || strtoupper($tag) == 'TSC' || strtoupper($tag) == 'WL' || strtoupper($tag) == 'ETS' || strtoupper($tag) == 'LIMS' || strtoupper($tag) == 'AT' || strtoupper($tag) == 'BTJ') {
$quotation = [
'low' => 0,
'high' => 0,
......@@ -271,20 +271,20 @@ class ExchangeBusiness
if (count($condition[0]) > 1) {
foreach ($condition as $val) {
if ('null' == $val[1] || 'coin' == $val[1]) {
$data[] = Coin::find()->select('id,sid,icon,name,optional_name,nickname,platform,chain,address as contract_address,treaty')
$data[] = Coin::find()->select('id,sid,icon,name,optional_name,nickname,introduce,platform,chain,address as contract_address,treaty')
->where(['name' => $val[0]])
->asArray()
->one();
continue;
}
$data[] = Coin::find()->select('id,sid,icon,name,optional_name,nickname,platform,chain,address as contract_address,treaty')
$data[] = Coin::find()->select('id,sid,icon,name,optional_name,nickname,introduce,platform,chain,address as contract_address,treaty')
->where(['name' => $val[0]])
->andWhere(['platform' => $val[1]])
->asArray()
->one();
}
} else {
$data = Coin::find()->select('id,sid,icon,name,optional_name,nickname,platform,chain,address as contract_address,treaty')
$data = Coin::find()->select('id,sid,icon,name,optional_name,nickname,introduce,platform,chain,address as contract_address,treaty')
->where(['in', 'name', $condition])
->asArray()->all();
}
......
......@@ -29,7 +29,7 @@ class CoinController extends BaseController
public function actionGetIconByNames()
{
$response_ = new ResponseBuild();
$names = Yii::$app->request->POST('names');
$names = Yii::$app->request->POST('names');
if (empty($names)) {
$response_->build(ResponseBuild::STATUS_PARAMS_NOT_VALIDATE);
return $response_;
......@@ -38,7 +38,7 @@ class CoinController extends BaseController
$names = [$names];
}
$infos = Coin::getInfoByNames($names);
$data = [];
$data = [];
if ($infos) {
$data = array_column($infos, 'icon', 'name');
}
......@@ -53,7 +53,7 @@ class CoinController extends BaseController
public function actionCoinInfoByNames()
{
$response_ = new ResponseBuild();
$names = Yii::$app->request->POST('names');
$names = Yii::$app->request->POST('names');
if (empty($names)) {
$response_->build(ResponseBuild::STATUS_PARAMS_NOT_VALIDATE);
return $response_;
......@@ -62,11 +62,11 @@ class CoinController extends BaseController
$names = [$names];
}
$condition = $names;
$fields = ['id', 'sid', 'icon', 'name', 'nickname', 'platform', 'chain','address as contract_address','introduce'];
$result = ExchangeBusiness::getApiListForIndex(1, 999, $condition,$fields);
$fields = ['id', 'sid', 'icon', 'name', 'nickname', 'platform', 'chain', 'address as contract_address', 'introduce'];
$result = ExchangeBusiness::getApiListForIndex(1, 999, $condition, $fields);
if ($result) {
$response_->build(ResponseBuild::STATUS_SUCCEED, '', $result['data']);
}else{
} else {
$response_->build(ResponseBuild::STATUS_SUCCEED, '', []);
}
return $response_;
......
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