where($whereArr)->sum('money'); } /** * [getSortByMoney 根据合同金额排序] * @author zhi * @param * @return */ function getSortByMoney($whereArr) { return $this->group('owner_user_id')->field('owner_user_id,sum(money) as money')->order('money desc')->where($whereArr)->select(); } /** * [getDataList 根据合同签约数排序] * @author zhi * @param * @return */ function getSortByCount($whereArr) { $money = db('crm_contract')->group('owner_user_id')->field('owner_user_id,count(contract_id) as count')->order('count desc')->where($whereArr)->select(); return $money; } /** * 获取合同数量 * @author zhi * @param * @return */ function getDataCount($whereArr){ $count = db('crm_contract')->where($whereArr)->count('contract_id'); return $count; } /** * 获取合同金额 * @author zhi * @param * @return */ function getDataMoney($whereArr){ $money = db('crm_contract')->where($whereArr)->sum('money'); return $money; } }