resumelogic.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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 13:36:15
  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. 'newinfo' => [
  25. ['name' => 'openid', 'title' => 'openid', 'require' => true, 'type' => 'string'],
  26. ],
  27. 'newebinfo' => [
  28. ['name' => 'openid', 'title' => 'openid', 'require' => true, 'type' => 'string'],
  29. ],
  30. 'newweinfo' => [
  31. ['name' => 'openid', 'title' => 'openid', 'require' => true, 'type' => 'string'],
  32. ],
  33. ];
  34. return $list;
  35. }
  36. /**
  37. * 新增信息
  38. * 20200119
  39. * wj
  40. */
  41. public function newinfo($arr)
  42. {
  43. $result = $this->checkparam(__FUNCTION__, $arr);
  44. if (1 != $result['status']) {
  45. return $result;
  46. }
  47. $openid = $arr['openid'];
  48. $m_u = new usermodel();
  49. $uinfo = $m_u->getinfobyopenid($openid);
  50. if (empty($uinfo)) {
  51. return backarr(0, "用户信息不存在");
  52. }
  53. $userid = $uinfo['id'];
  54. $m_r = new resumemodel();
  55. $rinfo = $m_r->getinfobyuserid($userid);
  56. if (!empty($rinfo)) {
  57. return backarr(0, "简历已存在");
  58. }
  59. $arr['user_id'] = $uinfo['id'];
  60. $id = $m_r->insertData($arr);
  61. if (empty($id)) {
  62. return backarr(0, "新增失败");
  63. }
  64. return backarr(1, "新增成功", ['id' => $id]);
  65. }
  66. /**
  67. * 新增教育背景
  68. * 20200119
  69. * wj
  70. */
  71. public function newebinfo($arr)
  72. {
  73. $result = $this->checkparam(__FUNCTION__, $arr);
  74. if (1 != $result['status']) {
  75. return $result;
  76. }
  77. $openid = $arr['openid'];
  78. $m_u = new usermodel();
  79. $uinfo = $m_u->getinfobyopenid($openid);
  80. if (empty($uinfo)) {
  81. return backarr(0, "用户信息不存在");
  82. }
  83. $userid = $uinfo['id'];
  84. $m_r = new resumemodel();
  85. $rinfo = $m_r->getinfobyuserid($userid);
  86. if (empty($rinfo)) {
  87. return backarr(0, "简历不存在");
  88. }
  89. $resumeid = $rinfo['id'];
  90. $arr['resume_id'] = $resumeid;
  91. $arr['user_id'] = $userid;
  92. $m_eb = new educationbackgroundemodel();
  93. $id = $m_eb->insertData($arr);
  94. if (empty($id)) {
  95. return backarr(0, "新增失败");
  96. }
  97. return backarr(1, "新增成功", ['id' => $id]);
  98. }
  99. /**
  100. * 新增工作经历
  101. * 20200119
  102. * wj
  103. */
  104. public function newweinfo($arr)
  105. {
  106. $result = $this->checkparam(__FUNCTION__, $arr);
  107. if (1 != $result['status']) {
  108. return $result;
  109. }
  110. $openid = $arr['openid'];
  111. $m_u = new usermodel();
  112. $uinfo = $m_u->getinfobyopenid($openid);
  113. if (empty($uinfo)) {
  114. return backarr(0, "用户信息不存在");
  115. }
  116. $userid = $uinfo['id'];
  117. $m_r = new resumemodel();
  118. $rinfo = $m_r->getinfobyuserid($userid);
  119. if (empty($rinfo)) {
  120. return backarr(0, "简历不存在");
  121. }
  122. $resumeid = $rinfo['id'];
  123. $arr['resume_id'] = $resumeid;
  124. $arr['user_id'] = $userid;
  125. $m_we = new workexperiencemodel();
  126. $id = $m_we->insertData($arr);
  127. if (empty($id)) {
  128. return backarr(0, "新增失败");
  129. }
  130. return backarr(1, "新增成功", ['id' => $id]);
  131. }
  132. }