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 "
\r\n"; echo "
移动文档
\r\n"; echo "
关闭
\r\n"; echo "
\r\n"; echo "
\r\n"; echo "\r\n"; echo "\r\n"; echo "\r\n"; ?>
 目标栏目:
 文档ID:
移动到的目标栏目必须和选定的文档频道类型一致,否则程序会自动勿略不符合的文档。
  
GetOne("SELECT tp.channeltype,tp.ispart,tp.channeltype,ch.maintable,ch.addtable,ch.issystem FROM `#@__arctype` tp LEFT JOIN `#@__channeltype` ch on ch.id=tp.channeltype WHERE tp.id='$totype' "); $idtype = "id"; if (!is_array($typeInfos)) { ShowMsg('参数错误!', '-1'); exit(); } if ($typeInfos['ispart'] != 0) { ShowMsg('文档保存的栏目必须为最终列表栏目!', '-1'); exit(); } if (empty($typeInfos['addtable'])) { $typeInfos['maintable'] = '#@__archives'; } //增加单表模型判断 if ($typeInfos['issystem'] == -1) { $typeInfos['maintable'] = $typeInfos['addtable']; $idtype = "aid"; } $arcids = preg_replace("#[^0-9,]#", '', preg_replace("#`#", ',', $qstr)); $arc = ''; $j = 0; $okids = array(); $dsql->SetQuery("SELECT {$idtype},typeid,typeid2,arcrank FROM `{$typeInfos['maintable']}` WHERE {$idtype} in($arcids) AND channel='{$typeInfos['channeltype']}' "); $dsql->Execute(); $sendTime = time(); while ($row = $dsql->GetArray()) { if ($row['typeid'] != $totype) { $dsql->ExecuteNoneQuery("UPDATE `#@__arctiny` SET typeid='$totype' WHERE id='{$row[$idtype]}' "); $dsql->ExecuteNoneQuery("UPDATE `{$typeInfos['maintable']}` SET typeid='$totype',`senddate`={$sendTime} WHERE id='{$row[$idtype]}' "); $dsql->ExecuteNoneQuery("UPDATE `{$typeInfos['addtable']}` SET typeid='$totype' WHERE aid='{$row[$idtype]}' "); $okids[] = $row[$idtype]; $j++; } } //更新HTML foreach ($okids as $aid) { $arc = new Archives($aid); //维护文档主副栏目关系 modify sjl 2023.10.18 $arcTypeid2Logic = new \hqjfmanage\logic\article\ArchivesTypeid2Logic(); $arcTypeid2Logic->updateArcTypeid2($aid, $totype, $arc->Fields['typeid2'],$arc->Fields['arcrank']); $arc->MakeHtml(); } ShowMsg("成功移动 $j 个文档!", $ENV_GOBACK_URL); exit(); } } /*----------------------------- //还原文档 function RbReturnArchives(){ } ------------------------------*/ else if ($dopost == 'return') { CheckPurview('a_Del,a_AccDel,a_MyDel,sys_ArcBatch'); require_once DEDEINC . "/oxwindow.class.php"; if (!empty($aid) && empty($qstr)) { $qstr = $aid; } if ($qstr == '') { ShowMsg("参数无效!", "recycling.php"); exit(); } $qstrs = explode("`", $qstr); $sendTime = time(); foreach ($qstrs as $aid) { $dsql->ExecuteNoneQuery("UPDATE `#@__archives` SET arcrank='-1',ismake='0',`senddate`={$sendTime} WHERE id='$aid'"); $dsql->ExecuteNoneQuery("UPDATE `#@__arctiny` SET `arcrank` = '-1' WHERE id = '$aid'; "); } ShowMsg("成功还原指定的文档!", "recycling.php"); exit(); } /*----------------------------- //清空文档 function RbClearArchives(){ } ------------------------------*/ else if ($dopost == 'clear') { CheckPurview('a_Del,a_AccDel,a_MyDel,sys_ArcBatch'); require_once DEDEINC . "/oxwindow.class.php"; if (empty($fmdo)) { $fmdo = ''; } $recycle = empty($recycle) ? "" : $recycle; if ($fmdo == 'yes') { if (!empty($aid) && empty($qstr)) { $qstr = $aid; } if ($qstr == '') { ShowMsg("参数无效!", "recycling.php"); exit(); } $qstrs = explode(",", $qstr); $okaids = array(); foreach ($qstrs as $qstr) { if (!isset($okaids[$qstr])) { DelArc($qstr, "OK", false, $recycle); $okaids[$qstr] = $qstr; } else { $okaids[$qstr] = 1; } } ShowMsg("成功删除指定的文档!", "recycling.php"); exit(); } else { $dsql->SetQuery("SELECT id FROM `#@__archives` WHERE `arcrank` = '-2'"); $dsql->Execute(); $qstr = ''; while ($row = $dsql->GetArray()) { $qstr .= $row['id'] . ","; $aid = $row['id']; } $num = $dsql->GetTotalRow(); if (empty($num)) { ShowMsg("对不起,未发现相关文档!", "recycling.php"); exit(); } $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); $win->AddHidden("recycle", $recycle); $win->AddTitle("本次操作将清空回收站所有共 $num 篇文档
你确实要永久删除“ $qstr ”这些文档?"); $winform = $win->GetWindow("ok"); $win->Display(); } } /*----------------------------- //清除文档 function RbDelArchives(){ } ------------------------------*/ else if ($dopost == 'del') { CheckPurview('a_Del,a_AccDel,a_MyDel,sys_ArcBatch'); require_once DEDEINC . "/oxwindow.class.php"; if (empty($fmdo)) { $fmdo = ''; } $recycle = empty($recycle) ? "" : $recycle; if ($fmdo == 'yes') { if (!empty($aid) && empty($qstr)) { $qstr = $aid; } if ($qstr == '') { ShowMsg("参数无效!", "recycling.php"); exit(); } $qstrs = explode("`", $qstr); $okaids = array(); $archivesRepo = new \hqjfmanage\repository\article\ArchivesRepository(); if (empty($elecfans_config['queue']['msg_host'])) { $elecfans_config = include DEDEROOT . '/webapi/refactoring/config.php'; } foreach ($qstrs as $aid) { if (!isset($okaids[$aid])) { DelArc($aid, "OK", "", $recycle); //由通过, 变删除,删除动态 $field = 'id,mid,arcrank,title,litpic,typeid,typeid2,channel,unionid'; $article = $archivesRepo->getOneById($aid,$field); if (in_array($article['channel'], [1,3]) && $article['arcrank'] >= 0 ) { $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' ); } } else { $okaids[$aid] = 1; } } ShowMsg("成功删除指定的文档!", "recycling.php"); exit(); } else { $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); $win->AddHidden("recycle", $recycle); $win->AddTitle("你确实要永久删除“ $qstr 和 $aid ”这些文档?"); $winform = $win->GetWindow("ok"); $win->Display(); } } /*----------------------------- //快速编辑 function quickEdit(){ } ------------------------------*/ else if ($dopost == 'quickEdit') { require_once DEDEADMIN . "/inc/inc_catalog_options.php"; AjaxHead(); $query = "SELECT ch.typename as channelname,ch.addtable,ar.membername as rankname,arc.*,addattr.fail_reason FROM `#@__archives` arc LEFT JOIN `#@__channeltype` ch ON ch.id=arc.channel LEFT JOIN `#@__archives_additional_attribute` addattr ON addattr.aid=arc.id LEFT JOIN `#@__arcrank` ar ON ar.rank=arc.arcrank WHERE arc.id='$aid' "; $arcRow = $dsql->GetOne($query, MYSQL_ASSOC ,'master'); //add sjl20230605 企业号文章不能在主站编辑 if (isset($arcRow['store_flag']) && 15 == $arcRow['store_flag']) { $evipArticleLogic = new \hqjfmanage\logic\evip\EvipArticleLogic(); $html = $evipArticleLogic->quickEditHtml($arcRow); echo $html; return ; } //获取审核失败原因 $arc_reasons = getArchivesReasons(); //获取检测状态 $state = 1; $divname = 'quickEdit'; echo "
\r\n"; echo "
快速属性编辑
\r\n"; echo "
关闭
\r\n"; echo "
\r\n"; echo "
\r\n"; echo "\r\n"; echo "\r\n"; echo "\r\n"; ?> GetOne("select aid,file_flag from `#@__addonsoft` where aid = {$arcRow["id"]}"); $file_flag = ($soft_row['file_flag'] == 2) ? '软件' : '资料'; ?> "; echo ""; echo ""; echo ""; echo ""; echo ""; } ?>
 所属栏目: getUserChannel(), $arcRow['channel'], 'arc'); echo ""; ?>
 属 性: ' /> SetQuery("SELECT * FROM `#@__arcatt` ORDER BY sortid ASC"); $dsql->Execute(); while ($trow = $dsql->GetObject()) { if ($trow->att == 'j' || $trow->att == 'p') { continue; } if ($arcRow['channel'] != 3 && $trow->att == 'o'){ continue; } if (preg_match("#" . $trow->att . "#", $arcRow['flag'])) { echo "{$trow->attname}.{$trow->att}"; } else { echo "{$trow->attname}.{$trow->att}"; } } ?>
 类型:
 标 题:
 SEO标题:
 阅读权限: 需要金币:" style="width:80px" />
 关键字:
 内容检测:{$checkArtRes['text']}
 图片检测:{$checkArtRes['img']}
  
