Skip to content

Commit 312139c

Browse files
committed
fix(news): 修复撤销投稿 SQL 报错
thinksns-plus-android/issues#2402
1 parent f8cd28e commit 312139c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

packages/slimkit-plus-news/src/API2/Controllers/ContributeController.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,9 @@ public function destroy(
330330

331331
return $category->getConnection()->transaction(function () use ($news, $response, $user) {
332332
if ($news->audit_status == 0) { // 已发布的需提交后台申请删除
333-
$news->applylog()->firstOrCreate(['user_id' => $user->id, 'news_id' => $news->id], ['status' => 0]);
333+
$news
334+
->applylog()
335+
->firstOrCreate(['user_id' => $user->id], ['status' => 0]);
334336

335337
return $response->make(['message' => '删除申请已提交,请等待审核'], 201);
336338
}

packages/slimkit-plus-news/src/Models/News.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public function tags()
159159
*/
160160
public function applylog()
161161
{
162-
return $this->hasOne(NewsApplyLog::class, 'id', 'news_id');
162+
return $this->hasOne(NewsApplyLog::class, 'news_id', 'id');
163163
}
164164

165165
/**

0 commit comments

Comments
 (0)