using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using New_College.IServices;
using New_College.Model;
using New_College.Model.ViewModels.Query;

namespace New_College.Api.Controllers.Front
{
    [Route("api/front/[controller]/[action]")]
    [ApiController]
    public class FeedBackController : ControllerBase
    {

        private readonly IFeedbackInfoServices feedback;
        public FeedBackController(IFeedbackInfoServices feedbackInfoServices)
        {
            this.feedback = feedbackInfoServices;
        }



      
        /// <summary>
        /// 用户反馈
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<MessageModel<string>> Add(FeedBackRequest request)
        {
            try
            {
                var status = await feedback.Add(new Model.Models.FeedbackInfo()
                {
                    Content = request.Content,
                    CustomerId = request.CustomerId,
                    Title = request.Title
                });

                return new MessageModel<string>()
                {
                    response = "系统已收到您的反馈！！！我们平台运维人员将对您的问题做统计分类，请您耐心等待后续反馈",
                    msg = "success",
                    success = true
                };
            }
            catch (Exception ex)
            {

                return new MessageModel<string>()
                {
                    msg = ex.Message
                };
            }
        }




    }
}
