You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

StoreServiceFeedbackServices.php 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. namespace app\services\message\service;
  3. use app\dao\message\service\StoreServiceFeedbackDao;
  4. use app\services\BaseServices;
  5. use crmeb\services\FormBuilder;
  6. use crmeb\traits\ServicesTrait;
  7. use think\exception\ValidateException;
  8. /**
  9. * 客服反馈
  10. * Class StoreServiceFeedbackServices
  11. * @package app\services\message\service
  12. */
  13. class StoreServiceFeedbackServices extends BaseServices
  14. {
  15. use ServicesTrait;
  16. /**
  17. * StoreServiceFeedbackServices constructor.
  18. * @param StoreServiceFeedbackDao $dao
  19. */
  20. public function __construct(StoreServiceFeedbackDao $dao)
  21. {
  22. $this->dao = $dao;
  23. }
  24. /**
  25. * 获取反馈列表
  26. * @param array $where
  27. * @return array
  28. * @throws \think\db\exception\DataNotFoundException
  29. * @throws \think\db\exception\DbException
  30. * @throws \think\db\exception\ModelNotFoundException
  31. */
  32. public function getFeedbackList(array $where)
  33. {
  34. [$page, $limit] = $this->getPageValue();
  35. $data = $this->dao->getFeedback($where, $page, $limit);
  36. $count = $this->dao->count($where);
  37. return compact('data', 'count');
  38. }
  39. /**
  40. *
  41. * @param int $id
  42. * @return array
  43. * @throws \FormBuilder\Exception\FormBuilderException
  44. * @throws \think\db\exception\DataNotFoundException
  45. * @throws \think\db\exception\DbException
  46. * @throws \think\db\exception\ModelNotFoundException
  47. */
  48. public function editForm(int $id)
  49. {
  50. $feedInfo = $this->dao->get($id);
  51. if (!$feedInfo) {
  52. throw new ValidateException('反馈内容没有查到');
  53. }
  54. $feedInfo = $feedInfo->toArray();
  55. $field = [
  56. FormBuilder::textarea('make', '备注', $feedInfo['make'])->col(22),
  57. ];
  58. if (!$feedInfo['status']) {
  59. $field[] = FormBuilder::radio('status', '状态', 0)->setOptions([
  60. ['label' => '已处理', 'value' => 1],
  61. ['label' => '未处理', 'value' => 0]
  62. ]);
  63. }
  64. return create_form($feedInfo['status'] ? '备注' : '处理', $field, $this->url('/app/feedback/' . $id), 'PUT');
  65. }
  66. }