resumelogic.php 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  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 17:29:15
  7. * 微信类
  8. */
  9. namespace app\index\logic;
  10. use app\index\model\educationbackgroundemodel;
  11. use app\index\model\inventmodel;
  12. use app\index\model\partymodel;
  13. use app\index\model\resumemodel;
  14. use app\index\model\sendrecordmodel;
  15. use app\index\model\usermodel;
  16. use app\index\model\workexperiencemodel;
  17. class resumelogic extends baselogic
  18. {
  19. /**
  20. * 设置请求数据规则
  21. * 20220107
  22. * wj
  23. */
  24. protected function setrules()
  25. {
  26. $list = [
  27. 'newinfobyopenid' => [
  28. ['name' => 'openid', 'title' => 'openid', 'require' => true, 'type' => 'string'],
  29. ],
  30. 'newebinfobyopenid' => [
  31. ['name' => 'openid', 'title' => 'openid', 'require' => true, 'type' => 'string'],
  32. ],
  33. 'newweinfobyopenid' => [
  34. ['name' => 'openid', 'title' => 'openid', 'require' => true, 'type' => 'string'],
  35. ],
  36. 'getinfobyopenid' => [
  37. ['name' => 'openid', 'title' => 'openid', 'require' => true, 'type' => 'string'],
  38. ],
  39. 'sendinvent' => [
  40. ['name' => 'openid', 'title' => 'openid', 'require' => true, 'type' => 'string'],
  41. ['name' => 'inventid', 'title' => 'inventid', 'require' => true, 'type' => 'numeric'],
  42. ['name' => 'partyid', 'title' => 'partyid', 'type' => 'numeric'],
  43. ],
  44. ];
  45. return $list;
  46. }
  47. /**
  48. * 新增信息
  49. * 20200119
  50. * wj
  51. */
  52. public function newinfobyopenid($arr)
  53. {
  54. $result = $this->checkparam(__FUNCTION__, $arr);
  55. if (1 != $result['status']) {
  56. return $result;
  57. }
  58. $openid = $arr['openid'];
  59. $m_u = new usermodel();
  60. $uinfo = $m_u->getinfobyopenid($openid);
  61. if (empty($uinfo)) {
  62. return backarr(0, "用户信息不存在");
  63. }
  64. $userid = $uinfo['id'];
  65. $m_r = new resumemodel();
  66. $rinfo = $m_r->getinfobyuserid($userid);
  67. if (!empty($rinfo)) {
  68. return backarr(0, "简历已存在");
  69. }
  70. $arr['user_id'] = $uinfo['id'];
  71. $id = $m_r->insertData($arr);
  72. if (empty($id)) {
  73. return backarr(0, "新增失败");
  74. }
  75. return backarr(1, "新增成功", ['id' => $id]);
  76. }
  77. /**
  78. * 新增教育背景
  79. * 20200119
  80. * wj
  81. */
  82. public function newebinfobyopenid($arr)
  83. {
  84. $result = $this->checkparam(__FUNCTION__, $arr);
  85. if (1 != $result['status']) {
  86. return $result;
  87. }
  88. $openid = $arr['openid'];
  89. $m_u = new usermodel();
  90. $uinfo = $m_u->getinfobyopenid($openid);
  91. if (empty($uinfo)) {
  92. return backarr(0, "用户信息不存在");
  93. }
  94. $userid = $uinfo['id'];
  95. $m_r = new resumemodel();
  96. $rinfo = $m_r->getinfobyuserid($userid);
  97. if (empty($rinfo)) {
  98. return backarr(0, "简历不存在");
  99. }
  100. $resumeid = $rinfo['id'];
  101. $arr['resume_id'] = $resumeid;
  102. $arr['user_id'] = $userid;
  103. $m_eb = new educationbackgroundemodel();
  104. $id = $m_eb->insertData($arr);
  105. if (empty($id)) {
  106. return backarr(0, "新增失败");
  107. }
  108. return backarr(1, "新增成功", ['id' => $id]);
  109. }
  110. /**
  111. * 新增工作经历
  112. * 20200119
  113. * wj
  114. */
  115. public function newweinfobyopenid($arr)
  116. {
  117. $result = $this->checkparam(__FUNCTION__, $arr);
  118. if (1 != $result['status']) {
  119. return $result;
  120. }
  121. $openid = $arr['openid'];
  122. $m_u = new usermodel();
  123. $uinfo = $m_u->getinfobyopenid($openid);
  124. if (empty($uinfo)) {
  125. return backarr(0, "用户信息不存在");
  126. }
  127. $userid = $uinfo['id'];
  128. $m_r = new resumemodel();
  129. $rinfo = $m_r->getinfobyuserid($userid);
  130. if (empty($rinfo)) {
  131. return backarr(0, "简历不存在");
  132. }
  133. $resumeid = $rinfo['id'];
  134. $arr['resume_id'] = $resumeid;
  135. $arr['user_id'] = $userid;
  136. $m_we = new workexperiencemodel();
  137. $id = $m_we->insertData($arr);
  138. if (empty($id)) {
  139. return backarr(0, "新增失败");
  140. }
  141. return backarr(1, "新增成功", ['id' => $id]);
  142. }
  143. /**
  144. * 根据openid获取简历
  145. * 20220119
  146. * wj
  147. */
  148. public function getinfobyopenid($arr)
  149. {
  150. $result = $this->checkparam(__FUNCTION__, $arr);
  151. if (1 != $result['status']) {
  152. return $result;
  153. }
  154. $openid = $arr['openid'];
  155. $m_u = new usermodel();
  156. $uinfo = $m_u->getinfobyopenid($openid);
  157. if (empty($uinfo)) {
  158. return backarr(0, "用户信息不存在");
  159. }
  160. $userid = $uinfo['id'];
  161. $m_r = new resumemodel();
  162. $rinfo = $m_r->getinfobyuserid($userid);
  163. if (empty($rinfo)) {
  164. return backarr(0, "简历不存在");
  165. }
  166. $resumeid = $rinfo['id'];
  167. $m_eb = new educationbackgroundemodel();
  168. $eblist = $m_eb->getList(['resume_id' => $resumeid], '*', 1, 0);
  169. $rinfo['eblist'] = $eblist;
  170. $m_we = new workexperiencemodel();
  171. $welist = $m_we->getList(['resume_id' => $resumeid], '*', 1, 0);
  172. $rinfo['welist'] = $welist;
  173. return backarr(1, "查询成功", $rinfo);
  174. }
  175. /**
  176. * 简历投递
  177. * 20220119
  178. * wj
  179. */
  180. public function sendresume($arr)
  181. {
  182. $result = $this->checkparam(__FUNCTION__, $arr);
  183. if (1 != $result['status']) {
  184. return $result;
  185. }
  186. $openid = $arr['openid'];
  187. $m_u = new usermodel();
  188. $uinfo = $m_u->getinfobyopenid($openid);
  189. if (empty($uinfo)) {
  190. return backarr(0, "用户信息不存在");
  191. }
  192. $inventid = $arr['inventid'];
  193. $m_i = new inventmodel();
  194. $iinfo = $m_i->getinfobyid($inventid);
  195. $m_r = new resumemodel();
  196. $userid = $uinfo['id'];
  197. $rinfo = $m_r->getinfobyuserid($userid);
  198. if (empty($rinfo)) {
  199. return backarr(0, "简历不存在");
  200. }
  201. $partyid = $arr['partyid'];
  202. $m_p = new partymodel();
  203. $pinfo = $m_p->getinfobyid($partyid);
  204. if (empty($pinfo)) {
  205. return backarr(0, "活动不存在");
  206. }
  207. $arr['send_user_id'] = $userid;
  208. $arr['party_id'] = $pinfo['id'];
  209. $arr['company_id'] = $iinfo['company_id'];
  210. $arr['resume_id'] = $rinfo['id'];
  211. $arr['invent_id'] = $iinfo['id'];
  212. $m_s = new sendrecordmodel();
  213. $id = $m_s->insertData($arr);
  214. if (empty($id)) {
  215. return backarr(0, "投递失败");
  216. }
  217. return backarr(1, "投递成功", ['id' => $id]);
  218. }
  219. }