<?php

namespace App\Models;
class Feedback extends BaseModel {
	protected $table = 'feedback';
	public $timestamps = false;

	/**
	 * 用户反馈内容
	 * [feedback description]
	 * @return [type] [description]
	 */
	function feedback($list, $page, $where = '') {
		$data = $this->select('id', 'account_name', 'type', 'content', 'submit_time', 'status', 'reply')
			->orderBy('submit_time', 'desc')
			->paginate($list);
		if (!empty($where) && is_array($where)) {
			$data = $this->select('id', 'account_name', 'type', 'content', 'submit_time', 'status', 'reply')
				->where($where)
				->orderBy('submit_time', 'desc')
				->paginate($list);
		}
		if (!$data) {
			return -2020032003; //没有用户反馈信息
		}
		return $data->toArray();
	}

	//一条信息
	function getCloseOne($id) {
		$data = $this->where('id', $id)->first();
		if (!$data) {
			return -5040000622;
		}
		return $data->toArray();
	}
	//更新信息
	function updateOne($data, $id) {
		$res = $this->where('id', $id)->update($data);
		if (!$res) {
			return -5040000122;
		}
		return 1;
	}
}

?>