123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222 |
- <?php
- /*
- * @Author: wang jun
- * @Date: 2022-01-18 11:12:23
- * @Last Modified by: wang jun
- * @Last Modified time: 2022-01-19 17:29:15
- * 微信类
- */
- namespace app\index\logic;
- use app\index\model\educationbackgroundemodel;
- use app\index\model\inventmodel;
- use app\index\model\partymodel;
- use app\index\model\resumemodel;
- use app\index\model\sendrecordmodel;
- use app\index\model\usermodel;
- use app\index\model\workexperiencemodel;
- class resumelogic extends baselogic
- {
- /**
- * 设置请求数据规则
- * 20220107
- * wj
- */
- protected function setrules()
- {
- $list = [
- 'newinfobyopenid' => [
- ['name' => 'openid', 'title' => 'openid', 'require' => true, 'type' => 'string'],
- ],
- 'newebinfobyopenid' => [
- ['name' => 'openid', 'title' => 'openid', 'require' => true, 'type' => 'string'],
- ],
- 'newweinfobyopenid' => [
- ['name' => 'openid', 'title' => 'openid', 'require' => true, 'type' => 'string'],
- ],
- 'getinfobyopenid' => [
- ['name' => 'openid', 'title' => 'openid', 'require' => true, 'type' => 'string'],
- ],
- 'sendinvent' => [
- ['name' => 'openid', 'title' => 'openid', 'require' => true, 'type' => 'string'],
- ['name' => 'inventid', 'title' => 'inventid', 'require' => true, 'type' => 'numeric'],
- ['name' => 'partyid', 'title' => 'partyid', 'type' => 'numeric'],
- ],
- ];
- return $list;
- }
- /**
- * 新增信息
- * 20200119
- * wj
- */
- public function newinfobyopenid($arr)
- {
- $result = $this->checkparam(__FUNCTION__, $arr);
- if (1 != $result['status']) {
- return $result;
- }
- $openid = $arr['openid'];
- $m_u = new usermodel();
- $uinfo = $m_u->getinfobyopenid($openid);
- if (empty($uinfo)) {
- return backarr(0, "用户信息不存在");
- }
- $userid = $uinfo['id'];
- $m_r = new resumemodel();
- $rinfo = $m_r->getinfobyuserid($userid);
- if (!empty($rinfo)) {
- return backarr(0, "简历已存在");
- }
- $arr['user_id'] = $uinfo['id'];
- $id = $m_r->insertData($arr);
- if (empty($id)) {
- return backarr(0, "新增失败");
- }
- return backarr(1, "新增成功", ['id' => $id]);
- }
- /**
- * 新增教育背景
- * 20200119
- * wj
- */
- public function newebinfobyopenid($arr)
- {
- $result = $this->checkparam(__FUNCTION__, $arr);
- if (1 != $result['status']) {
- return $result;
- }
- $openid = $arr['openid'];
- $m_u = new usermodel();
- $uinfo = $m_u->getinfobyopenid($openid);
- if (empty($uinfo)) {
- return backarr(0, "用户信息不存在");
- }
- $userid = $uinfo['id'];
- $m_r = new resumemodel();
- $rinfo = $m_r->getinfobyuserid($userid);
- if (empty($rinfo)) {
- return backarr(0, "简历不存在");
- }
- $resumeid = $rinfo['id'];
- $arr['resume_id'] = $resumeid;
- $arr['user_id'] = $userid;
- $m_eb = new educationbackgroundemodel();
- $id = $m_eb->insertData($arr);
- if (empty($id)) {
- return backarr(0, "新增失败");
- }
- return backarr(1, "新增成功", ['id' => $id]);
- }
- /**
- * 新增工作经历
- * 20200119
- * wj
- */
- public function newweinfobyopenid($arr)
- {
- $result = $this->checkparam(__FUNCTION__, $arr);
- if (1 != $result['status']) {
- return $result;
- }
- $openid = $arr['openid'];
- $m_u = new usermodel();
- $uinfo = $m_u->getinfobyopenid($openid);
- if (empty($uinfo)) {
- return backarr(0, "用户信息不存在");
- }
- $userid = $uinfo['id'];
- $m_r = new resumemodel();
- $rinfo = $m_r->getinfobyuserid($userid);
- if (empty($rinfo)) {
- return backarr(0, "简历不存在");
- }
- $resumeid = $rinfo['id'];
- $arr['resume_id'] = $resumeid;
- $arr['user_id'] = $userid;
- $m_we = new workexperiencemodel();
- $id = $m_we->insertData($arr);
- if (empty($id)) {
- return backarr(0, "新增失败");
- }
- return backarr(1, "新增成功", ['id' => $id]);
- }
- /**
- * 根据openid获取简历
- * 20220119
- * wj
- */
- public function getinfobyopenid($arr)
- {
- $result = $this->checkparam(__FUNCTION__, $arr);
- if (1 != $result['status']) {
- return $result;
- }
- $openid = $arr['openid'];
- $m_u = new usermodel();
- $uinfo = $m_u->getinfobyopenid($openid);
- if (empty($uinfo)) {
- return backarr(0, "用户信息不存在");
- }
- $userid = $uinfo['id'];
- $m_r = new resumemodel();
- $rinfo = $m_r->getinfobyuserid($userid);
- if (empty($rinfo)) {
- return backarr(0, "简历不存在");
- }
- $resumeid = $rinfo['id'];
- $m_eb = new educationbackgroundemodel();
- $eblist = $m_eb->getList(['resume_id' => $resumeid], '*', 1, 0);
- $rinfo['eblist'] = $eblist;
- $m_we = new workexperiencemodel();
- $welist = $m_we->getList(['resume_id' => $resumeid], '*', 1, 0);
- $rinfo['welist'] = $welist;
- return backarr(1, "查询成功", $rinfo);
- }
- /**
- * 简历投递
- * 20220119
- * wj
- */
- public function sendresume($arr)
- {
- $result = $this->checkparam(__FUNCTION__, $arr);
- if (1 != $result['status']) {
- return $result;
- }
- $openid = $arr['openid'];
- $m_u = new usermodel();
- $uinfo = $m_u->getinfobyopenid($openid);
- if (empty($uinfo)) {
- return backarr(0, "用户信息不存在");
- }
- $inventid = $arr['inventid'];
- $m_i = new inventmodel();
- $iinfo = $m_i->getinfobyid($inventid);
- $m_r = new resumemodel();
- $userid = $uinfo['id'];
- $rinfo = $m_r->getinfobyuserid($userid);
- if (empty($rinfo)) {
- return backarr(0, "简历不存在");
- }
- $partyid = $arr['partyid'];
- $m_p = new partymodel();
- $pinfo = $m_p->getinfobyid($partyid);
- if (empty($pinfo)) {
- return backarr(0, "活动不存在");
- }
- $arr['send_user_id'] = $userid;
- $arr['party_id'] = $pinfo['id'];
- $arr['company_id'] = $iinfo['company_id'];
- $arr['resume_id'] = $rinfo['id'];
- $arr['invent_id'] = $iinfo['id'];
- $m_s = new sendrecordmodel();
- $id = $m_s->insertData($arr);
- if (empty($id)) {
- return backarr(0, "投递失败");
- }
- return backarr(1, "投递成功", ['id' => $id]);
- }
- }
|