1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
- /**
- * Created by PhpStorm.
- * User: 中闽 < 1464674022@qq.com >
- * Date: 2019/12/5
- * Time: 17:44
- */
- namespace app\api\controller;
- use app\common\model\Feedback;
- use app\api\controller\base\Permissions;
- class User extends Permissions
- {
- //个人资料接口
- public function info()
- {
- $this->json_success('success', $this->user);
- }
- //提交反馈接口
- public function feedback()
- {
- $post = $this->request->param();
- //验证
- $validate = new \think\Validate([
- ['content|内容', 'require|max:500'],
- ]);
- if (!$validate->check($post)) {
- $this->error('提交失败:' . $validate->getError());
- }
- $model = new Feedback();
- $post['user_id'] = $this->user->id;
- $res = $model->allowField(true)->save($post);
- if ($res) {
- $this->json_success("创建成功", $model);
- } else {
- $this->json_error("创建失败");
- }
- }
- }
|