<?php

namespace app\admin\model\shopro;

use app\admin\model\shopro\Common;
use app\admin\model\shopro\user\User;
use traits\model\SoftDelete;

class Feedback extends Common
{
    protected $name = 'shopro_feedback';

    use SoftDelete;
    protected $deleteTime = 'deletetime';

    public $type_text = [
        1 => '咨询',
        2 => '建议',
        3 => '投诉',
    ];

    protected $type = [
        'images' => 'json'
    ];
    
    protected $append = [
        'status_text',
        'type_text',
    ];


    /**
     * 状态列表
     *
     * @return array
     */
    public function statusList()
    {
        return ['0' => '待处理', '1' => '已处理'];
    }

    /**
     * 类型列表
     *
     * @return array
     */
    public function typeList()
    {
        return [
            1 => '咨询',
            2 => '建议',
            3 => '投诉'
        ];
    }

    public function user()
    {
        return $this->belongsTo(User::class, 'user_id', 'id')->field('id, nickname, avatar, mobile');
    }

}
