Appupdate.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. namespace app\shop\controller\appsetting;
  3. use app\shop\controller\Controller;
  4. use app\shop\model\app\AppUpdate as AppUpdateModel;
  5. /**
  6. * 升级管理
  7. */
  8. class Appupdate extends Controller
  9. {
  10. /**
  11. * 列表
  12. */
  13. public function index()
  14. {
  15. $model = new AppUpdateModel();
  16. $list = $model->getList($this->postData());
  17. return $this->renderSuccess('', compact('list'));
  18. }
  19. /**
  20. * 新增
  21. */
  22. public function add()
  23. {
  24. $model = new AppUpdateModel();
  25. if ($model->add($this->postData())) {
  26. return $this->renderSuccess('添加成功');
  27. }
  28. return $this->renderError('添加失败');
  29. }
  30. /**
  31. * 编辑
  32. */
  33. public function edit($update_id)
  34. {
  35. $model = AppUpdateModel::detail($update_id);
  36. // 更新记录
  37. if ($model->edit($this->postData())) {
  38. return $this->renderSuccess('更新成功');
  39. }
  40. return $this->renderError($model->getError()?:'更新失败');
  41. }
  42. /**
  43. * 删除
  44. */
  45. public function delete($update_id)
  46. {
  47. $model = AppUpdateModel::detail($update_id);
  48. if ($model->setDelete()) {
  49. return $this->renderSuccess('删除成功');
  50. }
  51. return $this->renderError('删除失败');
  52. }
  53. }