瀏覽代碼

重建user

lizhen_gitee 3 年之前
父節點
當前提交
96b2b70add

+ 41 - 0
application/admin/controller/user/User.php

@@ -25,9 +25,16 @@ class User extends Backend
     {
         parent::_initialize();
         $this->model = new \app\admin\model\User;
+        $this->view->assign("realStatusList", $this->model->getRealStatusList());
         $this->view->assign("genderList", $this->model->getGenderList());
         $this->view->assign("idcardStatusList", $this->model->getIdcardStatusList());
         $this->view->assign("statusList", $this->model->getStatusList());
+        $this->view->assign("openMatchVideoList", $this->model->getOpenMatchVideoList());
+        $this->view->assign("openMatchAudioList", $this->model->getOpenMatchAudioList());
+        $this->view->assign("openMatchTypingList", $this->model->getOpenMatchTypingList());
+        $this->view->assign("freeVideoList", $this->model->getFreeVideoList());
+        $this->view->assign("freeAudioList", $this->model->getFreeAudioList());
+        $this->view->assign("freeTypingList", $this->model->getFreeTypingList());
     }
 
     public function import()
@@ -42,4 +49,38 @@ class User extends Backend
      */
     
 
+    /**
+     * 查看
+     */
+    public function index()
+    {
+        //当前是否为关联查询
+        $this->relationSearch = true;
+        //设置过滤方法
+        $this->request->filter(['strip_tags', 'trim']);
+        if ($this->request->isAjax()) {
+            //如果发送的来源是Selectpage,则转发到Selectpage
+            if ($this->request->request('keyField')) {
+                return $this->selectpage();
+            }
+            list($where, $sort, $order, $offset, $limit) = $this->buildparams();
+
+            $list = $this->model
+                    ->with(['gonghui'])
+                    ->where($where)
+                    ->order($sort, $order)
+                    ->paginate($limit);
+
+            foreach ($list as $row) {
+                
+                $row->getRelation('gonghui')->visible(['id','name']);
+            }
+
+            $result = array("total" => $list->total(), "rows" => $list->items());
+
+            return json($result);
+        }
+        return $this->view->fetch();
+    }
+
 }

+ 77 - 41
application/admin/lang/zh-cn/user/user.php

