| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <?php
- /**
- * @package merchant
- *
- * @author xaboy<xaboy2005@qq.com>
- * @day 2020/5/28
- *
- *
- */
- namespace app\controller\api\user;
- use crmeb\basic\BaseController;
- use app\common\repositories\user\FeedbackRepository;
- use app\validate\api\FeedbackValidate;
- use think\App;
- class Feedback extends BaseController
- {
- protected $repository;
- public function __construct(App $app, FeedbackRepository $repository)
- {
- parent::__construct($app);
- $this->repository = $repository;
- }
- /**
- * @param FeedbackValidate $validate
- * @param FeedbackRepository $repository
- * @return mixed
- * @author xaboy
- * @day 2020/5/28
- */
- public function feedback(FeedbackValidate $validate)
- {
- $data = $this->request->params(['type', 'content', 'images', 'realname', 'contact']);
- if (!is_array($data["images"])){
- $data["images"]=explode(",", $data["images"]);
- }
- $validate->check($data);
- $data['uid'] = $this->request->uid();
- $this->repository->create($data);
- return app('json')->success('反馈成功');
- }
- /**
- * @return mixed
- * @author xaboy
- * @day 2020/5/28
- */
- public function feedbackList()
- {
- [$page, $limit] = $this->getPage();
- return app('json')->success($this->repository->getList(['uid' => $this->request->uid(),'is_del' => 0], $page, $limit));
- }
- public function detail($id)
- {
- if (!$this->repository->uidExists($id, $this->request->uid()))
- return app('json')->fail('数据不存在');
- $feedback = $this->repository->get($id);
- return app('json')->success($feedback);
- }
- }
|