EmailSendJobStatu.php 954 字节
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;


/**
 * 邮件发送任务,状态
 * @author:dc
 * @time 2022/11/9 11:17
 * Class EmailSendJob
 * @package App\Http\Mail\Models
 */
class EmailSendJobStatu extends Model{

    const STATUS_WAIT = 0; // 等待发送
    const STATUS_SUCCESS = 1; // 发送成功
    const STATUS_ERROR = 2; // 发送失败
    const STATUS_STOP = 3; // 暂停发送

    static $status_text = [
        self::STATUS_WAIT =>  '等待',
        self::STATUS_SUCCESS =>  '成功',
        self::STATUS_ERROR =>  '失败',
        self::STATUS_STOP =>  '暂停',
    ];


    public function getStatusTextAttribute()
    {
        return static::$status_text[$this->status];
    }



    public function getErrorAttribute($val)
    {

        return $val ? json_decode($val,true) : [];
    }

    public function getLinksAttribute($val)
    {
        return $val ? json_decode($val,true) : [];
    }

}