ソースを参照

fix(finance): 修复共富会员概况查询条件拼接问题

- 修改了上周时间条件变量初始化方式
- 修改了周时间条件变量初始化方式
- 修改了今日时间条件变量初始化方式
- 确保查询条件正确拼接到初始条件上
- 避免了数据库查询中的语法错误
shichen 5 ヶ月 前
コミット
bed3578690
共有1 個のファイルを変更した6 個の追加3 個の削除を含む
  1. 6 3
      app/common/repositories/finance/FinanceRepository.php

+ 6 - 3
app/common/repositories/finance/FinanceRepository.php

@@ -473,12 +473,15 @@ class FinanceRepository extends BaseRepository
473 473
 
474 474
 
475 475
         // 共富会员概况
476
+        $sWeekWhere = " 1=1";
477
+        $weekWhere = " 1=1";
478
+        $dayWhere = " 1=1";
476 479
         //上周时间条件
477
-        $sWeekWhere = " and DATE(create_time) >= '" . $startDate . "' and DATE(create_time) <= '" . $endDate . "'";
480
+        $sWeekWhere .= " and DATE(create_time) >= '" . $startDate . "' and DATE(create_time) <= '" . $endDate . "'";
478 481
         //周时间条件
479
-        $weekWhere = " and DATE(create_time) >= '" . $oneWeekAgoFormatted . "' and DATE(create_time) <= '" . $todayFormatted . "'";
482
+        $weekWhere .= " and DATE(create_time) >= '" . $oneWeekAgoFormatted . "' and DATE(create_time) <= '" . $todayFormatted . "'";
480 483
         //今日时间条件
481
-        $dayWhere = " and DATE(create_time) = '" . $todayFormatted . "'";
484
+        $dayWhere .= " and DATE(create_time) = '" . $todayFormatted . "'";
482 485
         $sharedUserCount = Db::name('shared_prosperity_user')->count(); //共富会员总人数
483 486
         $sharedUserDayCount = Db::name('shared_prosperity_user')->where($dayWhere)->count(); //共富今日新增会员
484 487
         $sharedUserPvCount = Db::name('shared_prosperity_reward_record')->where(['type'=>SharedProsperityRewardRecordEnum::TYPE['PV']['code']])->sum('number'); // 共富会员专区总业绩