<?php

namespace app\model;

use think\Model;
use think\facade\Db;

class Account extends Model
{

    protected $connection = 'mysql';

    protected $pk = 'id';

    protected $name = 'account';

    public static function datainitial()
    {
        $data =  self::create([
            'title' => '默认平台',
            'endtime' => 0,
            'sort' => 100,
            'status' => 1
        ]);

        $data->id;
    }

    public static function getInfo($id)
    {
        $data = self::find($id);
        if ($data) {
            $data = $data->toArray();
            $data['pic'] = toimg($data['pic']);
            $data['endtime'] = time_format($data['endtime']);
        }
        return $data;
    }
}
