Moudel.php 1.0 KB

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace app\bug\model;
  3. class Moudel extends Base
  4. {
  5. // protected $name="Model";
  6. //设置字段信息
  7. protected $schema = [
  8. 'id' =>'int',//
  9. 'name' =>'varchar',//模块名称
  10. 'pid' =>'int',//父级id
  11. 'level' =>'int',//层级
  12. 'company_name' =>'varchar',//公司平台名称
  13. 'company_type' =>'varchar',//公司平台类别
  14. 'weight' =>'double',//
  15. 'status' =>'int',//0启用1禁用 状态
  16. 'is_del' =>'bigint',//是否删除
  17. 'addtime' =>'datetime',//添加时间
  18. 'updatetime' =>'datetime',//更新时间
  19. ];
  20. protected $updateTime='updatetime';
  21. protected $createTime='addtime';
  22. public static function GetModelByCid($cid,$data=[]){
  23. $info = self::where(["id"=>$cid])->field("id,pid,name")->findOrEmpty();
  24. array_unshift($data,$info);
  25. if($info->pid==0)return $data;
  26. else return self::GetModelByCid($info->pid,$data);
  27. }
  28. }