public function active() { $battery_id = I('battery_id'); $user_id = I('user_id'); $m = new \Home\Model\BatteryModel(); $ret = $m->activeBattery($user_id, $battery_id); if ($ret == 1) { return $this->myAjaxOkReturn(); } else { return $this->myAjaxErrReturn('激活失败'); } }
public function GetbatteryBtMac() { $battery_id = I('battery_id', 0); if ($battery_id === 0) { $reason = "蓝牙参数错误"; goto ERR; } $btr = new \Home\Model\BatteryModel(); $thisBatteries = $btr->getBtMacByBatteryId($battery_id); if (count($thisBatteries) === 0) { $reason = "no this battery_id"; goto ERR; } $data = $thisBatteries[0]; return $this->ok_ajax_return($data); ERR: $this->error_ajax_return($reason); return; }