Преглед на файлове

用户列表也能调整钱包,用户资料审核显示性别

lizhen_gitee преди 11 месеца
родител
ревизия
a8d5be48bf

+ 1 - 1
application/admin/controller/Useraudit.php

@@ -62,7 +62,7 @@ class Useraudit extends Backend
 
             foreach ($list as $row) {
                 
-                $row->getRelation('user')->visible(['username','nickname']);
+                $row->getRelation('user')->visible(['username','nickname','gender']);
             }
 
             $result = array("total" => $list->total(), "rows" => $list->items());

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

@@ -69,7 +69,7 @@ class User extends Backend
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
 
             $list = $this->model
-                    ->with(['usergroup'])
+                    ->with(['usergroup','userwallet'])
                     ->where($where)
                     ->order($sort, $order)
                     ->paginate($limit);
@@ -77,6 +77,7 @@ class User extends Backend
             foreach ($list as $row) {
                 
                 $row->getRelation('usergroup')->visible(['name']);
+                $row->getRelation('userwallet')->visible(['gold','jewel']);
             }
 
             $result = array("total" => $list->total(), "rows" => $list->items());
@@ -86,4 +87,63 @@ class User extends Backend
         return $this->view->fetch();
     }
 
+    /**
+     * 充值金币
+     */
+    public function updatemoney(){
+        $id = input('id');
+        $info = Db::name('user_wallet')
+            ->where('id',$id)
+            ->find();
+
+        if ($this->request->isPost()) {
+
+            $user_id = input('user_id');
+            $gold = input('gold');
+            $remark = input('remark','后台调节');
+
+            Db::startTrans();
+            $rs = model('wallet')->lockChangeAccountRemain($user_id,'gold',$gold,1,$remark);
+            if($rs['status'] === false){
+                Db::rollback();
+                $this->error($rs['msg']);
+            }
+
+            Db::commit();
+            $this->success('充值完成');
+        }
+
+        $this->assign('row',$info);
+        return $this->view->fetch();
+    }
+    /**
+     * 收益金币
+     */
+    public function updatejewel(){
+        $id = input('id');
+        $info = Db::name('user_wallet')
+            ->where('id',$id)
+            ->find();
+
+        if ($this->request->isPost()) {
+
+            $user_id = input('user_id');
+            $jewel = input('jewel');
+            $remark = input('remark','后台调节');
+
+            Db::startTrans();
+            $rs = model('wallet')->lockChangeAccountRemain($user_id,'jewel',$jewel,2,$remark);
+            if($rs['status'] === false){
+                Db::rollback();
+                $this->error($rs['msg']);
+            }
+
+            Db::commit();
+            $this->success('充值完成');
+        }
+
+        $this->assign('row',$info);
+        return $this->view->fetch();
+    }
+
 }

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

@@ -78,5 +78,7 @@ return [
     'Is_shouchong'         => '完成首充',
     'Is_shouchong 0'       => '没有',
     'Is_shouchong 1'       => '完成',
-    'Usergroup.name'       => '角色'
+    'Usergroup.name'       => '角色',
+    'Userwallet.gold'      => '充值余额',
+    'Userwallet.jewel'     => '收益余额',
 ];

+ 5 - 1
application/admin/lang/zh-cn/useraudit.php

@@ -18,5 +18,9 @@ return [
     'Audittime'     => '审核时间',
     'Auditremark'   => '审核备注',
     'User.username' => '用户名',
-    'User.nickname' => '昵称'
+    'User.nickname' => '昵称',
+    'User.Gender'               => '性别',
+    'User.Gender -1'            => '未知',
+    'User.Gender 1'             => '男',
+    'User.Gender 0'             => '女',
 ];

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

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

+ 12 - 0
application/admin/model/Useraudit.php

@@ -28,6 +28,7 @@ class Useraudit extends Model
         'status_text',
         'audittime_text',
         'type_text',
+        'gender_text',
     ];
     
 
@@ -50,6 +51,17 @@ class Useraudit extends Model
         return ['photo_images' => __('Type photo_images'), 'avatar' => __('Type avatar'), 'audio_bio' => __('Type audio_bio'), 'video_bio' => __('Type video_bio')];
     }
 
