123456789101112131415161718192021222324252627282930313233 |
- <?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;
- }
- }
|