where('channel_id', $data['channel_id'])->first(); if ($old) { $old->subscribe_chapter_id = $data['subscribe_chapter_id']; $old->save(); return $old; } else { return self::create($data); } } /** * 查询渠道设置的书籍的强关章节序号 * $book_id:书本id * $channelId:渠道id */ public static function getSubcribleChapter($book_id, $channelId) { return self::select('subscribe_chapter_id')->where('book_id', $book_id)->where('channel_id', $channelId)->first(); } }