作者 王晓刚
1 个管道 的构建 通过 耗费 1 秒

我的钱包

... ... @@ -262,6 +262,29 @@ class Member extends WechatBase
}
/**
* 更多收益记录
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function more_earnings_log(){
$user_id = $this->request->param('user_id',0,'intval');
$page = $this->request->param('page',1,'intval');
$pageNum = $this->request->param('pageNum',5,'intval');
if(empty($user_id)){
$this->error('缺少必要参数');
}
$data = Db::name('user_exp_log')->where(['type'=>['in',[4,5]]])->order('id desc')->page($page,$pageNum)->select();
$exp_ratio = Db::name('exp_ratio')->where(['id'=>1])->find();
foreach($data as $key => $vo){
$data[$key]['createtime'] = date('Y年m月d日 H:i');
//转换为人民币
$data[$key]['rmb'] = round($vo['exp']*$exp_ratio['ratio']*0.01,2);
}
$this->success('SUCCESS',$data);
}
/**
* 提现记录页面
* @return mixed
* @throws \think\db\exception\DataNotFoundException
... ...
... ... @@ -6,7 +6,7 @@
<body>
<!-- 收益记录 -->
<div class="income_record">
<div class="income_record" id="dom">
<div class="record_tips">红包劵收益记录</div>
{foreach name="$data" item="vo"}
<div class="record_single">
... ... @@ -45,5 +45,56 @@
{/notempty}
{include file="public/js" /}
</body>
<script>
$(function(){
//加载更多
$(".load_more").click(function () {
var page = $('#page').val();
page++;
$.ajax({
url:"{:url('home/index/more')}",
type:"POST",
data:{'page':page},
success:function(res){
if(res.code == 1){
if(res.data == ''){
$('.justify_center').html("<div>没有更多了~</div>");
toast('没有更多了~');
return;
}
var html = "";
$(res.data).each(function (key, vo) {
var type = "";
if(vo.type == 4){
type = "参与答题";
}else if(vo.type == 5){
type = "下级答题";
}
html += "<div class=\"record_single\">\n" +
" <div class=\"record_box layout justify flex_diection\">\n" +
" <div class=\"layout justify flex_row\">\n" +
" <div class=\"record_title\">\n" +
" "+type+"\n" +
" </div>\n" +
" <div class=\"record_num\">+"+vo.rmb+"元</div>\n" +
" </div>\n" +
" <div class=\"record_date\">\n" +
" "+vo.createtime+"\n" +
" </div>\n" +
" </div>\n" +
" </div>";
});
$('#dom').append(html);
$('#page').val(page);
}else{
toast('与服务器断开连接');
}
},
error:function(){
toast('与服务器断开连接');
}
})
})
})
</script>
</html>
\ No newline at end of file
... ...