resumelogic.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  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. 'sendresume' => [
  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. 'getsendedresumebywhere' => [
  45. ['name' => 'openid', 'title' => 'openid', 'require' => true, 'type' => 'string'],
  46. ['name' => 'status', 'title' => 'status', 'type' => 'numeric', 'regex' => '/[0|1|2]{1}/'],
  47. ['name' => 'page', 'title' => 'page', 'type' => 'numeric'],
  48. ['name' => 'size', 'title' => 'size', 'type' => 'numeric'],
  49. ['name' => 'iscompany', 'title' => 'iscompany', 'type' => 'numeric', 'regex' => '/[0|1]{1}/'],
  50. ['name' => 'inventid', 'title' => 'inventid', 'type' => 'numeric'],
  51. ],
  52. 'getinfobyid' => [
  53. ['name' => 'id', 'title' => 'id', 'require' => true, 'type' => 'numeric'],
  54. ],
  55. 'getinfobyuserid' => [
  56. ['name' => 'userid', 'title' => 'userid', 'require' => true, 'type' => 'numeric'],
  57. ],
  58. 'getallinfobyid' => [
  59. ['name' => 'id', 'title' => 'id', 'require' => true, 'type' => 'numeric'],
  60. ],
  61. 'updatesendstatusbyid' => [
  62. ['name' => 'sendid', 'title' => 'sendid', 'require' => true, 'type' => 'numeric'],
  63. ['name' => 'status', 'title' => 'status', 'require' => true, 'type' => 'numeric', 'regex' => '/[0|1|2]{1}/'],
  64. ],
  65. ];
  66. return $list;
  67. }
  68. /**
  69. * 新增信息
  70. * 20200119
  71. * wj
  72. */
  73. public function newinfobyopenid($arr)
  74. {
  75. $result = $this->checkparam(__FUNCTION__, $arr);
  76. if (1 != $result['status']) {
  77. return $result;
  78. }
  79. $openid = $arr['openid'];
  80. $m_u = new usermodel();
  81. $uinfo = $m_u->getinfobyopenid($openid);
  82. if (empty($uinfo)) {
  83. return backarr(0, "用户信息不存在");
  84. }
  85. $userid = $uinfo['id'];
  86. $m_r = new resumemodel();
  87. $rinfo = $m_r->getinfobyuserid($userid);
  88. if (!empty($rinfo)) {
  89. return backarr(0, "简历已存在");
  90. }
  91. $arr['user_id'] = $uinfo['id'];
  92. $id = $m_r->insertData($arr);
  93. if (empty($id)) {
  94. return backarr(0, "新增失败");
  95. }
  96. return backarr(1, "新增成功", ['id' => $id]);
  97. }
  98. /**
  99. * 新增教育背景
  100. * 20200119
  101. * wj
  102. */
  103. public function newebinfobyopenid($arr)
  104. {
  105. $result = $this->checkparam(__FUNCTION__, $arr);
  106. if (1 != $result['status']) {
  107. return $result;
  108. }
  109. $openid = $arr['openid'];
  110. $m_u = new usermodel();
  111. $uinfo = $m_u->getinfobyopenid($openid);
  112. if (empty($uinfo)) {
  113. return backarr(0, "用户信息不存在");
  114. }
  115. $userid = $uinfo['id'];
  116. $m_r = new resumemodel();
  117. $rinfo = $m_r->getinfobyuserid($userid);
  118. if (empty($rinfo)) {
  119. return backarr(0, "简历不存在");
  120. }
  121. $resumeid = $rinfo['id'];
  122. $arr['resume_id'] = $resumeid;
  123. $arr['user_id'] = $userid;
  124. $m_eb = new educationbackgroundemodel();
  125. $id = $m_eb->insertData($arr);
  126. if (empty($id)) {
  127. return backarr(0, "新增失败");
  128. }
  129. return backarr(1, "新增成功", ['id' => $id]);
  130. }
  131. /**
  132. * 新增工作经历
  133. * 20200119
  134. * wj
  135. */
  136. public function newweinfobyopenid($arr)
  137. {
  138. $result = $this->checkparam(__FUNCTION__, $arr);
  139. if (1 != $result['status']) {
  140. return $result;
  141. }
  142. $openid = $arr['openid'];
  143. $m_u = new usermodel();
  144. $uinfo = $m_u->getinfobyopenid($openid);
  145. if (empty($uinfo)) {
  146. return backarr(0, "用户信息不存在");
  147. }
  148. $userid = $uinfo['id'];
  149. $m_r = new resumemodel();
  150. $rinfo = $m_r->getinfobyuserid($userid);
  151. if (empty($rinfo)) {
  152. return backarr(0, "简历不存在");
  153. }
  154. $resumeid = $rinfo['id'];
  155. $arr['resume_id'] = $resumeid;
  156. $arr['user_id'] = $userid;
  157. $m_we = new workexperiencemodel();
  158. $id = $m_we->insertData($arr);
  159. if (empty($id)) {
  160. return backarr(0, "新增失败");
  161. }
  162. return backarr(1, "新增成功", ['id' => $id]);
  163. }
  164. /**
  165. * 根据openid获取简历
  166. * 20220119
  167. * wj
  168. */
  169. public function getinfobyopenid($arr)
  170. {
  171. $result = $this->checkparam(__FUNCTION__, $arr);
  172. if (1 != $result['status']) {
  173. return $result;
  174. }
  175. $openid = $arr['openid'];
  176. $m_u = new usermodel();
  177. $uinfo = $m_u->getinfobyopenid($openid);
  178. if (empty($uinfo)) {
  179. return backarr(0, "用户信息不存在");
  180. }
  181. $userid = $uinfo['id'];
  182. $m_r = new resumemodel();
  183. $rinfo = $m_r->getinfobyuserid($userid);
  184. if (empty($rinfo)) {
  185. return backarr(0, "简历不存在");
  186. }
  187. $resumeid = $rinfo['id'];
  188. $m_eb = new educationbackgroundemodel();
  189. $eblist = $m_eb->getList(['resume_id' => $resumeid], '*', 1, 0);
  190. $rinfo['eblist'] = $eblist;
  191. $m_we = new workexperiencemodel();
  192. $welist = $m_we->getList(['resume_id' => $resumeid], '*', 1, 0);
  193. $rinfo['welist'] = $welist;
  194. return backarr(1, "查询成功", $rinfo);
  195. }
  196. /**
  197. * 根据id获取简历
  198. * 20220119
  199. * wj
  200. */
  201. public function getinfobyid($arr)
  202. {
  203. $result = $this->checkparam(__FUNCTION__, $arr);
  204. if (1 != $result['status']) {
  205. return $result;
  206. }
  207. $id = $arr['id'];
  208. $m_r = new resumemodel();
  209. $rinfo = $m_r->getinfobyid($id);
  210. if (empty($rinfo)) {
  211. return backarr(0, "简历不存在");
  212. }
  213. $resumeid = $rinfo['id'];
  214. $m_eb = new educationbackgroundemodel();
  215. $eblist = $m_eb->getList(['resume_id' => $resumeid], '*', 1, 0);
  216. $rinfo['eblist'] = $eblist;
  217. $m_we = new workexperiencemodel();
  218. $welist = $m_we->getList(['resume_id' => $resumeid], '*', 1, 0);
  219. $rinfo['welist'] = $welist;
  220. return backarr(1, "查询成功", $rinfo);
  221. }
  222. /**
  223. * 根据id获取简历、用户信息
  224. * 20220119
  225. * wj
  226. */
  227. public function getallinfobyid($arr)
  228. {
  229. $result = $this->checkparam(__FUNCTION__, $arr);
  230. if (1 != $result['status']) {
  231. return $result;
  232. }
  233. $id = $arr['id'];
  234. $m_r = new resumemodel();
  235. $rinfo = $m_r->getinfobyid($id);
  236. if (empty($rinfo)) {
  237. return backarr(0, "简历不存在");
  238. }
  239. $resumeid = $rinfo['id'];
  240. $m_eb = new educationbackgroundemodel();
  241. $eblist = $m_eb->getList(['resume_id' => $resumeid], '*', 1, 0);
  242. $rinfo['eblist'] = $eblist;
  243. $m_we = new workexperiencemodel();
  244. $welist = $m_we->getList(['resume_id' => $resumeid], '*', 1, 0);
  245. $rinfo['welist'] = $welist;
  246. $userid = $rinfo['user_id'];
  247. $m_u = new usermodel();
  248. $uinfo = $m_u->getfieldbyid($userid);
  249. if (empty($uinfo)) {
  250. return backarr(0, "用户信息不存在");
  251. }
  252. $rinfo['userinfo'] = $uinfo;
  253. return backarr(1, "查询成功", $rinfo);
  254. }
  255. /**
  256. * 根据id获取简历
  257. * 20220119
  258. * wj
  259. */
  260. public function getinfobyuserid($arr)
  261. {
  262. $result = $this->checkparam(__FUNCTION__, $arr);
  263. if (1 != $result['status']) {
  264. return $result;
  265. }
  266. $userid = $arr['userid'];
  267. $m_u = new usermodel();
  268. $uinfo = $m_u->getinfobyid($userid);
  269. if (empty($uinfo)) {
  270. return backarr(0, "用户信息不存在");
  271. }
  272. $m_r = new resumemodel();
  273. $rinfo = $m_r->getinfobyuserid($userid);
  274. if (empty($rinfo)) {
  275. return backarr(0, "简历不存在");
  276. }
  277. $resumeid = $rinfo['id'];
  278. $m_eb = new educationbackgroundemodel();
  279. $eblist = $m_eb->getList(['resume_id' => $resumeid], '*', 1, 0);
  280. $rinfo['eblist'] = $eblist;
  281. $m_we = new workexperiencemodel();
  282. $welist = $m_we->getList(['resume_id' => $resumeid], '*', 1, 0);
  283. $rinfo['welist'] = $welist;
  284. return backarr(1, "查询成功", $rinfo);
  285. }
  286. /**
  287. * 简历投递
  288. * 20220119
  289. * wj
  290. */
  291. public function sendresume($arr)
  292. {
  293. $result = $this->checkparam(__FUNCTION__, $arr);
  294. if (1 != $result['status']) {
  295. return $result;
  296. }
  297. $openid = $arr['openid'];
  298. $m_u = new usermodel();
  299. $uinfo = $m_u->getinfobyopenid($openid);
  300. if (empty($uinfo)) {
  301. return backarr(0, "用户信息不存在");
  302. }
  303. $inventid = $arr['inventid'];
  304. $m_i = new inventmodel();
  305. $iinfo = $m_i->getinfobyid($inventid);
  306. if (empty($iinfo)) {
  307. return backarr(0, "岗位不存在");
  308. }
  309. $m_r = new resumemodel();
  310. $userid = $uinfo['id'];
  311. $rinfo = $m_r->getinfobyuserid($userid);
  312. if (empty($rinfo)) {
  313. return backarr(0, "简历不存在");
  314. }
  315. if (isset($arr['partyid'])) {
  316. $partyid = $arr['partyid'];
  317. $m_p = new partymodel();
  318. $pinfo = $m_p->getinfobyid($partyid);
  319. if (empty($pinfo)) {
  320. return backarr(0, "活动不存在");
  321. }
  322. $arr['party_id'] = $pinfo['id'];
  323. }
  324. $arr['send_user_id'] = $userid;
  325. $arr['company_id'] = $iinfo['company_id'];
  326. $arr['resume_id'] = $rinfo['id'];
  327. $arr['invent_id'] = $iinfo['id'];
  328. //未判断重复投递
  329. $m_s = new sendrecordmodel();
  330. $id = $m_s->insertData($arr);
  331. if (empty($id)) {
  332. return backarr(0, "投递失败");
  333. }
  334. return backarr(1, "投递成功", ['id' => $id]);
  335. }
  336. /**
  337. * 根据条件获取简历投地记录
  338. * 企业用户返回 向企业投递的简历 根据 company_id 查
  339. * 非企业用户返回 投递过的简历 根据 send_user_id 查
  340. *
  341. * @return void
  342. */
  343. public function getsendedresumebywhere($arr)
  344. {
  345. $result = $this->checkparam(__FUNCTION__, $arr);
  346. if (1 != $result['status']) {
  347. return $result;
  348. }
  349. $openid = $arr['openid'];
  350. $iscompany = isset($arr['iscompany']) ? $arr['iscompany'] : 0;
  351. $m_u = new usermodel();
  352. $uinfo = $m_u->getinfobyopenid($openid);
  353. if (empty($uinfo)) {
  354. return backarr(0, "用户信息不存在");
  355. }
  356. $where = [];
  357. if (isset($arr['inventid'])) {
  358. $where['invent_id'] = $arr['inventid'];
  359. }
  360. if (isset($arr['status'])) {
  361. $where['status'] = $arr['status'];
  362. }
  363. /*if (1 != $uinfo['is_company']) {
  364. $where['send_user_id'] = $uinfo['id'];
  365. } else {
  366. $where['company_id'] = $uinfo['company_id'];
  367. }*/
  368. if (1 != $iscompany) {
  369. $where['send_user_id'] = $uinfo['id'];
  370. } else {
  371. $where['company_id'] = $uinfo['company_id'];
  372. }
  373. $m_s = new sendrecordmodel();
  374. $count = $m_s->getlist($where, 'count');
  375. if ($count < 0) {
  376. return backarr(0, "无数据");
  377. }
  378. $page = isset($arr['page']) && !empty($arr['page']) ? $arr['page'] : 1;
  379. $size = isset($arr['size']) && !empty($arr['size']) ? $arr['size'] : 10;
  380. $list = $m_s->getList($where, '*', $page, $size);
  381. return backarr(1, "查询成功", $list);
  382. }
  383. /**
  384. * 修改投递状态 根据投递的id
  385. * 20220127
  386. * wj
  387. * */
  388. public function updatesendstatusbyid($arr)
  389. {
  390. $result = $this->checkparam(__FUNCTION__, $arr);
  391. if (1 != $result['status']) {
  392. return $result;
  393. }
  394. $sendid = $arr['sendid'];
  395. $status = $arr['status'];
  396. $m_s = new sendrecordmodel();
  397. $info = $m_s->getinfobyid($sendid);
  398. if (empty($info)) {
  399. return backarr(0, "无数据");
  400. }
  401. $row = $m_s->updatestatusbyid($info['id'], $status);
  402. return backarr(1, "修改成功", ['id' => $info['id']]);
  403. }
  404. }