Index.php 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <?php
  2. namespace app\enterprise\controller;
  3. use app\admin\model\Enterprise;
  4. use app\enterprise\common\EnterpriseController;
  5. use app\common\api\DictApi;
  6. use app\common\state\CommonConst;
  7. /**
  8. * Description of Index
  9. *
  10. * @author sgq
  11. */
  12. class Index extends EnterpriseController {
  13. public function index() {
  14. $vars["user"] = [
  15. "name" => $this->user["name"],
  16. "rolename" => $this->user["rolename"],
  17. "avatar" => $this->user["avatar"]
  18. ];
  19. $ep = \app\common\api\EnterpriseApi::getOne($this->user["uid"]);
  20. switch ($ep["special"]) {
  21. case 0:
  22. if ($ep["type"] == 1) {
  23. $checkEnterpriseFullFields = ["agencyType", "enterpriseTag", "enterpriseType", "bankCard", "bankNetwork", "bank", "imgurl", "bankImg", "beian"];
  24. if ($ep["agencyType"] == 1) {
  25. $checkEnterpriseFullFields[] = "industryFieldNew";
  26. $checkEnterpriseFullFields[] = "industryFieldOld";
  27. $checkEnterpriseFullFields[] = "domainImg";
  28. }
  29. if (in_array($ep["enterpriseType"], ['guishang', 'gaoxinjishu', 'zhuanjingtexin'])) {
  30. $checkEnterpriseFullFields[] = "typeImg";
  31. }
  32. } else {
  33. if (!in_array($ep["type"], [CommonConst::ENTERPRISE_WJ, CommonConst::ENTERPRISE_GJ])) {
  34. $checkEnterpriseFullFields = ["bankCard", "bankNetwork", "bank", "imgurl", "bankImg", "beian"];
  35. } else {
  36. $checkEnterpriseFullFields = [];
  37. }
  38. }
  39. break;
  40. case 1:
  41. $checkEnterpriseFullFields = ["institutionTag"];
  42. break;
  43. case 3:
  44. $checkEnterpriseFullFields = ["organizationTag"];
  45. break;
  46. }
  47. $errorCounts = 0;
  48. while ($chk = array_shift($checkEnterpriseFullFields)) {
  49. if ($ep[$chk] == null)
  50. $errorCounts++;
  51. }
  52. $vars["isEnterpriseFull"] = $errorCounts > 0 ? 0 : 1;
  53. $menus = \app\common\api\MenuApi::getEnterpriseMenuByType($this->user["type"]);
  54. $vars["menus"] = $menus;
  55. return view("", $vars);
  56. }
  57. public function centerPage() {
  58. $ep = Enterprise::where('id', $this->user['uid'])->find();
  59. $ep['agencyTypeName'] = DictApi::findByParentCodeAndCode('agency_type', $ep['agencyType'])->name ?? "";
  60. $ep['industryFieldNewName'] = DictApi::findDictByCode($ep['industryFieldNew'])->name ?? '';
  61. $ep['industryFieldOldName'] = DictApi::findDictByCode($ep['industryFieldOld'])->name ?? '';
  62. $ep['enterpriseTagName'] = DictApi::findDictByCode($ep['enterpriseTag'])->name ?? '';
  63. $ep['organizationTagName'] = DictApi::findDictByCode($ep['organizationTag'])->name ?? '';
  64. $ep['institutionTagName'] = DictApi::findDictByCode($ep['institutionTag'])->name ?? '';
  65. $ep['streetName'] = DictApi::findDictByCode($ep['street'])->name ?? '';
  66. $ep['enterpriseTypeName'] = DictApi::findDictByCode($ep['enterpriseType'])->name ?? '';
  67. if ($ep["imgurl"]) {
  68. $pathinfo = pathinfo($ep["imgurl"]);
  69. if (in_array($pathinfo["extension"], ["jpg", "jpeg", "png", "gif"])) {
  70. $ep["imgurl_is_img"] = 1;
  71. }
  72. }
  73. if ($ep["bankImg"]) {
  74. $pathinfo = pathinfo($ep["bankImg"]);
  75. if (in_array($pathinfo["extension"], ["jpg", "jpeg", "png", "gif"])) {
  76. $ep["bankImg_is_img"] = 1;
  77. }
  78. }
  79. if ($ep["domainImg"]) {
  80. $pathinfo = pathinfo($ep["domainImg"]);
  81. if (in_array($pathinfo["extension"], ["jpg", "jpeg", "png", "gif"])) {
  82. $ep["domainImg_is_img"] = 1;
  83. }
  84. }
  85. if ($ep["typeImg"]) {
  86. $pathinfo = pathinfo($ep["typeImg"]);
  87. if (in_array($pathinfo["extension"], ["jpg", "jpeg", "png", "gif"])) {
  88. $ep["typeImg_is_img"] = 1;
  89. }
  90. }
  91. if ($ep["beian"]) {
  92. $pathinfo = pathinfo($ep["beian"]);
  93. if (in_array($pathinfo["extension"], ["jpg", "jpeg", "png", "gif"])) {
  94. $ep["beian_is_img"] = 1;
  95. }
  96. }
  97. switch ($ep['type']) {
  98. case CommonConst::ENTERPRISE_NORMAL:
  99. $ep['typeName'] = '晋江市现代产业体系人才';
  100. break;
  101. case CommonConst::ENTERPRISE_JC:
  102. $ep['typeName'] = '集成电路优秀人才';
  103. break;
  104. case 3:
  105. $ep['typeName'] = '海峡计划团队';
  106. break;
  107. case CommonConst::ENTERPRISE_WJ:
  108. $ep['typeName'] = '卫健医院';
  109. break;
  110. case CommonConst::ENTERPRISE_GJ:
  111. $ep['typeName'] = '高教学校';
  112. break;
  113. }
  114. switch ($ep['checkState']) {
  115. case 1:
  116. $ep['checkStateName'] = '待审核';
  117. break;
  118. case 2:
  119. $ep['checkStateName'] = '审核驳回';
  120. break;
  121. case 3:
  122. $ep['checkStateName'] = '审核通过';
  123. break;
  124. case 4:
  125. $ep['checkStateName'] = '重新提交';
  126. break;
  127. }
  128. switch ($ep['active']) {
  129. case 1:
  130. $ep['activeName'] = '账号有效';
  131. break;
  132. case 2:
  133. $ep['activeName'] = '冻结/拉黑';
  134. break;
  135. }
  136. $template = "";
  137. switch ($this->user["type"]) {
  138. case CommonConst::ENTERPRISE_WJ:
  139. $template = "/index/hospital/center_page";
  140. $ep["fullLocationName"] = $ep["county"] ? \app\common\api\LocationApi::getNameByCode($ep["county"], true) : \app\common\api\LocationApi::getNameByCode($ep["city"], true);
  141. break;
  142. case CommonConst::ENTERPRISE_GJ:
  143. $template = "/index/school/center_page";
  144. $ep["fullLocationName"] = $ep["county"] ? \app\common\api\LocationApi::getNameByCode($ep["county"], true) : \app\common\api\LocationApi::getNameByCode($ep["city"], true);
  145. break;
  146. }
  147. return view($template, ['ep' => $ep]);
  148. }
  149. }