Feedback.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace App\Models;
  3. class Feedback extends BaseModel {
  4. protected $table = 'feedback';
  5. public $timestamps = false;
  6. /**
  7. * 用户反馈内容
  8. * [feedback description]
  9. * @return [type] [description]
  10. */
  11. function feedback($list, $page, $where = '') {
  12. $data = $this->select('id', 'account_name', 'type', 'content', 'submit_time', 'status', 'reply')
  13. ->orderBy('submit_time', 'desc')
  14. ->paginate($list);
  15. if (!empty($where) && is_array($where)) {
  16. $data = $this->select('id', 'account_name', 'type', 'content', 'submit_time', 'status', 'reply')
  17. ->where($where)
  18. ->orderBy('submit_time', 'desc')
  19. ->paginate($list);
  20. }
  21. if (!$data) {
  22. return -2020032003; //没有用户反馈信息
  23. }
  24. return $data->toArray();
  25. }
  26. //一条信息
  27. function getCloseOne($id) {
  28. $data = $this->where('id', $id)->first();
  29. if (!$data) {
  30. return -5040000622;
  31. }
  32. return $data->toArray();
  33. }
  34. //更新信息
  35. function updateOne($data, $id) {
  36. $res = $this->where('id', $id)->update($data);
  37. if (!$res) {
  38. return -5040000122;
  39. }
  40. return 1;
  41. }
  42. }
  43. ?>