Sfoglia il codice sorgente

提现配置和后台

zhangxiaobin 1 anno fa
parent
commit
ca91eef1f0

+ 40 - 0
application/admin/controller/conf/Withdrawal.php

@@ -0,0 +1,40 @@
+<?php
+
+namespace app\admin\controller\conf;
+
+use app\common\controller\Backend;
+
+/**
+ * 提现配置管理
+ *
+ * @icon fa fa-circle-o
+ */
+class Withdrawal extends Backend
+{
+    
+    /**
+     * Withdrawal模型对象
+     * @var \app\admin\model\conf\Withdrawal
+     */
+    protected $model = null;
+
+    public function _initialize()
+    {
+        parent::_initialize();
+        $this->model = new \app\admin\model\conf\Withdrawal;
+
+    }
+
+    public function import()
+    {
+        parent::import();
+    }
+
+    /**
+     * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
+     * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
+     * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
+     */
+    
+
+}

+ 10 - 0
application/admin/lang/zh-cn/conf/withdrawal.php

@@ -0,0 +1,10 @@
+<?php
+
+return [
+    'Id'         => 'ID',
+    'Money'      => '金额',
+    'Real_money' => '实际到账金额',
+    'Weigh'      => '权重排序',
+    'Createtime' => '创建时间',
+    'Updatetime' => '更新时间'
+];

+ 8 - 2
application/admin/model/conf/Exchmoney.php

@@ -27,11 +27,17 @@ class Exchmoney extends Model
     protected $append = [
 
     ];
-    
 
-    
 
 
+    protected static function init()
+    {
+        self::afterInsert(function ($row) {
+            $pk = $row->getPk();
+            $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
+        });
+    }
+
 
 
 

+ 48 - 0
application/admin/model/conf/Withdrawal.php

@@ -0,0 +1,48 @@
+<?php
+
+namespace app\admin\model\conf;
+
+use think\Model;
+
+
+class Withdrawal extends Model
+{
+
+    
+
+    
+
+    // 表名
+    protected $name = 'withdrawal_config';
+    
+    // 自动写入时间戳字段
+    protected $autoWriteTimestamp = 'int';
+
+    // 定义时间戳字段名
+    protected $createTime = 'createtime';
+    protected $updateTime = 'updatetime';
+    protected $deleteTime = false;
+
+    // 追加属性
+    protected $append = [
+
+    ];
+    
+
+    protected static function init()
+    {
+        self::afterInsert(function ($row) {
+            $pk = $row->getPk();
+            $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
+        });
+    }
+
+    
+
+
+
+
+
+
+
+}

+ 27 - 0
application/admin/validate/Withdrawal.php

@@ -0,0 +1,27 @@
+<?php
+
+namespace app\admin\validate;
+
+use think\Validate;
+
+class Withdrawal extends Validate
+{
+    /**
+     * 验证规则
+     */
+    protected $rule = [
+    ];
+    /**
+     * 提示消息
+     */
+    protected $message = [
+    ];
+    /**
+     * 验证场景
+     */
+    protected $scene = [
+        'add'  => [],
+        'edit' => [],
+    ];
+    
+}

+ 6 - 0
application/admin/view/conf/exchmoney/add.html

@@ -12,6 +12,12 @@
             <input id="c-money" data-rule="required" class="form-control" name="row[money]" type="number" value="0">
         </div>
     </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-weigh" data-rule="" class="form-control" name="row[weigh]" type="number" 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">

+ 6 - 0
application/admin/view/conf/exchmoney/edit.html

@@ -12,6 +12,12 @@
             <input id="c-money" data-rule="required" class="form-control" name="row[money]" type="number" value="{$row.money|htmlentities}">
         </div>
     </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-weigh" data-rule="" class="form-control" name="row[weigh]" type="number" value="{$row.weigh|htmlentities}">
+        </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">

+ 28 - 0
application/admin/view/conf/withdrawal/add.html

@@ -0,0 +1,28 @@
+<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Money')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-money" data-rule="required" class="form-control" step="0.01" name="row[money]" type="number" value="0.00">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Real_money')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-real_money" data-rule="required" class="form-control" step="0.01" name="row[real_money]" type="number" value="0.00">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-weigh" data-rule="" class="form-control" name="row[weigh]" type="number">
+        </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>

