Kaynağa Gözat

用户禁言

lizhen_gitee 1 yıl önce
ebeveyn
işleme
1b7801f283

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

@@ -56,5 +56,6 @@ return [
     'Is_tuijian'           => '首页推荐',
     'Is_tuijian 1'         => '是',
     'Is_tuijian 0'         => '否',
-    'plat_unique_id'       => '设备唯一ID'
+    'plat_unique_id'       => '设备唯一ID',
+    'jinyantime'           => '禁言截止时间',
 ];

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

@@ -30,6 +30,7 @@ class User extends Model
         'prevtime_text',
         'logintime_text',
         'jointime_text',
+        'jinyantime_text',
         'status_text',
         'hide_is_finishinfo_text',
         'is_active_text',
@@ -175,6 +176,13 @@ class User extends Model
     }
 
 
+    public function getJinyantimeTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['jinyantime']) ? $data['jinyantime'] : '');
+        return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
+    }
+
+
     public function getStatusTextAttr($value, $data)
     {
         $value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
@@ -221,5 +229,10 @@ class User extends Model
         return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
     }
 
+    protected function setJinyantimeAttr($value)
+    {
+        return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
+    }
+
 
 }

+ 8 - 1
application/admin/view/user/user/edit.html

@@ -40,7 +40,8 @@
     <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Mobile')}:</label>
         <div class="col-xs-12 col-sm-8">
-            <input id="c-mobile" data-rule="required" class="form-control" name="row[mobile]" type="text" value="{$row.mobile|htmlentities}">
+            <input id="c-mobile" class="form-control" name="row[mobile]" type="text" value="{$row.mobile|htmlentities}">
+            不需要修改就不填
         </div>
     </div>
     <!--<div class="form-group">
@@ -264,6 +265,12 @@
         </div>
     </div>-->
     <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('jinyantime')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-jinyantime" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[jinyantime]" type="text" value="{:$row.jinyantime?datetime($row.jinyantime):''}">
+        </div>
+    </div>
+    <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Is_tuijian')}:</label>
         <div class="col-xs-12 col-sm-8">
                         

+ 5 - 1
application/common/library/Auth.php

@@ -28,7 +28,6 @@ class Auth
     protected $options = [];
     protected $allowFields = [
         'id',
-        'gh_id',
         'username',
         'nickname',
         'introcode',
@@ -58,6 +57,8 @@ class Auth
 
         'attribute',
         'shoesize',
+
+        'jinyantime',
     ];
 
     public function __construct($options = [])
@@ -702,6 +703,9 @@ class Auth
         //用户权限
         $userinfo['power'] = Db::name('user_power')->where('user_id',$this->id)->find();
 
+        //禁言时间,0不禁,-1永久,>0封禁截止时间
+        $userinfo['is_jinyan'] = $userinfo['jinyantime'] > time() ? 1 : 0;
+
         return $userinfo;
     }
 

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

@@ -65,6 +65,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {field: 'attribute', title: __('Attribute'), operate: 'LIKE'},
                         {field: 'shoesize', title: __('Shoesize'), operate: 'LIKE'},
                         {field: 'plat_unique_id', title: __('plat_unique_id'),sortable:true, operate: 'LIKE'},
+                        {field: 'jinyantime', title: __('jinyantime'), operate:false, addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
                         {field: 'is_tuijian', title: __('Is_tuijian'), searchList: {"1":__('Is_tuijian 1'),"0":__('Is_tuijian 0')}, formatter: Table.api.formatter.normal},
                         {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                     ]