国庆更新代码
This commit is contained in:
@@ -6,7 +6,7 @@ use think\Controller;
|
||||
use think\Db;
|
||||
use think\Log;
|
||||
|
||||
class Ceshi extends Controller
|
||||
class Ceshi extends Controllers
|
||||
{
|
||||
//设置白名单ip访问本类接口
|
||||
protected $allowIp = [
|
||||
@@ -211,17 +211,17 @@ class Ceshi extends Controller
|
||||
|
||||
|
||||
$user = db::name('user')->where('id','>', 0)->select();
|
||||
if($user){
|
||||
foreach ($user as &$v){
|
||||
if($v['id']){
|
||||
$j = 0;
|
||||
$data[$j] = [
|
||||
'UserID' => 'u'.$v['id'],
|
||||
];
|
||||
}
|
||||
model('Tencent')->account_deletes($data);
|
||||
}
|
||||
}
|
||||
// if($user){
|
||||
// foreach ($user as &$v){
|
||||
// if($v['id']){
|
||||
// $j = 0;
|
||||
// $data[$j] = [
|
||||
// 'UserID' => 'u'.$v['id'],
|
||||
// ];
|
||||
// }
|
||||
// // model('Tencent')->account_deletes($data);
|
||||
// }
|
||||
// }
|
||||
|
||||
$reslut9 = db::name('user')->where('id','>', 0)->delete();
|
||||
if($reslut9){
|
||||
@@ -458,9 +458,9 @@ class Ceshi extends Controller
|
||||
|
||||
//删除腾讯房间
|
||||
$room = db::name('vs_room')->select();
|
||||
foreach ($room as &$value){
|
||||
model('Tencent')->delete_group('room'.$value['id']);
|
||||
}
|
||||
// foreach ($room as &$value){
|
||||
// // model('Tencent')->delete_group('room'.$value['id']);
|
||||
// }
|
||||
$reslut35 = db::name('vs_room')->where('id','>', 0)->delete();
|
||||
if($reslut35){
|
||||
$i++ ;
|
||||
|
||||
@@ -282,6 +282,13 @@ class GiveGift extends Model
|
||||
return ['code' => 0, 'msg' => '房主收益失败', 'data' => null];
|
||||
}
|
||||
}
|
||||
}else{
|
||||
//增加房主收益并记录日志
|
||||
$room_owner_earning = $this -> change_user_cion_or_earnings_log($room_owner,$room_owner_earnings,$from_id,2,18,'房主收益');
|
||||
if(!$room_owner_earning){
|
||||
Db::rollback();
|
||||
return ['code' => 0, 'msg' => '房主收益失败', 'data' => null];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -310,7 +317,9 @@ class GiveGift extends Model
|
||||
//平台收益 = 总金额 - 收礼人收益 - 房主收益 - 工会长收益
|
||||
$app_ratio = 100 - $ratio - $configs['room_author_ratio'] - $guid_ratio;
|
||||
$app_earning = coin_earning($gv['gift_price'], $app_ratio);
|
||||
$gift_rate = $this->change_give_gift_profit($gv['give_gift_id'], $ratio, $receiver_earnings, $configs['room_author_ratio'], $room_owner_earnings, $app_ratio, $app_earning);
|
||||
$receiver_earningss = $this -> receiver_earnings($to_id,$gv['gift_price'],$from_type);
|
||||
$room_owner_earningss = $this -> receiver_earnings($room_owner,$gv['gift_price'],99);//结果是钻石
|
||||
$gift_rate = $this->change_give_gift_profit($gv['give_gift_id'], $ratio, $receiver_earningss, $configs['room_author_ratio'], $room_owner_earningss, $app_ratio, $app_earning);
|
||||
if (!$gift_rate) {
|
||||
Db::rollback();
|
||||
return ['code' => 0, 'msg' => '礼物记录失败', 'data' => null];
|
||||
@@ -722,9 +731,15 @@ class GiveGift extends Model
|
||||
return ['code' => 0, 'msg' => '房主收益失败', 'data' => null];
|
||||
}
|
||||
}
|
||||
}else{
|
||||
//增加房主收益并记录日志
|
||||
$room_owner_earning = $this -> change_user_cion_or_earnings_log($room_owner,$room_owner_earnings,$from_id,2,18,'房主收益');
|
||||
if(!$room_owner_earning){
|
||||
return ['code' => 0, 'msg' => '房主收益失败', 'data' => null];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if($gift_info['label'] == 2){
|
||||
foreach ($gift_box as $gv) {
|
||||
//记录送礼利率和各方收益
|
||||
@@ -750,8 +765,11 @@ class GiveGift extends Model
|
||||
//平台收益 = 总金额 - 收礼人收益 - 房主收益 - 工会长收益
|
||||
$app_ratio = 100 - $ratio - $configs['room_author_ratio'] - $guid_ratio;
|
||||
$app_earning = coin_earning($gv['gift_price'], $app_ratio);
|
||||
$gift_rate = $this->change_give_gift_profit($gv['give_gift_id'], $ratio, $receiver_earnings, $configs['room_author_ratio'], $room_owner_earnings, $app_ratio, $app_earning);
|
||||
$receiver_earningss = $this -> receiver_earnings($to_id,$gv['gift_price'],$from_type);
|
||||
$room_owner_earningss = $this -> receiver_earnings($room_owner,$gv['gift_price'],99);//结果是钻石
|
||||
$gift_rate = $this->change_give_gift_profit($gv['give_gift_id'], $ratio, $receiver_earningss, $configs['room_author_ratio'], $room_owner_earningss, $app_ratio, $app_earning);
|
||||
if (!$gift_rate) {
|
||||
Db::rollback();
|
||||
return ['code' => 0, 'msg' => '礼物记录失败', 'data' => null];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2254,7 +2254,7 @@ class Room extends Model
|
||||
->join('user c','a.user_id2 = c.id','left')
|
||||
->join('vs_relation d','a.relation_id = d.id','left')//关系
|
||||
->field('a.relation_id,a.cp_room_id,a.id,a.user_id1,a.user_id2,a.updatetime,a.time_day,a.end_time,b.nickname as nickname1,b.avatar as avatar1,c.nickname as nickname2,c.avatar as avatar2,d.name as relation_name,d.icon as image')
|
||||
->where(['a.user_id1' => $user_id,'a.end_time' =>['>',time()],'a.delete_time' => 0,'d.id' => ['>',0]])
|
||||
->where(['a.user_id1' => $user_id,'a.end_time' =>['>',time()],'a.delete_time' => 0,'a.relation_id' => ['>',0]])
|
||||
->order('a.updatetime desc')
|
||||
->select();
|
||||
$room_auction2 = db::name('vs_room_auction_relation')->alias('a')
|
||||
@@ -2262,7 +2262,7 @@ class Room extends Model
|
||||
->join('user c','a.user_id2 = c.id','left')
|
||||
->join('vs_relation d','a.relation_id = d.id','left')//关系
|
||||
->field('a.relation_id,a.cp_room_id,a.id,a.user_id1,a.user_id2,a.updatetime,a.time_day,a.end_time,b.nickname as nickname1,b.avatar as avatar1,c.nickname as nickname2,c.avatar as avatar2,d.name as relation_name,d.icon as image')
|
||||
->where(['a.user_id2' => $user_id,'a.end_time' =>['>',time()],'a.delete_time' => 0])
|
||||
->where(['a.user_id2' => $user_id,'a.end_time' =>['>',time()],'a.delete_time' => 0,'a.relation_id' => ['>',0]])
|
||||
->order('a.updatetime desc')
|
||||
->select();
|
||||
|
||||
@@ -2555,7 +2555,7 @@ class Room extends Model
|
||||
public function user_reconnect($user_id,$room_id)
|
||||
{
|
||||
if(!$room_id){
|
||||
$room_id = Db::name('user_data')->where('user_id', $user_id)->value('room_id');
|
||||
// $room_id = Db::name('user_data')->where('user_id', $user_id)->value('room_id');
|
||||
}
|
||||
if(!$room_id){
|
||||
return ['code' => 0, 'msg' => '参数错误', 'data' => null];
|
||||
|
||||
@@ -915,7 +915,7 @@ class Tencent extends Model
|
||||
}
|
||||
|
||||
//腾讯IM监控在线状态更新
|
||||
public function tencent_member_status_change($info){
|
||||
public function tencent_member_status_changeee($info){
|
||||
$uid = substr($info['To_Account'],1);
|
||||
$action = $info['Action'];
|
||||
|
||||
@@ -925,6 +925,7 @@ class Tencent extends Model
|
||||
Log::record("腾讯离线推送,房间信息".json_encode($quit_room),"infos");
|
||||
if($quit_room) {
|
||||
foreach ($quit_room as &$v){
|
||||
if(isset($v['room_id'])){
|
||||
$room_type = db::name('vs_room')->where(['id' => $v['room_id']])->field('step,type_id,label_id')->find();
|
||||
Log::record("腾讯离线推送,房间类型".json_encode($room_type),"infos");
|
||||
if($room_type['label_id'] == 1 && ($room_type['type_id'] == 1 || $room_type['type_id'] == 8)){
|
||||
@@ -945,6 +946,8 @@ class Tencent extends Model
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$room_type = null;
|
||||
}
|
||||
}
|
||||
@@ -968,4 +971,109 @@ class Tencent extends Model
|
||||
return true;
|
||||
}
|
||||
|
||||
//腾讯IM监控在线状态更新
|
||||
public function tencent_member_status_change($info){
|
||||
$uid = substr($info['To_Account'],1);
|
||||
$action = $info['Action'];
|
||||
|
||||
if($action == 'Disconnect') {
|
||||
$is_keep = 1;
|
||||
$keep = db::name('vs_xintiao')->where('user_id' , $uid)->find();
|
||||
if(isset($keep)){
|
||||
if(time() - $keep['updatetime'] >= 60){
|
||||
$is_keep = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//判断保活用户是否安卓用户
|
||||
$user_system = db::name('user')->where('id' , $uid)->value('system');
|
||||
if($user_system == 'android'){
|
||||
Db::name('user')->where('id', $uid)->update(['is_online' => 0, 'updatetime' => time()]);
|
||||
$quit_room = Db::name('vs_room_visitor')->where('user_id', $uid)->select();
|
||||
Log::record("腾讯离线推送,用户安卓所在房间信息".json_encode($quit_room),"infos");
|
||||
if($quit_room) {
|
||||
foreach ($quit_room as &$v){
|
||||
if(isset($v['room_id'])){
|
||||
$room_type = db::name('vs_room')->where(['id' => $v['room_id']])->field('step,type_id,label_id')->find();
|
||||
// Log::record("腾讯离线推送,房间类型".json_encode($room_type),"infos");
|
||||
if($room_type['label_id'] == 1 && ($room_type['type_id'] == 1 || $room_type['type_id'] == 8)){
|
||||
// Log::record("腾讯离线推送,我是二卡八","infos");
|
||||
Db::name('user')->where('id', $uid)->update(['is_online' => 1, 'updatetime' => time()]);
|
||||
}else{
|
||||
if(isset($room_type) && ($room_type['type_id'] == 7 && ($room_type['step'] == 2 ||$room_type['step'] == 3)) || $room_type == 2){
|
||||
$text['text'] = '掉线!';
|
||||
$text['user_id'] = $uid;
|
||||
$text['type'] = 2;
|
||||
model('Chat')->sendMsg(1058,$v['room_id'],$text);
|
||||
}else {
|
||||
//查询是否有切后台的操作
|
||||
// $bg_room = db::name('vs_user_in_room_bg')->where(['room_id' => $v['room_id'],'user_id' => $v['user_id']])->find();
|
||||
// if(!$bg_room){
|
||||
// // Log::record("腾讯离线推送,要踢你","infos");
|
||||
// model('Room')->quit_room($v['user_id'], $v['room_id'],$v['user_id'],2);
|
||||
// }
|
||||
Log::record("腾讯离线推送,判断心跳".$is_keep,"infos");
|
||||
if($is_keep == 0){
|
||||
model('Room')->quit_room($v['user_id'], $v['room_id'],$v['user_id'],2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$room_type = null;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
Db::name('user')->where('id', $uid)->update(['is_online' => 0, 'updatetime' => time()]);
|
||||
$quit_room = Db::name('vs_room_visitor')->where('user_id', $uid)->select();
|
||||
// Log::record("腾讯离线推送,房间信息".json_encode($quit_room),"infos");
|
||||
if($quit_room) {
|
||||
foreach ($quit_room as &$v){
|
||||
if(isset($v['room_id'])){
|
||||
$room_type = db::name('vs_room')->where(['id' => $v['room_id']])->field('step,type_id,label_id')->find();
|
||||
// Log::record("腾讯离线推送,房间类型".json_encode($room_type),"infos");
|
||||
if($room_type['label_id'] == 1 && ($room_type['type_id'] == 1 || $room_type['type_id'] == 8)){
|
||||
// Log::record("腾讯离线推送,我是二卡八","infos");
|
||||
Db::name('user')->where('id', $uid)->update(['is_online' => 1, 'updatetime' => time()]);
|
||||
}else{
|
||||
if(isset($room_type) && ($room_type['type_id'] == 7 && ($room_type['step'] == 2 ||$room_type['step'] == 3)) || $room_type == 2){
|
||||
$text['text'] = '掉线!';
|
||||
$text['user_id'] = $uid;
|
||||
$text['type'] = 2;
|
||||
model('Chat')->sendMsg(1058,$v['room_id'],$text);
|
||||
}else {
|
||||
//查询是否有切后台的操作
|
||||
$bg_room = db::name('vs_user_in_room_bg')->where(['room_id' => $v['room_id'],'user_id' => $v['user_id']])->find();
|
||||
if(!$bg_room){
|
||||
// Log::record("腾讯离线推送,要踢你","infos");
|
||||
model('Room')->quit_room($v['user_id'], $v['room_id'],$v['user_id'],2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$room_type = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
} elseif ($action == 'Login') {
|
||||
Db::name('user')->where('id', $uid)->update(['is_online' => 1, 'updatetime' => time()]);
|
||||
$room = Db::name('vs_room_visitor')->where('user_id', $uid)->order('id desc')->value('room_id');
|
||||
|
||||
$text['text'] = '重新上线!';
|
||||
$text['user_id'] = $uid;
|
||||
$text['type'] = 1;
|
||||
model('Chat')->sendMsg(1058,$room,$text);
|
||||
}elseif ($action == 'Logout'){
|
||||
// Db::name('user')->where('id', $uid)->update(['is_online' => 0, 'updatetime' => time()]);
|
||||
// $room = Db::name('vs_room_visitor')->where('user_id', $uid)->order('id desc')->value('room_id');
|
||||
// $text['text'] = '掉线!';
|
||||
// $text['user_id'] = $uid;
|
||||
// $text['type'] = 2;
|
||||
// model('Chat')->sendMsg(1058,$room,$text);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user