Commit 7c2f317a authored by ZhuChunYang's avatar ZhuChunYang

添加手机号搜索资产

parent de93cd92
......@@ -204,4 +204,28 @@ class CoinPublishRuleController extends BaseController
}
return $query['pid'];
}
public function actionGetRememberList()
{
$mobile = Yii::$app->request->get('mobile', '');
Yii::$app->response->format = 'json';
$pid = $this->getPid();
if($pid && $mobile){
$ruleItems = CoinPublishRule::getPublishRuleItemsByPid($pid);
$ruleIds = array_column($ruleItems,'id');
$ruleInfos = array_column($ruleItems,'sid','id');
$data = CoinReleaseMember::getMemberListByMobile($ruleIds,$mobile);
foreach($data as &$value){
$value['rule_sid'] = $ruleInfos[$value['rule_id']];
$value['amount'] /= 1e8;
$value['release'] /= 1e8;
$value['freeze'] /= 1e8;
$value['output'] /= 1e8;
}
$data = $data ?? [];
return ['code' => 0,'data' => $data,'count' => count($data)];
}else{
return ['code' => -1, 'msg' => 'pid获取失败或手机号不能为空'];
}
}
}
......@@ -30,7 +30,19 @@ ListAsset::register($this);
</table>
</div>
</div>
<div class="layui-row">
<div class="layui-col-md8">
<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="mobile">
</div>
</div>
<div class="layui-inline">
<button class="layui-btn" id="search">搜索</button>
</div>
</div>
</div>
<div class="layui-row">
<table class="layui-hide" id="table1" lay-filter="table1"></table>
</div>
......
......@@ -140,3 +140,44 @@ form.on('select(form_data)', function (data) {
format: format[index]
});
});
$('#search').click(function () {
var mobile = $('input[name="mobile"]').val();
$.get('/admin/coin-publish-rule/get-remember-list', {mobile:mobile}, function (rev) {
if (0 == rev.code) {
console.log(rev.data);
var tr_data = '';
var data = rev.data;
for(var i=0;i<data.length;i++){
tr_data += '<tr><td>'+data[i]['rule_sid']+'</td><td>'+data[i]['id']+'</td><td>'+data[i]['mobile']+'</td><td>'+data[i]['coin']+'</td><td>'+
data[i]['amount']+'</td><td>'+data[i]['release']+'</td><td>'+data[i]['freeze']+'</td><td>'+
data[i]['output']+'</td></tr>';
}
var count_html = '<p style="color:#0000ff">共<b style="color:red">'+rev.count+'</b>条资产记录:'+'</p>';
var html = count_html + '<table class="layui-table">' +
'<thead>' +
'<tr>' +
'<th>锁仓编号</th>' +
'<th>用户id</th>' +
'<th>手机号</th>' +
'<th>币种</th>' +
'<th>总量</th>' +
'<th>活动数量</th>' +
'<th>冻结数量</th>' +
'<th>已提币数量</th>' +
'</tr>' +
'</thead>' +
'<tbody>' +
tr_data +
'</tbody>' +
'</table>';
layer.open({
title: '个人资产信息',
content: html,
area: ['1000px', '800px'],
scrollbar:true,
});
}
});
});
......@@ -16,7 +16,7 @@ table.render({
}
},
{
field: 'release', title: '已解冻', templet: function (d) {
field: 'release', title: '活动数量', templet: function (d) {
return d.release / 1e8;
}
},
......
......@@ -36,5 +36,4 @@ class CoinPublish extends BaseActiveRecord
return self::find()->where(['id' => $id])->one();
}
}
......@@ -292,4 +292,10 @@ class CoinPublishRule extends BaseActiveRecord
}
return $result;
}
public static function getPublishRuleItemsByPid($pid)
{
return self::find()->where(['pid' => $pid])->asArray()->all();
}
}
......@@ -127,4 +127,9 @@ class CoinReleaseMember extends BaseActiveRecord
{
return CoinReleaseMember::find()->where(['rule_id' => $ids])->andWhere(['>', 'freeze', 0])->asArray()->all();
}
public static function getMemberListByMobile($ruleIds,$mobile)
{
return self::find()->where(['in','rule_id',$ruleIds])->andWhere(['mobile' => $mobile])->select('id,rule_id,mobile,coin,amount,release,freeze,output')->asArray()->all();
}
}
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