SmsRemind.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. declare (strict_types = 1);
  3. namespace app\store\controller;
  4. use app\store\controller\Controller;
  5. use app\common\model\SmsRemind as SmsRemindModel;
  6. /**
  7. * 短信提醒管理控制器
  8. * Class RiceCard
  9. * @package app\store\controller\card
  10. */
  11. class SmsRemind extends Controller
  12. {
  13. public function list()
  14. {
  15. $model = new SmsRemindModel;
  16. $list = $model->getList($this->request->param());
  17. return $this->renderSuccess(compact('list'));
  18. }
  19. /**
  20. * 详情记录
  21. * @param int $id
  22. * @return array
  23. */
  24. public function detail(int $id)
  25. {
  26. $model = new SmsRemindModel;
  27. $detail = SmsRemindModel::detail($id);
  28. return $this->renderSuccess(compact('detail'));
  29. }
  30. /**
  31. * 添加现金卡
  32. * @return array|string
  33. */
  34. public function add()
  35. {
  36. // 新增记录
  37. $model = new SmsRemindModel;
  38. $post = $this->postForm();
  39. $post['ftype'] = 1;
  40. if ($model->add($post)) {
  41. return $this->renderSuccess('添加成功');
  42. }
  43. return $this->renderError($model->getError() ?: '添加失败');
  44. }
  45. /**
  46. * 编辑
  47. * @param int $id
  48. * @return mixed
  49. */
  50. public function edit(int $id)
  51. {
  52. // 详情
  53. $model = SmsRemindModel::detail($id);
  54. // 更新记录
  55. $post = $this->postForm();
  56. if ($model->edit($post)) {
  57. return $this->renderSuccess('更新成功');
  58. }
  59. return $this->renderError($model->getError() ?: '更新失败');
  60. }
  61. }