|
@@ -648,26 +648,51 @@ class TaskProc {
|
|
}
|
|
}
|
|
$dailyCards = (array) $dailyCards;
|
|
$dailyCards = (array) $dailyCards;
|
|
ksort($dailyCards);
|
|
ksort($dailyCards);
|
|
-
|
|
|
|
foreach ($dailyCards as $id => $cardMo) {
|
|
foreach ($dailyCards as $id => $cardMo) {
|
|
- foreach ($store->taskcards as $uid => $card) {
|
|
|
|
- $cardVo = new Ins_TaskCard($card);
|
|
|
|
- if ($cardVo->typeId == $id) { # 找到对应的实例.
|
|
|
|
- unset($store->taskcards->$uid); # 删除昨日未完成日常
|
|
|
|
|
|
+ foreach ($store->taskcards as $uid => $card) {
|
|
|
|
+ $cardVo = new Ins_TaskCard($card);
|
|
|
|
+ if ($cardVo->typeId == $id) { # 找到对应的实例.
|
|
|
|
+ unset($store->taskcards->$uid); # 删除昨日未完成日常
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
}
|
|
}
|
|
ctx()->store = $store;
|
|
ctx()->store = $store;
|
|
- // 再遍历一遍, 添加今日日常任务.
|
|
|
|
- $cid = 0;
|
|
|
|
- foreach ($dailyCards as $id => $cardMo) {
|
|
|
|
- $cid = StoreProc::PutTaskCardInStore($id); # 添加任务卡到背包
|
|
|
|
- }
|
|
|
|
- $pri = ctx()->privateData(); # 私有数据
|
|
|
|
|
|
+
|
|
|
|
+ if (count($dailyCards) < 4) {
|
|
|
|
+ // 再遍历一遍, 添加今日日常任务.
|
|
|
|
+ $cid = 0;
|
|
|
|
+ foreach ($dailyCards as $id => $cardMo) {
|
|
|
|
+ $cid = StoreProc::PutTaskCardInStore($id); # 添加任务卡到背包
|
|
|
|
+ }
|
|
|
|
+ $pri = ctx()->privateData(); # 私有数据
|
|
|
|
|
|
- $cardType = 2; # 日常任务,设置追踪
|
|
|
|
- my_default_Obj($pri->taskCardTracing); # 确保 tracing数据结构是否完整.
|
|
|
|
- $pri->taskCardTracing->$cardType = $cid; # 更新tracing数据.
|
|
|
|
|
|
+ $cardType = 2; # 日常任务,设置追踪
|
|
|
|
+ my_default_Obj($pri->taskCardTracing); # 确保 tracing数据结构是否完整.
|
|
|
|
+ $pri->taskCardTracing->$cardType = $cid; # 更新tracing数据
|
|
|
|
+ } else {
|
|
|
|
+ $count = count($dailyCards);
|
|
|
|
+ $temp = array();
|
|
|
|
+ while (true) {
|
|
|
|
+ $num = rand(0,$count);
|
|
|
|
+ if(in_array($num, $temp)){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ $index = 0;
|
|
|
|
+ foreach ($dailyCards as $id => $cardMo) {
|
|
|
|
+ if($index >= $num){
|
|
|
|
+ $cid = StoreProc::PutTaskCardInStore($id);# 添加任务卡到背包
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ $index+=1;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $temp[] = $num;
|
|
|
|
+ if(count($temp)>=4){
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
UserProc::updateUserInfo(); # 回存数据.(不管从哪里调用的, 更新肯定没错.)
|
|
UserProc::updateUserInfo(); # 回存数据.(不管从哪里调用的, 更新肯定没错.)
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1038,12 +1063,12 @@ class TaskProc {
|
|
$tasks = ctx()->store->taskcards;
|
|
$tasks = ctx()->store->taskcards;
|
|
$pri = ctx()->privateData();
|
|
$pri = ctx()->privateData();
|
|
for ($tp = 1; $tp < 5; $tp++) {
|
|
for ($tp = 1; $tp < 5; $tp++) {
|
|
- if(StlUtil::dictHasProperty($pri->taskCardTracing, $tp)){
|
|
|
|
|
|
+ if (StlUtil::dictHasProperty($pri->taskCardTracing, $tp)) {
|
|
$curId = $pri->taskCardTracing->$tp;
|
|
$curId = $pri->taskCardTracing->$tp;
|
|
} else {
|
|
} else {
|
|
$curId = 0;
|
|
$curId = 0;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
//$curId = my_null_default($pri->taskCardTracing->$tp, 0); # 当前追踪中的任务卡id
|
|
//$curId = my_null_default($pri->taskCardTracing->$tp, 0); # 当前追踪中的任务卡id
|
|
|
|
|
|
$needRefresh = false;
|
|
$needRefresh = false;
|