@@ -1,45 +1,81 @@
 <?php
 
 return [
-    'Id'              => 'ID',
-    'Group_id'        => '组别ID',
-    'Username'        => '用户名',
-    'Truename'        => '姓名',
-    'Nickname'        => '昵称',
-    'Password'        => '密码',
-    'Salt'            => '密码盐',
-    'Email'           => '电子邮箱',
-    'Mobile'          => '手机号',
-    'Avatar'          => '头像',
-    'Level'           => '等级',
-    'Gender'          => '性别',
-    'Gender 1'        => '男',
-    'Gender 0'        => '女',
-    'Birthday'        => '生日',
-    'Bio'             => '格言',
-    'Idcard'          => '身份证号',
-    'Idcard_images'   => '身份证图片',
-    'Idcard_status'   => '实名认证',
-    'Idcard_status -1' => '未申请',
-    'Idcard_status 0' => '待审核',
-    'Idcard_status 1' => '审核通过',
-    'Idcard_status 2' => '审核拒绝',
-    'Money'           => '余额',
-    'Score'           => '积分',
-    'Successions'     => '连续登录天数',
-    'Maxsuccessions'  => '最大连续登录天数',
-    'Prevtime'        => '上次登录时间',
-    'Logintime'       => '登录时间',
-    'Loginip'         => '登录IP',
-    'Loginfailure'    => '失败次数',
-    'Joinip'          => '加入IP',
-    'Jointime'        => '加入时间',
-    'Createtime'      => '创建时间',
-    'Updatetime'      => '更新时间',
-    'Token'           => 'Token',
-    'Status'          => '状态',
-    'Status 1'        => '正常',
-    'Status 0'        => '禁用',
-    'Verification'    => '验证',
-	'Leave password blank if dont want to change' => '不修改密码请留空',
+    'Id'                  => 'ID',
+    'Gh_id'               => '公会ID',
+    'Username'            => '用户名',
+    'Truename'            => '姓名',
+    'Nickname'            => '昵称',
+    'Password'            => '密码',
+    'Salt'                => '密码盐',
+    'Email'               => '电子邮箱',
+    'Mobile'              => '手机号',
+    'Avatar'              => '头像',
+    'Real_status'         => '真人认证',
+    'Real_status -1'      => '未申请',
+    'Real_status 0'       => '待审核',
+    'Real_status 1'       => '审核通过',
+    'Real_status 2'       => '审核驳回',
+    'Gender'              => '性别',
+    'Gender 1'            => '男',
+    'Gender 0'            => '女',
+    'Height'              => '身高',
+    'Weight'              => '体重',
+    'Birthday'            => '生日',
+    'Bio'                 => '个性签名',
+    'Audio_bio'           => '语音签名',
+    'Idcard'              => '身份证号',
+    'Idcard_images'       => '身份证图片',
+    'Alipay_account'      => '支付宝账号',
+    'Idcard_status'       => '实名认证',
+    'Idcard_status -1'    => '未申请',
+    'Idcard_status 0'     => '待审核',
+    'Idcard_status 1'     => '审核通过',
+    'Idcard_status 2'     => '审核驳回',
+    'Successions'         => '连续登录天数',
+    'Maxsuccessions'      => '最大连续登录天数',
+    'Prevtime'            => '上次登录时间',
+    'Logintime'           => '登录时间',
+    'Loginip'             => '登录IP',
+    'Loginfailure'        => '失败次数',
+    'Joinip'              => '加入IP',
+    'Jointime'            => '加入时间',
+    'Createtime'          => '创建时间',
+    'Updatetime'          => '更新时间',
+    'Token'               => 'Token',
+    'Status'              => '状态',
+    'Status 1'            => '正常',
+    'Status 0'            => '禁用',
+    'Verification'        => '验证',
+    'Longitude'           => '经度',
+    'Latitude'            => '纬度',
+    'Cityname'            => '即时城市名',
+    'Photo_images'        => '相册',
+    'Education_id'        => '学历id',
+    'Hobby_ids'           => '爱好ids',
+    'Job_id'              => '职业id',
+    'Marital_id'          => '婚恋id',
+    'Tag_ids'             => '标签ids',
+    'Wages_id'            => '收入id',
+    'Hometown_cityid'     => '家乡城市id',
+    'Open_match_video'    => '匹配视频开关',
+    'Open_match_video 1'  => '开',
+    'Open_match_video 0'  => '关',
+    'Open_match_audio'    => '匹配语音开关',
+    'Open_match_audio 1'  => '开',
+    'Open_match_audio 0'  => '关',
+    'Open_match_typing'   => '匹配聊天开关',
+    'Open_match_typing 1' => '开',
+    'Open_match_typing 0' => '关',
+    'Free_video'          => '免费视频开关',
+    'Free_video 1'        => '开',
+    'Free_video 0'        => '关',
+    'Free_audio'          => '免费语音开关',
+    'Free_audio 1'        => '开',
+    'Free_audio 0'        => '关',
+    'Free_typing'         => '免费聊天开关',
+    'Free_typing 1'       => '开',
+    'Free_typing 0'       => '关',
+    'Gonghui.id'          => '公会ID',
+    'Gonghui.name'        => '公会名称'
 ];

+ 104 - 2
application/admin/model/User.php

@@ -25,12 +25,19 @@ class User extends Model
 
     // 追加属性
     protected $append = [
+        'real_status_text',
         'gender_text',
         'idcard_status_text',
         'prevtime_text',
         'logintime_text',
         'jointime_text',
-        'status_text'
+        'status_text',
+        'open_match_video_text',
+        'open_match_audio_text',
+        'open_match_typing_text',
+        'free_video_text',
+        'free_audio_text',
+        'free_typing_text'
     ];
 
     protected static function init()
@@ -98,6 +105,11 @@ class User extends Model
         });
     }
     
+    public function getRealStatusList()
+    {
+        return ['-1' => __('Real_status -1'), '0' => __('Real_status 0'), '1' => __('Real_status 1'), '2' => __('Real_status 2')];
+    }
+
     public function getGenderList()
     {
         return ['1' => __('Gender 1'), '0' => __('Gender 0')];
@@ -105,7 +117,7 @@ class User extends Model
 
     public function getIdcardStatusList()
     {
-        return ['-1' => __('Idcard_status -1'),'0' => __('Idcard_status 0'),'1' => __('Idcard_status 1'), '2' => __('Idcard_status 2')];
+        return ['-1' => __('Idcard_status -1'), '0' => __('Idcard_status 0'), '1' => __('Idcard_status 1'), '2' => __('Idcard_status 2')];
     }
 
     public function getStatusList()
@@ -113,6 +125,44 @@ class User extends Model
         return ['1' => __('Status 1'), '0' => __('Status 0')];
     }
 
