123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408 |
- <?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'],
- ],
- 'sendresume' => [
- ['name' => 'openid', 'title' => 'openid', 'require' => true, 'type' => 'string'],
- ['name' => 'inventid', 'title' => 'inventid', 'require' => true, 'type' => 'numeric'],
- ['name' => 'partyid', 'title' => 'partyid', 'type' => 'numeric'],
- ],
- 'getsendedresumebywhere' => [
- ['name' => 'openid', 'title' => 'openid', 'require' => true, 'type' => 'string'],
- ['name' => 'status', 'title' => 'status', 'type' => 'numeric', 'regex' => '/[0|1|2]{1}/'],
- ['name' => 'page', 'title' => 'page', 'type' => 'numeric'],
- ['name' => 'size', 'title' => 'size', 'type' => 'numeric'],
- ['name' => 'iscompany', 'title' => 'iscompany', 'type' => 'numeric', 'regex' => '/[0|1]{1}/'],
- ['name' => 'inventid', 'title' => 'inventid', 'type' => 'numeric'],
- ],
- 'getinfobyid' => [
- ['name' => 'id', 'title' => 'id', 'require' => true, 'type' => 'numeric'],
- ],
- 'getinfobyuserid' => [
- ['name' => 'userid', 'title' => 'userid', 'require' => true, 'type' => 'numeric'],
- ],
- 'getallinfobyid' => [
- ['name' => 'id', 'title' => 'id', 'require' => true, 'type' => 'numeric'],
- ],
- 'updatesendstatusbyid' => [
- ['name' => 'sendid', 'title' => 'sendid', 'require' => true, 'type' => 'numeric'],
- ['name' => 'status', 'title' => 'status', 'require' => true, 'type' => 'numeric', 'regex' => '/[0|1|2]{1}/'],
- ],
- ];
- 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);
- }
- /**
- * 根据id获取简历
- * 20220119
- * wj
- */
- public function getinfobyid($arr)
- {
- $result = $this->checkparam(__FUNCTION__, $arr);
- if (1 != $result['status']) {
- return $result;
- }
- $id = $arr['id'];
- $m_r = new resumemodel();
- $rinfo = $m_r->getinfobyid($id);
- 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);
- }
- /**
- * 根据id获取简历、用户信息
- * 20220119
- * wj
- */
- public function getallinfobyid($arr)
- {
- $result = $this->checkparam(__FUNCTION__, $arr);
- if (1 != $result['status']) {
- return $result;
- }
- $id = $arr['id'];
- $m_r = new resumemodel();
- $rinfo = $m_r->getinfobyid($id);
- 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;
- $userid = $rinfo['user_id'];
- $m_u = new usermodel();
- $uinfo = $m_u->getfieldbyid($userid);
- if (empty($uinfo)) {
- return backarr(0, "用户信息不存在");
- }
- $rinfo['userinfo'] = $uinfo;
- return backarr(1, "查询成功", $rinfo);
- }
- /**
- * 根据id获取简历
- * 20220119
- * wj
- */
- public function getinfobyuserid($arr)
- {
- $result = $this->checkparam(__FUNCTION__, $arr);
- if (1 != $result['status']) {
- return $result;
- }
- $userid = $arr['userid'];
- $m_u = new usermodel();
- $uinfo = $m_u->getinfobyid($userid);
- if (empty($uinfo)) {
- return backarr(0, "用户信息不存在");
- }
- $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);
- if (empty($iinfo)) {
- return backarr(0, "岗位不存在");
- }
- $m_r = new resumemodel();
- $userid = $uinfo['id'];
- $rinfo = $m_r->getinfobyuserid($userid);
- if (empty($rinfo)) {
- return backarr(0, "简历不存在");
- }
- if (isset($arr['partyid'])) {
- $partyid = $arr['partyid'];
- $m_p = new partymodel();
- $pinfo = $m_p->getinfobyid($partyid);
- if (empty($pinfo)) {
- return backarr(0, "活动不存在");
- }
- $arr['party_id'] = $pinfo['id'];
- }
- $arr['send_user_id'] = $userid;
- $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]);
- }
- /**
- * 根据条件获取简历投地记录
- * 企业用户返回 向企业投递的简历 根据 company_id 查
- * 非企业用户返回 投递过的简历 根据 send_user_id 查
- *
- * @return void
- */
- public function getsendedresumebywhere($arr)
- {
- $result = $this->checkparam(__FUNCTION__, $arr);
- if (1 != $result['status']) {
- return $result;
- }
- $openid = $arr['openid'];
- $iscompany = isset($arr['iscompany']) ? $arr['iscompany'] : 0;
- $m_u = new usermodel();
- $uinfo = $m_u->getinfobyopenid($openid);
- if (empty($uinfo)) {
- return backarr(0, "用户信息不存在");
- }
- $where = [];
- if (isset($arr['inventid'])) {
- $where['invent_id'] = $arr['inventid'];
- }
- if (isset($arr['status'])) {
- $where['status'] = $arr['status'];
- }
- /*if (1 != $uinfo['is_company']) {
- $where['send_user_id'] = $uinfo['id'];
- } else {
- $where['company_id'] = $uinfo['company_id'];
- }*/
- if (1 != $iscompany) {
- $where['send_user_id'] = $uinfo['id'];
- } else {
- $where['company_id'] = $uinfo['company_id'];
- }
- $m_s = new sendrecordmodel();
- $count = $m_s->getlist($where, 'count');
- if ($count < 0) {
- return backarr(0, "无数据");
- }
- $page = isset($arr['page']) && !empty($arr['page']) ? $arr['page'] : 1;
- $size = isset($arr['size']) && !empty($arr['size']) ? $arr['size'] : 10;
- $list = $m_s->getList($where, '*', $page, $size);
- return backarr(1, "查询成功", $list);
- }
- /**
- * 修改投递状态 根据投递的id
- * 20220127
- * wj
- * */
- public function updatesendstatusbyid($arr)
- {
- $result = $this->checkparam(__FUNCTION__, $arr);
- if (1 != $result['status']) {
- return $result;
- }
- $sendid = $arr['sendid'];
- $status = $arr['status'];
- $m_s = new sendrecordmodel();
- $info = $m_s->getinfobyid($sendid);
- if (empty($info)) {
- return backarr(0, "无数据");
- }
- $row = $m_s->updatestatusbyid($info['id'], $status);
- return backarr(1, "修改成功", ['id' => $info['id']]);
- }
- }
|