+ 28 - 0
application/admin/view/conf/withdrawal/edit.html

@@ -0,0 +1,28 @@
+<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Money')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-money" data-rule="required" class="form-control" step="0.01" name="row[money]" type="number" value="{$row.money|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Real_money')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-real_money" data-rule="required" class="form-control" step="0.01" name="row[real_money]" type="number" value="{$row.real_money|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-weigh" data-rule="" class="form-control" name="row[weigh]" type="number" value="{$row.weigh|htmlentities}">
+        </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>

+ 35 - 0
application/admin/view/conf/withdrawal/index.html

@@ -0,0 +1,35 @@
+<div class="panel panel-default panel-intro">
+    {:build_heading()}
+
+    <div class="panel-body">
+        <div id="myTabContent" class="tab-content">
+            <div class="tab-pane fade active in" id="one">
+                <div class="widget-body no-padding">
+                    <div id="toolbar" class="toolbar">
+                        <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
+                        <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('conf/withdrawal/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
+                        <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('conf/withdrawal/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
+                        <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('conf/withdrawal/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
+                        <a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('conf/withdrawal/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a>
+
+                        <div class="dropdown btn-group {:$auth->check('conf/withdrawal/multi')?'':'hide'}">
+                            <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
+                            <ul class="dropdown-menu text-left" role="menu">
+                                <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>
+                                <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>
+                            </ul>
+                        </div>
+
+                        
+                    </div>
+                    <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
+                           data-operate-edit="{:$auth->check('conf/withdrawal/edit')}" 
+                           data-operate-del="{:$auth->check('conf/withdrawal/del')}" 
+                           width="100%">
+                    </table>
+                </div>
+            </div>
+
+        </div>
+    </div>
+</div>

+ 13 - 1
application/api/controller/Index.php

@@ -397,7 +397,7 @@ class Index extends Api
         $whereOr["party_name"] = ["like","%$search%"];
         //$where['is_online'] = 1;
         $where['status'] = 1;
-        $partyList = \app\common\model\Party::field("id,party_logo,party_id,party_name")
+        $partyList = \app\common\model\Party::field("id,party_logo,party_id,party_name,party_type")
             ->where($where)
             ->where(function ($query) {
                 global $whereOr;
@@ -411,6 +411,14 @@ class Index extends Api
             $partyRes = $tenimService->getRoomUser($partyParams);
             if ($partyRes['status'] == 1) {
                 foreach ($partyList as $pKey => &$pVal) {
+                    // 派对类型
+                    $partyTypeName = "普通房";
+                    if($pVal["party_type"]) {
+                        $partyTypeName = \app\common\model\PartyType::where(["id"=>$pVal["party_type"]])->value("name");
+                    }
+                    $mod = isset($pVal["party_type"])?intval($pVal["party_type"])%5:1;
+                    $pVal["party_type_color"] = $mod == 0?5:$mod;
+                    $pVal["type_name"] = $partyTypeName;
                     if (isset($partyRes['data'][$pVal['id']])) {
                         $pVal['member_list'] = $partyRes['data'][$pVal['id']]['member_list'];
                         $pVal['online_num'] = $partyRes['data'][$pVal['id']]['online_num'];
@@ -434,6 +442,10 @@ class Index extends Api
                     $userWhere['id'] = ['in',$memberUids];
                     $userData = model('User')->field($userField)->where($userWhere)->select();
                 }
+                /*$mod = intval($gKey)%5;
+                $pVal["party_type_color"] = $mod == 0?5:$mod;*/
+                $pVal["party_type_color"] = 1;
+                $pVal["type_name"] = '普通房';
                 $gVal['member_list'] = $userData;
                 $gVal['online_num'] = count($userData);
                 unset($gVal['guildmember']);

+ 16 - 0
application/api/controller/Usercenter.php

@@ -1144,4 +1144,20 @@ class UserCenter extends Common
             $this->error($e->getMessage());
         }
     }
+
+    /**
+     * 提现配置列表
+     * @return void
+     */
+    public function withdrawalList()
+    {
+        try {
+            $field = 'id,money,real_money';
+            $result = model('Withdrawal')->field($field)->autopage()->order('weigh asc')->select();
+
+            $this->success('获取成功',$result);
+        } catch (Exception $e) {
+            $this->error($e->getMessage());
+        }
+    }
 }

+ 37 - 0
application/common/model/Withdrawal.php

@@ -0,0 +1,37 @@
+<?php
+
+namespace app\common\model;
+
+use think\Model;
+
+
+class Withdrawal extends Model
+{
+
+
+    // 表名
+    protected $name = 'withdrawal_config';
+    
+    // 自动写入时间戳字段
+    protected $autoWriteTimestamp = 'int';
+
+    // 定义时间戳字段名
+    protected $createTime = 'createtime';
+    protected $updateTime = 'updatetime';
+    protected $deleteTime = false;
+
+    // 追加属性
+    protected $append = [
+
+    ];
+
+
+    
+
+
+
+
+
+
+
+}

+ 8 - 6
application/common/service/RoomService.php

@@ -106,9 +106,9 @@ class RoomService
             $partyData = $this->model->field($field)->where($where)->select();
             if (!empty($partyData)) {
                 //获取房间用户信息
-                /*$tenimService = new TenimService();
+                $tenimService = new TenimService();
                 $userParams = ['party_ids' => $partyIds];
-                $userImRes = $tenimService->getRoomUser($userParams);*/
+                $userImRes = $tenimService->getRoomUser($userParams);
                 foreach($partyData as $k => $v) {
                     $roomType = $v['room_type'];
                     $roomTypeStr = isset($this->roomTypeArr[$roomType]) ? $this->roomTypeArr[$roomType] : '';
@@ -137,13 +137,15 @@ class RoomService
                     }
                     if($foreachData["status"] != 1) $hasdata = false;
                     $foreachData = info_domain_image($foreachData,['party_logo']);
-                    $userIds = $this->redis->zRange("party_user_".$foreachData["id"],0,-1);
+                    //$userIds = $this->redis->zRange("party_user_".$foreachData["id"],0,-1);
                     if ($hasdata) {
-                        $field = 'id,avatar';
+                        $field = 'user_id,avatar';
                         $fieldArr = explode(',',$field);
-                        $userWhere['id'] = ['in', $userIds];
+                        /*$userWhere['id'] = ['in', $userIds];
                         $userModel = new \app\common\model\User();
-                        $userData = $userModel->field($field)->where($userWhere)->select();
+                        $userData = $userModel->field($field)->where($userWhere)->select();*/
+                        $userDataRes = isset($userImRes['data'][$v['id']]) ? $userImRes['data'][$v['id']] : [];
+                        $userData = isset($userDataRes['member_list']) ? $userDataRes['member_list'] : [];
                         $userDatas = [];
                         if (!empty($userData)) {
                             foreach($userData as $key => $value) {

+ 55 - 0
public/assets/js/backend/conf/withdrawal.js

@@ -0,0 +1,55 @@
+define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
+
+    var Controller = {
+        index: function () {
+            // 初始化表格参数配置
+            Table.api.init({
+                extend: {
+                    index_url: 'conf/withdrawal/index' + location.search,
+                    add_url: 'conf/withdrawal/add',
+                    edit_url: 'conf/withdrawal/edit',
+                    del_url: 'conf/withdrawal/del',
+                    multi_url: 'conf/withdrawal/multi',
+                    import_url: 'conf/withdrawal/import',
+                    table: 'withdrawal_config',
+                }
+            });
+
+            var table = $("#table");
+
+            // 初始化表格
+            table.bootstrapTable({
+                url: $.fn.bootstrapTable.defaults.extend.index_url,
+                pk: 'id',
+                sortName: 'weigh',
+                columns: [
+                    [
+                        {checkbox: true},
+                        {field: 'id', title: __('Id')},
+                        {field: 'money', title: __('Money'), operate:'BETWEEN'},
+                        {field: 'real_money', title: __('Real_money'), operate:'BETWEEN'},
+                        {field: 'weigh', title: __('Weigh'), operate: false},
+                        {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: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
+                    ]
+                ]
+            });
+
+            // 为表格绑定事件
+            Table.api.bindevent(table);
+        },
+        add: function () {
+            Controller.api.bindevent();
+        },
+        edit: function () {
+            Controller.api.bindevent();
+        },
+        api: {
+            bindevent: function () {
+                Form.api.bindevent($("form[role=form]"));
+            }
+        }
+    };
+    return Controller;
+});