package com.sqx.modules.errand.controller.app;

import com.sqx.common.utils.Result;
import com.sqx.modules.app.annotation.Login;
import com.sqx.modules.errand.entity.ErrandEvaluate;
import com.sqx.modules.errand.service.ErrandEvaluateService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/app/apperrandevaluate")
@Api(value = "用户端-评价", tags = {"用户端-评价"})
public class AppErrandEvaluateController {

    @Autowired
    private ErrandEvaluateService errandEvaluateService;

    @Login
    @PostMapping(value = "userEvaluate")
    @ApiOperation("用户评价（评价等级和内容）")
    public Result userEvaluate(@RequestAttribute Long userId, @RequestBody ErrandEvaluate evaluate){

        return errandEvaluateService.userEvaluate(userId, evaluate);
    }
    @Login
    @PostMapping(value = "getMyEvaluateList")
    @ApiOperation("我的评价列表")
    public Result getMyEvaluateList(@RequestAttribute Long userId,Integer page,Integer limit){
        return Result.success().put("data", errandEvaluateService.getMyEvaluateList(userId, page,limit));
    }
}
