zqwang 2 anni fa
parent
commit
7a74d95b80
1 ha cambiato i file con 16 aggiunte e 8 eliminazioni
  1. 16 8
      app/Http/Controllers/QuickApp/User/UserController.php

+ 16 - 8
app/Http/Controllers/QuickApp/User/UserController.php

@@ -452,16 +452,17 @@ class UserController extends BaseController
      * name: hasPendingTask
      * date 2023/02/22 14:15
      */
-    public function hasPendingTask()
+    public function hasPendingTask(Request $request)
     {
         $show = true;
         try {
+            $type =  $request->input('type', "home");
             $service = new SignService($this->uid);
             $has_sign_today = $service->hasSignToday();
 
             if ($has_sign_today) {
                 // 签到找查看是否有可领取的任务
-                $show = $this->checkTask();
+                $show = $this->checkTask($type);
             }
         } catch (\Exception $exception) {
             $show = true;
@@ -475,11 +476,11 @@ class UserController extends BaseController
      * @return bool
      * date 2023/02/22 15:11
      */
-    private function checkTask()
+    private function checkTask($type= "home")
     {
        $list = $this->getTaskList();
        $task = $list['new_user_tasks'] ?? [];
-       $show = $this->checkTaskItem($task);
+       $show = $this->checkTaskItem($task,$type);
         if ($show){
             return $show;
         }
@@ -520,13 +521,20 @@ class UserController extends BaseController
      * @return bool
      * date 2023/02/22 15:10
      */
-    private function checkTaskItem($task)
+    private function checkTaskItem($task,$type)
     {
         $show = false;
         foreach ($task as  $value){
-            if (isset($value['status']) && $value['status'] == 1){
-                $show = true;
-                break ;
+            if ($type == 'home'){
+                if (isset($value['status']) && $value['status'] < 2){
+                    $show = true;
+                    break ;
+                }
+            }else if ($type == 'recharge'){
+                if (isset($value['status']) && $value['status'] == 1){
+                    $show = true;
+                    break ;
+                }
             }
         }
         return $show;