+    public function getGenderList()
+    {
+        return ['-1' => __('User.Gender -1'),'1' => __('User.Gender 1'), '0' => __('User.Gender 0')];
+    }
+
+    public function getGenderTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['gender']) ? $data['gender'] : '');
+        $list = $this->getGenderList();
+        return isset($list[$value]) ? $list[$value] : '';
+    }
 
     public function getTypeTextAttr($value, $data)
     {

+ 3 - 1
application/admin/view/user/user/index.html

@@ -34,7 +34,9 @@
                     </div>
                     <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
                            data-operate-edit="{:$auth->check('user/user/edit')}" 
-                           data-operate-del="{:$auth->check('user/user/del')}" 
+                           data-operate-del="{:$auth->check('user/user/del')}"
+                           data-operate-updatemoney="{:$auth->check('user/user/updatemoney')}"
+                           data-operate-updatejewel="{:$auth->check('user/user/updatejewel')}"
                            width="100%">
                     </table>
                 </div>

+ 32 - 0
application/admin/view/user/user/updatejewel.html

@@ -0,0 +1,32 @@
+<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
+    <input type="hidden" name="id" value="{$row.id}">
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">用户:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-user_id" disabled data-rule="required" data-source="user/user/index" data-field="username" class="form-control selectpage" name="user_id" type="text" value="{$row.user_id|htmlentities}">
+        </div>
+    </div>
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">增加收益金币:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-jewel" data-rule="required" class="form-control" name="jewel" type="number" value="">
+            负数可以减少
+        </div>
+    </div>
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">备注:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-remark" data-rule="required" class="form-control" name="remark" type="text" value="">
+        </div>
+    </div>
+
+    <div class="form-group layer-footer">
+        <label class="control-label col-xs-12 col-sm-2"></label>
+        <div class="col-xs-12 col-sm-8">
+            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
+            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
+        </div>
+    </div>
+</form>

+ 32 - 0
application/admin/view/user/user/updatemoney.html

@@ -0,0 +1,32 @@
+<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
+    <input type="hidden" name="id" value="{$row.id}">
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">用户:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-user_id" disabled data-rule="required" data-source="user/user/index" data-field="username" class="form-control selectpage" name="user_id" type="text" value="{$row.user_id|htmlentities}">
+        </div>
+    </div>
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">增加充值金币:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-gold" data-rule="required" class="form-control" name="gold" type="number" value="">
+            负数可以减少
+        </div>
+    </div>
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">备注:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-remark" data-rule="required" class="form-control" name="remark" type="text" value="">
+        </div>
+    </div>
+
+    <div class="form-group layer-footer">
+        <label class="control-label col-xs-12 col-sm-2"></label>
+        <div class="col-xs-12 col-sm-8">
+            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
+            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
+        </div>
+    </div>
+</form>

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

@@ -75,7 +75,39 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {field: 'jinyantime', title: __('Jinyantime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
                         {field: 'jinyantype', title: __('Jinyantype'), searchList: {"1":__('Jinyantype 1'),"2":__('Jinyantype 2'),"3":__('Jinyantype 3')}, formatter: Table.api.formatter.normal},
 //                        {field: 'is_shouchong', title: __('Is_shouchong'), searchList: {"0":__('Is_shouchong 0'),"1":__('Is_shouchong 1')}, formatter: Table.api.formatter.normal},
-                        {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
+                        {field: 'userwallet.gold', title: __('Userwallet.gold'), operate: false},
+                        {field: 'userwallet.jewel', title: __('Userwallet.jewel'), operate: false},
+                        {field: 'operate', title: __('Operate'), table: table,
+                            buttons:[
+                                {
+                                    name:'updatemoney',
+                                    text:'充值金币',
+                                    title:'充值金币',
+                                    icon:'fa fa-exclamation-circle',
+                                    classname:'btn btn-xs btn-info btn-dialog',
+                                    url:'user/user/updatemoney/id/{ids}?dialog=1',
+                                    target:'_self',
+                                },
+                                {
+                                    name:'updatejewel',
+                                    text:'收益金币',
+                                    title:'收益金币',
+                                    icon:'fa fa-exclamation-circle',
+                                    classname:'btn btn-xs btn-info btn-dialog',
+                                    url:'user/user/updatejewel/id/{ids}?dialog=1',
+                                    target:'_self',
+                                },
+                                /* {
+                                 name:'updatevip',
+                                 text:'充值vip会员',
+                                 title:'充值vip会员',
+                                 icon:'fa fa-exclamation-circle',
+                                 classname:'btn btn-xs btn-info btn-dialog',
+                                 url:'userwallet/updatevip/id/{ids}?dialog=1',
+                                 target:'_self',
+                                 }*/
+                            ],
+                            events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                     ]
                 ]
             });
@@ -89,6 +121,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
         edit: function () {
             Controller.api.bindevent();
         },
+        updatemoney: function () {
+            Controller.api.bindevent();
+        },
+        updatejewel: function () {
+            Controller.api.bindevent();
+        },
         api: {
             bindevent: function () {
                 Form.api.bindevent($("form[role=form]"));

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

@@ -29,6 +29,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
 //                        {field: 'user_id', title: __('User_id')},
                         {field: 'user.username', title: __('User.username'), operate: 'LIKE'},
                         {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
+                        {field: 'user.gender', title: __('User.Gender'), searchList: {"-1":__('User.Gender -1'),"1":__('User.Gender 1'),"0":__('User.Gender 0')}, formatter: Table.api.formatter.normal},
                         {field: 'type', title: __('Type'), searchList: {"photo_images":__('Type photo_images'),"avatar":__('Type avatar'),"audio_bio":__('Type audio_bio'),"video_bio":__('Type video_bio')}, formatter: Table.api.formatter.status},
                         {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
                         {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.status},