ShareProfits.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace app\controller\admin\profits;
  3. use app\common\repositories\profits\ProfitsRepository;
  4. use app\common\utils\Pv;
  5. use app\controller\admin\BaseController;
  6. use app\entity\admin\request\profits\PartnerProfitsRequestEntity;
  7. use app\entity\admin\response\profits\ZeroUserProfitResponseEntity;
  8. use app\validate\admin\profits\PartnerProfitsValidate;
  9. class ShareProfits extends BaseController
  10. {
  11. /**
  12. * @var
  13. */
  14. private $repository;
  15. public function __construct(ProfitsRepository $repository)
  16. {
  17. parent::__construct();
  18. $this->repository = $repository;
  19. }
  20. /**
  21. * @param PartnerProfitsValidate $validate
  22. * @return mixed
  23. * @throws \think\db\exception\DataNotFoundException
  24. * @throws \think\db\exception\DbException
  25. * @throws \think\db\exception\ModelNotFoundException
  26. * 合伙人分红接口
  27. */
  28. public function partnerProfits(PartnerProfitsValidate $validate)
  29. {
  30. $a = new Pv();
  31. $a->countPv();
  32. die;
  33. $validationResult = $this->validateRequest($validate, PartnerProfitsRequestEntity::class);
  34. $res = $this->repository->getZeroUser($validationResult->toArray());
  35. // $res = $this->repository->profits($validationResult->toArray());
  36. if (is_string($res)) {
  37. $response = ZeroUserProfitResponseEntity::error($res);
  38. return app('json')->fail($response->toResponseArray());
  39. }
  40. $response = ZeroUserProfitResponseEntity::success();
  41. return app('json')->success($response->toResponseArray());
  42. }
  43. }