任务修改
This commit is contained in:
@@ -122,7 +122,7 @@ class Tasks extends Model
|
|||||||
|
|
||||||
//任务列表
|
//任务列表
|
||||||
$data = db::name('vs_tasks')
|
$data = db::name('vs_tasks')
|
||||||
->field('id as task_id,icon,task_name,target_quantity,task_type,jump_type,tasks_bag_id')
|
->field('id as task_id,icon,task_name,target_quantity,task_type,jump_type,tasks_bag_id,ext')
|
||||||
->where('delete_time',0)
|
->where('delete_time',0)
|
||||||
->where('is_active',1)
|
->where('is_active',1)
|
||||||
->order('sort desc,id asc')->select();
|
->order('sort desc,id asc')->select();
|
||||||
@@ -295,7 +295,7 @@ class Tasks extends Model
|
|||||||
if($v['task_id'] == 35){
|
if($v['task_id'] == 35){
|
||||||
//获胜数量
|
//获胜数量
|
||||||
$user_win_times = $user_daily_tasks['ext'] ?? 0;
|
$user_win_times = $user_daily_tasks['ext'] ?? 0;
|
||||||
$quantity_str = $quantity_str." 胜:(".$user_win_times."/1)场";
|
$quantity_str = $quantity_str." 胜:(".$user_win_times."/".$v['ext'].")场";
|
||||||
}
|
}
|
||||||
$v['task_name'] = $v['task_name'].$quantity_str;
|
$v['task_name'] = $v['task_name'].$quantity_str;
|
||||||
$v['jump_type_str'] = $this->jump_type[$v['jump_type']];
|
$v['jump_type_str'] = $this->jump_type[$v['jump_type']];
|
||||||
@@ -471,11 +471,10 @@ class Tasks extends Model
|
|||||||
|
|
||||||
//PK任务完成
|
//PK任务完成
|
||||||
public function tasks_complete_pk($Victory_user_ids,$Failure_user_ids,$Draw_user_ids,$task_id=35){
|
public function tasks_complete_pk($Victory_user_ids,$Failure_user_ids,$Draw_user_ids,$task_id=35){
|
||||||
Log::record("PK任务完成信息入值1:".$Victory_user_ids,"info");
|
|
||||||
Log::record("PK任务完成信息入值2:".$Failure_user_ids,"info");
|
|
||||||
Log::record("PK任务完成信息入值3:".$Draw_user_ids,"info");
|
|
||||||
//查询任务
|
//查询任务
|
||||||
$task_info = Db::name('vs_tasks')->where('id',$task_id)->where('delete_time',0)->where('is_active',1)->find();
|
$task_info = Db::name('vs_tasks')->where('id',$task_id)->where('delete_time',0)->where('is_active',1)->find();
|
||||||
|
//胜利场次配置
|
||||||
|
$pk_victory_num = $task_info['ext']??1;
|
||||||
if(empty($task_info)){
|
if(empty($task_info)){
|
||||||
return ['code' => 0, 'msg' => '任务不存在或已删除','data' => null];
|
return ['code' => 0, 'msg' => '任务不存在或已删除','data' => null];
|
||||||
}
|
}
|
||||||
@@ -504,24 +503,18 @@ class Tasks extends Model
|
|||||||
$ext = $user_daily_tasks['ext'];
|
$ext = $user_daily_tasks['ext'];
|
||||||
}
|
}
|
||||||
$current_progress = $user_daily_tasks['current_progress'] + 1;
|
$current_progress = $user_daily_tasks['current_progress'] + 1;
|
||||||
if($current_progress >= $task_info['target_quantity'] && $ext >= 1){
|
if($current_progress >= $task_info['target_quantity'] && $ext >= $pk_victory_num){
|
||||||
$is_completed = 1;
|
$is_completed = 1;
|
||||||
$completion_time = time();
|
$completion_time = time();
|
||||||
Log::record("PK任务完成信息".$user_id."-PK次数:".$current_progress,"info");
|
|
||||||
Log::record("PK任务完成信息".$user_id."-胜利次数:".$ext,"info");
|
|
||||||
Log::record("PK任务完成信息".$user_id.":1","info");
|
|
||||||
}else{
|
}else{
|
||||||
Log::record("PK任务完成信息".$user_id."-PK次数:".$current_progress,"info");
|
|
||||||
Log::record("PK任务完成信息".$user_id."-胜利次数:".$ext,"info");
|
|
||||||
$is_completed = 0;
|
$is_completed = 0;
|
||||||
$completion_time = null;
|
$completion_time = null;
|
||||||
Log::record("PK任务完成信息".$user_id.":2","info");
|
|
||||||
}
|
}
|
||||||
if($current_progress > $task_info['target_quantity']){
|
if($current_progress > $task_info['target_quantity']){
|
||||||
$current_progress = $task_info['target_quantity'];
|
$current_progress = $task_info['target_quantity'];
|
||||||
}
|
}
|
||||||
if($ext > 1){
|
if($ext > $pk_victory_num){
|
||||||
$ext = 1;
|
$ext = $pk_victory_num;
|
||||||
}
|
}
|
||||||
$reslut = Db::name('vs_tasks_user_daily')->where('id',$user_daily_tasks['id'])->update([
|
$reslut = Db::name('vs_tasks_user_daily')->where('id',$user_daily_tasks['id'])->update([
|
||||||
'current_progress' => $current_progress,
|
'current_progress' => $current_progress,
|
||||||
|
|||||||
Reference in New Issue
Block a user