工会后台开发-工会管理-用户管理 开发
This commit is contained in:
@@ -63,7 +63,7 @@ class Guild extends BaseCom
|
|||||||
$type = input('type', 1);
|
$type = input('type', 1);
|
||||||
$key_name = "api:guild:operate_guild:".$uid;
|
$key_name = "api:guild:operate_guild:".$uid;
|
||||||
redis_lock_exit($key_name);
|
redis_lock_exit($key_name);
|
||||||
$reslut = model('Guild')->operate_guild($uid, $apply_id, $type);
|
$reslut = model('Guild')->operate_guild($apply_id, $type,$uid);
|
||||||
redis_unlock($key_name);
|
redis_unlock($key_name);
|
||||||
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -167,17 +167,17 @@ class Guild extends Model
|
|||||||
$insert_data['user_id'] = $user_id;
|
$insert_data['user_id'] = $user_id;
|
||||||
$insert_data['guild_id'] = $guild_id;
|
$insert_data['guild_id'] = $guild_id;
|
||||||
$insert_data['room_id'] = $rid;
|
$insert_data['room_id'] = $rid;
|
||||||
$insert_data['status'] = 1;
|
$insert_data['status'] = 2;
|
||||||
$insert_data['is_deacon'] = 2;
|
$insert_data['is_deacon'] = 2;
|
||||||
$insert_data['createtime'] = time();
|
$insert_data['createtime'] = time();
|
||||||
$update_data['apply_time'] = time();
|
// $update_data['apply_time'] = time();
|
||||||
$insert_data['is_show_room'] = 1;
|
$insert_data['is_show_room'] = 1;
|
||||||
$reslut = db::name('vs_guild_user')->insert($insert_data);
|
$reslut = db::name('vs_guild_user')->insert($insert_data);
|
||||||
if($reslut){
|
if($reslut){
|
||||||
//增加公会人数
|
//增加公会人数
|
||||||
db::name('vs_guild')->where('id', $guild_info['id'])->setInc('num', 1);
|
db::name('vs_guild')->where('id', $guild_info['id'])->setInc('num', 1);
|
||||||
//拉用户进入工会群聊
|
//拉用户进入工会群聊
|
||||||
model('Tencent')->add_group_member('g'.$guild_id, $user_id);
|
// model('Tencent')->add_group_member('g'.$guild_id, $user_id);
|
||||||
// model('Tencent')->send_group_system_notification('g'.$guild_id,"欢迎".$user_info['nickname'].'加入公会');
|
// model('Tencent')->send_group_system_notification('g'.$guild_id,"欢迎".$user_info['nickname'].'加入公会');
|
||||||
|
|
||||||
return ['code' => 1, 'msg' => '提交成功', 'data' => null];
|
return ['code' => 1, 'msg' => '提交成功', 'data' => null];
|
||||||
@@ -208,7 +208,7 @@ class Guild extends Model
|
|||||||
'a.guild_id' => $guild_id,
|
'a.guild_id' => $guild_id,
|
||||||
'a.status' => 2
|
'a.status' => 2
|
||||||
];
|
];
|
||||||
$count = db::name('vs_guild_user')-alias('a')->join('user b', 'a.user_id = b.id')->where($map)->count();
|
$count = db::name('vs_guild_user')->alias('a')->join('user b', 'a.user_id = b.id')->where($map)->count();
|
||||||
$list = db::name('vs_guild_user')->alias('a')->join('user b', 'a.user_id = b.id')
|
$list = db::name('vs_guild_user')->alias('a')->join('user b', 'a.user_id = b.id')
|
||||||
->field('a.id, a.user_id, a.guild_id, a.room_id, a.status, b.nickname, b.avatar,b.user_code')
|
->field('a.id, a.user_id, a.guild_id, a.room_id, a.status, b.nickname, b.avatar,b.user_code')
|
||||||
->where($map)
|
->where($map)
|
||||||
@@ -231,11 +231,13 @@ class Guild extends Model
|
|||||||
/*
|
/*
|
||||||
* 同意,拒绝申请
|
* 同意,拒绝申请
|
||||||
*/
|
*/
|
||||||
public function operate_guild($uid, $apply_id, $type){
|
public function operate_guild($apply_id, $type,$uid=0,$remarks=""){
|
||||||
|
if($uid != 0){
|
||||||
$user_info = db::name('user')->find($uid);
|
$user_info = db::name('user')->find($uid);
|
||||||
if(!$user_info){
|
if(!$user_info){
|
||||||
return ['code' => 0, 'msg' => '参数错误', 'data' => null];
|
return ['code' => 0, 'msg' => '参数错误', 'data' => null];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//该申请是否已被操作
|
//该申请是否已被操作
|
||||||
$is_operate = db::name('vs_guild_user')->where(['id'=>$apply_id,'status'=>2])->find();
|
$is_operate = db::name('vs_guild_user')->where(['id'=>$apply_id,'status'=>2])->find();
|
||||||
if(!$is_operate){
|
if(!$is_operate){
|
||||||
@@ -245,7 +247,7 @@ class Guild extends Model
|
|||||||
return ['code' => 0, 'msg' => '参数错误', 'data' => null];
|
return ['code' => 0, 'msg' => '参数错误', 'data' => null];
|
||||||
}
|
}
|
||||||
$guild_info = db::name('vs_guild')->where('id', $is_operate['guild_id'])->find();
|
$guild_info = db::name('vs_guild')->where('id', $is_operate['guild_id'])->find();
|
||||||
if($uid != $guild_info['user_id']){
|
if($uid!=0 && $uid != $guild_info['user_id']){
|
||||||
return ['code' => 0, 'msg' => '您没有权限操作', 'data' => null];
|
return ['code' => 0, 'msg' => '您没有权限操作', 'data' => null];
|
||||||
}
|
}
|
||||||
//审核通过
|
//审核通过
|
||||||
@@ -263,20 +265,32 @@ class Guild extends Model
|
|||||||
$update_data['updatetime'] = time();
|
$update_data['updatetime'] = time();
|
||||||
$update_data['is_show_room'] = 1;
|
$update_data['is_show_room'] = 1;
|
||||||
$update_data['apply_time'] = time();
|
$update_data['apply_time'] = time();
|
||||||
|
$update_data['remarks'] = $remarks;
|
||||||
|
//结算比例
|
||||||
|
$configs = get_system_config();
|
||||||
|
//未加入工会的收益
|
||||||
|
$ratiogr = $configs['room_gift_ratio'];
|
||||||
|
//收益增加 加入工会的收益
|
||||||
|
$ratiog = $configs['room_gift_guild_ratio'];
|
||||||
|
//收礼人最终的收益比例
|
||||||
|
$ratio = $ratiogr + $ratiog;
|
||||||
|
$update_data['settlement_ratio'] = $ratio;
|
||||||
$reslut = db::name('vs_guild_user')->where(['id'=>$apply_id])->update($update_data);
|
$reslut = db::name('vs_guild_user')->where(['id'=>$apply_id])->update($update_data);
|
||||||
if(!$reslut){
|
if(!$reslut){
|
||||||
Db::rollback();
|
Db::rollback();
|
||||||
return ['code' => 0, 'msg' => '操作失败', 'data' => null];
|
return ['code' => 0, 'msg' => '操作失败', 'data' => null];
|
||||||
}
|
}
|
||||||
|
|
||||||
//增加公会人数
|
//增加公会人数
|
||||||
db::name('vs_guild')->where('id', $guild_info['id'])->setInc('num', 1);
|
db::name('vs_guild')->where('id', $guild_info['id'])->setInc('num', 1);
|
||||||
|
//拉用户进入工会群聊
|
||||||
|
model('Tencent')->add_group_member('g'.$is_operate['guild_id'], $is_operate['user_id']);
|
||||||
}else if($type == 2){//拒绝
|
}else if($type == 2){//拒绝
|
||||||
$update_data = [];
|
$update_data = [];
|
||||||
$update_data['status'] = 3;
|
$update_data['status'] = 3;
|
||||||
$update_data['updatetime'] = time();
|
$update_data['updatetime'] = time();
|
||||||
$update_data['apply_time'] = time();
|
$update_data['apply_time'] = time();
|
||||||
$reslut = db::name('user_guild')->where(['id'=>$apply_id])->update($update_data);
|
$update_data['remarks'] = $remarks;
|
||||||
|
$reslut = db::name('vs_guild_user')->where(['id'=>$apply_id])->update($update_data);
|
||||||
if(!$reslut){
|
if(!$reslut){
|
||||||
Db::rollback();
|
Db::rollback();
|
||||||
return ['code' => 0, 'msg' => '操作失败', 'data' => null];
|
return ['code' => 0, 'msg' => '操作失败', 'data' => null];
|
||||||
@@ -385,6 +399,20 @@ class Guild extends Model
|
|||||||
Db::rollback();
|
Db::rollback();
|
||||||
return ['code' => 0, '' => '退出失败', 'data' => null];
|
return ['code' => 0, '' => '退出失败', 'data' => null];
|
||||||
}
|
}
|
||||||
|
//加入审核表
|
||||||
|
$insert_data = [];
|
||||||
|
$insert_data['guid'] = $user_guild_info['id'];
|
||||||
|
$insert_data['user_id'] = $uid;
|
||||||
|
$insert_data['guild_id'] = $guild_id;
|
||||||
|
$insert_data['status'] = 1;
|
||||||
|
$insert_data['type'] = 2;
|
||||||
|
$insert_data['createtime'] = time();
|
||||||
|
$insert_data['updatetime'] = time();
|
||||||
|
$res = db::name('vs_guild_user_quit_log')->insert($insert_data);
|
||||||
|
if(!$res){
|
||||||
|
Db::rollback();
|
||||||
|
return ['code' => 0, '' => '退出失败', 'data' => null];
|
||||||
|
}
|
||||||
//减少公会人数
|
//减少公会人数
|
||||||
db::name('vs_guild')->where('id', $guild_info['id'])->setDec('num');
|
db::name('vs_guild')->where('id', $guild_info['id'])->setDec('num');
|
||||||
model('Tencent')->delete_group_member('g'.$guild_id, $uid);
|
model('Tencent')->delete_group_member('g'.$guild_id, $uid);
|
||||||
@@ -401,6 +429,7 @@ class Guild extends Model
|
|||||||
$insert_data['user_id'] = $uid;
|
$insert_data['user_id'] = $uid;
|
||||||
$insert_data['guild_id'] = $guild_id;
|
$insert_data['guild_id'] = $guild_id;
|
||||||
$insert_data['status'] = 0;
|
$insert_data['status'] = 0;
|
||||||
|
$insert_data['type'] = 1;
|
||||||
$insert_data['createtime'] = time();
|
$insert_data['createtime'] = time();
|
||||||
$insert_data['updatetime'] = time();
|
$insert_data['updatetime'] = time();
|
||||||
$res = db::name('vs_guild_user_quit_log')->insert($insert_data);
|
$res = db::name('vs_guild_user_quit_log')->insert($insert_data);
|
||||||
@@ -510,7 +539,7 @@ class Guild extends Model
|
|||||||
}catch (\Exception $e) {
|
}catch (\Exception $e) {
|
||||||
// 回滚事务
|
// 回滚事务
|
||||||
Db::rollback();
|
Db::rollback();
|
||||||
return ['code' => 0, 'msg' => '解散失败', 'data' => null];
|
return ['code' => 0, 'msg' => '审核失败', 'data' => null];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
167
application/guildAdmin/controller/Room.php
Normal file
167
application/guildAdmin/controller/Room.php
Normal file
@@ -0,0 +1,167 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\guildAdmin\controller;
|
||||||
|
|
||||||
|
use app\admin\command\Menu;
|
||||||
|
use app\GuildAdmin\model\AuthGroup;
|
||||||
|
use app\GuildAdmin\model\AuthGroupAccess;
|
||||||
|
use app\GuildAdmin\model\AuthRule;
|
||||||
|
use app\common\controller\GuildAdmin;
|
||||||
|
use fast\Random;
|
||||||
|
use fast\Tree;
|
||||||
|
use think\Cache;
|
||||||
|
use think\Db;
|
||||||
|
use think\Exception;
|
||||||
|
use think\Hook;
|
||||||
|
use think\Session;
|
||||||
|
use think\Validate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理员管理
|
||||||
|
*
|
||||||
|
* @icon fa fa-users
|
||||||
|
* @remark 一个管理员可以有多个角色组,左侧的菜单根据管理员所拥有的权限进行生成
|
||||||
|
*/
|
||||||
|
class Room extends GuildAdmin
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $noNeedLogin = [];
|
||||||
|
protected $noNeedRight = [];
|
||||||
|
protected $layout = '';
|
||||||
|
protected $table_guild_subsidy_config = 'vs_guild_subsidy_config';
|
||||||
|
protected $table_guild_subsidy = 'vs_guild_subsidy';
|
||||||
|
protected $table_guild_user = 'vs_guild_user';
|
||||||
|
protected $table_guild_data = 'vs_guild_data';
|
||||||
|
protected $table_guild = 'vs_guild';
|
||||||
|
public function _initialize()
|
||||||
|
{
|
||||||
|
parent::_initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 房间列表
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$guild_id = $this->guildId;
|
||||||
|
$page = input('page', 1);
|
||||||
|
$page_limit = input('page_limit', 30);
|
||||||
|
$room_id = input('room_id','');
|
||||||
|
$search_user_id = input('user_id','');
|
||||||
|
$status = input('status','');
|
||||||
|
$search_stime_str = input('search_stime','');
|
||||||
|
$search_etime_str = input('search_etime','');
|
||||||
|
$s_money_search = input('s_money_search','');
|
||||||
|
$e_money_search = input('e_money_search','');
|
||||||
|
|
||||||
|
$where['a.guild_id'] = $guild_id;
|
||||||
|
$where['a.status'] = 1;
|
||||||
|
$where['a.room_id'] = ['>',0];
|
||||||
|
if($room_id){
|
||||||
|
if(is_numeric($room_id)){
|
||||||
|
$where['b.room_number'] = $room_id;
|
||||||
|
}else{
|
||||||
|
$where['b.room_name'] = ['like', '%'.$room_id.'%'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($search_user_id){
|
||||||
|
$user_id = db::name('user')->where('user_code', $search_user_id)->value('id');
|
||||||
|
$where['a.user_id'] = $user_id;
|
||||||
|
}
|
||||||
|
if($status){
|
||||||
|
$where['room_status'] = $status;
|
||||||
|
}
|
||||||
|
$count = db::name($this->table_guild_user)->alias('a')
|
||||||
|
->join('vs_room b', 'a.room_id = b.id', 'left')->where($where)->count();
|
||||||
|
$lists = db::name($this->table_guild_user)->alias('a')
|
||||||
|
->join('vs_room b', 'a.room_id = b.id', 'left')
|
||||||
|
->field('a.*,b.room_name,b.room_number,b.room_cover,b.type_id,b.label_id,b.room_status')
|
||||||
|
->where($where)
|
||||||
|
->page($page, $page_limit)
|
||||||
|
->select();
|
||||||
|
$rum_lists = [];
|
||||||
|
//总流水
|
||||||
|
$total_consumption = 0;
|
||||||
|
foreach ($lists as $k=>$v){
|
||||||
|
$search_stime = $search_stime_str;
|
||||||
|
$search_etime = $search_etime_str;
|
||||||
|
if($search_stime!=""){
|
||||||
|
if($search_stime!="" && $v['createtime'] < strtotime($search_stime)){
|
||||||
|
$search_stime = $search_stime;
|
||||||
|
}else{
|
||||||
|
$search_stime = date('Y-m-d H:i:s',$v['createtime']) ;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$search_stime = $search_stime;
|
||||||
|
}
|
||||||
|
if($search_etime!=""){
|
||||||
|
if($v['quit_time']){
|
||||||
|
if($search_etime!="" && $v['quit_time'] > strtotime($search_etime)){
|
||||||
|
$search_etime = $search_etime;
|
||||||
|
}else{
|
||||||
|
$search_etime = date('Y-m-d H:i:s',$v['quit_time']);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$search_etime = $search_etime;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$search_etime = $search_etime;
|
||||||
|
}
|
||||||
|
$room_info = db::name('vs_room')->where(['id'=>$v['room_id']])->find();
|
||||||
|
$rum_lists[$k]['id']=$v['id'];
|
||||||
|
$rum_lists[$k]['room_id']=$v['room_id'];
|
||||||
|
$rum_lists[$k]['room_code']= $v['room_number'];
|
||||||
|
//靓号
|
||||||
|
$room_number = model('api/Decorate')->user_decorate_detail($v['room_id'], 7);
|
||||||
|
$rum_lists[$k]['room_number']= $room_number==$v['room_number'] ? '无' : $room_number;
|
||||||
|
//房主
|
||||||
|
$room_user = db::name('user')->where(['id'=>$v['user_id']])->find();
|
||||||
|
$rum_lists[$k]['room_user']= $room_user['user_code'] . '-' . $room_user['nickname'];
|
||||||
|
$rum_lists[$k]['room_name']=$room_info['room_name']?? '';
|
||||||
|
$rum_lists[$k]['room_cover']=$room_info['room_cover']?? '';
|
||||||
|
//房间分类
|
||||||
|
$rum_lists[$k]['room_type']= db::name('vs_room_type')->where('id', $v['type_id'])->value('type_name')??'';
|
||||||
|
//房间标签
|
||||||
|
$rum_lists[$k]['room_label']= db::name('vs_room_label')->where('id', $v['label_id'])->value('label_name')??'';
|
||||||
|
//房间粉丝
|
||||||
|
$stime = $search_stime_str=="" ? strtotime(date('Y-m-d',time())) : strtotime($search_stime_str);
|
||||||
|
$etime = time();
|
||||||
|
$rum_lists[$k]['follow_num'] = Db::name('user_follow')->where([
|
||||||
|
'follow_id'=>$v['room_id'],
|
||||||
|
'type'=>2,
|
||||||
|
'createtime'=>['<',$etime],
|
||||||
|
])->count();
|
||||||
|
$rum_lists[$k]['follow_num_new'] = Db::name('user_follow')->where([
|
||||||
|
'follow_id'=>$v['room_id'],
|
||||||
|
'type'=>2,
|
||||||
|
'createtime'=>['<',$etime],
|
||||||
|
])->where('createtime', '>', $stime)->count();
|
||||||
|
//房间状态
|
||||||
|
$rum_lists[$k]['room_status']= $v['room_status']==1 ? '正常' : '封禁';
|
||||||
|
//房间流水
|
||||||
|
$rum_lists[$k]['consumption']= model('adminapi/Room')->getRoomFlow($v['room_id'],$search_stime,$search_etime);
|
||||||
|
$rum_lists[$k]['add_time'] = date('Y-m-d H:i:s',$v['createtime']);
|
||||||
|
$total_consumption += $rum_lists[$k]['consumption'];
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
usort($rum_lists, function($a, $b) {
|
||||||
|
return $b['consumption'] - $a['consumption'];
|
||||||
|
});
|
||||||
|
//按流水查询
|
||||||
|
if($s_money_search!="" && $e_money_search!=""){
|
||||||
|
$rum_lists = array_filter($rum_lists, function($v) use ($s_money_search, $e_money_search) {
|
||||||
|
return $v['consumption'] >= $s_money_search && $v['consumption'] <= $e_money_search;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//分页
|
||||||
|
$rum_lists = array_slice($rum_lists, ($page-1)*$page_limit, $page_limit);
|
||||||
|
$return_data = [
|
||||||
|
'page' =>$page,
|
||||||
|
'page_limit' => $page_limit,
|
||||||
|
'total_consumption' => $total_consumption,
|
||||||
|
'count' => $count,
|
||||||
|
'lists' => $rum_lists
|
||||||
|
];
|
||||||
|
return V(1,"成功", $return_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
320
application/guildAdmin/controller/User.php
Normal file
320
application/guildAdmin/controller/User.php
Normal file
@@ -0,0 +1,320 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\guildAdmin\controller;
|
||||||
|
|
||||||
|
use app\admin\command\Menu;
|
||||||
|
use app\GuildAdmin\model\AuthGroup;
|
||||||
|
use app\GuildAdmin\model\AuthGroupAccess;
|
||||||
|
use app\GuildAdmin\model\AuthRule;
|
||||||
|
use app\common\controller\GuildAdmin;
|
||||||
|
use fast\Random;
|
||||||
|
use fast\Tree;
|
||||||
|
use think\Cache;
|
||||||
|
use think\Db;
|
||||||
|
use think\Exception;
|
||||||
|
use think\Hook;
|
||||||
|
use think\Session;
|
||||||
|
use think\Validate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理员管理
|
||||||
|
*
|
||||||
|
* @icon fa fa-users
|
||||||
|
* @remark 一个管理员可以有多个角色组,左侧的菜单根据管理员所拥有的权限进行生成
|
||||||
|
*/
|
||||||
|
class User extends GuildAdmin
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $noNeedLogin = [];
|
||||||
|
protected $noNeedRight = [];
|
||||||
|
protected $layout = '';
|
||||||
|
protected $table_guild_subsidy_config = 'vs_guild_subsidy_config';
|
||||||
|
protected $table_guild_subsidy = 'vs_guild_subsidy';
|
||||||
|
protected $table_guild_user = 'vs_guild_user';
|
||||||
|
protected $table_guild_data = 'vs_guild_data';
|
||||||
|
protected $table_guild = 'vs_guild';
|
||||||
|
public function _initialize()
|
||||||
|
{
|
||||||
|
parent::_initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 用户列表
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$guild_id = $this->guildId;
|
||||||
|
$page = input('page', 1);
|
||||||
|
$page_limit = input('page_limit', 30);
|
||||||
|
$search = input('search','');
|
||||||
|
$search_stime = input('search_stime','');
|
||||||
|
$search_etime = input('search_etime','');
|
||||||
|
$where = [];
|
||||||
|
if($search){
|
||||||
|
//手机号
|
||||||
|
if(preg_match('/^1[34578]\d{9}$/',$search)){
|
||||||
|
$where['b.mobile'] = ['like',$search];
|
||||||
|
}elseif(is_numeric($search) && strlen($search) <= 10){//ID 数字
|
||||||
|
$user_id = db::name('user')->where('user_code', $search)->value('id');
|
||||||
|
$where['a.user_id'] = ['like',$user_id];
|
||||||
|
}else{
|
||||||
|
$where['b.nickname'] = ['like',$search];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($search_stime){
|
||||||
|
$where['a.createtime'] = ['>=',strtotime($search_stime)];
|
||||||
|
}
|
||||||
|
if($search_etime){
|
||||||
|
$where['a.createtime'] = ['<=',strtotime($search_etime)];
|
||||||
|
}
|
||||||
|
$where['a.guild_id'] = $guild_id;
|
||||||
|
$where['a.status'] = 1;
|
||||||
|
$count = db::name('vs_guild_user')->alias('a')->join('user b', 'a.user_id = b.id')->where($where)->count();
|
||||||
|
$list = db::name('vs_guild_user')->alias('a')->join('user b', 'a.user_id = b.id')
|
||||||
|
->field('a.id, a.user_id, a.guild_id, a.room_id, b.status, b.nickname, b.avatar,b.user_code,b.sex,b.mobile,a.createtime,a.settlement_ratio')
|
||||||
|
->where($where)
|
||||||
|
->order('id desc')
|
||||||
|
->page($page, $page_limit)
|
||||||
|
->select();
|
||||||
|
$list_data =[];
|
||||||
|
foreach ($list as $k=>$item){
|
||||||
|
$list_data[$k]['id'] = $item['id'];
|
||||||
|
$list_data[$k]['nickname'] = $item['user_code'].'-'.$item['nickname'];
|
||||||
|
if($item['sex']){
|
||||||
|
$list_data[$k]['sex'] = $item['sex'] == 1 ? '男' : '女';
|
||||||
|
}else{
|
||||||
|
$list_data[$k]['sex'] = '未知';
|
||||||
|
}
|
||||||
|
$list_data[$k]['mobile'] = $item['mobile'];
|
||||||
|
//粉丝数量
|
||||||
|
$list_data[$k]['fans_num'] = db::name('user_follow')->where(['follow_id' => $item['user_id'],'type'=>1])->count();
|
||||||
|
if($search_stime==""){
|
||||||
|
$search_stime = strtotime(date('Y-m-d'));
|
||||||
|
}
|
||||||
|
if($search_etime==""){
|
||||||
|
$search_etime = time();
|
||||||
|
}
|
||||||
|
$list_data[$k]['fans_num_new'] = db::name('user_follow')->where(['follow_id' => $item['user_id'],'type'=>1])
|
||||||
|
->where('createtime', '>=', strtotime($search_stime))
|
||||||
|
->where('createtime', '<=', strtotime($search_etime))
|
||||||
|
->count();
|
||||||
|
$list_data[$k]['settlement_ratio'] = $item['settlement_ratio'];
|
||||||
|
//最高比例
|
||||||
|
//结算比例
|
||||||
|
$configs = get_system_config();
|
||||||
|
$list_data[$k]['max_settlement_ratio'] = $configs['room_gift_ratio'] + $configs['room_gift_guild_ratio'];
|
||||||
|
$list_data[$k]['createtime'] = date('Y-m-d H:i:s',$item['createtime']);
|
||||||
|
//状态 1正常,2禁止登录,0注销
|
||||||
|
$list_data[$k]['status'] = $item['status'];
|
||||||
|
$list_data[$k]['status_text'] = $item['status'] == 1 ? '正常' : ($item['status'] == 2 ? '禁止登录' : '注销');
|
||||||
|
}
|
||||||
|
$return_data =[
|
||||||
|
'page' => $page,
|
||||||
|
'limit' => $page_limit,
|
||||||
|
'count' => $count,
|
||||||
|
'list' => $list_data
|
||||||
|
];
|
||||||
|
return V(1,"成功", $return_data);
|
||||||
|
}
|
||||||
|
//用户申请列表
|
||||||
|
public function apply_list(){
|
||||||
|
$guild_id = $this->guildId;
|
||||||
|
$page = input('page', 1);
|
||||||
|
$page_limit = input('page_limit', 30);
|
||||||
|
$search = input('search','');
|
||||||
|
$search_stime = input('search_stime','');
|
||||||
|
$search_etime = input('search_etime','');
|
||||||
|
$where = [];
|
||||||
|
if($search){
|
||||||
|
//手机号
|
||||||
|
if(preg_match('/^1[34578]\d{9}$/',$search)){
|
||||||
|
$where['b.mobile'] = ['like',$search];
|
||||||
|
}elseif(is_numeric($search) && strlen($search) <= 10){//ID 数字
|
||||||
|
$user_id = db::name('user')->where('user_code', $search)->value('id');
|
||||||
|
$where['a.user_id'] = ['like',$user_id];
|
||||||
|
}else{
|
||||||
|
$where['b.nickname'] = ['like',$search];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($search_stime){
|
||||||
|
$where['a.createtime'] = ['>=',strtotime($search_stime)];
|
||||||
|
}
|
||||||
|
if($search_etime){
|
||||||
|
$where['a.createtime'] = ['<=',strtotime($search_etime)];
|
||||||
|
}
|
||||||
|
$where['a.guild_id'] = $guild_id;
|
||||||
|
$where['a.status'] = ['in','2,3'];
|
||||||
|
$count = db::name('vs_guild_user')->alias('a')->join('user b', 'a.user_id = b.id')->where($where)->count();
|
||||||
|
$list = db::name('vs_guild_user')->alias('a')->join('user b', 'a.user_id = b.id')
|
||||||
|
->field('a.id, a.user_id, a.guild_id, a.room_id, a.status, b.nickname, b.avatar,b.user_code,b.sex,b.mobile,a.createtime')
|
||||||
|
->where($where)
|
||||||
|
->order('id desc')
|
||||||
|
->page($page, $page_limit)
|
||||||
|
->select();
|
||||||
|
$list_data =[];
|
||||||
|
foreach ($list as $k=>$item){
|
||||||
|
$list_data[$k]['id'] = $item['id'];
|
||||||
|
$list_data[$k]['nickname'] = $item['user_code'].'-'.$item['nickname'];
|
||||||
|
if($item['sex']){
|
||||||
|
$list_data[$k]['sex'] = $item['sex'] == 1 ? '男' : '女';
|
||||||
|
}else{
|
||||||
|
$list_data[$k]['sex'] = '未知';
|
||||||
|
}
|
||||||
|
$list_data[$k]['mobile'] = $item['mobile'];
|
||||||
|
//粉丝数量
|
||||||
|
$list_data[$k]['fans_num'] = db::name('user_follow')->where(['follow_id' => $item['user_id'],'type'=>1])->count();
|
||||||
|
if($search_stime==""){
|
||||||
|
$search_stime = strtotime(date('Y-m-d'));
|
||||||
|
}
|
||||||
|
if($search_etime==""){
|
||||||
|
$search_etime = time();
|
||||||
|
}
|
||||||
|
$list_data[$k]['fans_num_new'] = db::name('user_follow')->where(['follow_id' => $item['user_id'],'type'=>1])
|
||||||
|
->where('createtime', '>=', strtotime($search_stime))
|
||||||
|
->where('createtime', '<=', strtotime($search_etime))
|
||||||
|
->count();
|
||||||
|
$list_data[$k]['createtime'] = date('Y-m-d H:i:s',$item['createtime']);
|
||||||
|
$list_data[$k]['status'] = $item['status'];
|
||||||
|
$list_data[$k]['status_text'] = $item['status'] == 2 ? '待审核' : '审核失败';
|
||||||
|
}
|
||||||
|
$return_data =[
|
||||||
|
'page' => $page,
|
||||||
|
'limit' => $page_limit,
|
||||||
|
'count' => $count,
|
||||||
|
'list' => $list_data
|
||||||
|
];
|
||||||
|
return V(1,"成功", $return_data);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* 同意,拒绝申请
|
||||||
|
*/
|
||||||
|
public function operate_guild(){
|
||||||
|
$id = input('id','');
|
||||||
|
$status = input('status','');
|
||||||
|
$remarks = input('remarks','');
|
||||||
|
if(!$id){
|
||||||
|
return V(0,"参数错误");
|
||||||
|
}
|
||||||
|
$guild_user = db::name('vs_guild_user')->where(['id'=>$id])->find();
|
||||||
|
if(!$guild_user){
|
||||||
|
return V(0,"参数错误");
|
||||||
|
}
|
||||||
|
$result = model('api/Guild')->operate_guild($id, $status,$remarks);
|
||||||
|
if($result['code'] == 1){
|
||||||
|
return V(1,"操作成功");
|
||||||
|
}else{
|
||||||
|
return V(0,$result['msg']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//结算比例编辑
|
||||||
|
public function settlement_ratio_edit(){
|
||||||
|
$id = input('id','');
|
||||||
|
$settlement_ratio = input('settlement_ratio','');
|
||||||
|
if(!$id){
|
||||||
|
return V(0,"参数错误");
|
||||||
|
}
|
||||||
|
$guild_user = db::name('vs_guild_user')->where(['id'=>$id])->find();
|
||||||
|
if(!$guild_user){
|
||||||
|
return V(0,"参数错误");
|
||||||
|
}
|
||||||
|
$configs = get_system_config();
|
||||||
|
$ratio = $configs['room_gift_ratio'] + $configs['room_gift_guild_ratio'];
|
||||||
|
if($settlement_ratio > $ratio){
|
||||||
|
return V(0,"最高比例不能超过".$ratio);
|
||||||
|
}
|
||||||
|
$result = db::name('vs_guild_user')->where(['id'=>$id])->update(['settlement_ratio'=>$settlement_ratio]);
|
||||||
|
if($result){
|
||||||
|
return V(1,"操作成功");
|
||||||
|
}else{
|
||||||
|
return V(0,"操作失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//踢出工会
|
||||||
|
public function kick_out_user(){
|
||||||
|
$id = input('id','');
|
||||||
|
if(!$id){
|
||||||
|
return V(0,"参数错误");
|
||||||
|
}
|
||||||
|
$guild_user = db::name('vs_guild_user')->where(['id'=>$id])->find();
|
||||||
|
$guild = db::name('vs_guild')->where(['id'=>$guild_user['guild_id']])->find();
|
||||||
|
$result = model('api/Guild')->kick_out_guild($guild['user_id'],$guild_user['user_id'], $guild_user['guild_id']);
|
||||||
|
if($result['code'] == 1){
|
||||||
|
return V(1,"操作成功");
|
||||||
|
}else{
|
||||||
|
return V(0,$result['msg']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//退出申请列表
|
||||||
|
public function quit_apply_list(){
|
||||||
|
$guild_id = $this->guildId;
|
||||||
|
$page = input('page', 1);
|
||||||
|
$page_limit = input('page_limit', 30);
|
||||||
|
$search = input('search','');
|
||||||
|
$search_stime = input('search_stime','');
|
||||||
|
$search_etime = input('search_etime','');
|
||||||
|
$where = [];
|
||||||
|
if($search){
|
||||||
|
//手机号
|
||||||
|
if(preg_match('/^1[34578]\d{9}$/',$search)){
|
||||||
|
$where['b.mobile'] = ['like',$search];
|
||||||
|
}elseif(is_numeric($search) && strlen($search) <= 10){//ID 数字
|
||||||
|
$user_id = db::name('user')->where('user_code', $search)->value('id');
|
||||||
|
$where['a.user_id'] = ['like',$user_id];
|
||||||
|
}else{
|
||||||
|
$where['b.nickname'] = ['like',$search];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($search_stime){
|
||||||
|
$where['a.createtime'] = ['>=',strtotime($search_stime)];
|
||||||
|
}
|
||||||
|
if($search_etime){
|
||||||
|
$where['a.createtime'] = ['<=',strtotime($search_etime)];
|
||||||
|
}
|
||||||
|
$where['a.guild_id'] = $guild_id;
|
||||||
|
$list = db::name('vs_guild_user_quit_log')->alias('a')->join('user b', 'a.user_id = b.id')
|
||||||
|
->field('a.id, a.user_id, a.guild_id,a.createtime,a.status,b.nickname, b.avatar,b.user_code,b.mobile,a.type')
|
||||||
|
->where($where)
|
||||||
|
->order('id desc')
|
||||||
|
->page($page, $page_limit)
|
||||||
|
->select();
|
||||||
|
$count = db::name('vs_guild_user_quit_log')->alias('a')->join('user b', 'a.user_id = b.id')->where($where)->count();
|
||||||
|
$list_data = [];
|
||||||
|
foreach ($list as $k => $item){
|
||||||
|
$list_data[$k]['id'] = $item['id'];
|
||||||
|
$list_data[$k]['nickname'] = $item['user_code'].'-'.$item['nickname'];
|
||||||
|
$list_data[$k]['mobile'] = $item['mobile'];
|
||||||
|
$list_data[$k]['type'] = $item['type']==1?'主动退出':'付费退出';
|
||||||
|
$list_data[$k]['createtime'] = date('Y-m-d H:i:s',$item['createtime']);
|
||||||
|
// 审核状态 0默认待审核 1已通过 2已拒绝
|
||||||
|
$list_data[$k]['status'] = $item['status'];
|
||||||
|
$list_data[$k]['status_text'] = $item['status'] == 0 ? '待审核' : ($item['status'] == 1 ? '已通过' : '已拒绝');
|
||||||
|
}
|
||||||
|
|
||||||
|
$return_data =[
|
||||||
|
'page' => $page,
|
||||||
|
'limit' => $page_limit,
|
||||||
|
'count' => $count,
|
||||||
|
'list' => $list_data
|
||||||
|
];
|
||||||
|
return V(1,"成功", $return_data);
|
||||||
|
}
|
||||||
|
//退出申请审核
|
||||||
|
public function quit_apply_operate(){
|
||||||
|
$id = input('id','');
|
||||||
|
$status = input('status',1);
|
||||||
|
if(!$id){
|
||||||
|
return V(0,"参数错误");
|
||||||
|
}
|
||||||
|
$quit_apply = db::name('vs_guild_user_quit_log')->where(['id'=>$id])->find();
|
||||||
|
if(!$quit_apply){
|
||||||
|
return V(0,"参数错误");
|
||||||
|
}
|
||||||
|
$result = model('api/Guild')->quit_apply_audit($quit_apply['user_id'],$id,$status);
|
||||||
|
if($result['code'] == 1){
|
||||||
|
return V(1,"操作成功");
|
||||||
|
}else{
|
||||||
|
return V(0,$result['msg']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user