getUserID()); } } $title = htmlspecialchars(cn_substrR($title, $cfg_title_maxlen)); $shorttitle = cn_substrR($shorttitle, 36); $keywords = trim(cn_substrR($keywords, 60)); $file_flag = isset($file_flag) ? $file_flag : 0; if (!TestPurview('a_Check,a_AccCheck,a_MyCheck')) { $arcrank = -1; } $article_orgin = $dsql->GetOne("SELECT id,arcrank,mid,channel,litpic,title,flag,store_flag,recommend_date,typeid,typeid2,unionid FROM `#@__archives` WHERE id='$aid' ", MYSQL_ASSOC, 'master'); //add sjl20230605 企业号文章不能在主站编辑 if (15 == $article_orgin['store_flag']) { ShowMsg("企业号文章/方案|资料禁止编辑", "-1"); exit(); } $adminid = $cuserLogin->getUserID(); //属性处理 $flag = isset($flags) ? join(',', $flags) : ''; if (!empty($flag)) { if (preg_match("#p#", $oldflag)) { $flag .= ',p'; } if (preg_match("#j#", $oldflag)) { $flag .= ',j'; } } //审核时检查 对采集文章,入库后文章标题不修改的标题 或与原标题相同的则不允许通过 add sunjinliang 2019-10-17 //d/article/apipicker这个接口采集的文章判断 $pickInfo = $dsql->GetOne('SELECT title FROM `#@__picker` where aid = ' . $aid . ' LIMIT 1'); $checkRes = checkCollectArticleWithTitle($aid, $pickInfo,$article_orgin, ['title' => $title,'arcrank' => $arcrank]); if (!$checkRes) { ShowMsg("未修改标题, 请修改标题再发布", "-1"); exit(); }//end //文章审核不通过时,不通过原因必填。 $fail_reason = empty($fail_reason) ? '' : htmlspecialchars($fail_reason); if(($article_orgin['channel'] == 1) && ($arcrank == -3) && empty($fail_reason)){ ShowMsg("请填写审核不通过原因"); exit(); } //modify 推荐时间 $topRepository = new \hqjfmanage\repository\article\ArchivesTopRepository(); $where = ['aid' => $aid, 'is_valid' => 1]; $oldTopInfo = $topRepository->getOneByWhere($where,'id'); $isValid = empty($oldTopInfo) ? 0 : 1; $archivesLogic = new \hqjfmanage\logic\article\ArchivesLogic(); $recommend_date = $archivesLogic->getRecommendTime($aid,$isValid, $flag); //edit 推荐时间 if(strstr($article_orgin['flag'],'z') !== false){ $flag = empty($flag) ? 'z' : $flag.',z'; } if(stripos($flag,'c') !== false && stripos($article_orgin['flag'],'c') ===false ){ //文章被设置为推荐时发送信息 $res = Setcredits($article_orgin['mid'],$aid,$article_orgin['title'],"TJL","first_recommendation"); $msg = ""; if($res){ $msg = "获得积分+2"; } $url = GetArcUrl($aid); $subject = "您发布的文章《{$article_orgin['title']}》已管理员设为推荐!{$msg} 查看,跳转进入文章详情页"; $message = "查看"; abc_sendSystemNoticeNew($article_orgin['mid'], $subject, $message); } $sendTime = time(); $query = "UPDATE `#@__archives` SET typeid = '$typeid', flag = '$flag', recommend_date = $recommend_date, arcrank = '$arcrank', money = '$money', title = '$title', senddate = '$sendTime', shorttitle = '$shorttitle', keywords = '$keywords', dutyadmin = '$adminid' WHERE id = '$aid'; "; //审核未通过 if ($arcrank == -3) { //添加审核不同原因 $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($aid, 2,$fail_reason); } //审核通过 if ($arcrank == 0 && ($article_orgin['arcrank'] == -1)) { sendSystemNotice($aid, 1); Setcredits($article_orgin['mid'],$article_orgin['id'],$article_orgin['title'],"ACT","article"); } //更新主表 if ($dsql->ExecuteNoneQuery($query)) { //采集文章审核通过后 移除入库原标题缓存 add sunjinliang 2019-10-18 if (empty($pickInfo) && strpos($article_orgin['flag'], 'g') !== false) { removeCollectArtOriginTitleCache($id, $article_orgin['arcrank'], $arcrank); }// end } //更新微表 $dsql->ExecuteNoneQuery(" UPDATE `#@__arctiny` SET typeid='$typeid',arcrank='$arcrank' WHERE id='$aid' "); //更新附加表 if ($typeid != $oldtypeid) { $addtable = trim($addtable); if (empty($addtable)) { $addtable = '#@__addonarticle'; } else { $addtable = preg_replace("#[^a-z0-9__#@-]#i", "", $addtable); } $dsql->ExecuteNoneQuery(" UPDATE `$addtable` SET typeid='$typeid' WHERE aid='$aid' "); } //维护文档主副栏目关系 modify sjl 2023.10.18 $arcTypeid2Logic = new \hqjfmanage\logic\article\ArchivesTypeid2Logic(); $arcTypeid2Logic->updateArcTypeid2($aid, $typeid, $article_orgin['typeid2'],$arcrank); //文档属性关系 $arcFlagLogic = new \hqjfmanage\logic\article\ArcFlagLogic(); $arcFlagLogic->updateArcFlag($aid, $flag); //如果是资料,更新资料属性表 if(($article_orgin['channel'] == 3) && ($file_flag > 0)){ $dsql->ExecuteNoneQuery("update #@__addonsoft set file_flag=$file_flag where aid ='" . $aid . "'"); } //更新HTML $artUrl = MakeArt($aid, true, true); if ($arcrank>=0 && $article_orgin['arcrank']<0 && in_array($article_orgin['channel'],[1,3]) ) { // 推送到BBS个人主页动态 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_orgin['mid'], $article_orgin['unionid'],$article_orgin['channel']); $memberRepo = new \hqjfmanage\repository\user\MemberRepository(); $userinfo = $memberRepo->getOneByWhere(['uid' => $uid], 'mid,uid,userid'); $username = empty($userinfo['userid']) ? '' : $userinfo['userid']; if (in_array($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; } //对比url $arcUrlRepository = new \hqjfmanage\repository\article\ArchivesUrlRepository(); $info = $arcUrlRepository->getOneById($aid,'url'); if (!empty($info['url']) && $artUrl != $info['url']) { $artUrl = $info['url']; } $litpic = $article_orgin['litpic']; $haha = $msg_queue->addToQueue( $uid, $username, $aid, $title, $litpic, $artUrl ); } //原来是开放浏览的文章,如果设置成不开放浏览,推送到队列把相关文章动态删除 if ($arcrank<0 && $article_orgin['arcrank']>=0 && in_array( $article_orgin['channel'],[1,3])) { 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_orgin['mid'], $article_orgin['unionid'],$article_orgin['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($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_orgin['id'],'url'); $artUrl = empty($artUrlInfo['url']) ? '' : $artUrlInfo['url']; $haha = $msg_queue->addToQueue( $uid, $username, $article_orgin['id'], $article_orgin['title'], $article_orgin['litpic'], $artUrl, 'DEL' ); } $backurl = !empty($_COOKIE['ENV_GOBACK_URL']) ? $_COOKIE['ENV_GOBACK_URL'] : '-1'; ShowMsg('成功更新一篇文档的基本信息!', $backurl); exit(); } /*-------------------------- 分析并自动获取文档关键词 function makekw(){ } --------------------------*/ else if ($dopost == "makekw") { include_once DEDEINC . '/splitword.class.php'; CheckPurview('a_Commend,sys_ArcBatch'); if (!empty($aid) && empty($qstr)) { $qstr = $aid; } if ($qstr == '') { ShowMsg("参数无效!", $ENV_GOBACK_URL); exit(); } $sp = new SplitWord($cfg_soft_lang, $cfg_soft_lang); $arcids = preg_replace("#[^0-9,]#", '', preg_replace("#`#", ',', $qstr)); $query = "SELECT arc.*, addt.* From `#@__archives` arc LEFT JOIN `#@__addonarticle` addt ON addt.aid=arc.id WHERE arc.id in($arcids) AND arc.channel=1 "; $dsql->SetQuery($query); $dsql->Execute(); $sendTime = time(); while ($row = $dsql->GetArray()) { //跳过已经有关键字的内容 if (trim($row['keywords']) != '') { continue; } $aid = $row['id']; $keywords = ''; $title = $row['title']; $description = $row['description']; $description = trim($description); $body = cn_substr($row['body'], 5000); $sp->SetSource($title, $cfg_soft_lang, $cfg_soft_lang); $sp->StartAnalysis(); $titleindexs = preg_replace("/#p#|#e#/", '', $sp->GetFinallyIndex()); $sp->SetSource(Html2Text($body), $cfg_soft_lang, $cfg_soft_lang); $sp->StartAnalysis(); $allindexs = preg_replace("/#p#|#e#/", '', $sp->GetFinallyIndex()); if (is_array($allindexs) && is_array($titleindexs)) { foreach ($titleindexs as $k => $v) { if (strlen($keywords . $k) >= 60) { break; } else { if (strlen($k) <= 2) { continue; } $keywords .= $k . ','; } } foreach ($allindexs as $k => $v) { if (strlen($keywords . $k) >= 60) { break; } else if (!in_array($k, $titleindexs)) { if (strlen($k) <= 2) { continue; } $keywords .= $k . ','; } } } $description = str_replace(' ', ' ', trim($description)); $description = str_replace('[', ' ', $description); $description = str_replace(']', ' ', $description); $description = preg_replace("#[ \r\n\t]{1,}#is", ' ', $description); $description = str_replace('关键字', '', $description); $description = str_replace('关键词', '', $description); $description = addslashes($description); $dsql->ExecuteNoneQuery(" UPDATE `#@__archives` SET `keywords`='$keywords',`description`='$description',`senddate`={$sendTime} WHERE id='{$aid}' "); } $sp = null; ShowMsg("成功分析指定文档的关键词!", $ENV_GOBACK_URL); exit(); } /*-------------------------- //批量增加属性 function attsAdd(){ } ---------------------------*/ else if ($dopost == 'attsAdd') { CheckPurview('a_Commend,sys_ArcBatch'); if (!empty($aid) && empty($qstr)) { $qstr = $aid; } if ($qstr == '') { ShowMsg("参数无效!", $ENV_GOBACK_URL); exit(); } if (empty($flagname) && empty($typeid2)) { ShowMsg("必须指定要添加的属性!", $ENV_GOBACK_URL); exit(); } $need_push_arr = array(); $arcids = preg_replace("#[^0-9,]#", '', preg_replace("#`#", ',', $qstr)); $query = "SELECT arc.id,arc.typeid,arc.channel,arc.arcrank,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']; if ($row['issystem'] != -1) { $maintable = (trim($row['maintable']) == '' ? '#@__archives' : trim($row['maintable'])); $arr = $dsql->GetOne("SELECT flag FROM `{$maintable}` WHERE id='$aid' "); $flag = ($arr['flag'] == '' ? $flagname : $arr['flag'] . ',' . $flagname); //modify 推荐时间 $topRepository = new \hqjfmanage\repository\article\ArchivesTopRepository(); $where = ['aid' => $aid, 'is_valid' => 1]; $oldTopInfo = $topRepository->getOneByWhere($where,'id'); $isValid = empty($oldTopInfo) ? 0 : 1; $archivesLogic = new \hqjfmanage\logic\article\ArchivesLogic(); $recommend_date = $archivesLogic->getRecommendTime($aid,$isValid, $flag); //edit 推荐时间 $dsql->ExecuteNoneQuery(" UPDATE `{$maintable}` SET `flag`='$flag',`senddate`={$sendTime},`recommend_date`={$recommend_date} WHERE id='{$aid}' "); //通过审核的文章首次设置为熊掌号提交到百度 if(($row['channel']==1)&&($row['arcrank']>-1)){ if(strpos($arr['flag'],'x')===false){ if($flagname == 'x'){ $need_push_arr[] = $aid; } } } } else { $maintable = trim($row['addtable']); $arr = $dsql->GetOne("SELECT typeid2,flag FROM `{$maintable}` WHERE aid='$aid' "); $flag = ($arr['flag'] == '' ? $flagname : $arr['flag'] . ',' . $flagname); $dsql->ExecuteNoneQuery(" UPDATE `{$maintable}` SET `flag`='$flag',`senddate`={$sendTime},`recommend_date`={$recommend_date} WHERE aid='{$aid}' "); } //文档属性关系 $arcFlagLogic = new \hqjfmanage\logic\article\ArcFlagLogic(); $arcFlagLogic->updateArcFlag($aid, $flag); // 看点属性增加id到看点表,提高拉取数据的性能 if ($flagname == 'k') { $focus = $dsql->GetOne("SELECT aid from `#@__app_article` where aid={$aid} limit 1"); if (!$focus) { $dsql->ExecuteNoneQuery("INSERT INTO `#@__app_article`(aid) values({$aid})"); } } if ($typeid2) { $thtypeid2 = $arr['typeid2'] ? explode(',', $arr['typeid2']) : array(); $thtypeid2[] = $typeid2; $thtypeid2 = implode(',', array_unique($thtypeid2)); if ($thtypeid2 != $arr['typeid2']) { $dsql->ExecuteNoneQuery(" UPDATE `{$maintable}` SET `typeid2`='$thtypeid2',`senddate`={$sendTime} WHERE id='{$aid}' "); $dsql->ExecuteNoneQuery(" UPDATE `#@__arctiny` SET `typeid2`='$thtypeid2' WHERE id='{$aid}' "); //维护文档主副栏目关系 modify sjl 2023.10.18 $arcTypeid2Logic = new \hqjfmanage\logic\article\ArchivesTypeid2Logic(); $arcTypeid2Logic->updateArcTypeid2($aid, $row['typeid'], $thtypeid2,$row['arcrank']); } } } $is_online = 0; if(strpos($_SERVER['HTTP_HOST'], 'elecfans.com')!==false){ $is_online = 1; } if($need_push_arr&&$is_online){ //熊掌号推送 push_content_to_baidu($need_push_arr); } ShowMsg("成功对选中文档增加指定的属性!", $ENV_GOBACK_URL); exit(); } /*-------------------------- //批量删除属性 function attsDel(){ } ---------------------------*/ else if ($dopost == 'attsDel') { CheckPurview('a_Commend,sys_ArcBatch'); if (!empty($aid) && empty($qstr)) { $qstr = $aid; } if ($qstr == '') { ShowMsg("参数无效!", $ENV_GOBACK_URL); exit(); } if (empty($flagname)) { 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']; if ($row['issystem'] != -1) { $idname = 'id'; $maintable = (trim($row['maintable']) == '' ? '#@__archives' : trim($row['maintable'])); $arr = $dsql->GetOne("SELECT flag FROM `{$maintable}` WHERE id='$aid' "); } else { $idname = 'aid'; $maintable = trim($row['addtable']); $arr = $dsql->GetOne("SELECT flag FROM `{$maintable}` WHERE aid='$aid' "); } $flag = $arr['flag']; if (trim($flag) == '' || !preg_match("#" . $flagname . "#", $flag)) { continue; } else { $flags = explode(',', $flag); $okflags = array(); foreach ($flags as $f) { if ($f != $flagname) { $okflags[] = $f; } } } $flag = trim(join(',', $okflags)); $set = "`flag`='$flag',`senddate`={$sendTime}"; if ($row['issystem'] != -1) { //modify 推荐时间 $topRepository = new \hqjfmanage\repository\article\ArchivesTopRepository(); $where = ['aid' => $aid, 'is_valid' => 1]; $oldTopInfo = $topRepository->getOneByWhere($where,'id'); $isValid = empty($oldTopInfo) ? 0 : 1; $archivesLogic = new \hqjfmanage\logic\article\ArchivesLogic(); $recommend_date = $archivesLogic->getRecommendTime($aid,$isValid, $flag); //edit 推荐时间 $set .= ',recommend_date=' . $recommend_date; } $dsql->ExecuteNoneQuery(" UPDATE `{$maintable}` SET `flag`='$flag',`senddate`={$sendTime} WHERE {$idname}='{$aid}' "); //文档属性关系 $arcFlagLogic = new \hqjfmanage\logic\article\ArcFlagLogic(); $arcFlagLogic->updateArcFlag($aid, $flag); // 看点属性增加id到看点表,提高拉取数据的性能 if ($flagname == 'k') { $focus = $dsql->GetOne("SELECT aid from `#@__app_article` where aid={$aid} limit 1"); if ($focus) { $dsql->ExecuteNoneQuery("DELETE FROM `#@__app_article` where aid={$aid} limit 1"); } } } ShowMsg("成功对选中文档删除指定的属性!", $ENV_GOBACK_URL); exit(); } /*-------------------------- //获得批量属性处理的AJAX窗体 function attsDlg(){ } ---------------------------*/ else if ($dopost == 'attsDlg') { if (!empty($aid) && empty($qstr)) { $qstr = $aid; } $dojobname = ($dojob == 'attsDel' ? '批量删除属性' : '批量增加属性'); AjaxHead(); //输出AJAX可移动窗体 $divname = 'attsDlg'; echo "
\r\n"; echo "
{$dojobname}
\r\n"; echo "
关闭
\r\n"; echo "
\r\n"; echo "
\r\n"; echo "\r\n"; echo "\r\n"; echo "\r\n"; ?>
 属 性: ' /> SetQuery("SELECT * FROM `#@__arcatt` ORDER BY sortid ASC"); $dsql->Execute(); while ($trow = $dsql->GetObject()) { if ($trow->att == 'j' || $trow->att == 'p') { continue; } echo "{$trow->attname}.{$trow->att}"; } ?>
 文档ID:
 副栏目ID:
  
