UserBrokerageFrozenServices.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\services\user;
  12. use app\dao\user\UserBrokerageFrozenDao;
  13. use app\services\BaseServices;
  14. /**
  15. * 佣金冻结
  16. * Class UserBrokerageFrozenServices
  17. * @package app\services\user
  18. * @method getUserFrozenPrice(int $uid, bool $isFrozen) 获取某个账户下冻结过期的佣金
  19. * @method updateFrozen(string $orderId) 修改佣金冻结状态
  20. * @method getFrozenBrokerage() 获取用户的冻结佣金数组
  21. * @method getSumFrozenBrokerage() 获取冻结佣金金额
  22. */
  23. class UserBrokerageFrozenServices extends BaseServices
  24. {
  25. /**
  26. * UserBrokerageFrozenServices constructor.
  27. * @param UserBrokerageFrozenDao $dao
  28. */
  29. public function __construct(UserBrokerageFrozenDao $dao)
  30. {
  31. $this->dao = $dao;
  32. }
  33. /**
  34. * 保存冻结金额
  35. * @param int $uid
  36. * @param string $price
  37. * @param int $uillId
  38. * @param string $orderId
  39. * @return mixed
  40. */
  41. public function saveBrokage(int $uid, string $price, int $uillId, string $orderId)
  42. {
  43. $broken_time = intval(sys_config('extract_time'));
  44. $data = [
  45. 'uid' => $uid,
  46. 'price' => $price,
  47. 'uill_id' => $uillId,
  48. 'order_id' => $orderId,
  49. 'add_time' => time(),
  50. 'status' => 1,
  51. 'frozen_time' => time() + $broken_time * 86400
  52. ];
  53. return $this->dao->save($data);
  54. }
  55. }