//控制器<?phpnamespace App\Http\Controllers\Flei;use Illuminate\Http\Request;use App\Http\Controllers\Controller;use Illuminate\Support\Facades\DB;class IndexController extends Controller{ /** * 分类首页 */ public function index(){ $sju = DB::table('dbo_cate')->where('pid', 0)->get(); $sju2 = DB::table('dbo_cate') ->where('pid', '!=', 0) ->get(); return view('flei/index', ['list' => $sju, 'erjishu'=>$sju2]); } public function updateyji(Request $request){ $id = $request->input('id'); $text = $request->input('text'); if($text == null){ echo "分类名不能为空"; }else { DB::table('dbo_cate') ->where('cate_id', $id) ->update(['cate_name' => $text]); echo '更改分类名成功'; } } public function updatefeilui(){ $cate_id = $_GET['cate_id']; $f_l = $_GET['f_l']; if($f_l == null){ echo '费率不能为空'; }else { DB::table('dbo_cate') ->where('cate_id', $cate_id) ->update(['sjfl' => $f_l]); echo '更改费率成功'; } } public function insert_erji(){ $pid = $_GET['pid']; $cate_name = $_GET['cate_name']; if($pid == null and $cate_name == null){ echo 'bug请找开发人员'; }else{ DB::table('dbo_cate')->insert([ ['pid' => $pid, 'cate_name' => $cate_name], ]); echo '添加子分类成功'; } } }
添加回答
举报
0/150
提交
取消