'待阅读', 'reading' => '阅读中', 'finished' => '已阅读' ]; public static function getList($readingID) { $list = self::alias('rb') ->leftJoin('book b', 'rb.book_id = b.id') ->leftJoin('category c', 'b.category_id = c.id') ->field('rb.*,b.name as book_name,b.author,c.name as category_name') ->where('rb.reading_id', $readingID) ->order('rb.sort', 'asc') ->select(); return $list->each(function($item){ $item->statusStr = self::$status[$item['status']]; }); } public static function onAfterInsert($model) { $model->sort = $model->id; $model->save(); } }