<?php

namespace app\common\model;

use think\Model;

/**
 * 用户机构
 */
class Userjigou extends Model
{

    // 表名,不含前缀
    protected $name = 'user_jigou';


    protected static function init()
    {
        self::afterInsert(function ($row) {
            $row->save(['weigh' => $row['id']]);
        });
    }

    /**
     * 读取分类列表
     * @return array
     */
    public static function getCategoryArray()
    {
        $list = collection(self::order('weigh', 'desc')->select())->toArray();
        return $list;
    }
}
