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

order

... ... @@ -166,19 +166,19 @@ class AesController extends HomeBaseController{
* @url /portal/Aes/decryption
* @method GET
*
* @param name:MACAddress type:String require:1 default:无 other: desc:设备MAC地址
* @param name:name type:String require:1 default:无 other: desc:设备名称
* @param name:key type:String require:1 default:无 other: desc:设备返回状态(未加密)
* @param name:type type:String require:1 default:无 other:1开锁返回指令,2状态返回指令 desc:命令类型
*
* @return code:1锁已开,0位锁已关,2为数据异常
*/
public function state($MACAddress,$key,$type){
public function state($name,$key,$type){
if ($type==1){
if($key[0]=='0xff' && $key[4]=='0xef'){
if ($key[3]=='0x01'){
//修改数据库设备状态
try{
Db::name('equipment')->where('mac_address',$MACAddress)->update(['use'=>1]);
Db::name('equipment')->where('name',$name)->update(['use'=>1]);
}catch (\Exception $exception){
$this->apiResponse(301,'数据库状态更改失败,错误信息:'.$exception->getMessage());
}
... ... @@ -192,7 +192,7 @@ class AesController extends HomeBaseController{
}else if($type==2){
if($key[0]=='0xff' && $key[7]=='0xef'){
if ($key[5]=='0x01'){
Db::name('equipment')->where('mac_address',$MACAddress)->update(['electricity'=>0]);
Db::name('equipment')->where('name',$name)->update(['electricity'=>0]);
}
if ($key[6]=='0x01'){
//修改数据库设备状态
... ... @@ -200,7 +200,7 @@ class AesController extends HomeBaseController{
}else if($key[6]=='0x00'){
//修改数据库设备状态
try{
Db::name('equipment')->where('mac_address',$MACAddress)->update(['use'=>0]);
Db::name('equipment')->where('name',$name)->update(['use'=>0]);
}catch (\Exception $exception){
$this->apiResponse(301,'数据库状态更改失败,错误信息:'.$exception->getMessage());
}
... ...
... ... @@ -28,15 +28,15 @@ class OrderController extends HomeBaseController{
* @method GET
*
* @param name:users_id type:String require:1 default:无 other: desc:用户id
* @param name:mac_address type:String require:1 default:无 other: desc:设备Mac地址
* @param name:name type:String require:1 default:无 other: desc:设备名称
*
*/
public function createOrder(){
$users_id=$this->request->param('users_id');
$mac_address=$this->request->param('mac_address');
$name=$this->request->param('name');
$order=[
'order_no' => cmf_get_order_sn(),
'mac_address' => $mac_address,
'eq_name' => $name,
'users_id' => $users_id,
'start_time' => time(),
'state' => 1
... ... @@ -120,7 +120,6 @@ class OrderController extends HomeBaseController{
* @method GET
*
* @param name:order_no type:String require:1 default:无 other: desc:订单号
* @param name:openId type:String require:1 default:无 other: desc:openId
*
* @return data:返回用于调用支付的参数
*/
... ...