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

interface

@@ -60,19 +60,19 @@ class AesController extends HomeBaseController{ @@ -60,19 +60,19 @@ class AesController extends HomeBaseController{
60 * @url /portal/Aes/lock 60 * @url /portal/Aes/lock
61 * @method GET 61 * @method GET
62 * 62 *
63 - * @param name:MACAddress type:String require:1 default:无 other: desc:设备MAC地址 63 + * @param name:name type:String require:1 default:无 other: desc:设备名称
64 * 64 *
65 * 65 *
66 * @return lockKey:加密的开锁指令(数组) 66 * @return lockKey:加密的开锁指令(数组)
67 */ 67 */
68 public function lock(){ 68 public function lock(){
69 - $MACAddress=$this->request->param('MACAddress');  
70 - $strKey=Db::name('equipment')->where('mac_address',$MACAddress)->find(); 69 + $name=$this->request->param('name');
  70 + $strKey=Db::name('equipment')->where('name',$name)->find();
71 if (!empty($strKey)){ 71 if (!empty($strKey)){
72 if ($strKey['electricity']==0){ 72 if ($strKey['electricity']==0){
73 $this->apiResponse(302,'设备电量低'); 73 $this->apiResponse(302,'设备电量低');
74 }else{ 74 }else{
75 - $key="ff0ca2".$MACAddress."5500ef"; 75 + $key="ff0ca2".$strKey['']."5500ef";
76 $lockKey=$this->ToArray($key); 76 $lockKey=$this->ToArray($key);
77 $this->apiResponse(200,'success',$lockKey); 77 $this->apiResponse(200,'success',$lockKey);
78 } 78 }
@@ -82,7 +82,9 @@ class AesController extends HomeBaseController{ @@ -82,7 +82,9 @@ class AesController extends HomeBaseController{
82 82
83 } 83 }
84 84
  85 + public function macToStr(){
85 86
  87 + }
86 88
87 /** 89 /**
88 * @title 获取电压、开关状态(加密) 90 * @title 获取电压、开关状态(加密)
@@ -31,7 +31,6 @@ class LoginController extends HomeBaseController{ @@ -31,7 +31,6 @@ class LoginController extends HomeBaseController{
31 * 31 *
32 * @return users_id:用户id 32 * @return users_id:用户id
33 * @return type:是否注册(0、未注册,1、已注册) 33 * @return type:是否注册(0、未注册,1、已注册)
34 - * @return openid:openid  
35 * @return is_use:是否在使用设备(0:空闲,1:在用) 34 * @return is_use:是否在使用设备(0:空闲,1:在用)
36 */ 35 */
37 public function login(){ 36 public function login(){
@@ -42,10 +41,14 @@ class LoginController extends HomeBaseController{ @@ -42,10 +41,14 @@ class LoginController extends HomeBaseController{
42 if(isset($loginData['openid'])){ 41 if(isset($loginData['openid'])){
43 $users = Db::name('users')->where('open_id', $loginData['openid'])->find(); 42 $users = Db::name('users')->where('open_id', $loginData['openid'])->find();
44 if (empty($users)){ 43 if (empty($users)){
45 - $users_id=Db::name('users')->insertGetId(['open_id'=>$loginData['openid'],'create_time'=>date('Y-m-d H:i:s')]);  
46 - $this->apiResponse(200,'success',['users_id'=>$users_id,'type'=>0,'openid'=>$loginData['openid'],'is_use'=>0]); 44 + $users_id=Db::name('users')->insertGetId(['open_id'=>$loginData['openid'],'create_time'=>time()]);
  45 + $this->apiResponse(200,'success',['users_id'=>$users_id,'type'=>0,'is_use'=>0]);
47 }else{ 46 }else{
48 - $this->apiResponse(200,'success',['users_id'=>$users['id'],'type'=>1,'openid'=>$users['open_id'],'is_use'=>$users['is_use']]); 47 + if (empty($users['phone'])){
  48 + $this->apiResponse(200,'success',['users_id'=>$users['id'],'type'=>0,'is_use'=>$users['is_use']]);
  49 + }else{
  50 + $this->apiResponse(200,'success',['users_id'=>$users['id'],'type'=>1,'is_use'=>$users['is_use']]);
  51 + }
49 } 52 }
50 }else{ 53 }else{
51 $this->apiResponse(301,'获取登录凭证失败',$loginData); 54 $this->apiResponse(301,'获取登录凭证失败',$loginData);