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

后台设备模块开发

... ... @@ -139,10 +139,10 @@ class AdminLightController extends AdminBaseController
array_push($arr, [$r,$c]);
}
}
$is_set = Db::name('light')->where(['area_id'=>$id,'id'=>['neq',$this->request->param('lightId')]])->field('row,column')->select()->toArray();
if (!empty($lightId)) {
$is_set = Db::name('light')->where(['area_id'=> $id,'id'=>['neq',$lightId]])->field('row,column')->select()->toArray();
if (empty($lightId)){
$lightId=$this->request->param('lightId');
}
$is_set = Db::name('light')->where(['area_id'=> $id,'id'=>['neq',$lightId]])->field('row,column')->select()->toArray();
foreach ($arr as $k=>$v){
foreach ($is_set as $k1=>$v1){
if (array_values($v)==array_values($v1)){
... ...
... ... @@ -201,31 +201,13 @@ class AdminLightOrderController extends AdminBaseController
if (empty($id)) {
$id = $this->request->param('id');
}
$data = Db::name('temple_area')->where('id', $id)->find();
$arr = [];
for ($r = 1; $r <= $data['rows']; $r++) {
for ($c = 1; $c <= $data['columns']; $c++) {
array_push($arr, [$r,$c]);
}
if (empty($lightId)){
$lightId=$this->request->param('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()]])->field('l.row,l.column')->select()->toArray();
if (!empty($lightId)) {
$is_set = Db::name('light_order')
$data = 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)){
unset($arr[$k]);
// $arr = array_values($arr);
}
}
}
return json_encode($arr);
return json_encode($data);
}
}
... ...