dever 6 éve
szülő
commit
feb0d92511
1 módosított fájl, 18 hozzáadás és 16 törlés
  1. 18 16
      main/lib/Cron.php

+ 18 - 16
main/lib/Cron.php

@@ -112,25 +112,27 @@ class Cron
             $score = $data['product_num'] * 20;
         }
 
-        $where['uid'] = $data['uid'];
-        $user = Dever::db('score/user')->one($where);
-        if ($user) {
-            $user_score = $user['score'] - $score;
-            if ($user_score < 0) {
-                $user_score = 0;
+        if ($score > 0) {
+            $where['uid'] = $data['uid'];
+            $user = Dever::db('score/user')->one($where);
+            if ($user) {
+                $user_score = $user['score'] - $score;
+                if ($user_score < 0) {
+                    $user_score = 0;
+                }
+                Dever::db('score/user')->update(array('where_id' => $user['id'], 'score' => $user_score));
             }
-            Dever::db('score/user')->update(array('where_id' => $user['id'], 'score' => $user_score));
-        }
 
-        $where['type'] = 4;
-        $where['data_id'] = 28;
-        $user = Dever::db('act/score')->one($where);
-        if ($user) {
-            $user_score = $user['score'] - $score;
-            if ($user_score < 0) {
-                $user_score = 0;
+            $where['type'] = 4;
+            $where['data_id'] = 28;
+            $user = Dever::db('act/score')->one($where);
+            if ($user) {
+                $user_score = $user['score'] - $score;
+                if ($user_score < 0) {
+                    $user_score = 0;
+                }
+                Dever::db('act/score')->update(array('where_id' => $user['id'], 'score' => $user_score));
             }
-            Dever::db('act/score')->update(array('where_id' => $user['id'], 'score' => $user_score));
         }
     }