失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > 自主开发悟空crm增加 公文管理功能 二次开发代码披露

自主开发悟空crm增加 公文管理功能 二次开发代码披露

时间:2024-03-01 18:26:25

相关推荐

自主开发悟空crm增加 公文管理功能 二次开发代码披露

1、招聘需求

2、审核刚刚创建的招聘需求内容

3、编辑内容

4、简历管理

5、面试记录时间轴

6、offer管理

<?phpnamespace app\hrm\model;use app\admin\controller\ApiCommon;use app\admin\model\User;use app\admin\traits\FieldVerificationTrait;use think\Db;use app\admin\model\Common;use think\response\Json;class Offer extends Common{use FieldVerificationTrait;protected $name = 'hrm_offer';protected $createTime = 'create_time';protected $updateTime = 'update_time';protected $autoWriteTimestamp = true;private $statusArr = ['0'=>'待审核','1'=>'审核中','2'=>'审核通过','3'=>'已拒绝','4'=>'已撤回','5'=>'未提交','6'=>'已作废', '7'=>'正常'];protected $type = [// 'next_time' => 'timestamp',];/*** [getDataList list]* @author Michael_xu* @param[string] $map [查询条件]* @param[number] $page[当前页数]* @param[number] $limit [每页数量]* @return [array][description]*/public function getDataList($request){$userModel = new \app\admin\model\User();# 格式化参数$request = $this->fmtRequest( $request );$requestMap = $request['map'] ? : [];# 普通筛选$searchMap = [];# 排序// if ($order_type && $order_field && $order_field != 'owner_user_structure_name') {//$order = $fieldModel->getOrderByFormtype('crm_customer','customer',$order_field,$order_type);// } else {$order = 'offer.update_time desc';// }$list = db('hrm_offer')->alias('offer')->where($map)->where($searchMap)->limit($request['offset'], $request['length'])// ->field($indexField)->orderRaw($order)->select();$totalRow = db('hrm_offer')->alias('offer')->where($map)->where($searchMap)->count();foreach($list as $key=>$row){$list[$key]['create_time_txt'] = date('Y-m-d H:i:s', $row['create_time']);$nParentId_name = db('crm_customer')->where(['customer_id' => $row['nParentId']])->value('name');$nParentId_info = ['customer_id' => $row['nParentId'],'name' => $nParentId_name,];$list[$key]['nParentId_name'] = $nParentId_name;$nUserId_name = db('admin_user')->where(['id' => $row['nUserId']])->value('realname');$list[$key]['nUserId_name'] = $nUserId_name;$list[$key]['check_status_info'] = $this->statusArr[$row['check_status']];$list[$key]['create_user_id_info'] = isset($row['create_user_id']) ? $userModel->getUserById($row['create_user_id']) : [];}$data = [];$data['list'] = $list ? : [];$data['totalRow'] = $totalRow ? : 0;return $data;}public function getDataById($id = '', $userId = 0, $model=''){$dataInfo = db('hrm_offer')->where(['id' => $id])->find();if (!$dataInfo) {$this->error = '数据不存在或已删除';return false;}$dataInfo['nParentId_name'] = db('crm_customer')->where(['customer_id' => $dataInfo['nParentId']])->value('name');$dataInfo['create_time_txt'] = date('Y-m-d H:i:s', $dataInfo['create_time']);$dataInfo['zpzyId_name'] = db('admin_user')->where(['id' => $dataInfo['zpzyId']])->value('realname');return $dataInfo;}/*** 创建主表信息* @author Michael_xu* @param * @return */ public function createData($param){unset($param['excel']);if(is_array($param['nParentId'])){$param['nParentId'] = $param['nParentId'][0]['customer_id'];}else{$param['nParentId'] = $param['nParentId'];}// 数据验证$validateResult = $this->fieldDataValidate($param, 'hrm_offer', $userId);if (!empty($validateResult)) {$this->error = $validateResult;return false;}if ($this->data($param)->allowField(true)->isUpdate(false)->save()) {$data['id'] = $this->id;$data['zpzw'] = $param['zpzw'];return $data;} else {$this->error = '添加失败';return false;} }/*** 编辑客户主表信息* @author Michael_xu* @param * @return */public function updateDataById($param, $id = ''){$dataInfo = $this->get($id);if (!$dataInfo) {$this->error = '数据不存在或已删除';return false;}$id = !empty($param['id']) ? $param['id'] : $id;// 数据权限判断if(isset($param['nParentId'])){if(is_array($param['nParentId'])){$param['nParentId'] = $param['nParentId'][0]['customer_id'];}else{$param['nParentId'] = $param['nParentId'];}}// 数据验证$validateResult = $this->fieldDataValidate($param, 'hrm_offer', $user_id, $id);if (!empty($validateResult)) {$this->error = $validateResult;return false;}// 修改数据if ($this->update($param, ['id' => $id], true)) {$data['id'] = $id;// 修改记录// updateActionLog($user_id, 'crm_customer', $customer_id, $dataInfo->data, $param);// RecordActionLog($user_id, 'crm_customer', 'update',$dataInfo['name'], $dataInfo->data, $param);return $data;} else {$this->error = '编辑失败';return false;}}/*** 导出数据处理*/public function exportHandle($list, $field_list, $type = ''){foreach ($list as &$val) {foreach ($field_list as $field) {switch ($field['field']) {case 'jjcdId':$val[$field['field']] = [1 => '加急',2 => '紧急',3 => '正常',4 => '一般',5 => '暂停'][$val[$field['field']]];break;case 'is_zt':$val[$field['field']] = [0 => '等待审核',1 => '审核中',2 => '通过',3 => '驳回'][$val[$field['field']]];break;}}}return $list;}}

7、用户的offer管理的详情资料

8、简历分类

9、面试状态

<?phpnamespace app\hrm\controller;use app\admin\controller\ApiCommon;use phpDocumentor\Reflection\Types\False_;use think\Cache;use think\Hook;use think\Request;use think\Db;class Resume extends ApiCommon{/*** 用于判断权限* @permission 无限制* @allow 登录用户可访问* @other 其他根据系统设置**/public function _initialize(){$action = ['permission' => ['exceldownload', 'setfollow', 'delete', 'left', 'remind'],'allow' => ['read', 'system', 'count', 'poolauthority', 'level']];Hook::listen('check_auth', $action);$request = Request::instance();$a = strtolower($request->action());if (!in_array($a, $action['permission'])) {parent::_initialize();} else {$param = Request::instance()->param();$this->param = $param;}}/*** 列表* @return* @author Michael_xu*/public function index(){$model = model('Resume');$param = $this->param;$userInfo = $this->userInfo;$param['user_id'] = $userInfo['id'];$data = $model->getDataList($param);return resultArray(['data' => $data]);}/*** 面试提醒* @return* @author Michael_xu*/public function remind(){$data = model('Resume')->alias('r')->join('(select msztId,nParentId,update_time,msrq,sjian,msrqsjian,from_unixtime(msrqsjian,"%Y-%m-%d %H:%i:%s") msrqsjian_txt from 5kcrm_hrm_miansjl where id in (select max(id) from 5kcrm_hrm_miansjl group by nParentId)) ms', 'ms.nParentId=r.id', 'right')->field('r.id, r.xm, r.classId, ms.*')->where('ms.msrq',date('Y-m-d'))->order('ms.msrqsjian desc')// ->where('ms.msztId', 154)->where('ms.msztId', 'in', [150,151])->select();return resultArray(['data' => $data]);}/*** 详情* @param* @return* @author Michael_xu*/public function read(){$model = model('Resume');$param = $this->param;$userInfo = $this->userInfo;$data = $model->getDataById($param['id'], $userInfo['id']);if (!$data) {return resultArray(['error' => $model->getError()]);}return resultArray(['data' => $data]);}/*** 添加* @param* @return* @author Michael_xu*/public function save(){$model = model('Resume');$param = $this->param;$userInfo = $this->userInfo;$param['nUserId'] = $userInfo['id'];if ($res = $model->createData($param)) {return resultArray(['data' => $res]);} else {return resultArray(['error' => $model->getError()]);}}/*** 编辑* @param* @return* @author Michael_xu*/public function update(){$model = model('Resume');$param = $this->param;$userInfo = $this->userInfo;//数据详情$data = $model->getDataById($param['id']);if (!$data) {return resultArray(['error' => $model->getError()]);}if ($model->updateDataById($param, $param['id'])) {return resultArray(['data' => '编辑成功']);} else {return resultArray(['error' => $model->getError()]);}}/*** 删除客户* @param* @return* @author Michael_xu*/public function delete(){$model = model('Resume');$param = $this->param;$userInfo = $this->userInfo;// $permission = checkPerByAction('hrm', 'resume', 'delete');// if ($permission == false) {//return resultArray(['error' => '无权操作']);// }$delIds = $param['id'];if ($delIds) {$delRes = $model->delDatas($delIds);if (!$delRes) {return resultArray(['error' => $model->getError()]);}}return resultArray(['data' => '删除成功']);}/*** 导入* @param* @return* @author Michael_xu*/public function excelImport(){set_time_limit(0);$model = model('Resume');$param = $this->param;$userInfo = $this->userInfo;$param['nUserId'] = $userInfo['id'];// $rename;$jlwjs = $param['jlwj'];if(!$jlwjs){return resultArray(['error' => '请上传简历']);}foreach ($param['jlwj'] as $key=>$v){$param['xm'] = substr($v['name'], 0, strpos($v['name'], '.'));$param['jlwj'] = [$v];$model->createData($param);}return resultArray(['data' => true]);/*** 导出* @param* @return* @author Michael_xu*/public function excelExport(){$param = $this->param;$userInfo = $this->userInfo;$param['user_id'] = $userInfo['id'];$action_name = '导出';$excelModel = new \app\admin\model\Excel();// 导出的字段列表$fieldModel = new \app\admin\model\Field();$field_list = $param['fieldList'];// 文件名$file_name = '简介_' . date('Ymd');$model = model('Resume');$temp_file = $param['temp_file'];unset($param['temp_file']);$page = $param['page'] ?: 1;unset($param['page']);unset($param['export_queue_index']);RecordActionLog($userInfo['id'], 'hrm_resume', 'excelexport', $action_name, '', '', '导出简介');return $excelModel->batchExportCsv($file_name, $temp_file, $field_list, $page, function ($page, $limit) use ($model, $param, $field_list) {$param['page'] = $page;$param['limit'] = $limit;$data = $model->getDataList($param);$data['list'] = $model->exportHandle($data['list'], $field_list, 'hrm_resume');return $data;});}/*** 客户清单* @return* @author Michael_xu*/public function left(){$model = model('Resume');$customerModel = model('\app\crm\model\Customer');$param = $this->param;$customer_id = $model->column('nParentId');$where = ['deal_status' => '已成交',];$data = $customerModel->where($where)->whereOr('customer_id','in',$customer_id)->field('customer_id, name')->select();return resultArray(['data' => $data]);}}

如果觉得《自主开发悟空crm增加 公文管理功能 二次开发代码披露》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。