You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
433 lines
18 KiB
433 lines
18 KiB
<?php
|
|
defined('IN_IA') or exit('Access Denied');
|
|
|
|
class rights_WeliamController
|
|
{
|
|
|
|
public function index()
|
|
{
|
|
global $_W, $_GPC;
|
|
|
|
$level = $_GPC['level'] ?: 0;
|
|
$levelList = Rights::$levelList;
|
|
$dateUnitList = Rights::$dateUnit;
|
|
$rightsBag = Rights::getRightsBagAll();
|
|
|
|
$sum_price = 0;
|
|
foreach ($rightsBag as $row) {
|
|
$levelList[$row['id']] = $row['title'];
|
|
if ($row['id'] == $level) $sum_price = $row['price'];
|
|
}
|
|
|
|
$list = pdo_getall(PDO_NAME . 'rights');
|
|
|
|
foreach ($list as &$item) {
|
|
$specField = 'id as specid,amount,amount_unit,date_amount,date_unit';
|
|
$rightsSpec = pdo_fetch("select {$specField} from ims_" . PDO_NAME
|
|
. "rights_spec where rightsid = {$item['id']} and rights_bagid = '{$level}'");
|
|
if ($rightsSpec) {
|
|
$item = array_merge($item, $rightsSpec);
|
|
$item['amountUnitStr'] = Rights::$amountUnit[$item['amount_unit']];
|
|
$item['dateUnitStr'] = Rights::$dateUnit[$item['date_unit']];
|
|
}
|
|
}
|
|
|
|
include wl_template('setting/rights/index');
|
|
}
|
|
|
|
public function save()
|
|
{
|
|
global $_W, $_GPC;
|
|
|
|
$data = $_GPC['data'];
|
|
$level = $_GPC['level'];
|
|
if (!is_array($data)) wl_message('请求数据有误');
|
|
|
|
try {
|
|
pdo_begin();
|
|
switch ($level) {
|
|
case 0:
|
|
foreach ($data as $id => $value) {
|
|
if (empty($id) || !is_numeric($id)) throw new Exception('缺少id参数');
|
|
$price = trim($value['price']);
|
|
$content = trim($value['content']);
|
|
if ($price < 0 || !is_numeric($price)) throw new Exception('价格不能为负数,且必须为数字');
|
|
$updateArr = ['price' => $price, 'content' => $content];
|
|
$result = pdo_update(PDO_NAME . 'rights', $updateArr, ['id' => $id]);
|
|
if ($result === false) throw new Exception('保存失败');
|
|
}
|
|
break;
|
|
case 1:
|
|
case 2:
|
|
$temp_specid = '';
|
|
foreach ($data as $specid => $value) {
|
|
|
|
if (empty($temp_specid)) $temp_specid = $specid;
|
|
|
|
$amount = (int)$value['amount'];
|
|
|
|
if (empty($specid) || !is_numeric($specid)) throw new Exception('缺少id参数');
|
|
if ($amount < 0 || !is_numeric($amount)) throw new Exception('个数不能为负数,且必须为数字整形');
|
|
$updateArr = ['amount' => trim($amount)];
|
|
|
|
if (isset($value['date_amount'])) {
|
|
$date_amount = (int)$value['date_amount'];
|
|
if ($date_amount < 0 || !is_numeric($date_amount)) throw new Exception('天数不能为负数,且必须为数字整形');
|
|
$updateArr['date_amount'] = $date_amount;
|
|
}
|
|
|
|
$result = pdo_update(PDO_NAME . 'rights_spec', $updateArr, ['id' => $specid]);
|
|
if ($result === false) throw new Exception('保存失败');
|
|
}
|
|
|
|
if (isset($_GPC['sum_price']) && !empty($temp_specid)) {
|
|
$sum_price = trim($_GPC['sum_price']);
|
|
if ($sum_price < 0 || !is_numeric($sum_price)) throw new Exception('总价不能为负数,且必须为数字');
|
|
$spec = pdo_get(PDO_NAME . 'rights_spec', ['id' => $temp_specid], ['rights_bagid']);
|
|
if ($spec) {
|
|
pdo_update(PDO_NAME . 'rights_bag', ['price' => $sum_price], ['id' => $spec['rights_bagid']]);
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
} catch (Exception $e) {
|
|
pdo_rollback();
|
|
wl_message($e->getMessage());
|
|
}
|
|
pdo_commit();
|
|
wl_message('设置成功!', web_url('setting/rights/index', array('level' => $level)), 'success');
|
|
}
|
|
|
|
public function useRightsIndex()
|
|
{
|
|
global $_W, $_GPC;
|
|
|
|
$levelList = pdo_getall(PDO_NAME . 'rights', ['id' => [1, 5]]);
|
|
$_GPC['level'] = $_GPC['level'] ?: 1;
|
|
$unit = $_GPC['level'] == 1 ? '天' : '份';
|
|
|
|
$where = ['rightsid' => $_GPC['level']];
|
|
|
|
if (!empty($_GPC['keyword'])) {
|
|
$midArr = [];
|
|
$keyword = trim($_GPC['keyword']);
|
|
if ($_GPC['keywordtype'] == 1) {
|
|
$storeUser = pdo_getall(PDO_NAME . 'merchantuser', ['storeid' => $keyword]);
|
|
foreach ($storeUser as $user) $midArr[] = $user['mid'];
|
|
} else if ($_GPC['keywordtype'] == 2) {
|
|
$storeidArr = [];
|
|
$storeData = pdo_getall(PDO_NAME . 'merchantdata', " storename like '%{$keyword}%'", ['id']);
|
|
foreach ($storeData as $storeVal) $storeidArr[] = $storeVal['id'];
|
|
if ($storeidArr) {
|
|
$storeUser = pdo_getall(PDO_NAME . 'merchantuser', ['storeid' => $storeidArr]);
|
|
foreach ($storeUser as $user) $midArr[] = $user['mid'];
|
|
}
|
|
} else if ($_GPC['keywordtype'] == 3) {
|
|
$midArr[] = $keyword;
|
|
} else if ($_GPC['keywordtype'] == 4) {
|
|
$member = pdo_getall(PDO_NAME . 'member', " nickname like '%{$keyword}%'", ['id']);
|
|
foreach ($member as $memberVal) $midArr[] = $memberVal['id'];
|
|
}
|
|
if (!empty($midArr)) {
|
|
$memberRightsQueryWhere = ['rightsid' => $_GPC['level'], 'mid' => $midArr];
|
|
$memberRightsQuery = pdo_getall(PDO_NAME . 'member_rights', $memberRightsQueryWhere, ['id']);
|
|
if ($memberRightsQuery) {
|
|
foreach ($memberRightsQuery as $memberRightsVal) $where['member_rightsid'][] = $memberRightsVal['id'];
|
|
} else {
|
|
$where['id'] = 0;
|
|
}
|
|
} else {
|
|
$where['id'] = 0;
|
|
}
|
|
}
|
|
|
|
if (is_numeric($_GPC['status'])) $where['status'] = $_GPC['status'];
|
|
|
|
$pindex = max(1, intval($_GPC['page']));
|
|
$psize = 10;
|
|
|
|
$memberData = Util::getNumData("*", PDO_NAME . 'member_rights_use', $where, 'id desc', $pindex, $psize, 1);
|
|
$list = $memberData[0];
|
|
$pager = $memberData[1];
|
|
|
|
foreach ($list as &$item) {
|
|
|
|
$item['remaining_amount'] = $item['use_total_amount'] - $item['use_amount'];
|
|
|
|
$memberRights = pdo_get(PDO_NAME . 'member_rights', ['id' => $item['member_rightsid']]);
|
|
$item['mid'] = $memberRights['mid'];
|
|
Member::getMemberInfo($item, $memberRights['mid']);
|
|
|
|
$storeUser = pdo_get(PDO_NAME . 'merchantuser', ['mid' => $memberRights['mid']], ['storeid']);
|
|
if ($storeUser) {
|
|
$item['storeid'] = $storeUser['storeid'];
|
|
$store = pdo_get(PDO_NAME . 'merchantdata', ['id' => $storeUser['storeid']], ['id', 'storename', 'logo', 'mobile']);
|
|
if ($store) {
|
|
$item['storename'] = $store['storename'];
|
|
$item['logo'] = tomedia($store['logo']);
|
|
$item['store_mobile'] = tomedia($store['mobile']);
|
|
}
|
|
}
|
|
|
|
if (!empty($item['start_time'])) $item['start_time'] = date("Y-m-d H:i:s", $item['start_time']);
|
|
if (!empty($item['end_time'])) $item['end_time'] = date("Y-m-d H:i:s", $item['end_time']);
|
|
|
|
if ($item['rightsid'] == 5) {
|
|
$title = pdo_getcolumn(PDO_NAME . 'recruit_recruit',['id' => $item['relation_id']],'title');
|
|
$item['recruit_title'] = $title;
|
|
}
|
|
}
|
|
|
|
include wl_template('setting/rights/useRightsIndex');
|
|
}
|
|
|
|
/**
|
|
* 开始使用 注:暂时只供广告曝光使用
|
|
* @return void
|
|
*/
|
|
public function beginRightsUse()
|
|
{
|
|
global $_W, $_GPC;
|
|
|
|
$rightsUseId = $_GPC['id'];
|
|
if (empty($rightsUseId)) wl_message('缺少参数ID');
|
|
|
|
$where = ['id' => $rightsUseId, 'status' => 0, 'rightsid' => 1];
|
|
$rightsUse = pdo_get(PDO_NAME . 'member_rights_use', $where, ['id', 'status']);
|
|
if (!$rightsUse) wl_message('开始失败,请检查状态是否待开始');
|
|
|
|
$updateData = ['status' => 1, 'start_time' => time()];
|
|
$updateRes = pdo_update(PDO_NAME . 'member_rights_use', $updateData, ['id' => $rightsUse['id']]);
|
|
if (!$updateRes) wl_message('开始失败');
|
|
|
|
wl_message('开始成功!', web_url('setting/rights/useRightsIndex', array('level' => $_GPC['level'])), 'success');
|
|
}
|
|
|
|
/**
|
|
* 手动推送简历 (展示企业需要的简历)
|
|
* @return void
|
|
*/
|
|
public function pushRecruitIndex()
|
|
{
|
|
global $_W, $_GPC;
|
|
|
|
$rightsUseId = $_GPC['id'];
|
|
$page = $_GPC['page'] ?: 1;
|
|
$pageSize = $_GPC['pageSize'] ?: 20;
|
|
|
|
// 用户使用权益信息
|
|
$rightsUse = pdo_get(PDO_NAME . 'member_rights_use', ['id' => $rightsUseId]);
|
|
|
|
// 权益类型
|
|
$rights = pdo_get(PDO_NAME . 'rights', ['id' => $rightsUse['rightsid']]);
|
|
|
|
// 已推荐简历id(去除已推送过简历)
|
|
$resume_where = '';
|
|
$filter = [];
|
|
if (!empty($rightsUse['filter'])) {
|
|
$filter = unserialize($rightsUse['filter']);
|
|
if (!empty($filter['resume_id'])) {
|
|
$str = "'" . implode("','", $filter['resume_id']) . "'";
|
|
$resume_where .= " and id not in ({$str})";
|
|
}
|
|
}
|
|
// 用户权益信息
|
|
$memberRights = pdo_get(PDO_NAME . 'member_rights', ['id' => $rightsUse['member_rightsid']]);
|
|
|
|
// 企业招聘信息
|
|
$recruit = pdo_get(PDO_NAME . 'recruit_recruit', ['id' => $rightsUse['relation_id']]);
|
|
// 企业信息
|
|
$store = pdo_get(PDO_NAME . 'merchantdata', ['id' => $recruit['release_sid']], ['storename', 'id']);
|
|
// 推荐简历查询条件
|
|
$where = '';
|
|
$industryPid = $recruit['industry_pid'] ? : 0;//上级行业id
|
|
$industryId = $recruit['industry_id'] ? : 0;//子行业id
|
|
$educational = $_GPC['educational_experience'] ? : 0;//最高学历
|
|
$position_id = $recruit['position_id'];//职位id
|
|
// 获取行业下面的所有职位
|
|
$positionWhere = [];
|
|
if (!empty($industryPid)) $positionWhere['industry_pid'] = $industryPid;
|
|
if (!empty($industryId)) $positionWhere['industry_id'] = $industryId;
|
|
$positionIdArr = [];
|
|
// 查询改简历同行业职位信息
|
|
$positionRes = pdo_getall(PDO_NAME . 'recruit_position',$positionWhere,'id');
|
|
if ($positionRes) {
|
|
foreach ($positionRes as $positionRow) $positionIdArr[] = $positionRow['id'];
|
|
}
|
|
if (!empty($position_id)) $positionIdArr[] = $position_id;
|
|
$positionIdArr = array_unique($positionIdArr);
|
|
// 获取职位的所有简历信息
|
|
$find_in_set_arr = [];
|
|
foreach ($positionIdArr as $positionId) $find_in_set_arr[] = " find_in_set('{$positionId}',expect_position) ";
|
|
if ($find_in_set_arr) $where .= implode(" or ",$find_in_set_arr);
|
|
if (!empty($recruit['job_type'])) $where .= ($where ? ' and' : '') . " job_type = '{$recruit['job_type']}'";
|
|
|
|
// 推荐简历列表
|
|
$recruit_resume = pdo_getall(PDO_NAME . 'recruit_resume', "{$where} ", '*', '', 'id desc', [$page, $pageSize]);
|
|
$graduated_school = '';#毕业院校
|
|
$experience = '';#优先选项
|
|
foreach ($recruit_resume as $key => &$item) {
|
|
|
|
// 是否是重点院校内
|
|
if (!empty($filter['graduated_school']) && is_numeric($filter['graduated_school'])) {
|
|
$educational_experience = unserialize($item['educational_experience']);
|
|
$graduated_school = Rights::$graduatedSchool[$filter['graduated_school']];
|
|
$is_continue = $this->isContinue($graduated_school,$educational_experience,'graduated_school');
|
|
if ($is_continue) {
|
|
unset($recruit_resume[$key]);
|
|
continue;
|
|
}
|
|
}
|
|
// 优先选项
|
|
if (!empty($filter['experience']) && is_numeric($filter['experience'])) {
|
|
$experience = Rights::$experience[$filter['experience']];
|
|
// 是否有在校职务
|
|
if ($filter['experience'] == 1) {
|
|
$school_office = unserialize($item['school_office']);
|
|
if (empty($school_office)) {
|
|
unset($recruit_resume[$key]);
|
|
continue;
|
|
}
|
|
// 是否有在校经历
|
|
} elseif ($filter['experience'] == 2) {
|
|
$work_experience = unserialize($item['work_experience']);
|
|
if (empty($work_experience)) {
|
|
unset($recruit_resume[$key]);
|
|
continue;
|
|
}
|
|
}
|
|
}
|
|
$item['is_push'] = false;
|
|
if (!empty($filter['resume_id']) && in_array($item['id'],$filter['resume_id'])) $item['is_push'] = true;
|
|
// 用户头像及昵称
|
|
Member::getMemberInfo($item, $item['mid']);
|
|
}
|
|
|
|
include wl_template('setting/rights/pushRecruitIndex');
|
|
}
|
|
|
|
/**
|
|
* 判断是否跳过
|
|
* @param $value
|
|
* @param $array
|
|
* @param $array_key
|
|
* @return bool
|
|
*/
|
|
protected function isContinue($value,$array,$array_key)
|
|
{
|
|
if (!$value) return false;
|
|
if ($array_key == 'graduated_school' && is_numeric($value)) $value = Rights::$graduatedSchool[$value];
|
|
|
|
if (!is_array($array)) return true;
|
|
|
|
$is_continue = true;
|
|
foreach ($array as $val) {
|
|
if ($value == $val[$array_key]) {
|
|
$is_continue = false;
|
|
break;
|
|
}
|
|
}
|
|
return $is_continue;
|
|
}
|
|
|
|
/**
|
|
* 推送简历
|
|
* @return void
|
|
*/
|
|
public function pushRecruit()
|
|
{
|
|
global $_W, $_GPC;
|
|
|
|
$resume_id = $_GPC['id'];
|
|
$recruit_id = $_GPC['recruit_id'];
|
|
$rights_use_id = $_GPC['rights_use_id'];
|
|
if (empty($resume_id)) wl_message('缺少简历ID');
|
|
if (empty($recruit_id)) wl_message('缺少招聘ID');
|
|
if (empty($rights_use_id)) wl_message('缺少权益ID');
|
|
|
|
// $recruit_resume = pdo_get(PDO_NAME . 'recruit_resume',['id' => $resume_id]);
|
|
$rightsUseRes = pdo_get(PDO_NAME . 'member_rights_use',['id' => $rights_use_id]);
|
|
$rightsid = $rightsUseRes['rightsid'];
|
|
$memberRights = pdo_get(PDO_NAME . 'member_rights', ['id' => $rightsUseRes['member_rightsid']]);
|
|
$mid = $memberRights['mid'];
|
|
|
|
// $submitData = [
|
|
// 'uniacid' => $_W['uniacid'],
|
|
// 'mid' => $mid,
|
|
// 'resume_id' => $resume_id,
|
|
// 'recruit_id' => $recruit_id,
|
|
// 'create_time' => time(),
|
|
// 'status' => 0
|
|
// ];
|
|
// pdo_insert(PDO_NAME."recruit_submit",$submitData);
|
|
|
|
$useRights = Rights::useMemberRights($rightsid,$mid,$recruit_id,'recruit_resume');
|
|
if (!$useRights['status']) wl_message($useRights['msg']);
|
|
|
|
$filter = unserialize($rightsUseRes['filter']);
|
|
if (empty($filter['resume_id']) || !in_array($resume_id,$filter['resume_id'])) {
|
|
$filter['resume_id'][] = $resume_id;
|
|
}
|
|
|
|
$useRightsUpdate = ['filter' => serialize($filter)];
|
|
pdo_update(PDO_NAME . 'member_rights_use',$useRightsUpdate,['id' => $rights_use_id]);
|
|
|
|
wl_message('开始成功!' , web_url('setting/rights/pushRecruitIndex',array('id' => $rights_use_id,'level' => $rightsid)) , 'success');
|
|
}
|
|
|
|
/**
|
|
* 权益订单管理
|
|
* @return void
|
|
*/
|
|
public function rightsOrderIndex()
|
|
{
|
|
global $_W,$_GPC;
|
|
//参数信息获取
|
|
$page = $_GPC['page'] ? : 1;
|
|
$pageIndex = $_GPC['page_index'] ? : 10;
|
|
$startPage = $page * $pageIndex - $pageIndex;
|
|
|
|
$where = ['uniacid' => $_W['uniacid'], 'aid' => $_W['aid'], 'plugin' => 'rights'];
|
|
|
|
if ($_GPC['rightsid'] == 99) {
|
|
$rightsid = $_GPC['rightsid'];
|
|
$_GPC['rights_bagid'] = '';
|
|
}
|
|
if (!empty($_GPC['rightsid']) && $_GPC['rightsid'] != 99) {
|
|
$_GPC['rights_bagid'] = '';
|
|
$rightsid = $_GPC['rightsid'];
|
|
$where['fkid'] = $rightsid;
|
|
$where['payfor'] = 'rights';
|
|
}
|
|
if (!empty($_GPC['rights_bagid'])) {
|
|
$_GPC['rightsid'] = '';
|
|
$rights_bagid = $_GPC['rights_bagid'];
|
|
$where['fkid'] = $rights_bagid;
|
|
$where['payfor'] = 'rightsBag';
|
|
}
|
|
|
|
$field = "id,orderno,status,paytype,payfor,paytime,price,fightstatus,fkid,mid";
|
|
$orderData = Util::getNumData($field, PDO_NAME . 'order', $where, 'id desc', $page, $pageIndex, 1);
|
|
|
|
$list = $orderData[0];
|
|
$pager = $orderData[1];
|
|
|
|
$rightsList = Rights::getRightsList();
|
|
|
|
foreach($list as $index => &$item){
|
|
if ($item['payfor'] == 'rightsBag') {
|
|
|
|
$rightsBag = pdo_get(PDO_NAME . 'rights_bag',['id' => $item['fkid']]);
|
|
$item['rights_type'] = $rightsBag['title'];
|
|
} else {
|
|
$rights = pdo_get(PDO_NAME . 'rights',['id' => $item['fkid']]);
|
|
$item['rights_type'] = $rights['rights_type'];
|
|
}
|
|
|
|
Member::getMemberInfo($item,$item['mid']);
|
|
}
|
|
|
|
|
|
include wl_template('setting/rights/rightsOrderIndex');
|
|
}
|
|
}
|