public function a(Request $request){
//获取指定的id
$id = $request->id;
$rs=R::find($id);
//仓库中
$re=$rs->rfid;
//判断仓库中的是否与数据库的rf在线的是否相等
$ws= G::where('rfid','=',$re)->first();
if($ws){
return response()->json(['status'=>0,'msg'=>'不成功']);
}
//导入数据
$sql=DB::insert("insert into gs( g ,id,created_at,updated_at) values (?,?,?,?)",
[$rs->p,$rs->r,$rs->creat,$rs->up]);
// 成功删除
if($sql){
$rs->delete();
return ['status'=>1,'msg'=>'成功'];
}else{
return response()->json(['status'=>0,'msg'=>'不成功']);
}
script>
$(".change").click(function () {
var id = $(this).data("id");
if(confirm("确定xxx")){
$.ajax({
url: '/',
type: 'get',
data: {'id':id},
success: function (res) {
if (res.status == 0) {
layer.msg(res.msg);
} else {
layer.msg(res.msg, {icon: 1}, function () {
location.href = '要跳转的页面';
});
}
}
});
}
});