TenantRatingCommissionLogic.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeadmin快速开发前后端分离管理后台(PHP版)
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 开源版本可自由商用,可去除界面版权logo
  7. // | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
  8. // | github下载:https://github.com/likeshop-github/likeadmin
  9. // | 访问官网:https://www.likeadmin.cn
  10. // | likeadmin团队 版权所有 拥有最终解释权
  11. // +----------------------------------------------------------------------
  12. // | author: likeadminTeam
  13. // +----------------------------------------------------------------------
  14. namespace app\api\logic;
  15. use app\common\enum\PayEnum;
  16. use app\common\logic\BaseLogic;
  17. use app\common\model\master_worker\MasterWorkerTeam;
  18. use app\common\model\recharge\RechargeOrder;
  19. use app\common\model\tenant\TenantRatingCommission;
  20. use app\common\model\user\User;
  21. use app\common\service\ConfigService;
  22. /**
  23. * 服务分抽成
  24. * Class TenantRatingCommissionLogic
  25. * @package app\shopapi\logic
  26. */
  27. class TenantRatingCommissionLogic extends BaseLogic
  28. {
  29. /**
  30. * 获取抽成比例
  31. * eg:
  32. * 3.5 <= 3.8 < 4.0
  33. *
  34. */
  35. public static function getCommissionByTenantId($tenant_id)
  36. {
  37. $comprehensive_score = MasterWorkerTeam::where('tenant_id',$tenant_id)->value('comprehensive_score')??0;
  38. return TenantRatingCommission::where('tenant_id',$tenant_id)
  39. ->where('rating_start','<=',$comprehensive_score)
  40. ->where('rating_end','>',$comprehensive_score)->value('commission')??0;
  41. }
  42. }