Commit c440c496 authored by ZhuChunYang's avatar ZhuChunYang

update

parent 9c81f813
......@@ -127,6 +127,8 @@ class CoinReleaseMemberController extends BaseController
$value[] = $value[3] * $present / 100;
$value[] = $company_name;
}
$data_json = json_encode($data);
Yii::$app->redis->set('coin_release_member_data',$data_json,'EX',3600);
foreach ($data as $key => &$value){
$value[3] /= 1e8;
unset($value[4]);
......@@ -143,6 +145,20 @@ class CoinReleaseMemberController extends BaseController
}
}
public function actionDataUpdate()
{
Yii::$app->response->format = 'json';
if(Yii::$app->request->isAjax){
$coin_release_member_data = Yii::$app->redis->get('coin_release_member_data');
if($coin_release_member_data){
$coin_release_member_data = json_decode($coin_release_member_data);
CoinReleaseMember::implode($coin_release_member_data);
return ['code' => 0, 'msg' => '导入成功'];
}
return ['code' => 0, 'msg' => '没有需要导入的数据'];
}
}
/**
* 获取rule_id
*
......
......@@ -35,7 +35,6 @@ upload.render({
exts: 'csv',
done: function (res) {
layer.closeAll('loading');
console.log(res);
var data = res.data;
var tr_data = '';
for(var i=0;i<data.length;i++){
......@@ -67,10 +66,20 @@ upload.render({
btn: ['确认导入', '取消']
,btn1: function(index, layero){
//按钮【按钮一】的回调
$.get('/admin/coin-release-member/data-update', {}, function (rev) {
layer.msg(rev.msg);
if (0 == rev.code) {
layer.close(index);
table.reload('table1', {
page: {
curr: 1
}
});
}
});
}
,btn2: function(index, layero){
//按钮【按钮二】的回调
alert(1);
//return false 开启该代码可禁止点击该按钮关闭
}
,cancel: function(){
......
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