Browse Source

fix(job-clean): more property name & value issue

Incisakura 5 years ago
parent
commit
a80e2824e5
3 changed files with 4 additions and 5 deletions
  1. 2 2
      sql/clean_job.sql
  2. 1 1
      src/Models/User.php
  3. 1 2
      utils/clean_job.php

+ 2 - 2
sql/clean_job.sql

@@ -2,5 +2,5 @@ ALTER TABLE `bought` ADD `is_renewed` BOOLEAN NOT NULL DEFAULT FALSE AFTER `pric
     ,CHANGE `is_renewed` `is_notified` BOOLEAN NOT NULL DEFAULT FALSE;
 ALTER TABLE `ss_node` ADD `online` BOOLEAN NOT NULL DEFAULT TRUE AFTER `mu_only`
     ,ADD `gfw_block` BOOLEAN NOT NULL DEFAULT FALSE AFTER `online`;
-ALTER TABLE `user` ADD `expired` BOOLEAN NOT NULL DEFAULT FALSE AFTER `telegram_id`
-    ,ADD `traffic_notified` BOOLEAN NULL DEFAULT FALSE AFTER `expired`;
+ALTER TABLE `user` ADD `expire_notified` BOOLEAN NOT NULL DEFAULT FALSE AFTER `telegram_id`
+    ,ADD `traffic_notified` BOOLEAN NULL DEFAULT FALSE AFTER `expire_notified`;

+ 1 - 1
src/Models/User.php

@@ -15,7 +15,7 @@ use Ramsey\Uuid\Uuid;
  *
  * @property-read   int     $id         ID
  * @todo More property
- * @property        bool    $expired    If account expired
+ * @property        bool    $expire_notified    If user is notified for expire
  * @property        bool    $traffic_notified   If user is noticed for low traffic
  */
 

+ 1 - 2
utils/clean_job.php

@@ -16,7 +16,6 @@ $processed = [];
 $renew = [];
 $renew_c = function ($ids) use ($processed) {
     echo 'Renew Process START.';
-    \App\Models\Bought::where('renew', '=', 0)->update(array('is_renewed' => true));
     foreach ($ids as $id) {
         $bought = \App\Models\Bought::find($id);
         if ($bought == null) {
@@ -24,7 +23,7 @@ $renew_c = function ($ids) use ($processed) {
             unlink(__DIR__ . '/../storage/' . $id . '.renew');
             $processed['renew'] = $id;
         } else {
-            $bought->is_renewed = true;
+            $bought->is_notified = true;
             if ($bought->save() == true) {
                 unlink(__DIR__ . '/../storage/' . $id . '.renew');
                 echo 'Renew Process successed for bought' . $id . PHP_EOL;