CompanyType.php 741 B

1234567891011121314151617181920212223242526
  1. <?php
  2. namespace app\user\model;
  3. class CompanyType extends Base
  4. {
  5. //设置字段信息
  6. protected $schema = [
  7. 'id' =>'int',//
  8. 'company_type' =>'varchar',//企业类型
  9. 'status' =>'tinyint',//状态
  10. 'is_del' =>'tinyint',//
  11. 'addtime' =>'datetime',//
  12. 'updatetime' =>'datetime',//
  13. ];
  14. protected $createTime="addtime";
  15. protected $updateTime="updatetime";
  16. public static function checkType($type){
  17. $list=self::where("company_type",$type)->where("is_del",0)->findOrEmpty();
  18. if($list->isEmpty()){
  19. $create= self::create(["company_type"=>$type]);
  20. return $create->id;
  21. }
  22. return $list->id;
  23. }
  24. }