测试问题修改
This commit is contained in:
@@ -256,8 +256,9 @@ class Contribute extends Base
|
|||||||
$aCorresponding = empty($aParam['corresponding']) ? [] : array_column($aParam['corresponding'], null,'name');
|
$aCorresponding = empty($aParam['corresponding']) ? [] : array_column($aParam['corresponding'], null,'name');
|
||||||
//查询文章作者
|
//查询文章作者
|
||||||
$aWhere = ['article_id' => $iArticleId,'state' => 0];
|
$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');
|
$aAuthorNameList = empty($aAuthorList) ? [] : array_column($aAuthorList, 'firstname');
|
||||||
|
$iMaxSort = empty($aAuthorList) ? 0 : max(array_column($aAuthorList, 'sort'));
|
||||||
foreach ($aAuthor as $key => $value) {
|
foreach ($aAuthor as $key => $value) {
|
||||||
if(empty($iArticleId)){
|
if(empty($iArticleId)){
|
||||||
break;
|
break;
|
||||||
@@ -317,9 +318,12 @@ class Contribute extends Base
|
|||||||
$value['email'] = empty($aCorresponding[$value['name']]['email']) ? '' : $aCorresponding[$value['name']]['email'];
|
$value['email'] = empty($aCorresponding[$value['name']]['email']) ? '' : $aCorresponding[$value['name']]['email'];
|
||||||
$value['article_id'] = $iArticleId;
|
$value['article_id'] = $iArticleId;
|
||||||
unset($value['name'],$value['company_id']);
|
unset($value['name'],$value['company_id']);
|
||||||
|
$iMaxSort++;
|
||||||
|
$value['sort'] = $iMaxSort;
|
||||||
$aAuthorData[] = $value;
|
$aAuthorData[] = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!empty($aAuthorData)){
|
if(!empty($aAuthorData)){
|
||||||
$author_result = DB::name('article_author')->insertAll($aAuthorData);
|
$author_result = DB::name('article_author')->insertAll($aAuthorData);
|
||||||
if(empty($author_result)){
|
if(empty($author_result)){
|
||||||
|
|||||||
Reference in New Issue
Block a user