paginate([ 'list_rows'=> $get['limit'], 'page'=> $get['page'] ]); return ['count' => $result->total(), 'lists' => $result->getCollection()]; } /** * Notes: 添加 * @param $post * @author 段誉(2021/4/15 10:54) * @return Supplier|\think\Model */ public static function add($shop_id, $post) { return Supplier::create([ 'shop_id' => $shop_id, 'name' => $post['name'], 'contact' => $post['contact'], 'mobile' => $post['mobile'], 'address' => $post['address'], 'remark' => $post['remark'] ?? '', ]); } /** * Notes: 编辑 * @param $post * @author 段誉(2021/4/15 10:54) * @return Supplier */ public static function edit($shop_id, $post) { return Supplier::update([ 'name' => $post['name'], 'contact' => $post['contact'], 'mobile' => $post['mobile'], 'address' => $post['address'], 'remark' => $post['remark'] ?? '', ], ['id' => $post['id'], 'shop_id' => $shop_id]); } /** * Notes: 删除 * @param $id * @author 段誉(2021/4/15 10:54) * @return Supplier */ public static function del($shop_id, $id) { return Supplier::update(['del' => 1], ['id' => $id, 'shop_id' => $shop_id]); } }