Skip to content
关注公众号,获取新课通知
【重要通知】uniapp实战社区交友交流群更换为:602180461,靓仔/靓女可以重新申请加入哦~

获取用户反馈列表api


controller层:application\api\controller\v1\Feedback.php

php
// 获取用户反馈列表
public function feedbacklist(){
    (new FeedbackValidate())->goCheck('feedbacklist');
    $list = (new FeedbackModel())->feedbacklist();
    return self::showResCode('获取成功',[ 'list' => $list ]);
}

route层:route\route.php

php
// 用户操作(绑定手机)
Route::group('api/:v1/',function(){
	// 获取用户反馈列表
	Route::get('feedbacklist/:page','api/:v1.Feedback/feedbacklist');
})->middleware(['ApiUserAuth','ApiUserBindPhone','ApiUserStatus']);

validate层:application\common\validate\FeedbackValidate.php

php
protected $rule = [
    'page'=>'require|integer|>:0'
];
protected $scene = [
    'feedbacklist'=>['page']
];

model层:application\common\model\Feedback.php

php
// 获取用户反馈列表
public function feedbacklist(){
    $page = request()->param('page');
    $user_id = request()->userId;
    return $this -> where('from_id',$user_id)->whereOr('to_id',$user_id)->page($page,10)->select();
}