<?php

namespace app\common\model;

use think\Model;

class Material extends Model
{

    // 表名
    protected $name = 'material';
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';
    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    // 追加属性
    protected $append = [
    ];
    public static function material($popularize_id,$nickname)
    {
        $list = self::field("id,name,image_url")->where('is_del',0)->select();

        foreach ($list as $k => $v) {
            $v["qrcode"] = "http://".$_SERVER["HTTP_HOST"]."/uploads/qrcode/".$popularize_id.".png";
            $v["name"] = $nickname;
        }

        return $list;
    }


}
