作者 anyv
1 个管道 的构建 通过 耗费 1 秒

5

... ... @@ -39,6 +39,15 @@ class SchoolController extends WeChatBaseController{
$class_data[] = $val;
}
}
//获取所有学校
$school_data = Db::name('school') -> select() -> toArray();
foreach ($school_data as $key => $val){
$school_data[$key]['grade'] = Db::name('grade_class') -> where("school_id",$val['id']) -> select() -> toArray();
}
//循环遍历比对
foreach ($school_data as $key => $val){
if()
}
$school['uid'] = cmf_get_current_user_id();
$school['create_time'] = time();
$school['region'] = $_POST['region'];
... ... @@ -59,6 +68,11 @@ class SchoolController extends WeChatBaseController{
}
}else{
$data = Db::name('school') -> select() -> toArray();
foreach ($data as $key => $val){
$data[$key]['grade'] = Db::name('grade_class') -> where("school_id",$val['id']) -> select() -> toArray();
}
dump($data);die;
return $this -> fetch();
}
... ...
... ... @@ -542,11 +542,11 @@
alert('请添加班级');
}else{
$.post("{:url('School/add_school')}",{school:school,type:type,region:region,str:str},function(data){
if(data){
/* if(data){
window.location.href="{:url('School/school')}";
}else{
alert('添加失败!');
}
}*/
});
}
}
... ...