GetOne($query);
$gurl = $row['editcon'];
if ($gurl == '') {
$gurl = 'article_edit.php';
}
header("location:{$gurl}?aid=$aid");
exit();
}
/*--------------------------
//浏览文档
function viewArchives(){ }
---------------------------*/
else if ($dopost == "viewArchives") {
$aid = preg_replace("#[^0-9]#", '', $aid);
//获取主表信息
$query = "SELECT arc.*,ch.maintable,ch.addtable,ch.issystem,ch.editcon,
tp.typedir,tp.typename,tp.corank,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.sitepath,tp.siteurl
FROM `#@__arctiny` arc
LEFT JOIN `#@__arctype` tp ON tp.id=arc.typeid
LEFT JOIN `#@__channeltype` ch ON ch.id=tp.channeltype
WHERE arc.id='$aid' ";
$trow = $dsql->GetOne($query);
$trow['maintable'] = (trim($trow['maintable']) == '' ? '#@__archives' : trim($trow['maintable']));
if ($trow['issystem'] != -1) {
$arcQuery = "SELECT arc.*,tp.typedir,tp.typename,tp.corank,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.sitepath,tp.siteurl
FROM `{$trow['maintable']}` arc LEFT JOIN `#@__arctype` tp on arc.typeid=tp.id
LEFT JOIN `#@__channeltype` ch on ch.id=arc.channel WHERE arc.id='$aid' ";
$arcRow = $dsql->GetOne($arcQuery);
if ($arcRow['store_flag'] == 11) {
//企业号的跳转
if ($arcRow['channel'] == 1) {
//文章
$query = "SELECT redirecturl
FROM `#@__addonarticle`
WHERE aid='$aid' ";
$articleDon = $dsql->GetOne($query);
$url = $cfg_basehost.$articleDon['redirecturl'];
} elseif ($arcRow['channel'] == 3) {
//资料
$query = "SELECT redirecturl
FROM `#@__addonsoft`
WHERE aid='$aid' ";
$articleDon = $dsql->GetOne($query);
$url = $articleDon['redirecturl'];
}
echo "";
exit();
}
if ($arcRow['ismake'] == -1 || $arcRow['corank'] != 0 || (($arcRow['arcrank'] != 0)&&($arcRow['arcrank']!=10)) || ($arcRow['typeid'] == 0 && $arcRow['channel'] != -1) || $arcRow['money'] > 0) {
echo "";
exit();
}
} else {
$arcRow['id'] = $aid;
$arcRow['typeid'] = $trow['typeid'];
$arcRow['senddate'] = $trow['senddate'];
$arcRow['title'] = '';
$arcRow['ismake'] = 1;
$arcRow['arcrank'] = $trow['corank'];
$arcRow['namerule'] = $trow['namerule'];
$arcRow['typedir'] = $trow['typedir'];
$arcRow['money'] = 0;
$arcRow['filename'] = '';
$arcRow['moresite'] = $trow['moresite'];
$arcRow['siteurl'] = $trow['siteurl'];
$arcRow['sitepath'] = $trow['sitepath'];
}
$arcurl = GetFileUrl($arcRow['id'], $arcRow['typeid'], $arcRow['senddate'], $arcRow['title'], $arcRow['ismake'], $arcRow['arcrank'],
$arcRow['namerule'], $arcRow['typedir'], $arcRow['money'], $arcRow['filename'], $arcRow['moresite'], $arcRow['siteurl'], $arcRow['sitepath']);
$arcfile = GetFileUrl($arcRow['id'], $arcRow['typeid'], $arcRow['senddate'], $arcRow['title'],
$arcRow['ismake'], $arcRow['arcrank'], $arcRow['namerule'], $arcRow['typedir'], $arcRow['money'], $arcRow['filename']);
if (preg_match("#^https:#", $arcfile)) {
$arcfile = preg_replace("#^https:\/\/([^\/]*)\/#i", '/', $arcfile);
}
$truefile = GetTruePath() . $arcfile;
if (!file_exists($truefile)) {
MakeArt($aid, true);
}
echo "";
exit();
}
/*--------------------------
//异步上传缩略图
function uploadLitpic(){ }
---------------------------*/
else if ($dopost == "uploadLitpic") {
$upfile = AdminUpload('litpic', 'imagelit', 0, false);
if ($upfile == '-1') {
$msg = "";
} else if ($upfile == '-2') {
$msg = "";
} else if ($upfile == '0') {
$msg = "";
} else {
if (!empty($cfg_uplitpic_cut) && $cfg_uplitpic_cut == 'N') {
$msg = "";
} else {
$msg = "";
}
}
echo $msg;
exit();
}
/*--------------------------
//文件系统异步上传缩略图
function uploadLitpic(){ }
---------------------------*/
else if ($dopost == "uploadLitpic2017") {
if($cfg_is_use_fastdfs){
// $fastdfs = new FastDFS();
if($cutflag==1){
$upfile = fastdfsUploadImgBase($image);
}else{
$upfile = fastdfsUploadFile('litpic');
}
}else{
$upfile = AdminUpload('litpic', 'imagelit', 0, false);
}
if($cutflag==1){//兼容裁剪
if(in_array($upfile,array('0','-1','-2'))){
echo json_encode(array('status'=>0, 'info'=>'上传错误', 'data'=>array()));
exit();
}else{
echo json_encode(array('status'=>'successed', 'info'=>'success', 'data'=> $upfile));
exit();
}
}
if ($upfile == '-1') {
$msg = "";
} else if ($upfile == '-2') {
$msg = "";
} else if ($upfile == '0') {
$msg = "";
} else {
//if (!empty($cfg_uplitpic_cut) && $cfg_uplitpic_cut == 'N') {
$msg = "";
/* } else {
$msg = "";
}*/
}
echo $msg;
exit();
}else if($dopost == 'softupload'){
/* print_r($_POST);
print_r($_FILES);DIE;*/
$uploadfile = isset($_FILES['softupload']['tmp_name']) ? $_FILES['softupload']['tmp_name'] : '';
$uploadfile_name = isset($_FILES['softupload']['name']) ? $_FILES['softupload']['name'] : '';
$uploadfile_type = isset($_FILES['softupload']['type']) ? $_FILES['softupload']['type'] : '';
$uploadfile_size = isset($_FILES['softupload']['size']) ? $_FILES['softupload']['size'] : '';
if(empty($uploadfile)) $uploadfile = '';
if(empty($uploadmbtype)) $uploadmbtype = '软件类型';
if(empty($bkurl)) $bkurl = 'select_soft.php';
$CKEditorFuncNum = (isset($CKEditorFuncNum))? $CKEditorFuncNum : 1;
$newname = ( empty($newname) ? '' : preg_replace("#[\\ \"\*\?\t\r\n<>':\/|]#", "", $newname) );
if(!is_uploaded_file($uploadfile))
{
$msg = "";
}
//软件类型所有支持的附件
$ext = pathinfo($uploadfile_name,PATHINFO_EXTENSION);
$cfg_softtype = $cfg_softtype;
$cfg_softtype = str_replace('||', '|', $cfg_softtype);
$uploadfile_name = trim(preg_replace("#[ \r\n\t\*\%\\\/\?><\|\":]{1,}#", '', $uploadfile_name));
if(!preg_match("#\.(".$cfg_softtype.")#i", $uploadfile_name))
{
$msg = "";
}
$nowtme = time();
$activepath = $cfg_soft_dir;//次数看似是废话 其实真的是废话 因为。。。
if($activepath==$cfg_soft_dir)
{
$newdir = MyDate($cfg_addon_savetype, $nowtme);
$activepath = $activepath.'/'.$newdir;
if(!is_dir($cfg_basedir.$activepath))
{
MkdirAll($cfg_basedir.$activepath,$cfg_dir_purview);
CloseFtp();
}
}
//文件名(前为手工指定, 后者自动处理)
if(!empty($newname))
{
$filename = $newname;
if(!preg_match("#\.#", $filename)) $fs = explode('.', $uploadfile_name);
else $fs = explode('.', $filename);
if(preg_match("#".$cfg_not_allowall."#", $fs[count($fs)-1]))
{
$msg = "";
echo $msg;exit();
}
if(!preg_match("#\.#", $filename)) $filename = $filename.'.'.$fs[count($fs)-1];
}else{
$filename = $cuserLogin->getUserID().'-'.dd2char(MyDate('ymdHis',$nowtme));
$fs = explode('.', $uploadfile_name);
if(preg_match("#".$cfg_not_allowall."#", $fs[count($fs)-1]))
{
$msg = "";
echo $msg;exit();
}
$filename = $filename.'.'.$fs[count($fs)-1];
}
$fullfilename = $cfg_basedir.$activepath.'/'.$filename;
$fullfileurl = $activepath.'/'.$filename;
if(!move_uploaded_file($uploadfile,$fullfilename)){
$msg = "";
echo $msg;exit();
}
@unlink($uploadfile);
if($cfg_remote_site=='Y' && $remoteuploads == 1)
{
//分析远程文件路径
$remotefile = str_replace(DEDEROOT, '', $fullfilename);
$localfile = '../..'.$remotefile;
//创建远程文件夹
$remotedir = preg_replace('/[^\/]*\.('.$cfg_softtype.')/', '', $remotefile);
$ftp->rmkdir($remotedir);
$ftp->upload($localfile, $remotefile);
}
if($uploadfile_type == 'application/x-shockwave-flash')
{
$mediatype=2;
}
else if(preg_match('#image#i', $uploadfile_type))
{
$mediatype=1;
}
else if(preg_match('#audio|media|video#i', $uploadfile_type))
{
$mediatype=3;
}
else
{
$mediatype=4;
}
//如果启用文件系统并且有fastdfs驱动 在ckupload场景下 用fastdfs上传
if($cfg_is_use_fastdfs&&class_exists('FastDFS',false)){
require_once(DEDEINC.'/fastdfsupload.class.php');
$fastdfs = new FdfsUpload();
$rs = $fastdfs->putFileByFilename($fullfilename,$ext);
if($rs){
@unlink($fullfilename);
$fullfileurl = $cfg_fastdfs_host.$rs['group_name'].'/'.$rs['filename'];
}
}
//fastdfs end
$inquery = "INSERT INTO `#@__uploads`(arcid,title,url,mediatype,width,height,playtime,filesize,uptime,mid)
VALUES ('0','$filename','$fullfileurl','$mediatype','0','0','0','{$uploadfile_size}','{$nowtme}','".$cuserLogin->getUserID()."'); ";
$dsql->ExecuteNoneQuery($inquery);
$fid = $dsql->GetLastID();
AddMyAddon($fid, $fullfileurl);
$msg = "";
echo $msg;exit();
}
/*--------------------------
//推荐文档
function commendArchives(){ }
---------------------------*/
else if ($dopost == "commendArchives") {
CheckPurview('a_Commend,sys_ArcBatch');
if (!empty($aid) && empty($qstr)) {
$qstr = $aid;
}
if ($qstr == '') {
ShowMsg("参数无效!", $ENV_GOBACK_URL);
exit();
}
$arcids = preg_replace("#[^0-9,]#", '', preg_replace("#`#", ',', $qstr));
$query = "SELECT arc.id,arc.typeid,ch.issystem,ch.maintable,ch.addtable FROM `#@__arctiny` arc
LEFT JOIN `#@__arctype` tp on tp.id=arc.typeid
LEFT JOIN `#@__channeltype` ch on ch.id=tp.channeltype
WHERE arc.id in($arcids) ";
$dsql->SetQuery($query);
$dsql->Execute();
$sendTime = time();
while ($row = $dsql->GetArray()) {
$aid = $row['id'];
$recommend_date = time();
if ($row['issystem'] != -1) {
$maintable = (trim($row['maintable']) == '' ? '#@__archives' : trim($row['maintable']));
$arr = $dsql->GetOne("SELECT flag,title,mid FROM `{$maintable}` WHERE id='$aid' ");
$flag = ($arr['flag'] == '' ? 'c' : $arr['flag'] . ',c');
$dsql->ExecuteNoneQuery(" UPDATE `{$maintable}` SET `flag`='$flag',`recommend_date`={$recommend_date},`senddate`={$sendTime} WHERE id='{$aid}' ");
} else {
$maintable = trim($row['addtable']);
$arr = $dsql->GetOne("SELECT flag,title,mid From `{$maintable}` where aid='$aid' ");
$flag = ($arr['flag'] == '' ? 'c' : $arr['flag'] . ',c');
$dsql->ExecuteNoneQuery(" UPDATE `{$maintable}` SET `flag`='$flag',`recommend_date`={$recommend_date},`senddate`={$sendTime} WHERE aid='{$aid}' ");
}
$res = Setcredits($arr['mid'],$aid,$arr['title'],"TJL","first_recommendation");
$msg = "";
if($res){
$msg = "获得积分+2";
}
$url = GetArcUrl($aid);
$subject = "您发布的文章《{$arr['title']}》已管理员设为推荐!{$msg} 查看,跳转进入文章详情页";
$message = "查看";
abc_sendSystemNoticeNew($arr['mid'], $subject, $message);
}
ShowMsg("成功把所选的文档设为推荐!", $ENV_GOBACK_URL);
exit();
}
/*--------------------------
//批量添加TAG标签
function adTag(){ }
---------------------------*/
else if ($dopost == 'adTag') {
CheckPurview('a_Del,a_AccDel,a_MyDel,sys_ArcBatch');
require_once DEDEINC . "/oxwindow.class.php";
if (empty($fmdo)) {
$fmdo = '';
}
if ($fmdo != 'yes') {
$wintitle = "文档管理-批量添加TAG";
$wecome_info = "文档管理::批量添加TAG";
$win = new OxWindow();
$win->Init("archives_do.php", "js/blank.js", "POST");
$win->AddHidden("fmdo", "yes");
$win->AddHidden("dopost", $dopost);
$win->AddHidden("qstr", $qstr);
$win->AddHidden("aid", $aid);
$win->AddTitle("你确定要对文档:“ $qstr 和 $aid ”批量添加标签?");
$win->AddInputText('标签:',"tagstr", '', '请输入标签,多个标签用逗号分隔');
$winform = $win->GetWindow("ok");
$win->Display();
die;
}
if (!empty($aid) && empty($qstr)) {
$qstr = $aid;
}
if ($qstr == '') {
ShowMsg("参数无效!", $ENV_GOBACK_URL);
exit();
}
if (empty($tagstr)) {
ShowMsg("TAG标签不能为空", $ENV_GOBACK_URL);
die;
}
$qstrs = explode("`", $qstr);
$okaids = array();
foreach ($qstrs as $aid) {
if (in_array($aid, $okaids)) {
continue;
}
$arc = $dsql->GetOne("SELECT id,arcrank,typeid from `#@__arctiny` where id={$aid} limit 1");
if ($arc) {
// 字段信息供 InsertOneTag 函数使用
$typeid = $arc['typeid'];
$arcrank = $arc['arcrank'];
} else {
// 文档不存在
continue;
}
$oldtag = GetTags($aid);
$oldtags = explode(',',$oldtag);
$tagstr = str_replace(',', ',', $tagstr);
$tagss = explode(',',$tagstr);
foreach($tagss as $tag) {
$tag = trim($tag);
if(isset($tag[30]) || $tag!=stripslashes($tag)) {
continue;
}
if(!in_array($tag, $oldtags)) {
InsertOneTag($tag, $aid);
}
}
if ($arcrank > -1) {
MakeArt($aid, false);
}
$okaids[] = $aid;
}
ShowMsg("成功对指定的文档批量添加标签:$tagstr", $ENV_GOBACK_URL);
die;
}
/*--------------------------
//批量添加TAG标签
function replaceTag(){ }
---------------------------*/
else if ($dopost == 'replaceTag') {
CheckPurview('a_Del,a_AccDel,a_MyDel,sys_ArcBatch');
require_once DEDEINC . "/oxwindow.class.php";
if (empty($fmdo)) {
$fmdo = '';
}
if ($fmdo != 'yes') {
if (!empty($aid) && empty($qstr)) {
$qstr = $aid;
}
if ($qstr) {
$qstrsql = str_replace('`', ',', $qstr);
}
$sql = "SELECT distinct tag from `#@__taglist` where aid in({$qstrsql})";
$dsql->SetQuery($sql);
$dsql->Execute('replaceTag');
$data = array();
while ($row = $dsql->GetArray('replaceTag')) {
$data[] = array(
'v' => $row['tag'],
'n' => $row['tag'],
);
}
$wintitle = "文档管理-批量替换TAG标签";
$wecome_info = "文档管理::批量替换TAG标签";
$win = new OxWindow();
$win->Init("archives_do.php", "js/blank.js", "POST");
$win->AddHidden("fmdo", "yes");
$win->AddHidden("dopost", $dopost);
$win->AddHidden("qstr", $qstr);
$win->AddTitle("你确定要对文档:“ $qstr 和 $aid ”批量替换TAG标签?");
$win->AddInputSelect('原标签:',"tagdel", $data);
$win->AddInputText('新标签:',"tagstr", '', '请输入标签,多个标签用逗号分隔');
$winform = $win->GetWindow("ok");
$win->Display();
die;
}
if (!empty($aid) && empty($qstr)) {
$qstr = $aid;
}
if ($qstr == '') {
ShowMsg("参数无效!", $ENV_GOBACK_URL);
exit();
}
if (empty($tagstr)) {
ShowMsg("新标签不能为空", $ENV_GOBACK_URL);
die;
}
if ($tagdel == '') {
ShowMsg("请选择一个原标签作为待替换的标签", $ENV_GOBACK_URL);
die;
}
$qstrs = explode("`", $qstr);
$tagstr = str_replace(',', ',', $tagstr);
$tagss = explode(',',$tagstr);
$okaids = array();
foreach ($qstrs as $aid) {
if (in_array($aid, $okaids)) {
continue;
}
$arc = $dsql->GetOne("SELECT id,arcrank,typeid from `#@__arctiny` where id={$aid} limit 1");
if ($arc) {
// 字段信息供 InsertOneTag 函数使用
$typeid = $arc['typeid'];
$arcrank = $arc['arcrank'];
} else {
// 文档不存在
continue;
}
$oldtag = GetTags($aid);
$oldtags = explode(',',$oldtag);
if(!in_array($tagdel, $oldtags)) {
continue;
}
// 删除要替换的标签
$dsql->ExecuteNoneQuery("DELETE FROM `#@__taglist` WHERE aid='$aid' AND tag = '$tagdel' ");
$dsql->ExecuteNoneQuery("UPDATE `#@__tagindex` SET total=total-1 WHERE tag = '$tagdel' ");
// 添加新标签
foreach($tagss as $tag) {
$tag = trim($tag);
if(isset($tag[30]) || $tag!=stripslashes($tag)) {
continue;
}
if(!in_array($tag, $oldtags)) {
InsertOneTag($tag, $aid);
}
}
if ($arcrank > -1) {
MakeArt($aid, false);
}
$okaids[] = $aid;
}
ShowMsg("成功对指定的文档批量替换标签:$tagstr", $ENV_GOBACK_URL);
die;
}
/**
* 批量编辑关键字
* @var [type]
*/
elseif ($dopost == 'editKeywords') {
CheckPurview('sys_MakeHtml,sys_ArcBatch');
require_once DEDEINC . "/oxwindow.class.php";
if (empty($fmdo)) {
$fmdo = '';
}
if ($fmdo != 'yes') {
if (!empty($aid) && empty($qstr)) {
$qstr = $aid;
}
if ($qstr) {
$qstrsql = str_replace('`', ',', $qstr);
}
$wintitle = "文档管理-批量修改关键字";
$wecome_info = "文档管理::批量修改关键字";
$win = new OxWindow();
$win->Init("archives_do.php", "js/blank.js", "POST");
$win->AddHidden("fmdo", "yes");
$win->AddHidden("dopost", $dopost);
$win->AddHidden("qstr", $qstr);
$win->AddTitle("你确定要对文档:“ $qstr 和 $aid ”批量修改关键字吗?");
$win->AddInputText('关键字:',"keywords", '', '请输入关键字,多个用逗号隔开');
$winform = $win->GetWindow("ok");
$win->Display();
die;
}
if (!empty($aid) && empty($qstr)) {
$qstr = $aid;
}
if ($qstr == '') {
ShowMsg("参数无效!", $ENV_GOBACK_URL);
exit();
}
if (empty($keywords)) {
ShowMsg("关键字不能为空", $ENV_GOBACK_URL);
die;
}
$qstrs = explode("`", $qstr);
$keywords = strip_tags($keywords);
$keywords = str_replace(',', ',', $keywords);
$okaids = array();
$sendTime = time();
foreach ($qstrs as $aid) {
if (in_array($aid, $okaids)) {
continue;
}
$arc = $dsql->GetOne("SELECT id,arcrank,typeid from `#@__arctiny` where id={$aid} limit 1");
if (!$arc) {
$noarc[] = $aid;
continue;
}
if ($arc['arcrank'] > -1) {
$already[] = $aid;
continue;
}
// 修改关键字
$dsql->ExecuteNoneQuery("UPDATE `#@__archives` set `keywords`='{$keywords}',`senddate`={$sendTime} where id={$aid} limit 1");
$okaids[] = $aid;
}
$msg = '';
if ($okaids) {
$msg .= "成功对指定的文档批量修改标签为:$keywords ".implode(',', $okaids);
}
if ($noarc) {
$msg .= '
文档不存在: '.implode(',', $noarc).'';
}
if ($already) {
$msg .= '
已审核通过文档不能批量修改:'.implode(',', $already).'';
}
ShowMsg($msg, $ENV_GOBACK_URL, 0, 5000);
die;
}
/*--------------------------
//生成HTML
function makeArchives();
---------------------------*/
else if ($dopost == "makeArchives") {
CheckPurview('sys_MakeHtml,sys_ArcBatch');
if (!empty($aid) && empty($qstr)) {
$qstr = $aid;
}
if ($qstr == '') {
ShowMsg('参数无效!', $ENV_GOBACK_URL);
exit();
}
require_once DEDEADMIN . '/inc/inc_archives_functions.php';
//在批量更新中加入es维护
$arcids = preg_replace("#[^0-9,]#", '', preg_replace("#`#", ',', $qstr));
$query = "SELECT arc.id,arc.typeid,arc.typeid2,ch.issystem,ch.maintable,ch.addtable,arc.mid,arc.channel,arc.arcrank
FROM `#@__arctiny` arc
LEFT JOIN `#@__arctype` tp ON tp.id=arc.typeid
LEFT JOIN `#@__channeltype` ch ON ch.id=tp.channeltype
WHERE arc.id in($arcids) ";
$dsql->SetQuery($query);
$dsql->Execute('ckall');
$shopToken = md5($shop_token);
while ($row = $dsql->GetArray('ckall')) {
$aid = $row['id'];
//维护elasticsearch
$article = $dsql->GetOne("SELECT * FROM `#@__archives` Where id = '{$aid}'");
if(!$article['title']){
ShowMsg("title不能为空!当前aid:{$aid},errorMsg:".$exceptionMsg,"-1");
exit;
}
if($article['channel'] == 6){
$shopInfo = $dsql->GetOne("SELECT * FROM `".trim($row['addtable'])."` WHERE aid='$aid'; ");
$bname = $shopInfo['brand'];
//检查brand是否已经存在
$bRow = $dsql->GetOne("SELECT * FROM `#@__company` WHERE `name`='$bname' AND type = 2 ; ");
if(!$bRow || !$bRow['id']){
ShowMsg("当前文档id:$aid;品牌($bname)不存在,请先到[厂商管理]中添加好产品库品牌".$dsql->GetError(),"-1");
exit;
}
$brandid = $bRow['id'];
//更新seo信息
if($bRow){
$brandEn = $bRow['title'];
}else{
$brandEn = '';
}
//if(strtolower($brandEn) == 'ti' || strtolower($brandEn) == 'adi'){
if(strtolower($brandEn) == 'adi'){
$brandEn = strtoupper($brandEn);
}
//品牌TI,特殊对待
$article['shorttitle'] = empty($article['shorttitle'])?"【{$shopInfo['model_name']}】产品参数介绍、{$shopInfo['model_name']}数据手册、中英文PDF资料下载-{$brandEn}资料-电子发烧友":$article['shorttitle'];
$article['keywords'] = empty($article['keywords'])?"{$shopInfo['model_name']},{$shopInfo['model_name']}产品介绍,{$shopInfo['model_name']}数据手册,{$shopInfo['model_name']}中英文资料下载":$article['keywords'];
$article['description'] = empty($article['description'])?"电子发烧友网为你提供{$brandEn}($brandEn){$shopInfo['model_name']}相关产品参数、数据手册,更有{$shopInfo['model_name']}的引脚图、接线图、封装手册、中文资料、英文资料,{$shopInfo['model_name']}真值表,{$shopInfo['model_name']}管脚等资料,希望可以帮助到广大的电子工程师们。":$article['description'];
//}else{
// $article['shorttitle'] = empty($article['shorttitle'])?"【{$shopInfo['model_name']}】引脚图、接线图、封装手册、中英文资料下载-{$brandEn}资料-电子发烧友":$article['shorttitle'];
// $article['keywords'] = empty($article['keywords'])?"{$shopInfo['model_name']}引脚图,{$shopInfo['model_name']}接线图,{$shopInfo['model_name']}封装手册,{$shopInfo['model_name']}中文资料,{$shopInfo['model_name']}英文资料":$article['keywords'];
// $article['description'] = empty($article['description'])?"电子发烧友网为你提供{$brandEn}({$bname}){$shopInfo['model_name']}相关数据表资料,例如:{$shopInfo['model_name']}的引脚图、接线图、封装手册、中文资料、英文资料,{$shopInfo['model_name']}真值表,{$shopInfo['model_name']}管脚等资料,希望可以帮组广大的电子工程师、尤其是电子发烧友的网友们。":$article['description'];
//}
$article['description'] = trim($article['description']);
$sendTime = time();
$dsql->ExecuteNoneQuery("UPDATE `#@__archives` SET shorttitle='{$article['shorttitle']}',keywords='{$article['keywords']}',description='{$article['description']}',`senddate`={$sendTime} WHERE id='$aid' ");
//提取summary
$summary = trim(strip_tags(htmlspecialchars_decode($shopInfo['body'])));
$summary = cut_str($summary,500);
$summary = substr($summary,6); //去掉前面的“描述”
$esData = array(
'archives_id' => $aid,
'title' => $article['title'],
'description' => $summary,
'keywords' => $article['keywords'],
'typeid' => $article['typeid'],
'typeid2' => $article['typeid2'],
'brandid' => !empty($brandid) ? $brandid : 0,
'bname'=>!empty($bname) ? $bname : '',
'arcrank'=>$article['arcrank'],
'ismake'=>$article['ismake'],
'pubdate'=>$article['pubdate'],
'senddate'=>$article['senddate'],
'litpic'=>!empty($article["litpic"]) ? $article["litpic"] : '',
'index_time' => time()
);
//由于网络或者其他原因有可能执行失败,记录异常
try {
//覆盖操作,因为并不确定改动了具体哪些字段
$esClient = new EsApi();
$res = $esClient->insertDocment($aid, $esData);
$exceptionMsg = '';
} catch (Exception $e) {
$exceptionMsg = $e->getMessage();
ShowMsg("es搜索引擎报错,请截图给开发人员!当前aid:{$aid},errorMsg:".$exceptionMsg,"-1");
exit;
}
}
//电子说需要清理下文章缓存
if($article['typeid'] == 1075){
$cacheKey = md5("Home\Model\ArchivesModel_Home\Model\ArchivesModel::getDetail_{$aid}lls");
$res01 = Network::doRequest($cfg_basehost.'/d/Cachemanagement/delCache',['token' => $shopToken, 'key' => $cacheKey],'get',[],'http',3000);
}
}
$qstrs = explode('`', $qstr);
$i = 0;
foreach ($qstrs as $aid) {
$i++;
$pageurl = MakeArt($aid, false);
//清除产品库缓存
$res1 = Network::doRequest($cfg_basehost.'/p/Cachemanagement/delCache',['token' => $shopToken, 'key' => "elecfansshop_index_$aid"],'get',[],'http',3000);
}
$res2 = Network::doRequest($cfg_basehost.'/p/Cachemanagement/delCache',['token' => $shopToken, 'key' => 'elecfans_addonshop_getcategorylist'],'get',[],'http',3000);
$res3 = Network::doRequest($cfg_basehost.'/p/Cachemanagement/delCache',['token' => $shopToken, 'key' => 'elecfans_shop_company_brandlist'],'get',[],'http',3000);
ShowMsg("成功更新指定 $i 个文件...", $ENV_GOBACK_URL);
exit();
}
/*--------------------------
//审核文档,通过
---------------------------*/
else if ($dopost == "checkArchives") {
CheckPurview('a_Check,a_AccCheck,sys_ArcBatch');
require_once DEDEADMIN . "/inc/inc_archives_functions.php";
if (!empty($aid) && empty($qstr)) {
$qstr = $aid;
}
if ($qstr == '') {
ShowMsg("参数无效!", $ENV_GOBACK_URL);
exit();
}
$arcids = preg_replace("#[^0-9,]#", '', preg_replace("#`#", ',', $qstr));
$query = "SELECT arc.id,arc.typeid,arc.typeid2,ch.issystem,ch.maintable,ch.addtable,arc.mid,arc.channel,arc.arcrank
FROM `#@__arctiny` arc
LEFT JOIN `#@__arctype` tp ON tp.id=arc.typeid
LEFT JOIN `#@__channeltype` ch ON ch.id=tp.channeltype
WHERE arc.id in($arcids) ";
$dsql->SetQuery($query);
$dsql->Execute('ckall');
$currentTimestamp = time();
if (empty($elecfans_config['queue']['msg_host'])) {
$elecfans_config = include DEDEROOT . '/webapi/refactoring/config.php';
}
$msg_queue = new MsgQueue(
$elecfans_config['queue']['msg_host'],
$elecfans_config['queue']['msg_port'],
$elecfans_config['queue']['msg_user'],
$elecfans_config['queue']['msg_password'],
$elecfans_config['queue']['msg_name_bbs']
);
//获取d/article/apipick接口采集入库的文章 add sunjinliang 2019-10-24
$noPassIds = ''; //未修改标题不通过文档id
$pickArr = [];
$dsql->SetQuery('SELECT title, aid FROM `#@__picker` WHERE aid IN (' . $arcids . ')');
$dsql->Execute('pick_all');
while ($pickRow = $dsql->GetArray('pick_all')) {
$pickArr[$pickRow['aid']] = $pickRow['title'];
}// end
$need_send_notice = array();
$shishi_push_arr = array();
$shopToken = md5($shop_token);
while ($row = $dsql->GetArray('ckall')) {
$aid = $row['id'];
$shishi_push_arr[] = $aid;
//添加文章添加记录
$adminid = $cuserLogin->getUserID();
$ip = GetIP();
$now_time = time();
$visitor = $_COOKIE['visitor'];
$dsql->ExecuteNoneQuery("insert into #@__arc_edit_log (aid,mid,visitor,ip,addtime) values ($aid,$adminid,'$visitor','$ip',$now_time) ");
$isTimeRelease = $dsql->getOne("SELECT aid from `#@__archives_timerelease` where aid='{$aid}'");
if ($isTimeRelease) {
$sTimeRelease .= ',' . $aid;
continue;
}
//维护elasticsearch
$article = $dsql->GetOne("SELECT * FROM `#@__archives` Where id = '{$aid}'");
if($article['channel'] == 6){
$shopInfo = $dsql->GetOne("SELECT * FROM `".trim($row['addtable'])."` WHERE aid='$aid'; ");
$bname = $shopInfo['brand'];
//检查brand是否已经存在
$bRow = $dsql->GetOne("SELECT * FROM `#@__company` WHERE `name`='$bname' AND type = 2 ; ");
if(!$bRow || !$bRow['id']){
ShowMsg("当前文档id:$aid;品牌($bname)不存在,请先到[厂商管理]中添加好产品库品牌".$dsql->GetError(),"-1");
exit;
}
$brandid = $bRow['id'];
//更新seo信息
if($bRow){
$brandEn = $bRow['title'];
}else{
$brandEn = '';
}
//if(strtolower($brandEn) == 'ti' || strtolower($brandEn) == 'adi'){
if(strtolower($brandEn) == 'adi'){
$brandEn = strtoupper($brandEn);
}
//品牌TI,特殊对待
$article['shorttitle'] = empty($article['shorttitle'])?"【{$shopInfo['model_name']}】产品参数介绍、{$shopInfo['model_name']}数据手册、中英文PDF资料下载-{$brandEn}资料-电子发烧友":$article['shorttitle'];
$article['keywords'] = empty($article['keywords'])?"{$shopInfo['model_name']},{$shopInfo['model_name']}产品介绍,{$shopInfo['model_name']}数据手册,{$shopInfo['model_name']}中英文资料下载":$article['keywords'];
$article['description'] = empty($article['description'])?"电子发烧友网为你提供{$brandEn}($brandEn){$shopInfo['model_name']}相关产品参数、数据手册,更有{$shopInfo['model_name']}的引脚图、接线图、封装手册、中文资料、英文资料,{$shopInfo['model_name']}真值表,{$shopInfo['model_name']}管脚等资料,希望可以帮助到广大的电子工程师们。":$article['description'];
//}else{
// $article['shorttitle'] = empty($article['shorttitle'])?"【{$shopInfo['model_name']}】引脚图、接线图、封装手册、中英文资料下载-{$brandEn}资料-电子发烧友":$article['shorttitle'];
// $article['keywords'] = empty($article['keywords'])?"{$shopInfo['model_name']}引脚图,{$shopInfo['model_name']}接线图,{$shopInfo['model_name']}封装手册,{$shopInfo['model_name']}中文资料,{$shopInfo['model_name']}英文资料":$article['keywords'];
// $article['description'] = empty($article['description'])?"电子发烧友网为你提供{$brandEn}({$bname}){$shopInfo['model_name']}相关数据表资料,例如:{$shopInfo['model_name']}的引脚图、接线图、封装手册、中文资料、英文资料,{$shopInfo['model_name']}真值表,{$shopInfo['model_name']}管脚等资料,希望可以帮组广大的电子工程师、尤其是电子发烧友的网友们。":$article['description'];
//}
$article['description'] = trim($article['description']);
$sendTime = time();
$dsql->ExecuteNoneQuery("UPDATE `#@__archives` SET shorttitle='{$article['shorttitle']}',keywords='{$article['keywords']}',description='{$article['description']}',`senddate`={$sendTime} WHERE id='$aid' ");
//提取summary
$summary = trim(strip_tags(htmlspecialchars_decode($shopInfo['body'])));
$summary = cut_str($summary,500);
$summary = substr($summary,6); //去掉前面的“描述”
$esData = array(
'archives_id' => $aid,
'title' => $article['title'],
'description' => $summary,
'keywords' => $article['keywords'],
'typeid' => $article['typeid'],
'typeid2' => $article['typeid2'],
'brandid' => !empty($brandid) ? $brandid : 0,
'bname'=>!empty($bname) ? $bname : '',
'arcrank'=>0,
'ismake'=>$article['ismake'],
'pubdate'=>$article['pubdate'],
'senddate'=>$article['senddate'],
'litpic'=>!empty($article["litpic"]) ? $article["litpic"] : '',
'index_time' => time()
);
//由于网络或者其他原因有可能执行失败,记录异常
try {
//覆盖操作,因为并不确定改动了具体哪些字段
$esClient = new EsApi();
$res = $esClient->insertDocment($aid, $esData);
$exceptionMsg = '';
} catch (Exception $e) {
$exceptionMsg = $e->getMessage();
ShowMsg("es搜索引擎报错,请截图给开发人员!当前aid:{$aid},errorMsg:".$exceptionMsg,"-1");
exit;
}
}
//获取uid
$userLogic = new \hqjfmanage\logic\user\UserLogic();
$row['uid'] = $userLogic->changeMidToUid($article['mid'], $article['unionid'],$article['channel']);
//审核时检查 对采集文章,入库后文章标题不修改的标题 或与原标题相同的则不允许通过 add sunjinliang 2019-10-18
//d/article/apipicker这个接口采集的文章判断
$pickInfo = array_key_exists($aid, $pickArr) ? ['title' => $pickArr[$aid]] : [];
$checkRes = checkCollectArticleWithTitle($aid, $pickInfo,$article, ['title' => $article['title'],'arcrank' => 0]);
if (!$checkRes) {
$noPassIds .= $aid . ',';
continue; //进入下一个
}
//end
$maintable = (trim($row['maintable']) == '' ? '#@__archives' : trim($row['maintable']));
$dsql->ExecuteNoneQuery("UPDATE `#@__arctiny` SET arcrank='0' WHERE id='$aid' ");
if ($row['issystem'] == -1) {
$dsql->ExecuteNoneQuery("UPDATE `" . trim($row['addtable']) . "` SET arcrank='0' WHERE aid='$aid' ");
} else {
$sql = "UPDATE `$maintable` SET arcrank='0',senddate=".$currentTimestamp.",pubdate='" . $currentTimestamp
. "',dutyadmin='" . $cuserLogin->getUserID() . "' WHERE id='$aid' ";
$dsql->ExecuteNoneQuery($sql);
}
//维护文档主副栏目关系 modify sjl 2023.10.18
$arcTypeid2Logic = new \hqjfmanage\logic\article\ArchivesTypeid2Logic();
$arcTypeid2Logic->updateArcTypeid2($aid, $article['typeid'], $article['typeid2'],0);
Setcredits($article['mid'],$article['id'],$article['title'],"ACT","article");
//审核通过,发系统消息
if (in_array($row['channel'],[1,3]) && $row['arcrank'] == -1 ) {
if($row['channel'] == 3){
editUserScores($row['uid'], 1, 41);
}
sendSystemNotice($article['id'],1);
}
//采集文章审核通过后 移除入库原标题缓存 add sunjinliang 2019-10-18
if (empty($pickInfo) && strpos($article['flag'], 'g') !== false) {
removeCollectArtOriginTitleCache($aid, $article['arcrank'], 0);
}// end
// 没有tag的资料默认使用关键字作为tag 2016年3月29日 by 刘平
if ($row['channel'] == 3 && $row['arcrank'] == -1) {
$tagCount = $dsql->GetOne("SELECT COUNT(*) cnt from `#@__taglist` where aid='{$aid}'");
if ($tagCount['cnt'] == 0) {
$keywords = $dsql->GetOne("SELECT keywords from `#@__archives` where id='{$aid}' limit 1");
$typeid = $row['typeid'];
$arcrank = 0;
insertTags($keywords['keywords'], $aid);
} else {
$dsql->ExecuteNoneQuery("UPDATE `#@__taglist` SET arcrank='0' WHERE aid='$aid' ");
}
} else {
$dsql->ExecuteNoneQuery("UPDATE `#@__taglist` SET arcrank='0' WHERE aid='$aid' ");
}
$pageurl = MakeArt($aid, false);
// 维护xunsearch 搜索索引
// 文章推送
$typeid2_array = $row['typeid2'] ? explode(',', $row['typeid2']) : array();
$article = $dsql->GetOne("SELECT * FROM `#@__archives` Where id = '{$aid}'");
if ($row['arcrank']<0 && in_array($row['channel'],[1,3])) {
$uid = $row['uid'];
$memberRepo = new \hqjfmanage\repository\user\MemberRepository();
$userinfo = $memberRepo->getOneByWhere(['uid' => $uid], 'mid,uid,userid');
$username = $userinfo['userid'];
if (in_array($row['typeid'], array(1075,1076)) || in_array(1075, $typeid2_array)) {
$mp_name = $dsql->GetOne("SELECT ch_name FROM `#@__wx_mp_list` WHERE uid='$uid' ");
$username = $mp_name['ch_name'] ? $mp_name['ch_name'] : $username;
}
//对比url
$arcUrlRepository = new \hqjfmanage\repository\article\ArchivesUrlRepository();
$info = $arcUrlRepository->getOneById($aid,'url');
if (!empty($info['url']) && $pageurl != $info['url']) {
$pageurl = $info['url'];
}
$haha = $msg_queue->addToQueue(
$uid,
$username,
$aid,
$article['title'],
$article['litpic'],
$pageurl
);
}
//前台用户发的电子说的文章 不是管理员发的 不是后台采集微信发的
if(($row['arcrank']<0)&&($row['channel']==1)&&(in_array($row['typeid'],[1075,1076]))){
$wx_pick_arr = $dsql->GetOne("SELECT * FROM `#@__wx_mp_list` Where uid = '{$row['mid']}' and type=0");
$admin_arr = $dsql->GetOne("SELECT * FROM `#@__admin` Where id = '{$row['mid']}'");
if(!$admin_arr&&!$wx_pick_arr){
$need_send_notice[$row['mid']][] = $aid;
}
}
$res1 = Network::doRequest($cfg_basehost.'/p/Cachemanagement/delCache',['token' => $shopToken, 'key' => "elecfansshop_index_$aid"],'get',[],'http',3000);
$res2 = Network::doRequest($cfg_basehost.'/p/Cachemanagement/delCache',['token' => $shopToken, 'key' => 'elecfans_addonshop_getcategorylist'],'get',[],'http',3000);
$res3 = Network::doRequest($cfg_basehost.'/p/Cachemanagement/delCache',['token' => $shopToken, 'key' => 'elecfans_shop_company_brandlist'],'get',[],'http',3000);
//电子说需要清理下文章缓存
if($article['typeid'] == 1075){
$cacheKey = md5("Home\Model\ArchivesModel_Home\Model\ArchivesModel::getDetail_{$aid}lls");
$res01 = Network::doRequest($cfg_basehost.'/d/Cachemanagement/delCache',['token' => $shopToken, 'key' => $cacheKey],'get',[],'http',3000);
}
//百度推送
$pushAsync = [];
if ($arcrank > -1 && DEDE_ENV == 'prod' && $pageurl) {
if ($article['ismake'] == 1) {
//向百度提交实时资讯
$push_id_arr = array($aid);
$pushAsync['key_push_content_to_baidu_shishi'] = array(
'push_id_arr' => $push_id_arr,
'artUrl' => $pageurl,
);
}
//需要推送百度ping 或者 熊掌号 已改为异步
$pushAsync['key_push_content_to_baidu_ping_or_xiongzhang'] = array(
'id' => $aid,
'is_y' => strpos($article['flag'],'y')!==false ? 1 : 0,
'artUrl' => $pageurl,
);
//推送异步消息 elecfans_script项目会消费,并且异步调用 article_add_edit_async.php
$pushQueue = new \hqjfmanage\logic\queue\Queue();
//编辑文章事件
$push = [];
$push['id'] = $aid;
$push['event'] = 'elecfans.article.edit';
$push['eventTime'] = time();
$push['pushTime'] = time();
//这里需要是jsonobject 不能是 jsonarray
$push['data'] = $pushAsync;
//print_r($push);exit;
$pushQueue->push_topic_queue($push,'elecfansScript',$push['event']);
}
}
$res4 = Network::doRequest($cfg_basehost.'/p/Cachemanagement/delCache',['token' => $shopToken, 'key' => 'newrecommend_list'],'get',[],'http',3000);
$need_send_notice = array_unique($need_send_notice);
//审核时检查 对采集文章,入库后文章标题不修改的标题,不通过提示 add sunjinliang 2019-10-22
if (!empty($noPassIds)) {
$noPassIds = '['. rtrim($noPassIds, ',') . ']';
$msg = '其审核失败:' . $noPassIds . ' (未修改标题, 请修改标题再发布)';
ShowMsg($msg, $ENV_GOBACK_URL,0, 5000);
exit;
}
if ($sTimeRelease) {
ShowMsg("成功审核了指定文档!,其中{$sTimeRelease}为定时发布的文档已自动跳过", $ENV_GOBACK_URL, 0, 5000);
} else {
ShowMsg("成功审核指定的文档!", $ENV_GOBACK_URL);
}
exit();
}
//审核文档,不通过
else if ($dopost == "checkArchivesNotpass") {
CheckPurview('a_Check,a_AccCheck,sys_ArcBatch');
require_once DEDEADMIN . "/inc/inc_archives_functions.php";
if (!empty($aid) && empty($qstr)) {
$qstr = $aid;
}
if ($qstr == '') {
ShowMsg("参数无效!", $ENV_GOBACK_URL);
exit();
}
//文章审核不通过时,不通过原因必填。
$fail_reason = empty($fail_reason) ? '' : htmlspecialchars($fail_reason);
if($fail_reason == ''){
ShowMsg("请填写审核不通过原因");
exit();
}
$arcids = preg_replace("#[^0-9,]#", '', preg_replace("#`#", ',', $qstr));
//获取d/article/apipick接口采集入库的文章 add sunjinliang 2019-10-24
$pickArr = [];
$dsql->SetQuery('SELECT title, aid FROM `#@__picker` WHERE aid IN (' . $arcids . ')');
$dsql->Execute('pick_all');
while ($pickRow = $dsql->GetArray('pick_all')) {
$pickArr[$pickRow['aid']] = $pickRow['title'];
}// end
$need_send_notice = array();
$query = "SELECT arc.id,arc.typeid,arc.arcrank,arc.mid,ch.issystem,ch.maintable,ch.addtable FROM `#@__arctiny` arc
LEFT JOIN `#@__arctype` tp ON tp.id=arc.typeid
LEFT JOIN `#@__channeltype` ch ON ch.id=tp.channeltype
WHERE arc.id in($arcids) ";
$dsql->SetQuery($query);
$dsql->Execute('ckall');
while ($row = $dsql->GetArray('ckall')) {
$aid = $row['id'];
//维护elasticsearch
$article = $dsql->GetOne("SELECT * FROM `#@__archives` Where id = '{$aid}'");
if($article['channel'] == 6){
$shopInfo = $dsql->GetOne("SELECT * FROM `".trim($row['addtable'])."` WHERE aid='$aid'; ");
$bname = $shopInfo['brand'];
//检查brand是否已经存在
$bRow = $dsql->GetOne("SELECT * FROM `#@__company` WHERE `name`='$bname' AND type = 2; ");
if(!$bRow || !$bRow['id']){
ShowMsg("当前文档id:$aid;品牌($bname)不存在,请先到[厂商管理]中添加好产品库品牌".$dsql->GetError(),"-1");
exit;
}
$brandid = $bRow['id'];
//提取summary
$summary = trim(strip_tags(htmlspecialchars_decode($shopInfo['body'])));
$summary = cut_str($summary,500);
$summary = substr($summary,6); //去掉前面的“描述”
$esData = array(
'archives_id' => $aid,
'title' => $article['title'],
'description' => $summary,
'keywords' => $article['keywords'],
'typeid' => $article['typeid'],
'typeid2' => $article['typeid2'],
'brandid' => !empty($brandid) ? $brandid : 0,
'bname'=>!empty($bname) ? $bname : '',
'arcrank'=>-3,
'ismake'=>$article['ismake'],
'pubdate'=>$article['pubdate'],
'senddate'=>$article['senddate'],
'litpic'=>!empty($article["litpic"]) ? $article["litpic"] : '',
'index_time' => time()
);
//由于网络或者其他原因有可能执行失败,记录异常
try {
//覆盖操作,因为并不确定改动了具体哪些字段
$esClient = new EsApi();
$res = $esClient->insertDocment($aid, $esData);
$exceptionMsg = '';
} catch (Exception $e) {
$exceptionMsg = $e->getMessage();
ShowMsg("es搜索引擎报错,请截图给开发人员!当前aid:{$aid},errorMsg:".$exceptionMsg,"-1");
exit;
}
}
//需求:【审核时检查 对采集文章,入库后文章标题不修改的标题 或与原标题相同的则不允许通过】 不通过时需要缓存入库标题 add sunjinliang 2019-10-22
//d/article/apipicker这个接口采集的文章判断
if (!array_key_exists($aid, $pickArr)) {
checkCollectArticleWithTitle($aid, [],$article, ['title' => $article['title'],'arcrank' => -3]);
}//end
$maintable = (trim($row['maintable']) == '' ? '#@__archives' : trim($row['maintable']));
$dsql->ExecuteNoneQuery("UPDATE `#@__arctiny` SET arcrank='-3' WHERE id='$aid' ");
if ($row['issystem'] == -1) {
$dsql->ExecuteNoneQuery("UPDATE `" . trim($row['addtable']) . "` SET arcrank='-3' WHERE aid='$aid' ");
} else {
$sendTime = time();
$dsql->ExecuteNoneQuery("UPDATE `$maintable` SET arcrank='-3', `senddate`={$sendTime},dutyadmin='" . $cuserLogin->getUserID() . "' WHERE id='$aid' ");
}
$dsql->ExecuteNoneQuery("UPDATE `#@__taglist` SET arcrank='-3' WHERE aid='$aid' ");
$pageurl = MakeArt($aid, false);
if(($row['arcrank']>-3)&&(in_array($row['typeid'],[1075,1076]))){
$wx_pick_arr = $dsql->GetOne("SELECT * FROM `#@__wx_mp_list` Where uid = '{$row['mid']}' and type=0");
$admin_arr = $dsql->GetOne("SELECT * FROM `#@__admin` Where id = '{$row['mid']}'");
if(!$admin_arr&&!$wx_pick_arr){
$need_send_notice[$row['mid']][] = $aid ;
}
}
//维护文档主副栏目关系 modify sjl 2023.10.18
$arcTypeid2Logic = new \hqjfmanage\logic\article\ArchivesTypeid2Logic();
$arcTypeid2Logic->updateArcTypeid2($aid, $article['typeid'], $article['typeid2'], -3);
//审核不通过,发送系统消息
if(in_array($article['channel'],[1,3])){
if($article['channel'] == 1){
//添加审核不通过原因
$sql = "INSERT INTO `#@__archives_additional_attribute` (aid,fail_reason) VALUES ($aid, '$fail_reason') ON DUPLICATE KEY UPDATE fail_reason =VALUES (fail_reason)";
$dsql->ExecuteNoneQuery($sql);
sendSystemNotice($article['id'],2,$fail_reason);
}else{
sendSystemNotice($article['id'],2);
}
//发消息
if ( $article['arcrank'] >= 0 ) {
if (empty($elecfans_config['queue']['msg_host'])) {
$elecfans_config = include DEDEROOT . '/webapi/refactoring/config.php';
}
$msg_queue = new MsgQueue(
$elecfans_config['queue']['msg_host'],
$elecfans_config['queue']['msg_port'],
$elecfans_config['queue']['msg_user'],
$elecfans_config['queue']['msg_password'],
$elecfans_config['queue']['msg_name_bbs']
);
//获取uid
$userLogic = new \hqjfmanage\logic\user\UserLogic();
$uid = $userLogic->changeMidToUid($article['mid'], $article['unionid'],$article['channel']);
$memberRepo = new \hqjfmanage\repository\user\MemberRepository();
$userinfo = $memberRepo->getOneByWhere(['uid' => $uid], 'mid,uid,userid');
$username = empty($userinfo['userid']) ? 'noname' : $userinfo['userid'];
if (in_array($article['typeid'], array(1075,1076))) {
$mp_name = $dsql->GetOne("SELECT ch_name FROM `#@__wx_mp_list` WHERE uid='$uid' ");
$username = $mp_name['ch_name'] ? $mp_name['ch_name'] : $username;
}
$arcUrlRepo = new \hqjfmanage\repository\article\ArchivesUrlRepository();
$artUrlInfo = $arcUrlRepo->getOneById($article['id'],'url');
$artUrl = empty($artUrlInfo['url']) ? '' : $artUrlInfo['url'];
$haha = $msg_queue->addToQueue(
$uid,
$username,
$article['id'],
$article['title'],
$article['litpic'],
$artUrl,
'DEL'
);
}
}
$shopToken = md5($shop_token);
$res1 = Network::doRequest($cfg_basehost.'/p/Cachemanagement/delCache',['token' => $shopToken, 'key' => "elecfansshop_index_$aid"],'get',[],'http',3000);
$res2 = Network::doRequest($cfg_basehost.'/p/Cachemanagement/delCache',['token' => $shopToken, 'key' => 'elecfans_addonshop_getcategorylist'],'get',[],'http',3000);
$res3 = Network::doRequest($cfg_basehost.'/p/Cachemanagement/delCache',['token' => $shopToken, 'key' => 'elecfans_shop_company_brandlist'],'get',[],'http',3000);
}
$need_send_notice = array_unique($need_send_notice);
ShowMsg("成功审核指定的文档!", $ENV_GOBACK_URL);
exit();
}
/*--------------------------
//删除文档
function delArchives(){ }
---------------------------*/
else if ($dopost == "delArchives") {
CheckPurview('a_Del,a_AccDel,a_MyDel,sys_ArcBatch');
require_once DEDEINC . "/oxwindow.class.php";
if (empty($fmdo)) {
$fmdo = '';
}
if ($fmdo == 'yes') {
if (!empty($aid) && empty($qstr)) {
$qstr = $aid;
}
if ($qstr == '') {
ShowMsg("参数无效!", $ENV_GOBACK_URL);
exit();
}
$qstrs = explode("`", $qstr);
$okaids = array();
if ($reason == '') {
$reason = $reasonother;
}
$reason = htmlspecialchars($reason);
foreach ($qstrs as $aid) {
//维护elasticsearch
$article = $dsql->GetOne("SELECT * FROM `#@__archives` Where id = '{$aid}'");
if($article['channel'] == 6){
//由于网络或者其他原因有可能执行失败,记录异常
// try {
// $esClient = new EsApi();
// $res = $esClient->delDocument($aid);
// $exceptionMsg = '';
// } catch (Exception $e) {
// $exceptionMsg = $e->getMessage();
// ShowMsg("es搜索引擎报错,请截图给开发人员!当前aid:{$aid},errorMsg:".$exceptionMsg,"-1");
// exit;
// }
}
if (!isset($okaids[$aid])) {
if ($reason != '') {
$dsql->ExecuteNoneQuery("UPDATE `#@__addonsoft` set reason='{$reason}' where aid={$aid} limit 1");
}
DelArc($aid);
} else {
$okaids[$aid] = 1;
}
//删除资料推送提示
sendSystemNotice($article['id'],3);
//维护文档主副栏目关系 modify sjl 2023.10.18
$arcTypeid2Logic = new \hqjfmanage\logic\article\ArchivesTypeid2Logic();
$arcTypeid2Logic->updateArcTypeid2($aid, $article['typeid'], $article['typeid2'],-2);
//维护es索引
$dsql->ExecuteNoneQuery("insert into #@__search_increment (content_id) values ($aid) ");
/*社区化编辑 删除文章时如果是编辑文章,则将发表的文章总是减1 begin*/
$user_index = $dsql->SetQuery("select mid from #@__archives where id ='" . $aid . "' and ftype !=0 ");
$dsql->Execute('uindex');
$user_row = $dsql->GetArray('uindex');
if ($user_row) {
$dsql->ExecuteNoneQuery("update #@__edit_application set art_count=art_count-1 where uid=" . $user_row['mid']);
}
/*社区化编辑 删除文章时如果是编辑文章,则将发表的文章总是减1 end*/
$shopToken = md5($shop_token);
$res1 = Network::doRequest($cfg_basehost.'/p/Cachemanagement/delCache',['token' => $shopToken, 'key' => "elecfansshop_index_$aid"],'get',[],'http',3000);
$res2 = Network::doRequest($cfg_basehost.'/p/Cachemanagement/delCache',['token' => $shopToken, 'key' => 'elecfans_addonshop_getcategorylist'],'get',[],'http',3000);
$res3 = Network::doRequest($cfg_basehost.'/p/Cachemanagement/delCache',['token' => $shopToken, 'key' => 'elecfans_shop_company_brandlist'],'get',[],'http',3000);
$res4 = Network::doRequest($cfg_basehost.'/d/Cachemanagement/delCache',['token' => $shopToken, 'key' => md5("Home\Model\ArchivesModel_Home\Model\ArchivesModel::getDetail_{$aid}lls")],'get',[],'http',3000);
if (in_array($article['channel'], [1,3]) && $article['arcrank'] >= 0 ) {
if (empty($elecfans_config['queue']['msg_host'])) {
$elecfans_config = include DEDEROOT . '/webapi/refactoring/config.php';
}
$msg_queue = new MsgQueue(
$elecfans_config['queue']['msg_host'],
$elecfans_config['queue']['msg_port'],
$elecfans_config['queue']['msg_user'],
$elecfans_config['queue']['msg_password'],
$elecfans_config['queue']['msg_name_bbs']
);
//获取uid
$userLogic = new \hqjfmanage\logic\user\UserLogic();
$uid = $userLogic->changeMidToUid($article['mid'], $article['unionid'],$article['channel']);
$memberRepo = new \hqjfmanage\repository\user\MemberRepository();
$userinfo = $memberRepo->getOneByWhere(['uid' => $uid], 'mid,uid,userid');
$username = empty($userinfo['userid']) ? '' : $userinfo['userid'];
if (in_array($article['typeid'], array(1075,1076))) {
$mp_name = $dsql->GetOne("SELECT ch_name FROM `#@__wx_mp_list` WHERE uid='$uid' ");
$username = $mp_name['ch_name'] ? $mp_name['ch_name'] : $username;
}
$arcUrlRepo = new \hqjfmanage\repository\article\ArchivesUrlRepository();
$artUrlInfo = $arcUrlRepo->getOneById($article['id'],'url');
$artUrl = empty($artUrlInfo['url']) ? '' : $artUrlInfo['url'];
$haha = $msg_queue->addToQueue(
$uid,
$username,
$article['id'],
$article['title'],
$article['litpic'],
$artUrl,
'DEL'
);
}
}
ShowMsg("成功删除指定的文档!", $ENV_GOBACK_URL);
exit();
} else {
$isSoftDel = false;
if (strpos($_SERVER['HTTP_REFERER'], 'content_i_list.php?channelid=3')) {
$isSoftDel = true;
}
if ($isSoftDel === false) {
$doc = $dsql->GetOne("SELECT channel from `#@__archives` where id=$aid limit 1");
if ($doc['channel'] == 3) {
$isSoftDel = true;
}
}
$wintitle = "文档管理-删除文档";
$wecome_info = "文档管理::删除文档";
$win = new OxWindow();
$win->Init("archives_do.php", "js/blank.js", "POST");
$win->AddHidden("fmdo", "yes");
$win->AddHidden("dopost", $dopost);
$win->AddHidden("qstr", $qstr);
$win->AddHidden("aid", $aid);
if ($isSoftDel) {
$reason = array(
array('n' => '打开失败', 'v' => '打开失败'),
array('n' => '解压需要密码', 'v' => '解压需要密码'),
array('n' => '资料不完整', 'v' => '资料不完整'),
array('n' => '资料内容看不清', 'v' => '资料内容看不清'),
array('n' => '资料与电子无关', 'v' => '资料与电子无关'),
array('n' => '资料与标题不符', 'v' => '资料与标题不符'),
array('n' => '营销或广告性质', 'v' => '营销或广告性质'),
array('n' => '侵犯版权', 'v' => '侵犯版权'),
array('n' => '木马病毒', 'v' => '木马病毒'),
array('n' => '其他', 'v' => ''),
);
$win->AddInputSelect('原因', 'reason', $reason);
$win->AddInputText('', 'reasonother', '', '选项中未包含?请在此填写其他原因');
}
$win->AddTitle("你确实要删除“ $qstr 和 $aid ”这些文档?");
$winform = $win->GetWindow("ok");
$win->Display();
}
}
/*-----------------------------
function moveArchives(){ }
------------------------------*/
else if ($dopost == 'moveArchives') {
CheckPurview('sys_ArcBatch');
if (empty($totype)) {
require_once DEDEINC . '/typelink.class.php';
if (!empty($aid) && empty($qstr)) {
$qstr = $aid;
}
AjaxHead();
$channelid = empty($channelid) ? 0 : $channelid;
$tl = new TypeLink($aid);
$typeOptions = $tl->GetOptionArray(0, $admin_catalogs, $channelid);
$typeOptions = "";
//输出AJAX可移动窗体
$divname = 'moveArchives';
echo "