Commit 8ca241d0 authored by hujun's avatar hujun

冻结经纪人

parent cc6dbdf0
...@@ -269,12 +269,26 @@ class Agent extends Basic ...@@ -269,12 +269,26 @@ class Agent extends Basic
} }
} }
$table = new AAgents(); try {
if ($table->saveStatus('status', $data['status'], $ids)) { $m_agent = new AAgents();
return $this->response(200, '成功', $data); if ($m_agent->saveStatus('status', $data['status'], $ids)) {
} else { if ($data['status'] != 0) {
return $this->response(100, '失败', $data); $is_forbidden = 1;
} else {
$is_forbidden = 0;
}
//同时修改设备绑定表
$m_agent_device = new ABindingDevice();
$m_agent_device->updateDate(['is_forbidden'=>$is_forbidden], ['agent_id'=>$ids]);
return $this->response(200, '成功', $data);
} else {
return $this->response(100, '失败', $data);
}
} catch (\Exception $e) {
return $this->response(100, '修改失败' . $e->getMessage(), $data);
} }
} }
/** /**
......
...@@ -128,4 +128,26 @@ class ABindingDevice extends BaseModel ...@@ -128,4 +128,26 @@ class ABindingDevice extends BaseModel
$arr["update_time"] = date("Y-m-d H:i:s", time()); $arr["update_time"] = date("Y-m-d H:i:s", time());
return $arr; return $arr;
} }
/**
* 修改绑定的设备id
*
* @param array $params
* @param $where
* @return int
* @throws \Exception
*/
public function updateDate(array $params, $where): int
{
$bandBin = $this->deviceBin($params);
Db::startTrans();
try {
$mun = $this->where($where)->update($bandBin);
Db::commit();
return $mun;
} catch (\Exception $exception) {
Db::rollback();
throw $exception;
}
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment