Jelajahi Sumber

会员升级

Kirin 1 bulan lalu
induk
melakukan
b0eac2e5f5
2 mengubah file dengan 9 tambahan dan 5 penghapusan
  1. 8 4
      app/dao/BaseDao.php
  2. 1 1
      app/services/user/UserServices.php

+ 8 - 4
app/dao/BaseDao.php

@@ -24,6 +24,7 @@ abstract class BaseDao
 {
 
     use CacheDaoTrait;
+
     /**
      * 当前表名别名
      * @var string
@@ -66,9 +67,12 @@ abstract class BaseDao
      * @param array $where
      * @return int
      */
-    public function getCount(array $where)
+    public function getCount(array $where, $search = false)
     {
-        return $this->getModel()->where($where)->count();
+        if ($search) {
+            return $this->search($where)->count();
+        } else
+            return $this->getModel()->where($where)->count();
     }
 
     /**
@@ -228,11 +232,11 @@ abstract class BaseDao
         return $this->getModel()::whereIn(is_null($key) ? $this->getPk() : $key, $ids)->update($data);
     }
 
-	/**
+    /**
      * 批量更新数据,增加条件
      * @param array $ids
      * @param array $data
- 	 * @param array $where
+     * @param array $where
      * @param string|null $key
      * @return BaseModel
      */

+ 1 - 1
app/services/user/UserServices.php

@@ -1775,7 +1775,7 @@ class UserServices extends BaseServices
         $times = sys_config('energy_to_money_times', 0);
         /** @var UserBillServices $userBillServices */
         $userBillServices = app()->make(UserBillServices::class);
-        $trans_times = $userBillServices->getCount(['uid' => $uid, 'type' => 'energy_to_money', 'time' => 'month']);
+        $trans_times = $userBillServices->getCount(['uid' => $uid, 'type' => 'energy_to_money', 'time' => 'month'], true);
         $user['energy_to_money_commission'] = $commission;
         $user['energy_to_money_times'] = $trans_times;
         $user['energy_to_money_times_limit'] = $times;