| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- namespace app\controller\admin\order;
- use app\common\repositories\store\order\StoreOrderProfitsharingRepository;
- use ln\basic\BaseController;
- use think\App;
- class OrderProfitsharing extends BaseController
- {
- protected $repository;
- public function __construct(App $app, StoreOrderProfitsharingRepository $repository)
- {
- parent::__construct($app);
- $this->repository = $repository;
- }
- public function getList()
- {
- $where = $this->request->params(['type', 'status', 'mer_id', 'keyword', 'profit_date', 'date']);
- $merId = $this->request->merId();
- if ($merId) {
- $where['mer_id'] = $merId;
- }
- [$page, $limit] = $this->getPage();
- return app('json')->success($this->repository->getList($where, $page, $limit, (bool)$merId));
- }
- public function again($id)
- {
- if (!$model = $this->repository->get((int)$id)) {
- return app('json')->fail('分账单不存在');
- }
- if ($model->status != -2) {
- return app('json')->fail('分账单状态操作,不能分账');
- }
- if ($this->repository->profitsharing($model)) {
- return app('json')->success('分账成功');
- }
- return app('json')->fail('分账失败');
- }
- }
|