浏览代码

重建用户

lizhen_gitee 1 年之前
父节点
当前提交
a7f392c74f

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

@@ -29,6 +29,7 @@ class User extends Backend
         $this->view->assign("isGuildList", $this->model->getIsGuildList());
         $this->view->assign("statusList", $this->model->getStatusList());
         $this->view->assign("isCoolList", $this->model->getIsCoolList());
+        $this->view->assign("isManagerList", $this->model->getIsManagerList());
     }
 
     public function import()
@@ -43,4 +44,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(['userwallet'])
+                    ->where($where)
+                    ->order($sort, $order)
+                    ->paginate($limit);
+
+            foreach ($list as $row) {
+                
+                $row->getRelation('userwallet')->visible(['money','jewel']);
+            }
+
+            $result = array("total" => $list->total(), "rows" => $list->items());
+
+            return json($result);
+        }
+        return $this->view->fetch();
+    }
+
 }

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

@@ -61,5 +61,10 @@ return [
     'Charm_empirical'  => '魅力值',
     'Job_id'           => '职业',
     'Longitude'        => '经度',
-    'Latitude'         => '纬度'
+    'Latitude'         => '纬度',
+    'Is_manager'       => '是否管理员',
+    'Is_manager 0'     => '否',
+    'Is_manager 1'     => '是',
+    'Userwallet.money' => '可用余额',
+    'Userwallet.jewel' => '钻石余额'
 ];

+ 19 - 1
application/admin/model/User.php

@@ -33,7 +33,8 @@ class User extends Model
         'is_auth_text',
         'is_guild_text',
         'status_text',
-        'is_cool_text'
+        'is_cool_text',
+        'is_manager_text'
     ];
     
 
@@ -73,6 +74,11 @@ class User extends Model
         return ['0' => __('Is_cool 0'), '1' => __('Is_cool 1')];
     }
 
+    public function getIsManagerList()
+    {
+        return ['0' => __('Is_manager 0'), '1' => __('Is_manager 1')];
+    }
+
 
     public function getLogintimeTextAttr($value, $data)
     {
@@ -143,6 +149,14 @@ class User extends Model
         return isset($list[$value]) ? $list[$value] : '';
     }
 
+
+    public function getIsManagerTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['is_manager']) ? $data['is_manager'] : '');
+        $list = $this->getIsManagerList();
+        return isset($list[$value]) ? $list[$value] : '';
+    }
+
     protected function setLogintimeAttr($value)
     {
         return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
@@ -154,4 +168,8 @@ class User extends Model
     }
 
 
+    public function userwallet()
+    {
+        return $this->belongsTo('Userwallet', 'id', 'user_id', [], 'LEFT')->setEagerlyType(0);
+    }
 }

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

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

+ 12 - 0
application/admin/view/user/user/add.html

@@ -286,6 +286,18 @@
             <input id="c-latitude" class="form-control" name="row[latitude]" type="text" value="39.914133">
         </div>
     </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Is_manager')}:</label>
+        <div class="col-xs-12 col-sm-8">
+                        
+            <select  id="c-is_manager" data-rule="required" class="form-control selectpicker" name="row[is_manager]">
+                {foreach name="isManagerList" item="vo"}
+                    <option value="{$key}" {in name="key" value="0"}selected{/in}>{$vo}</option>
+                {/foreach}
+            </select>
+
+        </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">

+ 12 - 0
application/admin/view/user/user/edit.html

@@ -286,6 +286,18 @@
             <input id="c-latitude" class="form-control" name="row[latitude]" type="text" value="{$row.latitude|htmlentities}">
         </div>
     </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Is_manager')}:</label>
+        <div class="col-xs-12 col-sm-8">
+                        
+            <select  id="c-is_manager" data-rule="required" class="form-control selectpicker" name="row[is_manager]">
+                {foreach name="isManagerList" item="vo"}
+                    <option value="{$key}" {in name="key" value="$row.is_manager"}selected{/in}>{$vo}</option>
+                {/foreach}
+            </select>
+
+        </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">

+ 8 - 10
application/api/controller/Party.php

@@ -1678,15 +1678,13 @@ class Party extends Api
 
         //进行抽点设置
         $partyInfo = null;
-        if(!$party_id) {
-            $platRate = 10;
-            $guilderRate = 30;
-        } else {
-            $partyInfo = \app\common\model\Party::field("id,room_type,party_name,party_hot,user_id,platRate,guilderRate,easemob_room_id")->where(["id"=>$party_id])->find();
-            // 获取系统配置信息
-            $platRate    = $partyInfo->platRate; // 平台抽成百分比
-            $guilderRate = $partyInfo->guilderRate; // 工会长抽成百分比
-        }
+
+        $partyInfo = \app\common\model\Party::field("id,room_type,party_name,party_hot,user_id,platRate,guilderRate,easemob_room_id")->where(["id"=>$party_id])->find();
+        // 获取系统配置信息
+        $platRate    = $partyInfo->platRate; // 平台抽成百分比
+        $guilderRate = $partyInfo->guilderRate; // 房主抽成百分比,包括公会房主,普通房房主
+
+
 
         //getValue削减
        
@@ -1754,7 +1752,7 @@ class Party extends Api
 
                 //每个礼物都要计算平台抽成和房主抽成
                 $data['platvalue']    = bcmul($platRate/100        ,$data["value"],2);//平台抽成
-                $data['guildervalue'] = bcmul($guilderRate/100     ,$data["value"],2);// 工会长抽成
+                $data['guildervalue'] = bcmul($guilderRate/100     ,$data["value"],2);// 房主抽成
                 $data['guildermoney'] = bcdiv($data['guildervalue'],$money_to_jewel,2);
                 $data['getvalue']     = bcsub(bcsub($data["value"] ,$data['platvalue'],2),$data['guildervalue'],2);//减去抽成剩余价值
 

+ 0 - 1
application/extra/site.php

@@ -38,7 +38,6 @@ return [
     'mail_from' => '10000@qq.com',
     'email' => '',
     'mobile' => '',
-    'getempirical' => '1',
     'roomLimit' => '10',
     'domain_name' => 'https://kge.huxiukeji.cn',
     'intro_image' => '/uploads/20230703/35b10db56529aa19086eeb3d1d0bb6b0.png',

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

@@ -66,6 +66,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {field: 'job_id', title: __('Job_id')},
                         {field: 'longitude', title: __('Longitude'), operate: 'LIKE'},
                         {field: 'latitude', title: __('Latitude'), operate: 'LIKE'},
+                        {field: 'is_manager', title: __('Is_manager'), searchList: {"0":__('Is_manager 0'),"1":__('Is_manager 1')}, formatter: Table.api.formatter.normal},
+                        {field: 'userwallet.money', title: __('Userwallet.money'), operate:'BETWEEN'},
+                        {field: 'userwallet.jewel', title: __('Userwallet.jewel')},
                         {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                     ]
                 ]