210 lines
7.8 KiB
PHP
210 lines
7.8 KiB
PHP
<?php
|
||
|
||
namespace app\modules\api\controllers;
|
||
|
||
use app\modules\api\behaviors\LoginBehavior;
|
||
use app\modules\api\models\BallArmForm;
|
||
|
||
/**
|
||
* 球杆
|
||
*/
|
||
class BallArmController extends Controller
|
||
{
|
||
public function behaviors()
|
||
{
|
||
return array_merge(parent::behaviors(), [
|
||
'login' => [
|
||
'class' => LoginBehavior::className(),
|
||
'ignore' => [
|
||
]
|
||
]
|
||
]);
|
||
}
|
||
|
||
/**
|
||
* showdoc
|
||
* @catalog 球杆
|
||
* @title 球杆列表 - 用户查看列表
|
||
* @description 本接口提供球杆列表【用户查看列表】
|
||
* @method get
|
||
* @url /api/ball-arm/get-list
|
||
* @param page 不必选 int 页码
|
||
* @param limit 不必选 int 条数
|
||
* @return {"code":0,"msg":"ok","data":[{"id":"6","title":"12345","status":"4"},{"id":"5","title":"12345","status":"3"},{"id":"4","title":"12345","status":"3"}],"count":"3","page_size":10,"page_count":1,"page_no":1,"end_flag":true}
|
||
* @return_param title string 球杆名称
|
||
* @return_param status int 状态,3.正常使用,4.停用
|
||
* @remark
|
||
*/
|
||
public function actionGetList()
|
||
{
|
||
$obj = new BallArmForm();
|
||
$obj->attributes = \Yii::$app->request->get();
|
||
$obj->user_id = \Yii::$app->user->identity->id;
|
||
$obj->cx_mch_id = $this->cx_mch_id;
|
||
$res = $obj->actionGetList();
|
||
return $this->responseHandler($res);
|
||
}
|
||
|
||
/**
|
||
* showdoc
|
||
* @catalog 球杆
|
||
* @title 球杆列表【检测员查看列表】
|
||
* @description 本接口提供球杆列表【检测员查看列表】
|
||
* @method get
|
||
* @url /api/ball-arm/get-jc-list
|
||
* @param page 不必选 int 页码
|
||
* @param limit 不必选 int 条数
|
||
* @param type 不必选 int 类型,1.待检测,2.已检测,默认为1
|
||
* @return {"code":0,"msg":"ok","data":[{"id":"6","title":"12345","status":"4"},{"id":"5","title":"12345","status":"3"},{"id":"4","title":"12345","status":"3"}],"count":"3","page_size":10,"page_count":1,"page_no":1,"end_flag":true}
|
||
* @return_param title string 球杆名称
|
||
* @return_param status int 状态,2.已支付待检测,3.正常使用,4.停用
|
||
* @return_param order_id int 对应的订单ID
|
||
* @remark
|
||
*/
|
||
public function actionGetJcList()
|
||
{
|
||
$obj = new BallArmForm();
|
||
$obj->attributes = \Yii::$app->request->get();
|
||
$obj->user_id = \Yii::$app->user->identity->id;
|
||
$obj->cx_mch_id = $this->cx_mch_id;
|
||
$res = $obj->actionGetJcList();
|
||
return $this->responseHandler($res);
|
||
}
|
||
|
||
/**
|
||
* showdoc
|
||
* @catalog 球杆
|
||
* @title 获取球杆数据[检测员查看]
|
||
* @description 本接口提供获取球杆数据
|
||
* @method get
|
||
* @url /api/ball-arm/get-data
|
||
* @param order_id 必选 int 订单数据唯一id
|
||
* @return {"code":0,"msg":"ok","data":{"jc_name":"","jc_img":"","title":"12345","updated_at":"2022-07-18 15:27:23","data":[{"title":"CLUB","value":"-"},{"title":"MODEL","value":"-"},{"title":"LENGTH","value":"-"},{"title":"LOFT","value":"-"},{"title":"LIE","value":"-"},{"title":"S/W","value":"-"},{"title":"T/W","value":"-"},{"title":"SHAFT","value":"-"},{"title":"CPM","value":"-"},{"title":"TQ","value":"-"},{"title":"GRIP","value":"-"},{"title":"SICE","value":"-"},{"title":"TYPE","value":"-"}]}}
|
||
* @return_param jc_name string 检测员名称
|
||
* @return_param jc_img string 检测员头像
|
||
* @return_param title string 球杆名称
|
||
* @return_param updated_at string 更新时间
|
||
* @return_param data array 数据
|
||
* @remark
|
||
*/
|
||
public function actionGetData()
|
||
{
|
||
$obj = new BallArmForm();
|
||
$obj->attributes = \Yii::$app->request->get();
|
||
$obj->user_id = \Yii::$app->user->identity->id;
|
||
$obj->cx_mch_id = $this->cx_mch_id;
|
||
$res = $obj->actionGetData();
|
||
return $this->responseHandler($res);
|
||
}
|
||
|
||
/**
|
||
* showdoc
|
||
* @catalog 球杆
|
||
* @title 获取球杆数据[用户查看]
|
||
* @description 本接口提供获取球杆数据
|
||
* @method get
|
||
* @url /api/ball-arm/get-user-data
|
||
* @param id 必选 int 数据唯一id
|
||
* @return {"code":0,"msg":"ok","data":{"jc_name":"","jc_img":"","title":"12345","updated_at":"2022-07-18 15:27:23","data":[{"title":"CLUB","value":"-"},{"title":"MODEL","value":"-"},{"title":"LENGTH","value":"-"},{"title":"LOFT","value":"-"},{"title":"LIE","value":"-"},{"title":"S/W","value":"-"},{"title":"T/W","value":"-"},{"title":"SHAFT","value":"-"},{"title":"CPM","value":"-"},{"title":"TQ","value":"-"},{"title":"GRIP","value":"-"},{"title":"SICE","value":"-"},{"title":"TYPE","value":"-"}]}}
|
||
* @return_param jc_name string 检测员名称
|
||
* @return_param jc_img string 检测员头像
|
||
* @return_param title string 球杆名称
|
||
* @return_param updated_at string 更新时间
|
||
* @return_param data array 数据
|
||
* @remark
|
||
*/
|
||
public function actionGetUserData()
|
||
{
|
||
$obj = new BallArmForm();
|
||
$obj->attributes = \Yii::$app->request->get();
|
||
$obj->user_id = \Yii::$app->user->identity->id;
|
||
$obj->cx_mch_id = $this->cx_mch_id;
|
||
$res = $obj->actionGetUserData();
|
||
return $this->responseHandler($res);
|
||
}
|
||
|
||
/**
|
||
* showdoc
|
||
* @catalog 球杆
|
||
* @title 购买球杆
|
||
* @description 本接口提供用户购买球杆
|
||
* @method post
|
||
* @url /api/ball-arm/buy
|
||
* @param title 必选 string 球杆名称
|
||
* @param store_id 必选 int 门店id
|
||
* @return {"code":0,"msg":"ok","data":{"id":8}}
|
||
* @return_param id int 获得的订单id,大概率用在支付接口上,未明确标注如何使用
|
||
* @remark
|
||
*/
|
||
public function actionBuy()
|
||
{
|
||
$obj = new BallArmForm();
|
||
$obj->attributes = \Yii::$app->request->post();
|
||
$obj->user_id = \Yii::$app->user->identity->id;
|
||
$obj->cx_mch_id = $this->cx_mch_id;
|
||
$res = $obj->actionBuy();
|
||
return $this->responseHandler($res);
|
||
}
|
||
|
||
/**
|
||
* showdoc
|
||
* @catalog 球杆
|
||
* @title 更新球杆数据
|
||
* @description 本接口提供更新球杆数据【检测员操作】
|
||
* @method post
|
||
* @url /api/ball-arm/updata
|
||
* @param array_data 必选 array 数据数组
|
||
* @return {"code":1,"msg":"当前用户非检测员","data":[]}
|
||
* @remark
|
||
*/
|
||
public function actionUpdata()
|
||
{
|
||
$obj = new BallArmForm();
|
||
$arr = \Yii::$app->request->post('array_data');
|
||
|
||
$arr = json_decode($arr, true);
|
||
|
||
$obj->user_id = \Yii::$app->user->identity->id;
|
||
$obj->cx_mch_id = $this->cx_mch_id;
|
||
$res = $obj->actionUpdata($arr);
|
||
return $this->responseHandler($res);
|
||
}
|
||
|
||
/**
|
||
* showdoc
|
||
* @catalog 球杆
|
||
* @title 更新球杆状态
|
||
* @description 本接口提供更新球杆状态【用户操作】
|
||
* @method post
|
||
* @url /api/ball-arm/up-status
|
||
* @param id 必选 string 数据id
|
||
* @return {"code":1,"msg":"订单未支付","data":[]}
|
||
* @remark
|
||
*/
|
||
public function actionUpStatus()
|
||
{
|
||
$obj = new BallArmForm();
|
||
$obj->attributes = \Yii::$app->request->post();
|
||
$obj->user_id = \Yii::$app->user->identity->id;
|
||
$obj->cx_mch_id = $this->cx_mch_id;
|
||
$res = $obj->actionUpStatus();
|
||
return $this->responseHandler($res);
|
||
}
|
||
|
||
|
||
/**
|
||
* 检测员信息
|
||
* @return array
|
||
*/
|
||
public function actionGetJc()
|
||
{
|
||
$obj = new BallArmForm();
|
||
$obj->attributes = \Yii::$app->request->get();
|
||
$obj->user_id = \Yii::$app->user->identity->id;
|
||
$obj->cx_mch_id = $this->cx_mch_id;
|
||
$res = $obj->getJc();
|
||
return $this->responseHandler($res);
|
||
}
|
||
|
||
}
|