Commit 9e6ef4fb authored by clone's avatar clone

1

parent 5ec78f1e
......@@ -66,6 +66,32 @@ class ABindingDevice extends BaseModel
* @return false|\PDOStatement|string|\think\Collection
*/
public function getDeviceByAgentId(array $params, string $field = "id,agent_id,device_id,is_forbidden,model,push_id,is_pc")
{
$where_ = [];
if (isset($params["agent_id"])) {
$where_["agent_id"] = $params["agent_id"];
}
try {
$data = $this
->field($field)
->where($where_)
->order("update_time desc")
->limit(5)
->select();
} catch (\Exception $e) {
$data = [];
}
return $data;
}
/**
* 根据经纪人id获取绑定过的设备id
*
* @param array $params
* @param string $field
* @return false|\PDOStatement|string|\think\Collection
*/
public function getDeviceNewByAgentId(array $params, string $field )
{
$where_ = [];
if (isset($params["agent_id"])) {
......@@ -87,7 +113,7 @@ class ABindingDevice extends BaseModel
$data = $this
->field($field)
->where($where_)
->order("create_time desc")
->order("update_time desc")
->select();
} catch (\Exception $e) {
$data = [];
......
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