Browse Source

用户余额

lizhen_gitee 6 months ago
parent
commit
7424c9415c

+ 2 - 1
application/admin/controller/user/User.php

@@ -52,7 +52,7 @@ class User extends Backend
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
 
             $list = $this->model
-                    ->with(['group'])
+                    ->with(['group','wallet'])
                     ->where($where)
                     ->order($sort, $order)
                     ->paginate($limit);
@@ -60,6 +60,7 @@ class User extends Backend
             foreach ($list as $row) {
                 
                 $row->getRelation('group')->visible(['name']);
+                $row->getRelation('wallet')->visible(['money']);
             }
 
             $result = array("total" => $list->total(), "rows" => $list->items());

+ 2 - 1
application/admin/lang/zh-cn/user/user.php

@@ -39,5 +39,6 @@ return [
     'Idcard_status 0'  => '待审核',
     'Idcard_status 1'  => '审核通过',
     'Idcard_status 2'  => '审核驳回',
-    'Group.name'       => '组名'
+    'Group.name'       => '组名',
+    'Wallet.money'     => '余额',
 ];

+ 6 - 0
application/admin/model/User.php

@@ -101,4 +101,10 @@ class User extends Model
     {
         return $this->belongsTo('UserGroup', 'group_id', 'id', [], 'LEFT')->setEagerlyType(0);
     }
+
+
+    public function wallet()
+    {
+        return $this->belongsTo('Userwallet', 'id', 'user_id', [], 'LEFT')->setEagerlyType(0);
+    }
 }

+ 13 - 0
application/admin/model/Userwallet.php

@@ -0,0 +1,13 @@
+<?php
+
+namespace app\admin\model;
+
+use think\Model;
+
+class Userwallet extends Model
+{
+
+    // 表名
+    protected $name = 'user_wallet';
+
+}

+ 1 - 0
public/assets/js/backend/user/user.js

@@ -56,6 +56,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"0":__('Status 0'),"-1":__('Status -1')}, formatter: Table.api.formatter.status},
 //                        {field: 'verification', title: __('Verification'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
                         {field: 'idcard_status', title: __('Idcard_status'), searchList: {"-1":__('Idcard_status -1'),"0":__('Idcard_status 0'),"1":__('Idcard_status 1'),"2":__('Idcard_status 2')}, formatter: Table.api.formatter.status},
+                        {field: 'wallet.money', title: __('Wallet.money'), operate: false},
                         {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                     ]
                 ]