浏览代码

wesmiler 更新第5期更新代码合并

wesmiler 4 年之前
父节点
当前提交
5407c17b9c
共有 1 个文件被更改,包括 19 次插入10 次删除
  1. 19 10
      app/weixin/model/Member.php

+ 19 - 10
app/weixin/model/Member.php

@@ -2544,18 +2544,27 @@ class Member extends Model
             if($check){
                 $datas['clear_day'] = date('m月'.$signClearDay.'号', strtotime('next month'));
                 $datas['clear_month'] = date('m月');
+                // 签到后清除月份总消费
+                $totalCost = AccountLog::where(['user_id' => $userId, 'status' => 2, 'account_type' => 1, 'change_type' => 2])
+                    ->where('created_at', '>=', $time)
+                    ->sum('money');
+
+                $totalClearSign = AccountLog::where(['user_id' => $userId, 'type' => 12, 'status' => 2])
+                    ->where('created_at', '>=', $time)
+                    ->sum('money');
+            }else{
+                // 签到后清除月份总消费
+                $totalCost = AccountLog::where(['user_id' => $userId, 'status' => 2, 'account_type' => 1, 'change_type' => 2])
+                    ->where('created_at', '>=', $time)
+                    ->where('created_at', '<=', date('Y-m-01 01:00:00'))
+                    ->sum('money');
+
+                $totalClearSign = AccountLog::where(['user_id' => $userId, 'type' => 12, 'status' => 2])
+                    ->where('created_at', '>=', $time)
+                    ->where('created_at', '<=', date('Y-m-01 01:00:00'))
+                    ->sum('money');
             }
 
-            // 签到后清除月份总消费
-            $totalCost = AccountLog::where(['user_id' => $userId, 'status' => 2, 'account_type' => 1, 'change_type' => 2])
-                ->where('created_at', '>=', $time)
-                ->where('created_at', '<=', date('Y-m-01 01:00:00'))
-                ->sum('money');
-
-            $totalClearSign = AccountLog::where(['user_id' => $userId, 'type' => 12, 'status' => 2])
-                ->where('created_at', '>=', $time)
-                ->where('created_at', '<=', date('Y-m-01 01:00:00'))
-                ->sum('money');
 
             $clearRedheart = ($totalClearSign - $totalCost);
             $datas['sign_clear'] = $clearRedheart;