Index.php 5.1 KB

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