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

我的钱包

@@ -262,6 +262,29 @@ class Member extends WechatBase @@ -262,6 +262,29 @@ class Member extends WechatBase
262 } 262 }
263 263
264 /** 264 /**
  265 + * 更多收益记录
  266 + * @throws \think\db\exception\DataNotFoundException
  267 + * @throws \think\db\exception\ModelNotFoundException
  268 + * @throws \think\exception\DbException
  269 + */
  270 + public function more_earnings_log(){
  271 + $user_id = $this->request->param('user_id',0,'intval');
  272 + $page = $this->request->param('page',1,'intval');
  273 + $pageNum = $this->request->param('pageNum',5,'intval');
  274 + if(empty($user_id)){
  275 + $this->error('缺少必要参数');
  276 + }
  277 + $data = Db::name('user_exp_log')->where(['type'=>['in',[4,5]]])->order('id desc')->page($page,$pageNum)->select();
  278 + $exp_ratio = Db::name('exp_ratio')->where(['id'=>1])->find();
  279 + foreach($data as $key => $vo){
  280 + $data[$key]['createtime'] = date('Y年m月d日 H:i');
  281 + //转换为人民币
  282 + $data[$key]['rmb'] = round($vo['exp']*$exp_ratio['ratio']*0.01,2);
  283 + }
  284 + $this->success('SUCCESS',$data);
  285 + }
  286 +
  287 + /**
265 * 提现记录页面 288 * 提现记录页面
266 * @return mixed 289 * @return mixed
267 * @throws \think\db\exception\DataNotFoundException 290 * @throws \think\db\exception\DataNotFoundException
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 6
7 <body> 7 <body>
8 <!-- 收益记录 --> 8 <!-- 收益记录 -->
9 - <div class="income_record"> 9 + <div class="income_record" id="dom">
10 <div class="record_tips">红包劵收益记录</div> 10 <div class="record_tips">红包劵收益记录</div>
11 {foreach name="$data" item="vo"} 11 {foreach name="$data" item="vo"}
12 <div class="record_single"> 12 <div class="record_single">
@@ -45,5 +45,56 @@ @@ -45,5 +45,56 @@
45 {/notempty} 45 {/notempty}
46 {include file="public/js" /} 46 {include file="public/js" /}
47 </body> 47 </body>
48 - 48 +<script>
  49 + $(function(){
  50 + //加载更多
  51 + $(".load_more").click(function () {
  52 + var page = $('#page').val();
  53 + page++;
  54 + $.ajax({
  55 + url:"{:url('home/index/more')}",
  56 + type:"POST",
  57 + data:{'page':page},
  58 + success:function(res){
  59 + if(res.code == 1){
  60 + if(res.data == ''){
  61 + $('.justify_center').html("<div>没有更多了~</div>");
  62 + toast('没有更多了~');
  63 + return;
  64 + }
  65 + var html = "";
  66 + $(res.data).each(function (key, vo) {
  67 + var type = "";
  68 + if(vo.type == 4){
  69 + type = "参与答题";
  70 + }else if(vo.type == 5){
  71 + type = "下级答题";
  72 + }
  73 + html += "<div class=\"record_single\">\n" +
  74 + " <div class=\"record_box layout justify flex_diection\">\n" +
  75 + " <div class=\"layout justify flex_row\">\n" +
  76 + " <div class=\"record_title\">\n" +
  77 + " "+type+"\n" +
  78 + " </div>\n" +
  79 + " <div class=\"record_num\">+"+vo.rmb+"元</div>\n" +
  80 + " </div>\n" +
  81 + " <div class=\"record_date\">\n" +
  82 + " "+vo.createtime+"\n" +
  83 + " </div>\n" +
  84 + " </div>\n" +
  85 + " </div>";
  86 + });
  87 + $('#dom').append(html);
  88 + $('#page').val(page);
  89 + }else{
  90 + toast('与服务器断开连接');
  91 + }
  92 + },
  93 + error:function(){
  94 + toast('与服务器断开连接');
  95 + }
  96 + })
  97 + })
  98 + })
  99 +</script>
49 </html> 100 </html>