作者 董瑞恩
1 个管道 的构建 通过 耗费 0 秒

interface

... ... @@ -60,19 +60,19 @@ class AesController extends HomeBaseController{
* @url /portal/Aes/lock
* @method GET
*
* @param name:MACAddress type:String require:1 default:无 other: desc:设备MAC地址
* @param name:name type:String require:1 default:无 other: desc:设备名称
*
*
* @return lockKey:加密的开锁指令(数组)
*/
public function lock(){
$MACAddress=$this->request->param('MACAddress');
$strKey=Db::name('equipment')->where('mac_address',$MACAddress)->find();
$name=$this->request->param('name');
$strKey=Db::name('equipment')->where('name',$name)->find();
if (!empty($strKey)){
if ($strKey['electricity']==0){
$this->apiResponse(302,'设备电量低');
}else{
$key="ff0ca2".$MACAddress."5500ef";
$key="ff0ca2".$strKey['']."5500ef";
$lockKey=$this->ToArray($key);
$this->apiResponse(200,'success',$lockKey);
}
... ... @@ -82,7 +82,9 @@ class AesController extends HomeBaseController{
}
public function macToStr(){
}
/**
* @title 获取电压、开关状态(加密)
... ...
... ... @@ -31,7 +31,6 @@ class LoginController extends HomeBaseController{
*
* @return users_id:用户id
* @return type:是否注册(0、未注册,1、已注册)
* @return openid:openid
* @return is_use:是否在使用设备(0:空闲,1:在用)
*/
public function login(){
... ... @@ -42,10 +41,14 @@ class LoginController extends HomeBaseController{
if(isset($loginData['openid'])){
$users = Db::name('users')->where('open_id', $loginData['openid'])->find();
if (empty($users)){
$users_id=Db::name('users')->insertGetId(['open_id'=>$loginData['openid'],'create_time'=>date('Y-m-d H:i:s')]);
$this->apiResponse(200,'success',['users_id'=>$users_id,'type'=>0,'openid'=>$loginData['openid'],'is_use'=>0]);
$users_id=Db::name('users')->insertGetId(['open_id'=>$loginData['openid'],'create_time'=>time()]);
$this->apiResponse(200,'success',['users_id'=>$users_id,'type'=>0,'is_use'=>0]);
}else{
$this->apiResponse(200,'success',['users_id'=>$users['id'],'type'=>1,'openid'=>$users['open_id'],'is_use'=>$users['is_use']]);
if (empty($users['phone'])){
$this->apiResponse(200,'success',['users_id'=>$users['id'],'type'=>0,'is_use'=>$users['is_use']]);
}else{
$this->apiResponse(200,'success',['users_id'=>$users['id'],'type'=>1,'is_use'=>$users['is_use']]);
}
}
}else{
$this->apiResponse(301,'获取登录凭证失败',$loginData);
... ...