异步更新数据
This commit is contained in:
@@ -7,6 +7,7 @@ use think\Log;
|
||||
use think\Model;
|
||||
use think\Session;
|
||||
use think\Db;
|
||||
use app\common\library\GiftQueue;
|
||||
|
||||
class GiveGift extends Model
|
||||
{
|
||||
@@ -1000,13 +1001,23 @@ class GiveGift extends Model
|
||||
'type' => $type,//1金币购买 2送背包礼物
|
||||
'createtime' => time(),
|
||||
];
|
||||
$res = Db::name('vs_give_gift')->insertGetId($data);
|
||||
if(!$res){
|
||||
return false;
|
||||
}
|
||||
|
||||
GiftQueue::push($data);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//送礼回调处理任务
|
||||
public function change_user_give_gift_log_callback($give_gift_id,$data)
|
||||
{
|
||||
$from_id = $data['from_id'];
|
||||
$uid = $data['user_id'];
|
||||
$to_id = $data['gift_user'];
|
||||
$gift_price = $data['total_price'];
|
||||
$gid = $data['gift_id'];
|
||||
//记录公会流水
|
||||
if($from_type==2 && $from_id > 0){
|
||||
model('api/Guild')->guild_flow($from_id,$gift_price,$res);
|
||||
if($from_id > 0){
|
||||
model('api/Guild')->guild_flow($from_id,$gift_price,$give_gift_id);
|
||||
}
|
||||
//查询是否第一次送礼
|
||||
$is_first_gift = db::name('vs_give_gift')->where(['user_id'=>$uid])->count();
|
||||
@@ -1047,30 +1058,28 @@ class GiveGift extends Model
|
||||
$is_today_gift = db::name('vs_give_gift')
|
||||
->where(['user_id'=>$uid,'gift_user'=>$to_id,'createtime' => ['>=',strtotime(date('Y-m-d'))],'gift_id' => ['in',$special_gift]])->count();
|
||||
// if($is_today_gift <= 2){
|
||||
//查询徒弟是否是首签的徒弟 sign_user_type:被签用户的类型:0-首次被签,1-签约过期,2-违约签
|
||||
$is_students = db::name('vs_user_sign')
|
||||
->where(['parent_user_id' => $uid,'sign_user_id' => $to_id,'sign_user_type' => 0,'end_time' => ['>',time()]])->value('id');
|
||||
if($is_students){
|
||||
//获取房间的类型
|
||||
$room_type = db::name('vs_room')->where(['id' => $from_id])->value('type_id');
|
||||
if($room_type == 2){
|
||||
//任务:21-邀请徒弟在拍卖房停留(0/5)分钟,并送给徒弟(0/1 ,特殊礼物)
|
||||
model('Tasks')->tasks_complete($uid,21,2,$to_id);
|
||||
}
|
||||
if($room_type == 9){
|
||||
//任务:22-邀请徒弟在点唱房点歌(0/1)首,并送给徒弟(0/1 ,特殊礼物)
|
||||
model('Tasks')->tasks_complete($uid,22,2,$to_id);
|
||||
}
|
||||
if($room_type == 7) {
|
||||
//任务:23-邀请徒弟在交友房停留(0/5)分钟,并送给徒弟(0/1 ,特殊礼物)
|
||||
model('Tasks')->tasks_complete($uid, 23, 2,$to_id);
|
||||
}
|
||||
//查询徒弟是否是首签的徒弟 sign_user_type:被签用户的类型:0-首次被签,1-签约过期,2-违约签
|
||||
$is_students = db::name('vs_user_sign')
|
||||
->where(['parent_user_id' => $uid,'sign_user_id' => $to_id,'sign_user_type' => 0,'end_time' => ['>',time()]])->value('id');
|
||||
if($is_students){
|
||||
//获取房间的类型
|
||||
$room_type = db::name('vs_room')->where(['id' => $from_id])->value('type_id');
|
||||
if($room_type == 2){
|
||||
//任务:21-邀请徒弟在拍卖房停留(0/5)分钟,并送给徒弟(0/1 ,特殊礼物)
|
||||
model('Tasks')->tasks_complete($uid,21,2,$to_id);
|
||||
}
|
||||
if($room_type == 9){
|
||||
//任务:22-邀请徒弟在点唱房点歌(0/1)首,并送给徒弟(0/1 ,特殊礼物)
|
||||
model('Tasks')->tasks_complete($uid,22,2,$to_id);
|
||||
}
|
||||
if($room_type == 7) {
|
||||
//任务:23-邀请徒弟在交友房停留(0/5)分钟,并送给徒弟(0/1 ,特殊礼物)
|
||||
model('Tasks')->tasks_complete($uid, 23, 2,$to_id);
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user