CompanyInfoModel.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <?php
  2. namespace App\Models;
  3. use App\Models\BaseModel;
  4. /**
  5. * @description 挖掘线索
  6. * @author system;
  7. * @version 1.0
  8. * @date 2018-11-19 08:23:08
  9. *
  10. */
  11. class CompanyInfoModel extends BaseModel
  12. {
  13. /**
  14. * 数据表名
  15. *
  16. * @var string
  17. *
  18. */
  19. protected $table = 'company_info';
  20. /**
  21. * 主键
  22. */
  23. protected $primaryKey = 'id';
  24. //分页
  25. protected $perPage = PAGE_NUMS;
  26. /**
  27. * 可以被集体附值的表的字段
  28. *
  29. * @var string
  30. */
  31. protected $fillable = [
  32. 'companyName',
  33. 'regNo',
  34. 'orgNo',
  35. 'legalPerson',
  36. 'openStatus',
  37. 'startDate',
  38. 'openTime',
  39. 'annualDate',
  40. 'regCapital',
  41. 'entType',
  42. 'industry',
  43. 'district',
  44. 'authority',
  45. 'regAddr',
  46. 'scope',
  47. 'website'
  48. ];
  49. /***
  50. * 是否已加为线索
  51. * @return mixed
  52. */
  53. public function isThread()
  54. {
  55. $ower_id = \Auth::guard('admin')->user()->id;
  56. return UserThreadsModel::where('ower_id', $ower_id)->where('company_id', $this->id)->count();
  57. }
  58. /***
  59. * 联系人
  60. * @return \Illuminate\Database\Eloquent\Relations\HasMany
  61. */
  62. public function contacts()
  63. {
  64. return $this->hasMany('App\Models\CompanyContactsModel', 'company_id');
  65. }
  66. /***
  67. * 表更纪录
  68. * @return \Illuminate\Database\Eloquent\Relations\HasMany
  69. */
  70. public function changeds(){
  71. return $this->hasMany('App\Models\CompanyChangedModel','company_id')->get();
  72. }
  73. /***
  74. * 主要人员
  75. * @return \Illuminate\Database\Eloquent\Relations\HasMany
  76. */
  77. public function mainpersons(){
  78. return $this->hasMany('App\Models\CompanyMainpersonsModel','company_id')->get();
  79. }
  80. /***
  81. * 股东
  82. * @return \Illuminate\Database\Eloquent\Relations\HasMany
  83. */
  84. public function shareholders(){
  85. return $this->hasMany('App\Models\CompanyShareholdersModel','company_id')->get();
  86. }
  87. public $filterFields = [
  88. 'district' => [
  89. ['value' => '成都', 'name' => '成都'],
  90. ['value' => '上海', 'name' => '上海'],
  91. ['value' => '北京', 'name' => '北京'],
  92. ['value' => '广州', 'name' => '广州'],
  93. ],
  94. 'industry' => [
  95. ['value' => '软件开发', 'name' => '软件开发'],
  96. ['value' => '信息传输', 'name' => '信息传输'],
  97. ['value' => '批发和零售业', 'name' => '批发和零售业'],
  98. ['value' => '软件和信息技术服务业', 'name' => '软件和信息技术服务业'],
  99. ],
  100. 'regCapital' => [
  101. ['value' => '-50', 'name' => '小于50万'],
  102. ['value' => '50-100', 'name' => '50~100万'],
  103. ['value' => '100-500', 'name' => '100~500万'],
  104. ['value' => '500-1000', 'name' => '500~1000'],
  105. ['value' => '1000-', 'name' => '1000万以上'],
  106. ],
  107. 'startDate' => [
  108. ['value' => '2014', 'name' => '2014'],
  109. ['value' => '2015', 'name' => '2015'],
  110. ['value' => '2016', 'name' => '2016'],
  111. ['value' => '2017', 'name' => '2017'],
  112. ],
  113. 'entType' => [
  114. ['value' => '有限责任公司', 'name' => '有限责任公司'],
  115. ],
  116. 'openStatus' => [
  117. ['value' => '开业', 'name' => '开业'],
  118. ['value' => '停业', 'name' => '停业'],
  119. ],
  120. ];
  121. }