0]) ->order('sort') ->paginate([ 'list_rows'=> $get['limit'], 'page'=> $get['page'] ]); return ['count' => $result->total(), 'lists' => $result->getCollection()]; } /** * Notes: 添加 * @param $post * @return GoodsUnit|\think\Model *@author 段誉(2021/4/15 10:54) */ public static function addUnit($post) { return GoodsUnit::create([ 'name' => $post['name'], 'sort' => $post['sort'] ?? 100, ]); } /** * Notes: 编辑 * @param $post * @return GoodsUnit *@author 段誉(2021/4/15 10:54) */ public static function editUnit($post) { return GoodsUnit::update([ 'name' => $post['name'], 'sort' => $post['sort'] ?? 100 ], ['id' => $post['id']]); } /** * Notes: 删除 * @param $id * @return GoodsUnit *@author 段誉(2021/4/15 10:54) */ public static function del($id) { return GoodsUnit::update(['del' => 1], ['id' => $id]); } }