| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <?php
- namespace app\controller\admin\merchant;
- use crmeb\basic\BaseController;
- use think\App;
- use app\common\repositories\merchant\apply\MerchantContributeRepository;
- class MerchantContribute extends BaseController
- {
- /**
- * @var MerchantContributeRepository
- */
- protected $repository;
- /**
- * MerchantContribute constructor.
- * @param MerchantContributeRepository $repository
- */
- public function __construct(App $app,MerchantContributeRepository $repository)
- {
- parent::__construct($app);
- $this->repository = $repository;
- }
- /**
- * @return mixed
- * @author Qinii
- */
- public function list()
- {
- return app('json')->success($this->repository->queryList());
- }
- public function add()
- {
- $data = $this->request->params([
- 'contribute_name',
- 'ratio_start',
- 'ratio_end',
- 'jing_dou',
- 'contribute_value'
- ]);
- $this->repository->add($data);
- return app('json')->success('添加成功');
- }
- public function edit()
- {
- $id = $this->request->id();
- if(empty($id)){
- return app('json')->fail('参数ID缺失');
- }
- $data = $this->request->params([
- 'contribute_name',
- 'ratio_start',
- 'ratio_end',
- 'jing_dou',
- 'contribute_value'
- ]);
- $this->repository->updateById($data, $id);
- return app('json')->success('更新成功');
- }
- public function delete()
- {
- $id = $this->request->id();
- if(empty($id)){
- return app('json')->fail('参数ID缺失');
- }
- $this->repository->deleteById($data, $id);
- return app('json')->success('删除成功');
- }
- }
|