Browse Source

资金日志,金币日志

lizhen_gitee 1 year ago
parent
commit
296751c963

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

@@ -53,23 +53,9 @@ class Moneylog extends Backend
             }
             }
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
 
 
-            //公会分权限
-            $gh_map = [];
-            $gh_ids = db('admin')->where('id',$this->auth->id)->value('gh_ids');
-            if(empty($gh_ids)){
-                $gh_map = ['moneylog.user_id' => '-1'];
-            }else{
-                $user_ids = db('user')->where('gh_id','IN',$gh_ids)->column('id');
-                $gh_map = ['moneylog.user_id' => ['IN',$user_ids]];
-            }
-            if($gh_ids == '*'){
-                $gh_map = [];
-            }
-
             $list = $this->model
             $list = $this->model
                     ->with(['user'])
                     ->with(['user'])
                     ->where($where)
                     ->where($where)
-                    ->where($gh_map)
                     ->order($sort, $order)
                     ->order($sort, $order)
                     ->paginate($limit);
                     ->paginate($limit);
 
 
@@ -81,13 +67,7 @@ class Moneylog extends Backend
                 $row['log_type_text'] = isset($wallet_logtype[$row['log_type']]) ? $wallet_logtype[$row['log_type']] : '';
                 $row['log_type_text'] = isset($wallet_logtype[$row['log_type']]) ? $wallet_logtype[$row['log_type']] : '';
             }
             }
 
 
-            $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'],
-                ]
-            );
+            $result = array("total" => $list->total(), "rows" => $list->items());
 
 
             return json($result);
             return json($result);
         }
         }

+ 1 - 1
application/admin/lang/zh-cn/goldlog.php

