resumelogic.php 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <?php
  2. /*
  3. * @Author: wang jun
  4. * @Date: 2022-01-18 11:12:23
  5. * @Last Modified by: wang jun
  6. * @Last Modified time: 2022-01-19 15:48:24
  7. * 微信类
  8. */
  9. namespace app\index\logic;
  10. use app\index\model\educationbackgroundemodel;
  11. use app\index\model\resumemodel;
  12. use app\index\model\usermodel;
  13. use app\index\model\workexperiencemodel;
  14. class resumelogic extends baselogic
  15. {
  16. /**
  17. * 设置请求数据规则
  18. * 20220107
  19. * wj
  20. */
  21. protected function setrules()
  22. {
  23. $list = [
  24. 'newinfobyopenid' => [
  25. ['name' => 'openid', 'title' => 'openid', 'require' => true, 'type' => 'string'],
  26. ],
  27. 'newebinfobyopenid' => [
  28. ['name' => 'openid', 'title' => 'openid', 'require' => true, 'type' => 'string'],
  29. ],
  30. 'newweinfobyopenid' => [
  31. ['name' => 'openid', 'title' => 'openid', 'require' => true, 'type' => 'string'],
  32. ],
  33. 'getinfobyopenid' => [
  34. ['name' => 'openid', 'title' => 'openid', 'require' => true, 'type' => 'string'],
  35. ],
  36. ];
  37. return $list;
  38. }
  39. /**
  40. * 新增信息
  41. * 20200119
  42. * wj
  43. */
  44. public function newinfobyopenid($arr)
  45. {
  46. $result = $this->checkparam(__FUNCTION__, $arr);
  47. if (1 != $result['status']) {
  48. return $result;
  49. }
  50. $openid = $arr['openid'];
  51. $m_u = new usermodel();
  52. $uinfo = $m_u->getinfobyopenid($openid);
  53. if (empty($uinfo)) {
  54. return backarr(0, "用户信息不存在");
  55. }
  56. $userid = $uinfo['id'];
  57. $m_r = new resumemodel();
  58. $rinfo = $m_r->getinfobyuserid($userid);
  59. if (!empty($rinfo)) {
  60. return backarr(0, "简历已存在");
  61. }
  62. $arr['user_id'] = $uinfo['id'];
  63. $id = $m_r->insertData($arr);
  64. if (empty($id)) {
  65. return backarr(0, "新增失败");
  66. }
  67. return backarr(1, "新增成功", ['id' => $id]);
  68. }
  69. /**
  70. * 新增教育背景
  71. * 20200119
  72. * wj
  73. */
  74. public function newebinfobyopenid($arr)
  75. {
  76. $result = $this->checkparam(__FUNCTION__, $arr);
  77. if (1 != $result['status']) {
  78. return $result;
  79. }
  80. $openid = $arr['openid'];
  81. $m_u = new usermodel();
  82. $uinfo = $m_u->getinfobyopenid($openid);
  83. if (empty($uinfo)) {
  84. return backarr(0, "用户信息不存在");
  85. }
  86. $userid = $uinfo['id'];
  87. $m_r = new resumemodel();
  88. $rinfo = $m_r->getinfobyuserid($userid);
  89. if (empty($rinfo)) {
  90. return backarr(0, "简历不存在");
  91. }
  92. $resumeid = $rinfo['id'];
  93. $arr['resume_id'] = $resumeid;
  94. $arr['user_id'] = $userid;
  95. $m_eb = new educationbackgroundemodel();
  96. $id = $m_eb->insertData($arr);
  97. if (empty($id)) {
  98. return backarr(0, "新增失败");
  99. }
  100. return backarr(1, "新增成功", ['id' => $id]);
  101. }
  102. /**
  103. * 新增工作经历
  104. * 20200119
  105. * wj
  106. */
  107. public function newweinfobyopenid($arr)
  108. {
  109. $result = $this->checkparam(__FUNCTION__, $arr);
  110. if (1 != $result['status']) {
  111. return $result;
  112. }
  113. $openid = $arr['openid'];
  114. $m_u = new usermodel();
  115. $uinfo = $m_u->getinfobyopenid($openid);
  116. if (empty($uinfo)) {
  117. return backarr(0, "用户信息不存在");
  118. }
  119. $userid = $uinfo['id'];
  120. $m_r = new resumemodel();
  121. $rinfo = $m_r->getinfobyuserid($userid);
  122. if (empty($rinfo)) {
  123. return backarr(0, "简历不存在");
  124. }
  125. $resumeid = $rinfo['id'];
  126. $arr['resume_id'] = $resumeid;
  127. $arr['user_id'] = $userid;
  128. $m_we = new workexperiencemodel();
  129. $id = $m_we->insertData($arr);
  130. if (empty($id)) {
  131. return backarr(0, "新增失败");
  132. }
  133. return backarr(1, "新增成功", ['id' => $id]);
  134. }
  135. public function getinfobyopenid($arr)
  136. {
  137. $result = $this->checkparam(__FUNCTION__, $arr);
  138. if (1 != $result['status']) {
  139. return $result;
  140. }
  141. $openid = $arr['openid'];
  142. $m_u = new usermodel();
  143. $uinfo = $m_u->getinfobyopenid($openid);
  144. if (empty($uinfo)) {
  145. return backarr(0, "用户信息不存在");
  146. }
  147. $userid = $uinfo['id'];
  148. $m_r = new resumemodel();
  149. $rinfo = $m_r->getinfobyuserid($userid);
  150. if (empty($rinfo)) {
  151. return backarr(0, "简历不存在");
  152. }
  153. $resumeid = $rinfo['id'];
  154. $m_eb = new educationbackgroundemodel();
  155. $eblist = $m_eb->getList(['resume_id' => $resumeid], '*', 1, 0);
  156. $rinfo['eblist'] = $eblist;
  157. $m_we = new workexperiencemodel();
  158. $welist = $m_we->getList(['resume_id' => $resumeid], '*', 1, 0);
  159. $rinfo['welist'] = $welist;
  160. return backarr(1, "查询成功", $rinfo);
  161. }
  162. }