183 lines
6.4 KiB
PHP
183 lines
6.4 KiB
PHP
<?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 unique 必选 string 设备唯一码
|
||
* @return {"code":0,"msg":"ok","data":{"unique":"xxxxxx","type":"ls_windows_device"}}
|
||
* @return_param type string 类型,ls_windows_device -- 客户端二维码
|
||
* @return_param unique string 设备唯一id
|
||
* @remark
|
||
*/
|
||
public function actionQrInfo(){
|
||
$form = new ScanQrForm();
|
||
$form->attributes = \Yii::$app->request->get();
|
||
$form->cx_mch_id = $this->cx_mch_id;
|
||
$data = $form->actionQrInfo();
|
||
return $this->responseHandler($data);
|
||
}
|
||
|
||
/**
|
||
* showdoc
|
||
* @catalog 小程序扫码
|
||
* @title 判断设备状态
|
||
* @description 本接口提供判断设备当前状态,是否可以走绑定接口,二维码type为ls_windows_device
|
||
* @method get
|
||
* @url /api/scan-qr/qr-windows-device
|
||
* @param unique 必选 string 设备唯一码
|
||
* @return {"code":0,"msg":"可以绑定","data":{"title":"是否绑定此机器","type":1}}
|
||
* @return_param title string 信息
|
||
* @return_param type int 类型,1.机器绑定店铺,2.机器绑定用户
|
||
* @remark
|
||
*/
|
||
public function actionQrWindowsDevice(){
|
||
$form = new ScanQrForm();
|
||
$form->attributes = \Yii::$app->request->get();
|
||
$form->cx_mch_id = $this->cx_mch_id;
|
||
$form->user_id = \Yii::$app->user->isGuest ? 0 : \Yii::$app->user->identity->id;
|
||
$data = $form->actionQrWindowsDevice();
|
||
return $this->responseHandler($data);
|
||
}
|
||
|
||
/**
|
||
* showdoc
|
||
* @catalog 小程序扫码
|
||
* @title 绑定二维码
|
||
* @description 本接口提供绑定设备操作,二维码type为ls_windows_device
|
||
* @method get
|
||
* @url /api/scan-qr/qr-windows-device-bind-user
|
||
* @param unique 必选 string 设备唯一码
|
||
* @return {"code":0,"msg":"绑定成功","data":{"id":6}}
|
||
* @remark
|
||
*/
|
||
public function actionQrWindowsDeviceBindUser(){
|
||
$form = new ScanQrForm();
|
||
$form->attributes = \Yii::$app->request->get();
|
||
$form->cx_mch_id = $this->cx_mch_id;
|
||
$form->user_id = \Yii::$app->user->isGuest ? 0 : \Yii::$app->user->identity->id;
|
||
$data = $form->actionQrWindowsDeviceBindUser();
|
||
return $this->responseHandler($data);
|
||
}
|
||
|
||
/**
|
||
* showdoc
|
||
* @catalog 小程序扫码
|
||
* @title 当前用户是否在场次中
|
||
* @description 本接口提供初始化小程序后,判断是否有在进行中的场次
|
||
* @method get
|
||
* @url /api/scan-qr/qr-windows-device-user-init
|
||
* @return {"code":0,"msg":"可以绑定","data":[]}
|
||
* @remark
|
||
*/
|
||
public function actionQrWindowsDeviceUserInit(){
|
||
$form = new ScanQrForm();
|
||
$form->attributes = \Yii::$app->request->get();
|
||
$form->cx_mch_id = $this->cx_mch_id;
|
||
$form->user_id = \Yii::$app->user->isGuest ? 0 : \Yii::$app->user->identity->id;
|
||
$data = $form->actionQrWindowsDeviceUserInit();
|
||
return $this->responseHandler($data);
|
||
}
|
||
|
||
/**
|
||
* showdoc
|
||
* @catalog 小程序扫码
|
||
* @title 判断当前是否结束场次
|
||
* @description 本接口提供绑定设备后,轮询判断当前状态
|
||
* @method get
|
||
* @url /api/scan-qr/qr-windows-device-bind-status
|
||
* @param unique 必选 string 设备唯一码
|
||
* @return {"code":0,"msg":"ok","data":{"status":1,"msg":"进行中"}}
|
||
* @return_param status int 状态,1.进行中,2.已结束
|
||
* @remark
|
||
*/
|
||
public function actionQrWindowsDeviceBindStatus(){
|
||
$form = new ScanQrForm();
|
||
$form->attributes = \Yii::$app->request->get();
|
||
$form->cx_mch_id = $this->cx_mch_id;
|
||
$form->user_id = \Yii::$app->user->isGuest ? 0 : \Yii::$app->user->identity->id;
|
||
$data = $form->actionQrWindowsDeviceBindStatus();
|
||
return $this->responseHandler($data);
|
||
}
|
||
|
||
/**
|
||
* showdoc
|
||
* @catalog 小程序扫码
|
||
* @title 判断是否能够使用击球检测
|
||
* @description 本接口提供判断是否能够使用击球检测
|
||
* @method get
|
||
* @url /api/scan-qr/qr-jiqiu-status
|
||
* @param unique 必选 string 订单id
|
||
* @return {"code":1,"msg":"订单不存在","data":[]}
|
||
* @remark
|
||
*/
|
||
public function actionQrJiqiuStatus(){
|
||
$form = new ScanQrForm();
|
||
$form->attributes = \Yii::$app->request->get();
|
||
$form->cx_mch_id = $this->cx_mch_id;
|
||
$form->user_id = \Yii::$app->user->isGuest ? 0 : \Yii::$app->user->identity->id;
|
||
$data = $form->actionQrJiqiuStatus();
|
||
return $this->responseHandler($data);
|
||
}
|
||
|
||
/**
|
||
* showdoc
|
||
* @catalog 小程序扫码
|
||
* @title 击球检测绑定教练
|
||
* @description 本接口提供击球检测绑定教练
|
||
* @method post
|
||
* @url /api/scan-qr/qr-jiqiu-bind
|
||
* @param unique 必选 string 订单id
|
||
* @return {"code":1,"msg":"订单不存在","data":[]}
|
||
* @remark
|
||
*/
|
||
public function actionQrJiqiuBind(){
|
||
$form = new ScanQrForm();
|
||
$form->attributes = \Yii::$app->request->get();
|
||
$form->cx_mch_id = $this->cx_mch_id;
|
||
$form->user_id = \Yii::$app->user->isGuest ? 0 : \Yii::$app->user->identity->id;
|
||
$data = $form->actionQrJiqiuBind();
|
||
return $this->responseHandler($data);
|
||
}
|
||
|
||
}
|
||
|