@@ -4,7 +4,7 @@ return [
     'Id'            => 'ID',
     'Id'            => 'ID',
     'User_id'       => '用户ID',
     'User_id'       => '用户ID',
     'Log_type'      => '日志类型',
     'Log_type'      => '日志类型',
-    'Money_type'    => '钱包类型',
+    'Before'        => '之前余额',
     'Change_value'  => '变动金额',
     'Change_value'  => '变动金额',
     'Remain'        => '剩余金额',
     'Remain'        => '剩余金额',
     'Table'         => '数据来源',
     'Table'         => '数据来源',

+ 1 - 1
application/admin/lang/zh-cn/moneylog.php

@@ -4,7 +4,7 @@ return [
     'Id'            => 'ID',
     'Id'            => 'ID',
     'User_id'       => '用户ID',
     'User_id'       => '用户ID',
     'Log_type'      => '日志类型',
     'Log_type'      => '日志类型',
-    'Money_type'    => '钱包类型',
+    'Before'        => '之前余额',
     'Change_value'  => '变动金额',
     'Change_value'  => '变动金额',
     'Remain'        => '剩余金额',
     'Remain'        => '剩余金额',
     'Table'         => '数据来源',
     'Table'         => '数据来源',

+ 7 - 7
application/admin/view/goldlog/add.html

@@ -9,31 +9,31 @@
     <div class="form-group">
     <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Log_type')}:</label>
         <label class="control-label col-xs-12 col-sm-2">{:__('Log_type')}:</label>
         <div class="col-xs-12 col-sm-8">
         <div class="col-xs-12 col-sm-8">
-            <input id="c-log_type" class="form-control" name="row[log_type]" type="number" value="0">
+            <input id="c-log_type" data-rule="required" class="form-control" name="row[log_type]" type="number" value="0">
         </div>
         </div>
     </div>
     </div>
     <div class="form-group">
     <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Money_type')}:</label>
+        <label class="control-label col-xs-12 col-sm-2">{:__('Before')}:</label>
         <div class="col-xs-12 col-sm-8">
         <div class="col-xs-12 col-sm-8">
-            <input id="c-money_type" class="form-control" name="row[money_type]" type="text" value="money">
+            <input id="c-before" data-rule="required" class="form-control" name="row[before]" type="number" value="0">
         </div>
         </div>
     </div>
     </div>
     <div class="form-group">
     <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Change_value')}:</label>
         <label class="control-label col-xs-12 col-sm-2">{:__('Change_value')}:</label>
         <div class="col-xs-12 col-sm-8">
         <div class="col-xs-12 col-sm-8">
-            <input id="c-change_value" class="form-control" name="row[change_value]" type="number" value="0">
+            <input id="c-change_value" data-rule="required" class="form-control" name="row[change_value]" type="number" value="0">
         </div>
         </div>
     </div>
     </div>
     <div class="form-group">
     <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Remain')}:</label>
         <label class="control-label col-xs-12 col-sm-2">{:__('Remain')}:</label>
         <div class="col-xs-12 col-sm-8">
         <div class="col-xs-12 col-sm-8">
-            <input id="c-remain" class="form-control" name="row[remain]" type="number">
+            <input id="c-remain" data-rule="required" class="form-control" name="row[remain]" type="number" value="0">
         </div>
         </div>
     </div>
     </div>
     <div class="form-group">
     <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Table')}:</label>
         <label class="control-label col-xs-12 col-sm-2">{:__('Table')}:</label>
         <div class="col-xs-12 col-sm-8">
         <div class="col-xs-12 col-sm-8">
-            <input id="c-table" class="form-control" name="row[table]" type="text">
+            <input id="c-table" data-rule="required" class="form-control" name="row[table]" type="text" value="">
         </div>
         </div>
     </div>
     </div>
     <div class="form-group">
     <div class="form-group">
@@ -45,7 +45,7 @@
     <div class="form-group">
     <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Remark')}:</label>
         <label class="control-label col-xs-12 col-sm-2">{:__('Remark')}:</label>
         <div class="col-xs-12 col-sm-8">
         <div class="col-xs-12 col-sm-8">
-            <input id="c-remark" class="form-control" name="row[remark]" type="text" value="">
+            <input id="c-remark" data-rule="required" class="form-control" name="row[remark]" type="text" value="">
         </div>
         </div>
     </div>
     </div>
     <div class="form-group layer-footer">
     <div class="form-group layer-footer">

+ 7 - 7
application/admin/view/goldlog/edit.html

@@ -9,31 +9,31 @@
     <div class="form-group">
     <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Log_type')}:</label>
         <label class="control-label col-xs-12 col-sm-2">{:__('Log_type')}:</label>
         <div class="col-xs-12 col-sm-8">
         <div class="col-xs-12 col-sm-8">
-            <input id="c-log_type" class="form-control" name="row[log_type]" type="number" value="{$row.log_type|htmlentities}">
+            <input id="c-log_type" data-rule="required" class="form-control" name="row[log_type]" type="number" value="{$row.log_type|htmlentities}">
         </div>
         </div>
     </div>
     </div>
     <div class="form-group">
     <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Money_type')}:</label>
+        <label class="control-label col-xs-12 col-sm-2">{:__('Before')}:</label>
         <div class="col-xs-12 col-sm-8">
         <div class="col-xs-12 col-sm-8">
-            <input id="c-money_type" class="form-control" name="row[money_type]" type="text" value="{$row.money_type|htmlentities}">
+            <input id="c-before" data-rule="required" class="form-control" name="row[before]" type="number" value="{$row.before|htmlentities}">
         </div>
         </div>
     </div>
     </div>
     <div class="form-group">
     <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Change_value')}:</label>
         <label class="control-label col-xs-12 col-sm-2">{:__('Change_value')}:</label>
         <div class="col-xs-12 col-sm-8">
         <div class="col-xs-12 col-sm-8">
-            <input id="c-change_value" class="form-control" name="row[change_value]" type="number" value="{$row.change_value|htmlentities}">
+            <input id="c-change_value" data-rule="required" class="form-control" name="row[change_value]" type="number" value="{$row.change_value|htmlentities}">
         </div>
         </div>
     </div>
     </div>
     <div class="form-group">
     <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Remain')}:</label>
         <label class="control-label col-xs-12 col-sm-2">{:__('Remain')}:</label>
         <div class="col-xs-12 col-sm-8">
         <div class="col-xs-12 col-sm-8">
-            <input id="c-remain" class="form-control" name="row[remain]" type="number" value="{$row.remain|htmlentities}">
+            <input id="c-remain" data-rule="required" class="form-control" name="row[remain]" type="number" value="{$row.remain|htmlentities}">
         </div>
         </div>
     </div>
     </div>
     <div class="form-group">
     <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Table')}:</label>
         <label class="control-label col-xs-12 col-sm-2">{:__('Table')}:</label>
         <div class="col-xs-12 col-sm-8">
         <div class="col-xs-12 col-sm-8">
-            <input id="c-table" class="form-control" name="row[table]" type="text" value="{$row.table|htmlentities}">
+            <input id="c-table" data-rule="required" class="form-control" name="row[table]" type="text" value="{$row.table|htmlentities}">
         </div>
         </div>
     </div>
     </div>
     <div class="form-group">
     <div class="form-group">
@@ -45,7 +45,7 @@
     <div class="form-group">
     <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Remark')}:</label>
         <label class="control-label col-xs-12 col-sm-2">{:__('Remark')}:</label>
         <div class="col-xs-12 col-sm-8">
         <div class="col-xs-12 col-sm-8">
-            <input id="c-remark" class="form-control" name="row[remark]" type="text" value="{$row.remark|htmlentities}">
+            <input id="c-remark" data-rule="required" class="form-control" name="row[remark]" type="text" value="{$row.remark|htmlentities}">
         </div>
         </div>
     </div>
     </div>
     <div class="form-group layer-footer">
     <div class="form-group layer-footer">

+ 7 - 7
application/admin/view/moneylog/add.html

@@ -9,31 +9,31 @@
     <div class="form-group">
     <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Log_type')}:</label>
         <label class="control-label col-xs-12 col-sm-2">{:__('Log_type')}:</label>
         <div class="col-xs-12 col-sm-8">
         <div class="col-xs-12 col-sm-8">
-            <input id="c-log_type" class="form-control" name="row[log_type]" type="number" value="0">
+            <input id="c-log_type" data-rule="required" class="form-control" name="row[log_type]" type="number" value="0">
         </div>
         </div>
     </div>
     </div>
     <div class="form-group">
     <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Money_type')}:</label>
+        <label class="control-label col-xs-12 col-sm-2">{:__('Before')}:</label>
         <div class="col-xs-12 col-sm-8">
         <div class="col-xs-12 col-sm-8">
-            <input id="c-money_type" class="form-control" name="row[money_type]" type="text" value="money">
+            <input id="c-before" data-rule="required" class="form-control" step="0.01" name="row[before]" type="number" value="0.00">
         </div>
         </div>
     </div>
     </div>
     <div class="form-group">
     <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Change_value')}:</label>
         <label class="control-label col-xs-12 col-sm-2">{:__('Change_value')}:</label>
         <div class="col-xs-12 col-sm-8">
         <div class="col-xs-12 col-sm-8">
-            <input id="c-change_value" class="form-control" step="0.01" name="row[change_value]" type="number" value="0.00">
+            <input id="c-change_value" data-rule="required" class="form-control" step="0.01" name="row[change_value]" type="number" value="0.00">
         </div>
         </div>
     </div>
     </div>
     <div class="form-group">
     <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Remain')}:</label>
         <label class="control-label col-xs-12 col-sm-2">{:__('Remain')}:</label>
         <div class="col-xs-12 col-sm-8">
         <div class="col-xs-12 col-sm-8">
-            <input id="c-remain" class="form-control" step="0.01" name="row[remain]" type="number">
+            <input id="c-remain" data-rule="required" class="form-control" step="0.01" name="row[remain]" type="number" value="0.00">
         </div>
         </div>
     </div>
     </div>
     <div class="form-group">
     <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Table')}:</label>
         <label class="control-label col-xs-12 col-sm-2">{:__('Table')}:</label>
         <div class="col-xs-12 col-sm-8">
         <div class="col-xs-12 col-sm-8">
-            <input id="c-table" class="form-control" name="row[table]" type="text">
+            <input id="c-table" data-rule="required" class="form-control" name="row[table]" type="text" value="">
         </div>
         </div>
     </div>
     </div>
     <div class="form-group">
     <div class="form-group">
@@ -45,7 +45,7 @@
     <div class="form-group">
     <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Remark')}:</label>
         <label class="control-label col-xs-12 col-sm-2">{:__('Remark')}:</label>
         <div class="col-xs-12 col-sm-8">
         <div class="col-xs-12 col-sm-8">
-            <input id="c-remark" class="form-control" name="row[remark]" type="text" value="">
+            <input id="c-remark" data-rule="required" class="form-control" name="row[remark]" type="text" value="">
         </div>
         </div>
     </div>
     </div>
     <div class="form-group layer-footer">
     <div class="form-group layer-footer">

+ 7 - 7
application/admin/view/moneylog/edit.html

@@ -9,31 +9,31 @@
     <div class="form-group">
     <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Log_type')}:</label>
         <label class="control-label col-xs-12 col-sm-2">{:__('Log_type')}:</label>
         <div class="col-xs-12 col-sm-8">
         <div class="col-xs-12 col-sm-8">
-            <input id="c-log_type" class="form-control" name="row[log_type]" type="number" value="{$row.log_type|htmlentities}">
+            <input id="c-log_type" data-rule="required" class="form-control" name="row[log_type]" type="number" value="{$row.log_type|htmlentities}">
         </div>
         </div>
     </div>
     </div>
     <div class="form-group">
     <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Money_type')}:</label>
+        <label class="control-label col-xs-12 col-sm-2">{:__('Before')}:</label>
         <div class="col-xs-12 col-sm-8">
         <div class="col-xs-12 col-sm-8">
-            <input id="c-money_type" class="form-control" name="row[money_type]" type="text" value="{$row.money_type|htmlentities}">
+            <input id="c-before" data-rule="required" class="form-control" step="0.01" name="row[before]" type="number" value="{$row.before|htmlentities}">
         </div>
         </div>
     </div>
     </div>
     <div class="form-group">
     <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Change_value')}:</label>
         <label class="control-label col-xs-12 col-sm-2">{:__('Change_value')}:</label>
         <div class="col-xs-12 col-sm-8">
         <div class="col-xs-12 col-sm-8">
-            <input id="c-change_value" class="form-control" step="0.01" name="row[change_value]" type="number" value="{$row.change_value|htmlentities}">
+            <input id="c-change_value" data-rule="required" class="form-control" step="0.01" name="row[change_value]" type="number" value="{$row.change_value|htmlentities}">
         </div>
         </div>
     </div>
     </div>
     <div class="form-group">
     <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Remain')}:</label>
         <label class="control-label col-xs-12 col-sm-2">{:__('Remain')}:</label>
         <div class="col-xs-12 col-sm-8">
         <div class="col-xs-12 col-sm-8">
-            <input id="c-remain" class="form-control" step="0.01" name="row[remain]" type="number" value="{$row.remain|htmlentities}">
+            <input id="c-remain" data-rule="required" class="form-control" step="0.01" name="row[remain]" type="number" value="{$row.remain|htmlentities}">
         </div>
         </div>
     </div>
     </div>
     <div class="form-group">
     <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Table')}:</label>
         <label class="control-label col-xs-12 col-sm-2">{:__('Table')}:</label>
         <div class="col-xs-12 col-sm-8">
         <div class="col-xs-12 col-sm-8">
-            <input id="c-table" class="form-control" name="row[table]" type="text" value="{$row.table|htmlentities}">
+            <input id="c-table" data-rule="required" class="form-control" name="row[table]" type="text" value="{$row.table|htmlentities}">
         </div>
         </div>
     </div>
     </div>
     <div class="form-group">
     <div class="form-group">
@@ -45,7 +45,7 @@
     <div class="form-group">
     <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Remark')}:</label>
         <label class="control-label col-xs-12 col-sm-2">{:__('Remark')}:</label>
         <div class="col-xs-12 col-sm-8">
         <div class="col-xs-12 col-sm-8">
-            <input id="c-remark" class="form-control" name="row[remark]" type="text" value="{$row.remark|htmlentities}">
+            <input id="c-remark" data-rule="required" class="form-control" name="row[remark]" type="text" value="{$row.remark|htmlentities}">
         </div>
         </div>
     </div>
     </div>
     <div class="form-group layer-footer">
     <div class="form-group layer-footer">

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

@@ -7,7 +7,6 @@
                 <div class="widget-body no-padding">
                 <div class="widget-body no-padding">
                     <div id="toolbar" class="toolbar">
                     <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-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-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-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>
                         <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 - 5
public/assets/js/backend/goldlog.js

@@ -27,12 +27,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {checkbox: true},
                         {checkbox: true},
                         {field: 'id', title: __('Id')},
                         {field: 'id', title: __('Id')},
 //                        {field: 'user_id', title: __('User_id')},
 //                        {field: 'user_id', title: __('User_id')},
-                        {field: 'user.username', title: __('User.username'), operate: 'LIKE'},
+                        {field: 'user.username', title: __('User.username')},
                         {field: 'log_type', title: __('Log_type')},
                         {field: 'log_type', title: __('Log_type')},
-                        {field: 'log_type_text', title: __('Log_type')},
-//                        {field: 'money_type', title: __('Money_type'), operate: 'LIKE'},
-                        {field: 'change_value', title: __('Change_value'), operate:'BETWEEN'},
-                        {field: 'remain', title: __('Remain'), operate:'BETWEEN'},
+                        {field: 'log_type_text', title: __('Log_type'),operate:false},
+                        {field: 'before', title: __('Before')},
+                        {field: 'change_value', title: __('Change_value')},
+                        {field: 'remain', title: __('Remain')},
 //                        {field: 'table', title: __('Table'), operate: 'LIKE'},
 //                        {field: 'table', title: __('Table'), operate: 'LIKE'},
 //                        {field: 'table_id', title: __('Table_id')},
 //                        {field: 'table_id', title: __('Table_id')},
                         {field: 'remark', title: __('Remark'), operate: 'LIKE'},
                         {field: 'remark', title: __('Remark'), operate: 'LIKE'},

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

@@ -27,12 +27,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {checkbox: true},
                         {checkbox: true},
                         {field: 'id', title: __('Id')},
                         {field: 'id', title: __('Id')},
 //                        {field: 'user_id', title: __('User_id')},
 //                        {field: 'user_id', title: __('User_id')},
-                        {field: 'user.username', title: __('User.username'), operate: 'LIKE'},
-                        {field: 'log_type', title: __('Log_type'),operate:'IN'},
+                        {field: 'user.username', title: __('User.username')},
+                        {field: 'log_type', title: __('Log_type')},
                         {field: 'log_type_text', title: __('Log_type'),operate:false},
                         {field: 'log_type_text', title: __('Log_type'),operate:false},
-//                        {field: 'money_type', title: __('Money_type'), operate: 'LIKE'},
-                        {field: 'change_value', title: __('Change_value'), operate:'BETWEEN'},
-                        {field: 'remain', title: __('Remain'), operate:'BETWEEN'},
+                        {field: 'before', title: __('Before')},
+                        {field: 'change_value', title: __('Change_value')},
+                        {field: 'remain', title: __('Remain')},
 //                        {field: 'table', title: __('Table'), operate: 'LIKE'},
 //                        {field: 'table', title: __('Table'), operate: 'LIKE'},
 //                        {field: 'table_id', title: __('Table_id')},
 //                        {field: 'table_id', title: __('Table_id')},
                         {field: 'remark', title: __('Remark'), operate: 'LIKE'},
                         {field: 'remark', title: __('Remark'), operate: 'LIKE'},
@@ -43,11 +43,6 @@ 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);
             Table.api.bindevent(table);
         },
         },