+    public function getOpenMatchVideoList()
+    {
+        return ['1' => __('Open_match_video 1'), '0' => __('Open_match_video 0')];
+    }
+
+    public function getOpenMatchAudioList()
+    {
+        return ['1' => __('Open_match_audio 1'), '0' => __('Open_match_audio 0')];
+    }
+
+    public function getOpenMatchTypingList()
+    {
+        return ['1' => __('Open_match_typing 1'), '0' => __('Open_match_typing 0')];
+    }
+
+    public function getFreeVideoList()
+    {
+        return ['1' => __('Free_video 1'), '0' => __('Free_video 0')];
+    }
+
+    public function getFreeAudioList()
+    {
+        return ['1' => __('Free_audio 1'), '0' => __('Free_audio 0')];
+    }
+
+    public function getFreeTypingList()
+    {
+        return ['1' => __('Free_typing 1'), '0' => __('Free_typing 0')];
+    }
+
+
+    public function getRealStatusTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['real_status']) ? $data['real_status'] : '');
+        $list = $this->getRealStatusList();
+        return isset($list[$value]) ? $list[$value] : '';
+    }
+
 
     public function getGenderTextAttr($value, $data)
     {
@@ -158,6 +208,54 @@ class User extends Model
         return isset($list[$value]) ? $list[$value] : '';
     }
 
+
+    public function getOpenMatchVideoTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['open_match_video']) ? $data['open_match_video'] : '');
+        $list = $this->getOpenMatchVideoList();
+        return isset($list[$value]) ? $list[$value] : '';
+    }
+
+
+    public function getOpenMatchAudioTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['open_match_audio']) ? $data['open_match_audio'] : '');
+        $list = $this->getOpenMatchAudioList();
+        return isset($list[$value]) ? $list[$value] : '';
+    }
+
+
+    public function getOpenMatchTypingTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['open_match_typing']) ? $data['open_match_typing'] : '');
+        $list = $this->getOpenMatchTypingList();
+        return isset($list[$value]) ? $list[$value] : '';
+    }
+
+
+    public function getFreeVideoTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['free_video']) ? $data['free_video'] : '');
+        $list = $this->getFreeVideoList();
+        return isset($list[$value]) ? $list[$value] : '';
+    }
+
+
+    public function getFreeAudioTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['free_audio']) ? $data['free_audio'] : '');
+        $list = $this->getFreeAudioList();
+        return isset($list[$value]) ? $list[$value] : '';
+    }
+
+
+    public function getFreeTypingTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['free_typing']) ? $data['free_typing'] : '');
+        $list = $this->getFreeTypingList();
+        return isset($list[$value]) ? $list[$value] : '';
+    }
+
     protected function setPrevtimeAttr($value)
     {
         return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
@@ -174,4 +272,8 @@ class User extends Model
     }
 
 
+    public function gonghui()
+    {
+        return $this->belongsTo('Gonghui', 'gh_id', 'id', [], 'LEFT')->setEagerlyType(0);
+    }
 }

+ 44 - 23
public/assets/js/backend/user/user.js

