cxgj/modules/api/controllers/ScanQrController.php
2023-11-27 09:45:13 +08:00

87 lines
2.6 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/**
* @author Any
* @description KISS
* @date 2021年6月2日
* @version 1.0.0
*
* _____LOG_____
*
*/
namespace app\modules\api\controllers;
use app\modules\api\behaviors\LoginBehavior;
use app\models\common\CommonAddressActionForm;
use app\models\common\CommonAddressListForm;
use app\models\common\CommonAddressEditForm;
use app\models\Address;
use app\modules\api\models\ScanQrForm;
use app\modules\api\models\WindowsApiForm;
class ScanQrController extends Controller
{
public function behaviors()
{
return array_merge(parent::behaviors(), [
'login' => [
'class' => LoginBehavior::className(),
'ignore' => [
'api/scan-qr/qr-info',
'api/scan-qr/qr-windows-device',
]
]
]);
}
/**
* showdoc
* @catalog 小程序扫码
* @title 获取二维码信息
* @description 本接口提供判断设备当前信息
* @method get
* @url /api/scan-qr/qr-info
* @param type 必选 string 设备类型
* @param sn 必选 string 设备唯一码
* @return {"code":0,"msg":"ok","data":{"unique":"xxxxxx","type":"ls_windows_device"}}
* @return_param type string 类型xt--小兔开门yp--有朋货柜
* @return_param sn string 设备唯一id
* @return_param money string 需要充值多少钱0不需要充值
* @return_param title string 设备标题
* @return_param content string 设备内容
* @return_param status int 设备状态1.可以打开2.设备进行中不可打开3.设备不在线4.需要充值
* @remark
*/
public function actionQrInfo(){
$form = new ScanQrForm();
$form->attributes = \Yii::$app->request->get();
$form->cx_mch_id = $this->cx_mch_id;
$form->user_id = empty(\Yii::$app->user->identity->id) ? 0 : \Yii::$app->user->identity->id;
$data = $form->actionQrInfo();
return $this->responseHandler($data);
}
/**
* showdoc
* @catalog 小程序扫码
* @title 小兔开门-大门
* @description 本接口提供设备开门操作,仅限于大门
* @method get
* @url /api/scan-qr/xt-open
* @param sn 必选 string 设备唯一码
* @return {"code":0,"msg":"ok"}
* @remark
*/
public function actionXtOpen(){
$form = new ScanQrForm();
$form->attributes = \Yii::$app->request->get();
$form->cx_mch_id = $this->cx_mch_id;
$form->user_id = \Yii::$app->user->identity->id;
$data = $form->actionXtOpen();
return $this->responseHandler($data);
}
}