|
@@ -6,6 +6,7 @@ use think\Controller;
|
|
|
|
|
|
use app\common\library\Tlssigapiv2;
|
|
use app\common\library\Tlssigapiv2;
|
|
use think\Db;
|
|
use think\Db;
|
|
|
|
+use app\common\library\Easemob;
|
|
class Plantask extends Controller
|
|
class Plantask extends Controller
|
|
{
|
|
{
|
|
//关于本文件里的计划任务
|
|
//关于本文件里的计划任务
|
|
@@ -52,7 +53,7 @@ class Plantask extends Controller
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- $partyInfo = \app\common\model\Party::field("id,room_type,party_name,party_hot,user_id,platRate,guilderRate")->where(["id"=>$giftuserparty['party_id']])->find();
|
|
|
|
|
|
+ $partyInfo = \app\common\model\Party::field("id,room_type,party_name,party_hot,user_id,platRate,guilderRate,easemob_room_id")->where(["id"=>$giftuserparty['party_id']])->find();
|
|
//增加房主抽成
|
|
//增加房主抽成
|
|
if ($partyInfo && $giftuserparty['guildervalue'] > 0) {
|
|
if ($partyInfo && $giftuserparty['guildervalue'] > 0) {
|
|
$guilderMoney = bcdiv($giftuserparty['guildervalue'],$money_to_jewel,2);
|
|
$guilderMoney = bcdiv($giftuserparty['guildervalue'],$money_to_jewel,2);
|
|
@@ -65,6 +66,9 @@ class Plantask extends Controller
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //更新麦位魅力值
|
|
|
|
+ $this->updateSeatCharm($partyInfo['easemob_room_id'],$giftuserparty['seat_num'],$hotValue,$partyInfo);
|
|
|
|
+
|
|
// 如果是主播,则添加魅力值记录做榜单统计,这个表和送礼物日志表重复了,无意义
|
|
// 如果是主播,则添加魅力值记录做榜单统计,这个表和送礼物日志表重复了,无意义
|
|
/*if($partyInfo) {
|
|
/*if($partyInfo) {
|
|
$data = [];
|
|
$data = [];
|
|
@@ -125,5 +129,49 @@ class Plantask extends Controller
|
|
|
|
|
|
/////////////////////////////////////////下面都是工具方法////////////////////////////////////////////////
|
|
/////////////////////////////////////////下面都是工具方法////////////////////////////////////////////////
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 用户赠送礼物后房间内麦位魅力值增加,更新到麦位自定义信息
|
|
|
|
+ * $seatnum 座位数字 1,不是键名 seat1
|
|
|
|
+ */
|
|
|
|
+ private function updateSeatCharm($easemob_room_id,$seatnum,$giftValue,$party_info) {
|
|
|
|
+ //获取已有信息
|
|
|
|
+ $key = 'seat'.$seatnum;
|
|
|
|
+ $easemob = new Easemob();
|
|
|
|
+ $seatdata = $easemob->room_getRoomCustomAttribute($easemob_room_id,[$key]);
|
|
|
|
+
|
|
|
|
+ if(empty($seatdata)){
|
|
|
|
+ //默认为空
|
|
|
|
+ $seatdata = [
|
|
|
|
+ 'charm' => 0, //红心,魅力值
|
|
|
|
+
|
|
|
|
+ 'isMaster' => false, // 是否是房主
|
|
|
|
+ 'headUrl' => '', // 头像
|
|
|
|
+ 'userNo' => '', // 座位上用户no
|
|
|
|
+ 'rtcUid' => '', // 座位上用户id,与rtc的userId一致
|
|
|
|
+ 'name' => '', // 座位上用户昵称
|
|
|
|
+ 'seatIndex' => $seatnum, // 座位编号
|
|
|
|
+ 'chorusSongCode' => '', // 是否合唱
|
|
|
|
+ 'isAudioMuted' => 1, // 是否静音
|
|
|
|
+ 'isVideoMuted' => 0, // 是否开启视频
|
|
|
|
+ 'checked' => false, // 用于送礼物选择用户
|
|
|
|
+ 'isUsed' => true, // 用于送礼物选择用户
|
|
|
|
+ 'gender' => 1, //性别
|
|
|
|
+ ];
|
|
|
|
+ }else{
|
|
|
|
+ $seatdata = json_decode($seatdata[$key],true);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //魅力值自增
|
|
|
|
+ $seatdata['charm'] += $giftValue;
|
|
|
|
+
|
|
|
|
+ //重新设置
|
|
|
|
+ $matedata = [
|
|
|
|
+ $key => json_encode($seatdata),
|
|
|
|
+ ];
|
|
|
|
+ $easemob->room_setRoomCustomAttributeForced($easemob_room_id,$party_info['user_id'],$matedata);
|
|
|
|
+
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
}
|
|
}
|