| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- namespace app\controller\admin\profits;
- use app\common\repositories\profits\ProfitsRepository;
- use app\controller\admin\BaseController;
- use app\entity\admin\request\profits\PartnerProfitsRequestEntity;
- use app\entity\admin\response\profits\ZeroUserProfitResponseEntity;
- use app\validate\admin\profits\PartnerProfitsValidate;
- class ShareProfits extends BaseController
- {
- /**
- * @var
- */
- private $repository;
- public function __construct(ProfitsRepository $repository)
- {
- parent::__construct();
- $this->repository = $repository;
- }
- /**
- * @param PartnerProfitsValidate $validate
- * @return mixed
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- * 合伙人分红接口
- */
- public function partnerProfits(PartnerProfitsValidate $validate)
- {
- $validationResult = $this->validateRequest($validate, PartnerProfitsRequestEntity::class);
- $res = $this->repository->getZeroUser($validationResult->toArray());
- // $res = $this->repository->profits($validationResult->toArray());
- if (is_string($res)) {
- $response = ZeroUserProfitResponseEntity::error($res);
- return app('json')->fail($response->toResponseArray());
- }
- $response = ZeroUserProfitResponseEntity::success();
- return app('json')->success($response->toResponseArray());
- }
- }
|