瀏覽代碼

金币总额sum统计

lizhen_gitee 2 年之前
父節點
當前提交
5c912d1acb

+ 7 - 1
application/admin/controller/Moneylog.php

@@ -81,7 +81,13 @@ class Moneylog extends Backend
                 $row['log_type_text'] = isset($wallet_logtype[$row['log_type']]) ? $wallet_logtype[$row['log_type']] : '';
             }
 
-            $result = array("total" => $list->total(), "rows" => $list->items());
+            $sum_money = db('user_money_log')->alias('moneylog')->join('user','moneylog.user_id = user.id','LEFT')->where($where)->where($gh_map)->field('sum(moneylog.change_value) as sum_money')->find();
+
+            $result = array("total" => $list->total(), "rows" => $list->items(),
+                'extend' => [
+                    'sum_money' => $sum_money['sum_money'],
+                ]
+            );
 
             return json($result);
         }

+ 1 - 0
application/admin/view/moneylog/index.html

@@ -7,6 +7,7 @@
                 <div class="widget-body no-padding">
                     <div id="toolbar" class="toolbar">
                         <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
+                        <a href="javascript:;" class="btn btn-default" title="消费总额">总额: <span id="sum_money"></span>元</a>
                         <!--<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('moneylog/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
                         <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('moneylog/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
                         <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('moneylog/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>

+ 5 - 0
application/index/controller/Index.php

@@ -19,6 +19,11 @@ class Index extends Frontend
         return $this->view->fetch();
     }
 
+    public function wxsharedownload(){
+        echo '你好,我是微信分享下载页';
+        exit;
+    }
+
     /**
      * app下载页
      * 判断是安卓还是ios

+ 1 - 1
public/assets/js/backend/gonghui.js

@@ -27,7 +27,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {checkbox: true},
                         {field: 'id', title: __('Id')},
                         {field: 'name', title: __('Name'), operate: 'LIKE'},
-                        {field: 'usernum', title: '人数'},
+                        {field: 'usernum', title: '人数', operate:false},
                         {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                     ]
                 ]

+ 5 - 0
public/assets/js/backend/moneylog.js

@@ -43,6 +43,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                 ]
             });
 
+            //这里我们手动设置底部的值
+            table.on('load-success.bs.table', function (e, data) {
+                $("#sum_money").text(data.extend.sum_money);
+            });
+
             // 为表格绑定事件
             Table.api.bindevent(table);
         },