function edit_train_audit($uid, $audit, $reason, $pms_notice) { global $db, $_CFG; $audit = intval($audit); $pms_notice = intval($pms_notice); $reason = trim($reason); if (!is_array($uid)) { $uid = array($uid); } $sqlin = implode(",", $uid); if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) { if (!$db->query("update " . table('train_profile') . " SET audit='{$audit}' WHERE uid IN ({$sqlin})")) { return false; } write_log("将会员uid为" . $sqlin . "的培训机构的审核状态设置为" . $audit, $_SESSION['admin_name'], 3); //发送站内信 if ($pms_notice == '1') { $reason = $reason == '' ? '无' : $reason; if ($audit == '1') { $note = '成功通过网站管理员审核!'; } elseif ($audit == '2') { $note = '正在审核中!'; } else { $note = '未通过网站管理员审核!'; } $result = $db->query("SELECT trainname,uid FROM " . table('train_profile') . " WHERE uid IN ({$sqlin})"); while ($list = $db->fetch_array($result)) { $user_info = get_user($list['uid']); $setsqlarr['message'] = "您的机构:{$list['trainname']}," . $note . '其他说明:' . $reason; $setsqlarr['msgtype'] = 1; $setsqlarr['msgtouid'] = $user_info['uid']; $setsqlarr['msgtoname'] = $user_info['username']; $setsqlarr['dateline'] = time(); $setsqlarr['replytime'] = time(); $setsqlarr['new'] = 1; $db->inserttable(table('pms'), $setsqlarr); } } if ($audit == '1') { if ($_CFG['operation_train_mode'] == '1') { $points_rule = get_cache('points_rule'); if ($points_rule['train_auth']['value'] > 0) { gift_points($sqlin, 'trainauth', $points_rule['train_auth']['type'], $points_rule['train_auth']['value']); } } } $mailconfig = get_cache('mailconfig'); $sms = get_cache('sms_config'); if ($audit == "1" && $mailconfig['set_licenseallow'] == '1') { $result = $db->query("SELECT uid FROM " . table('train_profile') . " WHERE uid IN ({$sqlin})"); while ($list = $db->fetch_array($result)) { $user_info = get_user($list['uid']); if ($user_info['email_audit'] == "1") { dfopen($_CFG['site_domain'] . $_CFG['site_dir'] . "plus/asyn_mail.php?uid={$list['uid']}&key=" . asyn_userkey($list['uid']) . "&act=set_licenseallow"); } } } if ($audit == "3" && $mailconfig['set_licensenotallow'] == "1") { $result = $db->query("SELECT uid FROM " . table('train_profile') . " WHERE uid IN ({$sqlin})"); while ($list = $db->fetch_array($result)) { $user_info = get_user($list['uid']); if ($user_info['email_audit'] == "1") { dfopen($_CFG['site_domain'] . $_CFG['site_dir'] . "plus/asyn_mail.php?uid={$list['uid']}&key=" . asyn_userkey($list['uid']) . "&act=set_licensenotallow"); } } } //sms if ($audit == "1" && $sms['open'] == "1" && $sms['set_licenseallow'] == "1") { $result = $db->query("SELECT uid FROM " . table('train_profile') . " WHERE uid IN ({$sqlin})"); while ($list = $db->fetch_array($result)) { $user_info = get_user($list['uid']); if ($user_info['mobile_audit'] == "1") { dfopen($_CFG['site_domain'] . $_CFG['site_dir'] . "plus/asyn_sms.php?uid={$list['uid']}&key=" . asyn_userkey($list['uid']) . "&act=set_licenseallow"); } } } //sms if ($audit == "3" && $sms['open'] == "1" && $sms['set_licensenotallow'] == "1") { $result = $db->query("SELECT uid FROM " . table('train_profile') . " WHERE uid IN ({$sqlin})"); while ($list = $db->fetch_array($result)) { $user_info = get_user($list['uid']); if ($user_info['mobile_audit'] == "1") { dfopen($_CFG['site_domain'] . $_CFG['site_dir'] . "plus/asyn_sms.php?uid={$list['uid']}&key=" . asyn_userkey($list['uid']) . "&act=set_licensenotallow"); } } } return true; } return false; }
function edit_company_audit($uid, $audit, $reason, $pms_notice) { global $db, $_CFG; $audit = intval($audit); $pms_notice = intval($pms_notice); $reason = trim($reason); if (!is_array($uid)) { $uid = array($uid); } $sqlin = implode(",", $uid); if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) { if (!$db->query("update " . table('company_profile') . " SET audit='{$audit}' WHERE uid IN ({$sqlin})")) { return false; } if (!$db->query("update " . table('jobs') . " SET company_audit='{$audit}' WHERE uid IN ({$sqlin})")) { return false; } if (!$db->query("update " . table('jobs_tmp') . " SET company_audit='{$audit}' WHERE uid IN ({$sqlin})")) { return false; } //发送站内信 if ($pms_notice == '1') { $reasonpm = $reason == '' ? '无' : $reason; if ($audit == '1') { $note = '成功通过网站管理员审核!'; } elseif ($audit == '2') { $note = '正在审核中!'; } else { $note = '未通过网站管理员审核!'; } $result = $db->query("SELECT companyname,uid FROM " . table('company_profile') . " WHERE uid IN ({$sqlin})"); while ($list = $db->fetch_array($result)) { $user_info = get_user($list['uid']); $setsqlarr['message'] = "您的公司:{$list['companyname']}," . $note . '其他说明:' . $reasonpm; $setsqlarr['msgtype'] = 1; $setsqlarr['msgtouid'] = $user_info['uid']; $setsqlarr['msgtoname'] = $user_info['username']; $setsqlarr['dateline'] = time(); $setsqlarr['replytime'] = time(); $setsqlarr['new'] = 1; inserttable(table('pms'), $setsqlarr); } } //审核未通过增加原因 if ($audit == '3') { $reasona = $reason == '' ? '原因:无' : '原因:' . $reason; foreach ($uid as $list) { $auditsqlarr['company_id'] = $list; $auditsqlarr['reason'] = $reasona; $auditsqlarr['addtime'] = time(); inserttable(table('audit_reason'), $auditsqlarr); } } if ($audit == '1') { //3.4升级修改注意,只有积分模式奖励积分 //3.5升级修改注意,积分和混合模式都奖励积分 if ($_CFG['operation_mode'] == '1' || $_CFG['operation_mode'] == '3' && $_CFG['setmeal_to_points'] == '1') { $points_rule = get_cache('points_rule'); if ($points_rule['company_auth']['value'] > 0) { gift_points($sqlin, 'companyauth', $points_rule['company_auth']['type'], $points_rule['company_auth']['value']); } } } $mailconfig = get_cache('mailconfig'); $sms = get_cache('sms_config'); if ($audit == "1" && $mailconfig['set_licenseallow'] == "1") { $result = $db->query("SELECT * FROM " . table('company_profile') . " WHERE uid IN ({$sqlin})"); while ($list = $db->fetch_array($result)) { $user_info = get_user($list['uid']); if ($user_info['email_audit'] == "1") { dfopen($_CFG['site_domain'] . $_CFG['site_dir'] . "plus/asyn_mail.php?uid={$list['uid']}&key=" . asyn_userkey($list['uid']) . "&act=set_licenseallow"); } } } if ($audit == "3" && $mailconfig['set_licensenotallow'] == "1") { $result = $db->query("SELECT * FROM " . table('company_profile') . " WHERE uid IN ({$sqlin})"); while ($list = $db->fetch_array($result)) { $user_info = get_user($list['uid']); if ($user_info['email_audit'] == "1") { dfopen($_CFG['site_domain'] . $_CFG['site_dir'] . "plus/asyn_mail.php?uid={$list['uid']}&key=" . asyn_userkey($list['uid']) . "&act=set_licensenotallow"); } } } //sms if ($audit == "1" && $sms['open'] == "1" && $sms['set_licenseallow'] == "1") { $result = $db->query("SELECT * FROM " . table('company_profile') . " WHERE uid IN ({$sqlin})"); while ($list = $db->fetch_array($result)) { $user_info = get_user($list['uid']); if ($user_info['mobile_audit'] == "1") { dfopen($_CFG['site_domain'] . $_CFG['site_dir'] . "plus/asyn_sms.php?uid={$list['uid']}&key=" . asyn_userkey($list['uid']) . "&act=set_licenseallow"); } } } //sms if ($audit == "3" && $sms['open'] == "1" && $sms['set_licensenotallow'] == "1") { $result = $db->query("SELECT * FROM " . table('company_profile') . " WHERE uid IN ({$sqlin})"); while ($list = $db->fetch_array($result)) { $user_info = get_user($list['uid']); if ($user_info['mobile_audit'] == "1") { dfopen($_CFG['site_domain'] . $_CFG['site_dir'] . "plus/asyn_sms.php?uid={$list['uid']}&key=" . asyn_userkey($list['uid']) . "&act=set_licensenotallow"); } } } //sms distribution_jobs_uid($uid); return true; } return false; }