Selaa lähdekoodia

清福利账户

gorden 1 kuukausi sitten
vanhempi
säilyke
4303625288
1 muutettua tiedostoa jossa 6 lisäystä ja 3 poistoa
  1. 6 3
      app/command/WelfareAccountCommand.php

+ 6 - 3
app/command/WelfareAccountCommand.php

@@ -7,6 +7,7 @@ use app\model\MemberAccount;
 use app\model\Order;
 use app\model\PayDetail;
 use support\Db;
+use support\Log;
 use Symfony\Component\Console\Command\Command;
 use Symfony\Component\Console\Input\InputArgument;
 use Symfony\Component\Console\Input\InputInterface;
@@ -32,9 +33,8 @@ class WelfareAccountCommand extends Command
         $accounts = MemberAccount::where('member_account_classify','WELFARE')->get()->toArray();
         Db::beginTransaction();
         try{
-            
             foreach($accounts as $account){
-                if ($account['member_account_income'] == '0.00'){
+                if ($account['member_account_income'] == '0.00' || $account['member_account_surplus'] == '0.00'){
                     echo "会员【" . $account['join_account_member_id'] . "】跳过\n";
                     continue;
                 }
@@ -46,6 +46,9 @@ class WelfareAccountCommand extends Command
 
                 // 插入清零记录
                 $this->generatePayDetail($account);
+                // 记录日志
+                Log::info("会员【" . $account['join_account_member_id'] . "】清除福利已完成",$account);
+
                 echo "会员【" . $account['join_account_member_id'] . "】已处理完成\n";
             }
             Db::commit();
@@ -55,8 +58,8 @@ class WelfareAccountCommand extends Command
             dump($e->getMessage());
 
             Db::rollBack();
+            return self::SUCCESS;
         }
-
     }
 
     /**