Commit 3098add5 authored by ZhuChunYang's avatar ZhuChunYang

update

parent 9a7e2e8f
...@@ -127,17 +127,14 @@ class CoinReleaseMemberController extends BaseController ...@@ -127,17 +127,14 @@ class CoinReleaseMemberController extends BaseController
$value[] = $value[3] * $present / 100; $value[] = $value[3] * $present / 100;
$value[] = $company_name; $value[] = $company_name;
} }
$result = CoinReleaseMember::implode($data); //$result = CoinReleaseMember::implode($data);
if ($result) { return ['code' => 0, 'msg' => '预览成功','data' => $data];
return ['code' => 0, 'msg' => '导入成功'];
}
} else { } else {
return ['code' => -1, 'msg' => '规则不存在']; return ['code' => -1, 'msg' => '规则不存在'];
} }
} catch (\Exception $e) { } catch (\Exception $e) {
return ['code' => $e->getCode(), 'msg' => $e->getMessage()]; return ['code' => $e->getCode(), 'msg' => $e->getMessage()];
} }
return ['code' => 0, 'msg' => '导入失败'];
} }
/** /**
......
...@@ -17,4 +17,4 @@ IndexAsset::register($this); ...@@ -17,4 +17,4 @@ IndexAsset::register($this);
<div class="layui-col-md8"> <div class="layui-col-md8">
<table class="layui-table" id="table1" lay-filter="table1"></table> <table class="layui-table" id="table1" lay-filter="table1"></table>
</div> </div>
</div> </div>
\ No newline at end of file
...@@ -35,12 +35,53 @@ upload.render({ ...@@ -35,12 +35,53 @@ upload.render({
exts: 'csv', exts: 'csv',
done: function (res) { done: function (res) {
layer.closeAll('loading'); layer.closeAll('loading');
layer.msg(res.msg); console.log(res);
table.reload('table1', { var data = res.data;
page: { var tr_data = '';
curr: 1 for(var i=0;i<data.length;i++){
} tr_data += '<tr><td>'+data[i][1]+'</td><td>'+data[i][2]+'</td><td>'+data[i][3]+'</td></tr>';
}); }
if(res.code == 0){
var html = '<table class="layui-table">' +
'<colgroup>\n' +
'<col width="150">' +
'<col width="150">' +
'<col width="200">' +
'</colgroup>' +
'<thead>' +
'<tr>' +
'<th>手机号</th>' +
'<th>币种</th>' +
'<th>数量</th>' +
'</tr>' +
'</thead>' +
'<tbody>' +
tr_data +
'</tbody>' +
'</table>';
layer.open({
title: '导入数据预览',
content: html,
area: ['1000px', '800px'],
scrollbar:true,
btn: ['确认导入', '取消']
,btn1: function(index, layero){
//按钮【按钮一】的回调
}
,btn2: function(index, layero){
//按钮【按钮二】的回调
alert(1);
//return false 开启该代码可禁止点击该按钮关闭
}
,cancel: function(){
}
});
}else{
layer.msg(res.msg);
}
}, },
before: function (obj) { //obj参数包含的信息,跟 choose回调完全一致,可参见上文。 before: function (obj) { //obj参数包含的信息,跟 choose回调完全一致,可参见上文。
layer.load(); //上传loading layer.load(); //上传loading
......
...@@ -202,10 +202,17 @@ class CoinBusiness ...@@ -202,10 +202,17 @@ class CoinBusiness
$row['introduce'] = ''; $row['introduce'] = '';
} }
$row['price'] = sprintf("%s", (double) $row['price']); $row['price'] = sprintf("%s", (double) $row['price']);
$coin = CoinFactory::createCoin($row['name'], $row['id'], $row['sid']); $quotation = ExchangeBusiness::getquatation($row['name']);
$row['quotation'] = $coin->quotation(); if($quotation){
$row['exchange_count'] = $coin->exchange_count(); $tikerdata['price'] = $quotation['rmb'];
$coin->__destruct(); $tikerdata['dollar'] = $quotation['last'];
}else{
$tikerdata['price'] = 0;
$tikerdata['dollar'] = 0;
}
$row['quotation'] = $tikerdata;
$row['quotation']['publish_count'] = $row['publish_count'];
$row['quotation']['circulate_count'] = $row['circulate_count'];
} }
return $row ? [$row] : []; return $row ? [$row] : [];
} }
......
...@@ -51,7 +51,7 @@ class CoinBTYService extends Coin implements CoinInterface ...@@ -51,7 +51,7 @@ class CoinBTYService extends Coin implements CoinInterface
$key = $this->cache_key_prifx . $this->sid . 'all'; $key = $this->cache_key_prifx . $this->sid . 'all';
$result = Yii::$app->cache->get($key); $result = Yii::$app->cache->get($key);
if ($result === false || YII_ENV_DEV) { if ($result === false || YII_ENV_DEV) {
$url = 'http://40.83.77.188/api/data/Ticker?sort=cname'; $url = 'https://zbapi.licai.cn/api/data/Ticker?sort=cname';
$ch = new Curl(); $ch = new Curl();
$content = $ch->get($url, false); $content = $ch->get($url, false);
if (is_array($content) && isset($content['code']) && $content['code'] == 200) { if (is_array($content) && isset($content['code']) && $content['code'] == 200) {
......
...@@ -492,7 +492,7 @@ class CoinService extends Coin implements CoinInterface ...@@ -492,7 +492,7 @@ class CoinService extends Coin implements CoinInterface
* @param string $sid * @param string $sid
* @return object|string * @return object|string
*/ */
public function quotation() /* public function quotation()
{ {
//使用缓存 //使用缓存
$key = [ $key = [
...@@ -538,5 +538,6 @@ class CoinService extends Coin implements CoinInterface ...@@ -538,5 +538,6 @@ class CoinService extends Coin implements CoinInterface
} }
} }
return $result; return $result;
} }*/
} }
\ No newline at end of file
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