diff --git a/crmeb/app/dao/user/UserBrokerageDao.php b/crmeb/app/dao/user/UserBrokerageDao.php index 54d688d2c..224677302 100644 --- a/crmeb/app/dao/user/UserBrokerageDao.php +++ b/crmeb/app/dao/user/UserBrokerageDao.php @@ -33,6 +33,10 @@ class UserBrokerageDao extends BaseDao * @param int $limit * @param array $typeWhere * @return array + * @throws \ReflectionException + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException */ public function getList(array $where, string $field = '*', int $page = 0, int $limit = 0, array $typeWhere = []) { @@ -68,7 +72,8 @@ class UserBrokerageDao extends BaseDao */ public function brokerageRankList(array $where, int $page = 0, int $limit = 0) { - return $this->search($where)->field('uid,SUM(IF(pm=1,`number`,-`number`)) as brokerage_price')->with(['user' => function ($query) { + //SUM(IF(pm=1,`number`,-`number`)) + return $this->search($where)->field('uid,SUM(number) as brokerage_price')->with(['user' => function ($query) { $query->field('uid,avatar,nickname'); }])->order('brokerage_price desc')->group('uid')->when($page && $limit, function ($query) use ($page, $limit) { $query->page($page, $limit); @@ -79,6 +84,7 @@ class UserBrokerageDao extends BaseDao * 获取某些条件的佣金总数 * @param array $where * @return mixed + * @throws \ReflectionException */ public function getBrokerageSumColumn(array $where) { @@ -92,6 +98,7 @@ class UserBrokerageDao extends BaseDao * 获取某个账户下的冻结佣金 * @param int $uid * @return float + * @throws \ReflectionException */ public function getUserFrozenPrice(int $uid) { diff --git a/crmeb/app/services/user/UserBrokerageServices.php b/crmeb/app/services/user/UserBrokerageServices.php index 36e15e6d1..ff4a9bad7 100644 --- a/crmeb/app/services/user/UserBrokerageServices.php +++ b/crmeb/app/services/user/UserBrokerageServices.php @@ -187,6 +187,7 @@ class UserBrokerageServices extends BaseServices * @param array|string[] $type * @param string $time * @return float + * @throws \ReflectionException */ public function getUserBrokerageSum(int $uid, array $type = ['one_brokerage', 'two_brokerage', 'brokerage_user'], $time = '') { @@ -271,7 +272,7 @@ class UserBrokerageServices extends BaseServices */ public function brokerageRankList(string $time = 'week') { - $where = []; + $where = ['pm' => 1]; if ($time) { $where['time'] = $time; } @@ -296,10 +297,14 @@ class UserBrokerageServices extends BaseServices * 获取用户排名 * @param int $uid * @param string $time + * @return false|int|string + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException */ public function getUserBrokerageRank(int $uid, string $time = 'week') { - $where = []; + $where = ['pm' => 1]; if ($time) { $where['time'] = $time; } @@ -327,6 +332,9 @@ class UserBrokerageServices extends BaseServices * 推广数据 昨天的佣金 累计提现金额 当前佣金 * @param int $uid * @return mixed + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException */ public function commission(int $uid) { @@ -354,6 +362,7 @@ class UserBrokerageServices extends BaseServices * @param array $where * @param int $time * @return mixed + * @throws \ReflectionException */ public function getUsersBokerageSum(array $where, $time = 0) { @@ -372,6 +381,10 @@ class UserBrokerageServices extends BaseServices * @param $uid * @param $type * @return array + * @throws \ReflectionException + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException */ public function getBrokerageList($uid, $type) {