@@ -26,37 +26,58 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                     [
                         {checkbox: true},
                         {field: 'id', title: __('Id')},
-//                        {field: 'group_id', title: __('Group_id')},
+                        {field: 'gh_id', title: __('Gh_id')},
                         {field: 'username', title: __('Username'), operate: 'LIKE'},
                         {field: 'truename', title: __('Truename'), operate: 'LIKE'},
                         {field: 'nickname', title: __('Nickname'), operate: 'LIKE'},
-//                        {field: 'password', title: __('Password'), operate: 'LIKE'},
-//                        {field: 'salt', title: __('Salt'), operate: 'LIKE'},
-//                        {field: 'email', title: __('Email'), operate: 'LIKE'},
+                        //{field: 'password', title: __('Password'), operate: 'LIKE'},
+                        //{field: 'salt', title: __('Salt'), operate: 'LIKE'},
+                        //{field: 'email', title: __('Email'), operate: 'LIKE'},
                         {field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
                         {field: 'avatar', title: __('Avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
-//                        {field: 'level', title: __('Level')},
+                        {field: 'real_status', title: __('Real_status'), searchList: {"-1":__('Real_status -1'),"0":__('Real_status 0'),"1":__('Real_status 1'),"2":__('Real_status 2')}, formatter: Table.api.formatter.status},
                         {field: 'gender', title: __('Gender'), searchList: {"1":__('Gender 1'),"0":__('Gender 0')}, formatter: Table.api.formatter.normal},
-//                        {field: 'birthday', title: __('Birthday')},
-//                        {field: 'bio', title: __('Bio'), operate: 'LIKE'},
-//                        {field: 'idcard', title: __('Idcard'), operate: 'LIKE'},
-//                        {field: 'idcard_images', title: __('Idcard_images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
+                        //{field: 'height', title: __('Height'), operate: 'LIKE'},
+                        //{field: 'weight', title: __('Weight'), operate: 'LIKE'},
+                        //{field: 'birthday', title: __('Birthday')},
+                        //{field: 'bio', title: __('Bio'), operate: 'LIKE'},
+                        //{field: 'audio_bio', title: __('Audio_bio'), operate: 'LIKE'},
+                        //{field: 'idcard', title: __('Idcard'), operate: 'LIKE'},
+                        //{field: 'idcard_images', title: __('Idcard_images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
+                        {field: 'alipay_account', title: __('Alipay_account'), operate: 'LIKE'},
                         {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: 'money', title: __('Money'), operate:'BETWEEN'},
-                        {field: 'score', title: __('Score')},
-//                        {field: 'successions', title: __('Successions')},
-//                        {field: 'maxsuccessions', title: __('Maxsuccessions')},
-//                        {field: 'prevtime', title: __('Prevtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
-//                        {field: 'logintime', title: __('Logintime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
-//                        {field: 'loginip', title: __('Loginip'), operate: 'LIKE'},
-//                        {field: 'loginfailure', title: __('Loginfailure')},
-//                        {field: 'joinip', title: __('Joinip'), operate: 'LIKE'},
-//                        {field: 'jointime', title: __('Jointime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
-//                        {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
-//                        {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
-//                        {field: 'token', title: __('Token'), operate: 'LIKE'},
+                        //{field: 'successions', title: __('Successions')},
+                        //{field: 'maxsuccessions', title: __('Maxsuccessions')},
+                        //{field: 'prevtime', title: __('Prevtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
+                        //{field: 'logintime', title: __('Logintime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
+                        //{field: 'loginip', title: __('Loginip'), operate: 'LIKE'},
+                        //{field: 'loginfailure', title: __('Loginfailure')},
+                        //{field: 'joinip', title: __('Joinip'), operate: 'LIKE'},
+                        //{field: 'jointime', title: __('Jointime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
+                        //{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
+                        //{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
+                        //{field: 'token', title: __('Token'), operate: 'LIKE'},
                         {field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"0":__('Status 0')}, formatter: Table.api.formatter.status},
-//                        {field: 'verification', title: __('Verification'), operate: 'LIKE'},
+                        //{field: 'verification', title: __('Verification'), operate: 'LIKE'},
+                        //{field: 'longitude', title: __('Longitude'), operate: 'LIKE'},
+                        //{field: 'latitude', title: __('Latitude'), operate: 'LIKE'},
+                        {field: 'cityname', title: __('Cityname'), operate: 'LIKE'},
+                        //{field: 'photo_images', title: __('Photo_images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
+                        //{field: 'education_id', title: __('Education_id')},
+                        //{field: 'hobby_ids', title: __('Hobby_ids'), operate: 'LIKE'},
+                        //{field: 'job_id', title: __('Job_id')},
+                        //{field: 'marital_id', title: __('Marital_id')},
+                        //{field: 'tag_ids', title: __('Tag_ids'), operate: 'LIKE'},
+                        //{field: 'wages_id', title: __('Wages_id')},
+                        //{field: 'hometown_cityid', title: __('Hometown_cityid')},
+                        //{field: 'open_match_video', title: __('Open_match_video'), searchList: {"1":__('Open_match_video 1'),"0":__('Open_match_video 0')}, formatter: Table.api.formatter.normal},
+                        //{field: 'open_match_audio', title: __('Open_match_audio'), searchList: {"1":__('Open_match_audio 1'),"0":__('Open_match_audio 0')}, formatter: Table.api.formatter.normal},
+                        //{field: 'open_match_typing', title: __('Open_match_typing'), searchList: {"1":__('Open_match_typing 1'),"0":__('Open_match_typing 0')}, formatter: Table.api.formatter.normal},
+                        //{field: 'free_video', title: __('Free_video'), searchList: {"1":__('Free_video 1'),"0":__('Free_video 0')}, formatter: Table.api.formatter.normal},
+                        //{field: 'free_audio', title: __('Free_audio'), searchList: {"1":__('Free_audio 1'),"0":__('Free_audio 0')}, formatter: Table.api.formatter.normal},
+                        //{field: 'free_typing', title: __('Free_typing'), searchList: {"1":__('Free_typing 1'),"0":__('Free_typing 0')}, formatter: Table.api.formatter.normal},
+                        //{field: 'gonghui.id', title: __('Gonghui.id')},
+                        {field: 'gonghui.name', title: __('Gonghui.name'), operate: 'LIKE'},
                         {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                     ]
                 ]