FinancialStatService.php 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: tandunzhao
  5. * Date: 2017/12/2
  6. * Time: 下午3:54
  7. */
  8. namespace App\Modules\Finance\Services;
  9. use App\Modules\Finance\Models\FinancialStat;
  10. class FinancialStatService
  11. {
  12. /**
  13. * 根据渠道ID获取FinancialStat
  14. * @param $channelId
  15. * @return mixed
  16. */
  17. public static function getFinancialStatSingle($channelId) {
  18. $financialStat = FinancialStat::getByDistributionChannel($channelId);
  19. return $financialStat;
  20. }
  21. /**
  22. * 更具提现金额修改 FinancialStat
  23. * @param $channelId 渠道ID
  24. * @param $money 提现金额额
  25. * @return mixed
  26. */
  27. public static function updateFinancialStatByWithdraw($channelId, $money) {
  28. $financialStat = self::getFinancialStatSingle($channelId);
  29. if(!empty($financialStat)) {
  30. $enable_amount = $financialStat['enable_withdrawal_amount'] - $money;
  31. $withdraw_pending_amount = $financialStat['withdraw_pending_amount'] + $money;
  32. //修改可提现总额
  33. $financialStat['enable_withdrawal_amount'] = $enable_amount;
  34. //修改提现中金额
  35. $financialStat['withdraw_pending_amount'] = $withdraw_pending_amount;
  36. //修改最近提现金额
  37. $dataFinancialStat['latest_withdrawal_amount'] = $money;
  38. //修改提现时间
  39. $financialStat['latest_withdraw_time'] = date('Y-m-d H:i:s');
  40. $financialStat->save();
  41. }
  42. return $financialStat;
  43. }
  44. /**
  45. * 获取账号信息列表
  46. * @param $params[]
  47. * channel_id:渠道ID 可选
  48. * channel_name:渠道名称 可选
  49. * person_in_charge_name: 渠道负责人姓名 可选
  50. * search_name: 搜索名称 可选
  51. * ac_start_time:开始时间 可选
  52. * ac_end_time:结束时间 可选
  53. * is_frozen:冻结 0; -1 可选
  54. * frozen_start_time:冻结开始时间 可选
  55. * frozen_end_time:冻结结束时间 可选
  56. * is_company 0:对私, 1:对公司
  57. * @return mixed
  58. */
  59. public static function getFrozenFinancialStatListParam($params=[]) {
  60. return FinancialStat::getFrozenFinancialStatListParam($params);
  61. }
  62. /**
  63. * 获取账号信息列表
  64. * @param $params[]
  65. * channel_id:渠道ID 可选
  66. * channel_name:渠道名称 可选
  67. * person_in_charge_name: 渠道负责人姓名 可选
  68. * search_name: 搜索名称 可选
  69. * ac_start_time:开始时间 可选
  70. * ac_end_time:结束时间 可选
  71. * is_frozen:冻结 0; -1 可选
  72. * frozen_start_time:冻结开始时间 可选
  73. * frozen_end_time:冻结结束时间 可选
  74. * @return mixed
  75. */
  76. public static function getFrozenFinancialStatPriceListDetail($params=[]) {
  77. return FinancialStat::getFrozenFinancialStatPriceListDetail($params);
  78. }
  79. }