作者 潘浩文
1 个管道 的构建 通过 耗费 0 秒

后台设备模块开发

... ... @@ -147,7 +147,7 @@ class AdminLightOrderController extends AdminBaseController
$this->assign('temple', $temple);
$area = Db::name('temple_area')->where('temple_id', $data['temple_id'])->select();
$this->assign('area', $area);
$location=json_decode($this->getLocation($id=$data['area_id']),true);
$location=json_decode($this->getLocation($id=$data['area_id'],$lightId=$data['light_id']),true);
$this->assign('location', $location);
$this->assign('list', $data);
... ... @@ -196,7 +196,7 @@ class AdminLightOrderController extends AdminBaseController
}
//获取区域下所有位置
public function getLocation($id="")
public function getLocation($id="",$lightId="")
{
if (empty($id)) {
$id = $this->request->param('id');
... ... @@ -210,8 +210,14 @@ class AdminLightOrderController extends AdminBaseController
}
$is_set = Db::name('light_order')
->alias('lo')
->join('light l','lo.light_id=l.id')
->where(['l.area_id'=> $id,'lo.status'=>1,'lo.end_time'=>['>',time()]])->field('l.row,l.column')->select()->toArray();
->join('light l', 'lo.light_id=l.id')
->where(['l.area_id' => $id, 'lo.status' => 1, 'lo.end_time' => ['>', time()]])->field('l.row,l.column')->select()->toArray();
if (!empty($lightId)) {
$is_set = Db::name('light_order')
->alias('lo')
->join('light l', 'lo.light_id=l.id')
->where(['l.area_id' => $id, 'lo.status' => 1, 'lo.end_time' => ['>', time()], 'l.id' => ['neq', $lightId]])->field('l.row,l.column')->select()->toArray();
}
foreach ($arr as $k=>$v){
foreach ($is_set as $k1=>$v1){
if (array_values($v)==array_values($v1)){
... ...
... ... @@ -240,7 +240,7 @@
$("#area").change(function(){
var one_id=$(this).val();
$.ajax({
url:"{:url('AdminLight/getLocation')}",
url:"{:url('AdminLightOrder/getLocation')}",
Type:"POST",
data:"id="+one_id,
dataType:"json",
... ...