履行以下脚本的时分请 先备份数据库!文本寄存的新闻正文字段不可用!

新闻正文字段作为主表的状况用以下句子:

updatephome_ecms_newssettitlepic=concat(replace(SUBSTRING_INDEX(SUBSTRING_INDEX(newstext,'src=',-1),'.gif',1),'"',''),'.gif')wherenewstextlike'%.gif%'andtitlepic='';
updatephome_ecms_newssettitlepic=concat(replace(SUBSTRING_INDEX(SUBSTRING_INDEX(newstext,'src=',-1),'.jpg',1),'"',''),'.gif')wherenewstextlike'%.jpg%'andtitlepic='';
updatephome_ecms_newssettitlepic=concat(replace(SUBSTRING_INDEX(SUBSTRING_INDEX(newstext,'src=',-1),'.png',1),'"',''),'.png')wherenewstextlike'%.png%'andtitlepic='';

新闻正文字段作为副表的状况用以下句子:

update[!db.pre!]ecms_news_data_1a,[!db.pre!]ecms_newsbsetb.titlepic=concat(replace(SUBSTRING_INDEX(SUBSTRING_INDEX(a.newstext,'src=',-1),'.gif',1),'"',''),'.gif')wherea.newstextlike'%.gif%'andb.titlepic=''anda.id=b.id;
update[!db.pre!]ecms_news_data_1a,[!db.pre!]ecms_newsbsetb.titlepic=concat(replace(SUBSTRING_INDEX(SUBSTRING_INDEX(a.newstext,'src=',-1),'.jpg',1),'"',''),'.jpg')wherea.newstextlike'%.jpg%'andb.titlepic=''anda.id=b.id;
update[!db.pre!]ecms_news_data_1a,[!db.pre!]ecms_newsbsetb.titlepic=concat(replace(SUBSTRING_INDEX(SUBSTRING_INDEX(a.newstext,'src=',-1),'.png',1),'"',''),'.png')wherea.newstextlike'%.png%'andb.titlepic=''anda.id=b.id;


声明:有的资源均来自网络转载,版权归原作者所有,如有侵犯到您的权益 请联系邮箱:123456@qq.com 我们将配合处理!

原文地址:帝国CMS批量设置正文第一张图片为缩略图方法发布于2022-07-02 07:43:30

相关推荐