From e54f390877c0a9f0af3b3a372f57d6940f542a73 Mon Sep 17 00:00:00 2001 From: chengxl Date: Thu, 6 Nov 2025 20:36:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E9=97=AE=E9=A2=98=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/controller/Contribute.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/application/api/controller/Contribute.php b/application/api/controller/Contribute.php index 6f2aedb..e911669 100644 --- a/application/api/controller/Contribute.php +++ b/application/api/controller/Contribute.php @@ -256,8 +256,9 @@ class Contribute extends Base $aCorresponding = empty($aParam['corresponding']) ? [] : array_column($aParam['corresponding'], null,'name'); //查询文章作者 $aWhere = ['article_id' => $iArticleId,'state' => 0]; - $aAuthorList = Db::name('article_author')->field('art_aut_id,firstname')->where($aWhere)->select(); + $aAuthorList = Db::name('article_author')->field('art_aut_id,firstname,sort')->where($aWhere)->select(); $aAuthorNameList = empty($aAuthorList) ? [] : array_column($aAuthorList, 'firstname'); + $iMaxSort = empty($aAuthorList) ? 0 : max(array_column($aAuthorList, 'sort')); foreach ($aAuthor as $key => $value) { if(empty($iArticleId)){ break; @@ -317,9 +318,12 @@ class Contribute extends Base $value['email'] = empty($aCorresponding[$value['name']]['email']) ? '' : $aCorresponding[$value['name']]['email']; $value['article_id'] = $iArticleId; unset($value['name'],$value['company_id']); + $iMaxSort++; + $value['sort'] = $iMaxSort; $aAuthorData[] = $value; } } + if(!empty($aAuthorData)){ $author_result = DB::name('article_author')->insertAll($aAuthorData); if(empty($author_result)){