Commit 3098add5 authored by ZhuChunYang's avatar ZhuChunYang

update

parent 9a7e2e8f
......@@ -127,17 +127,14 @@ class CoinReleaseMemberController extends BaseController
$value[] = $value[3] * $present / 100;
$value[] = $company_name;
}
$result = CoinReleaseMember::implode($data);
if ($result) {
return ['code' => 0, 'msg' => '导入成功'];
}
//$result = CoinReleaseMember::implode($data);
return ['code' => 0, 'msg' => '预览成功','data' => $data];
} else {
return ['code' => -1, 'msg' => '规则不存在'];
}
} catch (\Exception $e) {
return ['code' => $e->getCode(), 'msg' => $e->getMessage()];
}
return ['code' => 0, 'msg' => '导入失败'];
}
/**
......
......@@ -17,4 +17,4 @@ IndexAsset::register($this);
<div class="layui-col-md8">
<table class="layui-table" id="table1" lay-filter="table1"></table>
</div>
</div>
\ No newline at end of file
</div>
......@@ -35,12 +35,53 @@ upload.render({
exts: 'csv',
done: function (res) {
layer.closeAll('loading');
layer.msg(res.msg);
table.reload('table1', {
page: {
curr: 1
}
});
console.log(res);
var data = res.data;
var tr_data = '';
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回调完全一致,可参见上文。
layer.load(); //上传loading
......
......@@ -202,10 +202,17 @@ class CoinBusiness
$row['introduce'] = '';
}
$row['price'] = sprintf("%s", (double) $row['price']);
$coin = CoinFactory::createCoin($row['name'], $row['id'], $row['sid']);
$row['quotation'] = $coin->quotation();
$row['exchange_count'] = $coin->exchange_count();
$coin->__destruct();
$quotation = ExchangeBusiness::getquatation($row['name']);
if($quotation){
$tikerdata['price'] = $quotation['rmb'];
$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] : [];
}
......
......@@ -51,7 +51,7 @@ class CoinBTYService extends Coin implements CoinInterface
$key = $this->cache_key_prifx . $this->sid . 'all';
$result = Yii::$app->cache->get($key);
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();
$content = $ch->get($url, false);
if (is_array($content) && isset($content['code']) && $content['code'] == 200) {
......
......@@ -492,7 +492,7 @@ class CoinService extends Coin implements CoinInterface
* @param string $sid
* @return object|string
*/
public function quotation()
/* public function quotation()
{
//使用缓存
$key = [
......@@ -538,5 +538,6 @@ class CoinService extends Coin implements CoinInterface
}
}
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