Agreement.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. namespace app\controller\admin\agreement;
  3. use app\common\repositories\agreement\AgreementRepository;
  4. use crmeb\basic\BaseController;
  5. use app\common\repositories\article\ArticleRepository;
  6. use think\App;
  7. class Agreement extends BaseController
  8. {
  9. /**
  10. * @var AgreementRepository
  11. */
  12. protected $repository;
  13. /**
  14. * Agreement constructor.
  15. * @param AgreementRepository $app
  16. * @param $repository
  17. */
  18. public function __construct(App $app, AgreementRepository $repository)
  19. {
  20. parent::__construct($app);
  21. $this->repository = $repository;
  22. }
  23. /*列表*/
  24. public function lst(){
  25. return app("json")->success($this->repository->getList(1,20));
  26. }
  27. /*详情*/
  28. public function detail($id){
  29. return app("json")->success($this->repository->getDetail($id));
  30. }
  31. /*修改*/
  32. public function update($id){
  33. $data = $this->request->params(['content','title','status']);
  34. $res = $this->repository->updateData($id,$data);
  35. if (!$res){
  36. return app("json")->fail('修改失败');
  37. }
  38. return app("json")->success('修改成功');
  39. }
  40. /*详情*/
  41. public function detailContent($id){
  42. if ($id != 13) {
  43. return '';
  44. }
  45. return $this->repository->getDetailContent($id);
  46. }
  47. }