123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | Description: 客户
  4. // +----------------------------------------------------------------------
  5. // | Author: Michael_xu | gengxiaoxu@5kcrm.com
  6. // +----------------------------------------------------------------------
  7. namespace app\bi\model;
  8. use think\Db;
  9. use app\admin\model\Common;
  10. use think\Request;
  11. use think\Validate;
  12. class Receivables extends Common
  13. {
  14. /**
  15. * 为了数据库的整洁,同时又不影响Model和Controller的名称
  16. * 我们约定每个模块的数据表都加上相同的前缀,比如CRM模块用crm作为数据表前缀
  17. */
  18. protected $name = 'crm_receivables';
  19. /**
  20. * [getDataList 根据回款金额排序]
  21. * @author Michael_xu
  22. * @param
  23. * @return
  24. */
  25. function getSortByMoney($whereArr)
  26. {
  27. $money = db('crm_receivables')->group('owner_user_id')->field('owner_user_id,sum(money) as money')->order('money desc')->where($whereArr)->select();
  28. return $money;
  29. }
  30. /**
  31. * 获取回款金额
  32. * @return
  33. */
  34. function getDataMoney($whereArr){
  35. $money = db('crm_receivables')->where($whereArr)->sum('money');
  36. return $money;
  37. }
  38. }