<?php

namespace app\admin\controller;

use app\admin\AdminBaseController;
use app\common\model\FeedbackModel;

class Feedback extends AdminBaseController
{

    /**
     * 列表
     */
    public function index()
    {
        return view('',[
            'status_list' => FeedbackModel::STATUS,
        ]);
    }

    public function listFeedback()
    {
        $map = $this->dealEqualInput(['status']);
        $list  = FeedbackModel::with('user')
            ->where($map)
            ->order(['status' => 'desc'])
            ->limit(input('limit'))
            ->page(input('page'))
            ->append(['status_text'])
            ->select();
        $count = FeedbackModel::where($map)->count();
        if ($count == 0) {
            ajax_return(1, '未查询到数据');
        }
        list_return($list, $count);
    }

    public function dealFeedback()
    {
        $id_arr = input('id_arr/a');
        FeedbackModel::update(['status' => 1], ['id' => $id_arr]);
        ajax_return();
    }
}