\r\n"; echo "
栏目快速选择器
\r\n"; echo "
关闭
\r\n"; echo "\r\n"; $tus = new TypeUnitSelector(); ?>
ListAllType($channelid); ?>
  
ExecuteNoneQuery($query)) { $res['code'] = -2; $res['msg'] = '系统错误,请联系管理员'; } else { $res['code'] = 0; $res['msg'] = '执行成功'; } echo json_encode($res); die(); } //取消推荐 else if ($dopost == 'unrecommend') { if($channel == 3){ $id = intval($id); if($id <= 0){ $res['code'] = -3; $res['msg'] = '参数错误'; echo json_encode($res); die(); } $weight_num = intval($weight_num); $query = "update `#@__addonsoft` set weight_num = 0 where aid = $id "; // echo $query;die(); if (!$dsql->ExecuteNoneQuery($query)) { $res['code'] = -2; $res['msg'] = '系统错误,请联系管理员'; } else { $res['code'] = 0; $res['msg'] = '执行成功'; } echo json_encode($res); die(); } } else if ($dopost == 'getRedirectData') { if($channel == 1){ $filename = 'article.csv'; $addtable = 'elecfans_addonarticle'; }elseif($channel == 3){ $filename = 'soft.csv'; $addtable = 'elecfans_addonsoft'; }else{ echo '类型错误'; die(); } $output = fopen('php://output', 'w+'); header('Content-Type: application/csv'); header('Content-Disposition: attachment; filename="' . $filename . '"'); //文件头 $arrkeys = array( iconv('utf-8', 'gb2312', 'ID'), iconv('utf-8', 'gb2312', '文章标题'), iconv('utf-8', 'gb2312', '更新时间'), iconv('utf-8', 'gb2312', '生成状态'), iconv('utf-8', 'gb2312', '权限'), iconv('utf-8', 'gb2312', '发布方式'), iconv('utf-8', 'gb2312', '发布人'), iconv('utf-8', 'gb2312', '文章原链接'), iconv('utf-8', 'gb2312', '文章跳转链接'), ); fputcsv($output, $arrkeys); $query = " SELECT a.id, a.title, a.senddate, a.ismake, a.typeid, a.store_flag, a.channel, a.arcrank, a.flag, a.arc_from, a.mid, a.money, a.filename, c.namerule, c.typedir, c.moresite, c.siteurl, c.sitepath FROM elecfans_archives a JOIN elecfans_arctype c ON a.typeid = c.id where (ismake = 0 and arcrank = 0 and typeid!=1075) or (ismake = 1 and arcrank = -1) or ismake = -1 ;"; $dsql->SetQuery($query); $dsql->Execute(); while ($row = $dsql->GetArray()) { $postType = getArticlePostType($row); $memberName = GetMemberName($row['mid']); switch ($row['arcrank']){ case 0: $arcrank = '开放浏览';break; case -1: $arcrank = '待审核稿件';break; case -3: $arcrank = '审核未通过';break; default: $arcrank = '其他';break; } $url = GetFileUrl ( $row['id'], $row['typeid'], $row['senddate'], $row['title'], $row['ismake'], $row['arcrank'], $row['namerule'], $row['typedir'], $row['money'], $row['filename'], $row['moresite'], $row['siteurl'], $row['sitepath'] ); $arrkeys = array( $row['id'], iconv('utf-8', 'gb2312', $row['title']), date('Y-m-d H:i:s', $row['senddate']), iconv('utf-8', 'gb2312', $row['ismake']), iconv('utf-8', 'gb2312', $arcrank), iconv('utf-8', 'gb2312', $postType), iconv('utf-8', 'gb2312', $memberName), iconv('utf-8', 'gb2312', $url), iconv('utf-8', 'gb2312', $row['redirecturl']), ); fputcsv($output, $arrkeys); } fclose($output) or die("can't close "); die(); } else if ($dopost == 'getArchivesReasons') { $reasons = getArchivesReasons(); echo json_encode($reasons, JSON_UNESCAPED_UNICODE); exit(); } function getArchivesReasons() { $reasons = [ '请选择', '广告内容,质量不佳,分享您在电子方面经验或技术,更容易获得推荐。', '广告文章,内容方向不符合我网要求。', '广告文章,内容方向不符合我网要求,同时涉及不正当竞争。', '文章内容方向不符合我网要求,质量不佳,分享您在电子方面经验或技术,更容易获得推荐。', '文章内容方向不符合我网要求,分享您在电子方面经验或技术,更容易获得推荐。', '文章内容涉嫌违法。', '文章内容质量不佳,文章内容重复度过高,分享您在电子方面经验或技术,更容易获得推荐。', '文章内容质量不佳,分享您在电子方面经验或技术,更容易获得推荐。', '文章重复发布。', '图片显示不正常,请截图重新上传。', '文章内容时效性已过期。', '文章语言不符合我网要求,请翻译后重新上传。', ]; return $reasons; } function Setcredits($uid,$archives_id,$title,$operation,$action){ global $cfg_bbs_domain; $url = $cfg_bbs_domain . '/home.php?mod=misc&ac=credit&op=elecfans_credits&action=action'; $params = ['uid'=>$uid,'archives_id'=> $archives_id,'title'=>$title,'operation'=> $operation,'action'=> $action,"op"=>'elecfans_credits']; $data = Network::doRequest($url,$params,'POST',[],'https',3000); $res = json_decode($data['data'],1); if($res['data'] != 'lq'){ return true; } return false; } ?>