StoreServiceFeedbackServices.php 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\services\kefu\service;
  12. use app\dao\service\StoreServiceFeedbackDao;
  13. use app\services\BaseServices;
  14. use crmeb\exceptions\AdminException;
  15. use crmeb\services\FormBuilder;
  16. /**
  17. * 客服反馈
  18. * Class StoreServiceFeedbackServices
  19. * @package app\services\kefu\service
  20. */
  21. class StoreServiceFeedbackServices extends BaseServices
  22. {
  23. /**
  24. * StoreServiceFeedbackServices constructor.
  25. * @param StoreServiceFeedbackDao $dao
  26. */
  27. public function __construct(StoreServiceFeedbackDao $dao)
  28. {
  29. $this->dao = $dao;
  30. }
  31. /**
  32. * 获取反馈列表
  33. * @param array $where
  34. * @return array
  35. * @throws \think\db\exception\DataNotFoundException
  36. * @throws \think\db\exception\DbException
  37. * @throws \think\db\exception\ModelNotFoundException
  38. */
  39. public function getFeedbackList(array $where)
  40. {
  41. [$page, $limit] = $this->getPageValue();
  42. $data = $this->dao->getFeedback($where, $page, $limit);
  43. $count = $this->dao->count($where);
  44. return compact('data', 'count');
  45. }
  46. /**
  47. *
  48. * @param int $id
  49. * @return array
  50. * @throws \FormBuilder\Exception\FormBuilderException
  51. * @throws \think\db\exception\DataNotFoundException
  52. * @throws \think\db\exception\DbException
  53. * @throws \think\db\exception\ModelNotFoundException
  54. */
  55. public function editForm(int $id)
  56. {
  57. $feedInfo = $this->dao->get($id);
  58. if (!$feedInfo) {
  59. throw new AdminException(400460);
  60. }
  61. $feedInfo = $feedInfo->toArray();
  62. $field = [
  63. FormBuilder::textarea('make', '备注', $feedInfo['make'])->col(22),
  64. ];
  65. if (!$feedInfo['status']) {
  66. $field[] = FormBuilder::radio('status', '状态', 0)->setOptions([
  67. ['label' => '已处理', 'value' => 1],
  68. ['label' => '未处理', 'value' => 0]
  69. ]);
  70. }
  71. return create_form($feedInfo['status'] ? '备注' : '处理', $field, $this->url('/app/feedback/' . $id), 'PUT');
  72. }
  73. }