684 lines
29 KiB
PHP
684 lines
29 KiB
PHP
<?php
|
||
|
||
namespace app\modules\api\controllers;
|
||
|
||
use app\components\SysConst;
|
||
use app\models\DeviceUniqueConfig;
|
||
use app\models\DeviceUniqueData;
|
||
use app\models\Order;
|
||
use app\modules\api\models\OrderGoodsForm;
|
||
use function AlibabaCloud\Client\value;
|
||
use app\models\Banner;
|
||
use app\models\Store;
|
||
use app\modules\api\components\ApiHelper;
|
||
use app\modules\api\models\OrderForm;
|
||
use app\modules\api\models\StoreForm;
|
||
use app\modules\api\models\StoreCityForm;
|
||
use app\modules\api\models\UserBasicInfoForm;
|
||
use Yii;
|
||
use yii\web\NotFoundHttpException;
|
||
use yii\filters\VerbFilter;
|
||
use app\modules\api\behaviors\LoginBehavior;
|
||
|
||
/**
|
||
*订单
|
||
*/
|
||
class OrderController extends Controller
|
||
{
|
||
/**
|
||
* {@inheritdoc}
|
||
*/
|
||
public function behaviors()
|
||
{
|
||
return array_merge(parent::behaviors(), [
|
||
'verbs' => [
|
||
'class' => VerbFilter::className(),
|
||
'actions' => [
|
||
'delete' => ['POST'],
|
||
],
|
||
],
|
||
'login' => [
|
||
'class' => LoginBehavior::className(),
|
||
'ignore' => [
|
||
// 'api/order/index',
|
||
// 'api/order/order-one',
|
||
// 'api/order/order-buy',
|
||
// 'api/order/order-open',
|
||
'api/order/order-goods-check',
|
||
]
|
||
]
|
||
]);
|
||
}
|
||
|
||
|
||
/**
|
||
* showdoc
|
||
* @catalog 订单
|
||
* @title 创建包厢预约订单
|
||
* @description 本接口提供创建包厢预约订单
|
||
* @method post
|
||
* @url /api/order/order-buy
|
||
* @param plugin_sign 必选 string 表示 box_book
|
||
* @param box_id 必选 int 包厢ID
|
||
* @param store_id 必选 string 门店ID
|
||
* @param start_time 必选 string 开始时间
|
||
* @param end_time 必选 string 结束时间
|
||
* @return {"code":0,"msg":"ok","data":{"id":"1"}}
|
||
* @remark
|
||
*/
|
||
public function actionOrderBuy()
|
||
{
|
||
if (!\Yii::$app->request->isPost) {
|
||
$data = $this->invaildRequest();
|
||
return $this->responseHandler($data);
|
||
}
|
||
$orderForm = new OrderForm();
|
||
$post = \Yii::$app->request->post();
|
||
$orderForm->setScenario($post['plugin_sign']);
|
||
$orderForm->attributes = $post;
|
||
$orderForm->user_id = \Yii::$app->user->identity->id ?? 0;
|
||
$orderForm->attributes = $post;
|
||
|
||
$redis_name = "cxgyc:api:actionOrderBuy_v1:{$orderForm->user_id}";
|
||
$setnx = Yii::$app->redis->setnx($redis_name, 1);
|
||
if (empty($setnx)) {
|
||
$ttl = Yii::$app->redis->ttl($redis_name);
|
||
if ($ttl === -1) {
|
||
Yii::$app->redis->expire($redis_name, 3);
|
||
}
|
||
$data = ['code' => 1, 'msg' => '系统繁忙!稍后再试^v^!'];
|
||
return $this->responseHandler($data);
|
||
}
|
||
Yii::$app->redis->expire($redis_name, 3);
|
||
$data = $orderForm->createOrder();
|
||
return $this->responseHandler($data);
|
||
}
|
||
|
||
|
||
/**
|
||
* showdoc
|
||
* @catalog 订单
|
||
* @title 包厢订单列表
|
||
* @description 本接口提供包厢订单列表
|
||
* @method get
|
||
* @url /api/order/index
|
||
* @param page 不必选 int 页码
|
||
* @param limit 不必选 int 条数
|
||
* @param status 不必选 string 订单状态
|
||
* @param plugin_sign 必选 string 标识,box_book预约包厢订单goods商品
|
||
* @return {"code":0,"msg":"ok","data":[{"order_id":"525","is_sale":"0","total_price":"20.00","goods_id":"99","is_pay":"0","store_id":"18","plugin_sign":"box_book","store_mobile":"1811111111111","created_at":"1680596912","updated_at":"1680596912","pay_time":"0","cancel_status":"0","status":"1","store_name":"测试门店1111","total_pay_price":"20.00","city":"厦门市","region":"湖里区","location_detail":"中山路1号","cover_pic":"/upload/0/1/upload/image/2023/0403/1680489337194908.jpg","box_money":"20.00","box_pic":"http://cxgyc.com/upload/0/1/upload/image/2023/0404/1680579154475442.jpg","start_time":"2023-04-04 19:00","end_time":"2023-04-04 20:00","duration":"1.0","status_cn":"待支付"},{"order_id":"524","is_sale":"0","total_price":"4.00","goods_id":"99","is_pay":"0","store_id":"18","plugin_sign":"box_book","store_mobile":"1811111111111","created_at":"1680596848","updated_at":"1680596848","pay_time":"0","cancel_status":"0","status":"1","store_name":"测试门店1111","total_pay_price":"4.00","city":"厦门市","region":"湖里区","location_detail":"中山路1号","cover_pic":"/upload/0/1/upload/image/2023/0403/1680489337194908.jpg","box_money":"20.00","box_pic":"http://cxgyc.com/upload/0/1/upload/image/2023/0404/1680579154475442.jpg","start_time":"2023-04-04 18:47","end_time":"2023-04-04 19:00","duration":"0.2","status_cn":"待支付"},{"order_id":"523","is_sale":"0","total_price":"24.00","goods_id":"99","is_pay":"0","store_id":"18","plugin_sign":"box_book","store_mobile":"1811111111111","created_at":"1680595515","updated_at":"1680595515","pay_time":"0","cancel_status":"0","status":"1","store_name":"测试门店1111","total_pay_price":"24.00","city":"厦门市","region":"湖里区","location_detail":"中山路1号","cover_pic":"/upload/0/1/upload/image/2023/0403/1680489337194908.jpg","box_money":"20.00","box_pic":"http://cxgyc.com/upload/0/1/upload/image/2023/0404/1680579154475442.jpg","start_time":"2023-04-04 16:47","end_time":"2023-04-04 18:00","duration":"1.2","status_cn":"待支付"},{"order_id":"522","is_sale":"0","total_price":"4.00","goods_id":"99","is_pay":"0","store_id":"18","plugin_sign":"box_book","store_mobile":"1811111111111","created_at":"1680595478","updated_at":"1680595478","pay_time":"0","cancel_status":"0","status":"0","store_name":"测试门店1111","total_pay_price":"4.00","city":"厦门市","region":"湖里区","location_detail":"中山路1号","cover_pic":"/upload/0/1/upload/image/2023/0403/1680489337194908.jpg","box_money":"20.00","box_pic":"http://cxgyc.com/upload/0/1/upload/image/2023/0404/1680579154475442.jpg","start_time":"2023-04-04 16:47","end_time":"2023-04-04 17:00","duration":"0.2","status_cn":"已完成"}],"count":"4","page_size":10,"page_count":1,"page_no":1,"end_flag":true}
|
||
* @return_param order_id int 订单ID
|
||
* @return_param is_sale string 是否售后 1-是 0-没有
|
||
* @return_param is_pay int 是否支付 0=未支付,1=已支付
|
||
* @return_param store_id int 门店ID
|
||
* @return_param plugin_sign string 标识
|
||
* @return_param total_price string 订单金额
|
||
* @return_param created_at string 下单时间
|
||
* @return_param store_mobile string 门店联系方式
|
||
* @return_param box_pic string 包厢封面图
|
||
* @return_param start_time string 预约开始时间
|
||
* @return_param end_time string 预约结束时间
|
||
* @return_param duration string 时长
|
||
* @remark
|
||
*/
|
||
public function actionIndex()
|
||
{
|
||
$request = Yii::$app->request;
|
||
$get = $request->get();
|
||
$orderForm = new OrderForm();
|
||
$orderForm->cx_mch_id = $this->cx_mch_id;
|
||
$orderForm->user_id = \Yii::$app->user->identity->id;
|
||
$orderForm->plugin_sign = $get['plugin_sign'];
|
||
$orderForm->status = $get['status'];
|
||
$orderForm->page = $get['page'];
|
||
$orderForm->limit = $get['limit'];
|
||
$data = $orderForm->search();
|
||
return $this->responseHandler($data);
|
||
}
|
||
|
||
|
||
/**
|
||
* showdoc
|
||
* @catalog 订单
|
||
* @title 包厢订单详情
|
||
* @description 本接口提供订单详情
|
||
* @method get
|
||
* @url /api/order/order-one
|
||
* @param order_id 必选 int 订单ID
|
||
* @param order_id 必选 int 订单ID
|
||
* @return {"code":0,"msg":"ok","data":{"id":"1","order_no":"202211041113166039059736","total_price":"100.00","pay_type":"5","created_at":"2022-11-04 11:13:16","status":"0","cancel_status":"0","store_name":"富赛体育高尔夫厦门思明店","is_pay":"1","pay_time":0,"plugin_sign":"ball_cart","store_id":"12","location_detail":"思明南路422号","updated_at":"1667531596","ball_name":"10086","ball_cover_pic":"http://cxaibc.com/upload/0/1/upload/image/2022/1031/1667205605259683.jpg","mark_name":"1111","begin_time":"1970-01-01 08:33:42","end_time":"2022-11-04 11:13:16","order_status":0}}
|
||
* @return_param order_id int 订单ID
|
||
* @return_param is_sale string 是否售后 1-是 0-没有
|
||
* @return_param is_pay int 是否支付 0=未支付,1=已支付
|
||
* @return_param store_id int 门店ID
|
||
* @return_param plugin_sign string 标识
|
||
* @return_param total_price string 订单金额
|
||
* @return_param created_at string 下单时间
|
||
* @return_param store_mobile string 门店联系方式
|
||
* @return_param box_pic string 包厢封面图
|
||
* @return_param start_time string 预约开始时间
|
||
* @return_param end_time string 预约结束时间
|
||
* @return_param duration string 时长
|
||
* @remark
|
||
*/
|
||
public function actionOrderOne()
|
||
{
|
||
$orderForm = new OrderForm();
|
||
$request = Yii::$app->request;
|
||
$orderForm->order_id = $request->get('order_id');
|
||
$orderForm->plugin_sign = $request->get('plugin_sign');
|
||
$orderForm->user_id = \Yii::$app->user->identity->id;
|
||
$data = $orderForm->searchOne();
|
||
return $this->responseHandler($data);
|
||
}
|
||
|
||
|
||
/**
|
||
* showdoc
|
||
* @catalog 订单
|
||
* @title 包厢订单详情
|
||
* @description 本接口提供订单详情
|
||
* @method get
|
||
* @url /api/order/order-open
|
||
* @param store_id 必选 int 订单ID
|
||
* @param piugin_sign 必选 int 订单ID
|
||
* @return {"code":0,"msg":"ok","data":{"id":"1","order_no":"202211041113166039059736","total_price":"100.00","pay_type":"5","created_at":"2022-11-04 11:13:16","status":"0","cancel_status":"0","store_name":"富赛体育高尔夫厦门思明店","is_pay":"1","pay_time":0,"plugin_sign":"ball_cart","store_id":"12","location_detail":"思明南路422号","updated_at":"1667531596","ball_name":"10086","ball_cover_pic":"http://cxaibc.com/upload/0/1/upload/image/2022/1031/1667205605259683.jpg","mark_name":"1111","begin_time":"1970-01-01 08:33:42","end_time":"2022-11-04 11:13:16","order_status":0}}
|
||
* @return_param order_id int 订单ID
|
||
* @return_param is_sale string 是否售后 1-是 0-没有
|
||
* @return_param is_pay int 是否支付 0=未支付,1=已支付
|
||
* @return_param store_id int 门店ID
|
||
* @return_param plugin_sign string 标识
|
||
* @return_param total_price string 订单金额
|
||
* @return_param created_at string 下单时间
|
||
* @return_param store_mobile string 门店联系方式
|
||
* @return_param box_pic string 包厢封面图
|
||
* @return_param start_time string 预约开始时间
|
||
* @return_param end_time string 预约结束时间
|
||
* @return_param duration string 时长
|
||
* @remark
|
||
*/
|
||
public function actionOrderOpen()
|
||
{
|
||
$orderForm = new OrderForm();
|
||
$request = Yii::$app->request;
|
||
$orderForm->plugin_sign = $request->get('plugin_sign');
|
||
$orderForm->store_id = $request->get('store_id');
|
||
$orderForm->user_id = \Yii::$app->user->identity->id;
|
||
// $orderForm->user_id = 2;
|
||
|
||
$data = $orderForm->findOne();
|
||
return $this->responseHandler($data);
|
||
}
|
||
|
||
|
||
/**
|
||
* 更新订单状态
|
||
* @return array
|
||
*/
|
||
public function actionOrderStatus()
|
||
{
|
||
$orderForm = new OrderForm();
|
||
$orderForm->cx_mch_id = $this->cx_mch_id;
|
||
$orderForm->user_id = \Yii::$app->user->identity->id;
|
||
$data = $orderForm->orderSave();
|
||
return $this->responseHandler($data);
|
||
}
|
||
|
||
|
||
/**
|
||
* showdoc
|
||
* @catalog 订单
|
||
* @title 取消订单
|
||
* @description 本接口提供取消订单
|
||
* @method get
|
||
* @url /api/order/order-cancel
|
||
* @param order_id 必选 int 订单ID
|
||
* @return {"code":0,"msg":"取消成功","data":[]}
|
||
* @remark
|
||
*/
|
||
public function actionOrderCancel()
|
||
{
|
||
$orderForm = new OrderForm();
|
||
$orderForm->cx_mch_id = $this->cx_mch_id;
|
||
$orderForm->user_id = \Yii::$app->user->identity->id;
|
||
$orderForm->order_id = \Yii::$app->request->get('order_id');
|
||
$data = $orderForm->orderCancal();
|
||
return $this->responseHandler($data);
|
||
}
|
||
|
||
|
||
/**
|
||
* showdoc
|
||
* @catalog 订单
|
||
* @title 用户申请售后
|
||
* @description 本接口提供用户申请售后
|
||
* @method post
|
||
* @url /api/order/order-sales
|
||
* @param order_id 必选 int 订单ID
|
||
* @param plugin_sign 必选 int 标识 order_sale
|
||
* @param refund_price 必选 string 退款金额
|
||
* @param type 必选 int 退款类型
|
||
* @param remark 不必选 string 说明
|
||
* @param pic_urls 不必选 string 图片
|
||
* @return {"code":0,"msg":"申请还车成功","data":{}}
|
||
* @remark
|
||
*/
|
||
public function actionOrderSales()
|
||
{
|
||
$orderForm = new OrderForm();
|
||
$post = \Yii::$app->request->post();
|
||
$orderForm->cx_mch_id = $this->cx_mch_id;
|
||
$orderForm->user_id = \Yii::$app->user->identity->id;
|
||
$orderForm->plugin_sign = $post['plugin_sign'];
|
||
$orderForm->type = $post['type'];
|
||
$orderForm->order_id = $post['order_id'];
|
||
$data = $orderForm->orderSales();
|
||
return $this->responseHandler($data);
|
||
}
|
||
|
||
|
||
/**
|
||
* showdoc
|
||
* @catalog 订单
|
||
* @title 售后订单列表
|
||
* @description 本接口提供售后订单列表
|
||
* @method get
|
||
* @url /api/order/order-sales-list
|
||
* @param order_id 不必选 int 订单ID
|
||
* @param plugin_sign 必选 int 标识sale_list
|
||
* @return {"code":0,"msg":"ok","data":{"refund_price":"600.00","type":1,"remark":null,"apply_time":1668048577,"agree_time":1668050369,"detailed":"球车租赁","status":3,"merchant_remark":"没钱退"}}
|
||
* @return_param refund_price int 退款金额
|
||
* @return_param type int 退款类型
|
||
* @return_param remark string 退款说明
|
||
* @return_param apply_time int 申请时间
|
||
* @return_param agree_time int 同意时间
|
||
* @return_param detailed string 退款明细
|
||
* @return_param status string 状态:1=待商家处理,2=同意,3=拒绝
|
||
* @return_param merchant_remark string 商家同意|拒绝备注、理由
|
||
*/
|
||
public function actionOrderSalesList()
|
||
{
|
||
$orderForm = new OrderForm();
|
||
$post = \Yii::$app->request->get();
|
||
$orderForm->setScenario($post['plugin_sign']);
|
||
$orderForm->cx_mch_id = $this->cx_mch_id;
|
||
$orderForm->user_id = \Yii::$app->user->identity->id;
|
||
$orderForm->attributes = $post;
|
||
$data = $orderForm->saleList();
|
||
return $this->responseHandler($data);
|
||
}
|
||
|
||
/**
|
||
* hidedoc
|
||
* @catalog 订单
|
||
* @title 获取是否需要缴纳押金和押金金额
|
||
* @description 本接口提供校验是否需要缴纳押金和获取押金金额
|
||
* @method post
|
||
* @url /api/order/check-deposit
|
||
* @param plugin_sign 必选 string 订单类型:球车租赁=ball_cart,交纳押金=deposit
|
||
* @param store_id 必选 string 门店ID
|
||
* @param ball_number 必选 string 球车编号
|
||
* @param pay_type 必选 string 支付方式:微信支付=wxpay,微信支付分=wxpay_points
|
||
* @return {"code":0,"msg":"ok","data":{"is_deposit":true,"deposit_money":"2000"}}
|
||
* @return_param is_deposit bool 是否需要交纳押金,true为需要,false为不需要
|
||
* @return_param deposit_money string 押金金额
|
||
* @remark 注:code!=0时,msg为异常信息.不会返回data数据
|
||
*/
|
||
public function actionCheckDeposit()
|
||
{
|
||
if (!\Yii::$app->request->isPost) {
|
||
$data = $this->invaildRequest();
|
||
return $this->responseHandler($data);
|
||
}
|
||
$orderForm = new OrderForm();
|
||
$orderForm->scenario = 'check_deposit';
|
||
$orderForm->attributes = \Yii::$app->request->post();
|
||
$orderForm->cx_mch_id = $this->cx_mch_id;
|
||
$orderForm->user_id = \Yii::$app->user->identity->id;
|
||
$orderForm->user_type = \Yii::$app->user->identity->type;
|
||
$data = $orderForm->check_deposit();
|
||
return $this->responseHandler($data);
|
||
}
|
||
|
||
|
||
/**
|
||
* hidedoc
|
||
* @catalog 订单
|
||
* @title 创建押金订单
|
||
* @description 本接口提供创建押金订单
|
||
* @method post
|
||
* @url /api/order/order-buy-deposit
|
||
* @param plugin_sign 必选 string 订单类型,固定:deposit
|
||
* @param price 必选 string 订单金额
|
||
* @param store_id 必选 string 球车所在门店ID
|
||
* @param ball_number 必选 string 球车编号
|
||
* @param pay_type 必选 string 支付方式:固定为微信支付=wxpay
|
||
* @return {"code":0,"msg":"ok","data":{"id":"1"}}
|
||
* @remark 注:押金订单只能微信支付,不能支付分支付
|
||
*/
|
||
public function actionOrderBuyDeposit()
|
||
{
|
||
if (!\Yii::$app->request->isPost) {
|
||
$data = $this->invaildRequest();
|
||
return $this->responseHandler($data);
|
||
}
|
||
$orderForm = new OrderForm();
|
||
$orderForm->scenario = 'deposit';
|
||
$orderForm->attributes = \Yii::$app->request->post();
|
||
$orderForm->cx_mch_id = $this->cx_mch_id;
|
||
$orderForm->user_id = \Yii::$app->user->identity->id;
|
||
$orderForm->user_type = \Yii::$app->user->identity->type;
|
||
$data = $orderForm->createOrderDeposit();
|
||
return $this->responseHandler($data);
|
||
}
|
||
|
||
/**
|
||
* hidedoc
|
||
* @catalog 订单
|
||
* @title 押金订单列表
|
||
* @description 押金订单列表
|
||
* @method post
|
||
* @url /api/order/order-deposit
|
||
* @param page 不必选 int 页码
|
||
* @param limit 不必选 int 条数
|
||
* @return {"code":0,"msg":"ok","data":[{"id":"1"}]}
|
||
* @remark 注:押金订单只能微信支付,不能支付分支付
|
||
*/
|
||
public function actionOrderDeposit()
|
||
{
|
||
$request = Yii::$app->request;
|
||
$get = $request->get();
|
||
$orderForm = new OrderForm();
|
||
$orderForm->cx_mch_id = $this->cx_mch_id;
|
||
$orderForm->page = $get['page'];
|
||
$orderForm->limit = $get['limit'];
|
||
$orderForm->user_id = \Yii::$app->user->identity->id;
|
||
$data = $orderForm->search_order_deposit();
|
||
return $this->responseHandler($data);
|
||
}
|
||
|
||
//创建支付分订单
|
||
public function actionOrderBuyPoints()
|
||
{
|
||
$orderForm = new OrderForm();
|
||
$orderForm->scenario = 'ball_cart';
|
||
$orderForm->attributes = \Yii::$app->request->post();
|
||
$orderForm->cx_mch_id = $this->cx_mch_id;
|
||
$orderForm->user_id = \Yii::$app->user->identity->id;
|
||
$orderForm->user_type = \Yii::$app->user->identity->type;
|
||
$data = $orderForm->createOrderPoints();
|
||
return $this->responseHandler($data);
|
||
|
||
}
|
||
|
||
/**
|
||
* hidedoc
|
||
* @catalog 订单
|
||
* @title 关闭订单
|
||
* @description 本接口提供订单正在支付中,关闭或取消支付.将球车更新为正常状态
|
||
* @method post
|
||
* @url /api/order/close-order
|
||
* @param order_id 必选 int 订单id
|
||
* @return {"code":0,"msg":"ok","data":{}}
|
||
* @remark 注:押金订单只能微信支付,不能支付分支付
|
||
*/
|
||
public function actionCloseOrder()
|
||
{
|
||
if (!\Yii::$app->request->isPost) {
|
||
$data = $this->invaildRequest();
|
||
return $this->responseHandler($data);
|
||
}
|
||
$order_id = \Yii::$app->request->post('order_id');
|
||
$orderForm = new OrderForm();
|
||
$orderForm->cx_mch_id = $this->cx_mch_id;
|
||
$data = $orderForm->closeOrder($order_id);
|
||
return $this->responseHandler($data);
|
||
}
|
||
|
||
/**
|
||
* showdoc
|
||
* @catalog 订单
|
||
* @title 创建商品订单
|
||
* @description 本接口提供创建商品订单
|
||
* @method post
|
||
* @url /api/order/order-buy-goods
|
||
* @param cid 必选 string 设备ID
|
||
* @return {"code":0,"msg":"ok","data":{"id":"1"}}
|
||
* @remark 扫码开柜调用
|
||
* @author LLB
|
||
*/
|
||
public function actionOrderBuyGoods()
|
||
{
|
||
if (!\Yii::$app->request->isPost) {
|
||
$data = $this->invaildRequest();
|
||
return $this->responseHandler($data);
|
||
}
|
||
$form = new OrderGoodsForm();
|
||
$form->scenario = 'order_buy_goods';
|
||
$form->cid = \Yii::$app->request->post('cid');
|
||
$form->user_id = \Yii::$app->user->identity->id;
|
||
$data = $form->addGoodsOrder();
|
||
return $this->responseHandler($data);
|
||
}
|
||
|
||
/**
|
||
* showdoc
|
||
* @catalog 订单
|
||
* @title 浏览商品订单
|
||
* @description 本接口提供浏览商品订单
|
||
* @method get
|
||
* @url /api/order/order-buy-goods-view
|
||
* @param order_id 必选 string 订单ID
|
||
* @return {"code":0,"msg":"ok","data":{"id":"1"}}
|
||
* @return_param id int 订单ID
|
||
* @return_param order_no int 订单编号
|
||
* @return_param status int 订单状态0=已支付1=未支付2=用户申请售后3=已取消
|
||
* @return_param pay_type int 支付方式0=余额支付1=微信支付
|
||
* @return_param created_at int 下单时间戳
|
||
* @return_param created_at_cn int 下单日期
|
||
* @return_param total_price string 总计
|
||
* @return_param discount string 会员折扣
|
||
* @return_param integral int 积分抵扣
|
||
* @return_param sure_price string 总计价格,为0或小于0不能发起售后
|
||
* @return_param account_integral string 账户积分
|
||
* @return_param detail array 商品数据
|
||
* @return_param detail.id string 订单商品记录ID
|
||
* @return_param detail.goods_id string 商品ID
|
||
* @return_param detail.num string 数量
|
||
* @return_param detail.name string 名称
|
||
* @return_param detail.price string 单价
|
||
* @return_param detail.unit string 单位
|
||
* @return_param detail.cover_pic string 缩略图
|
||
* @return_param detail.total_original_price string 商品总价,优惠前
|
||
* @return_param detail.total_price string 商品总价,优惠后
|
||
* @return_param timeout_cancel string 待支付剩余秒数,为0则不展示
|
||
* @remark
|
||
* @author LLB
|
||
*/
|
||
public function actionOrderBuyGoodsView()
|
||
{
|
||
$form = new OrderGoodsForm();
|
||
$form->scenario = 'order_buy_goods_view';
|
||
$form->order_id = \Yii::$app->request->get('order_id');
|
||
$form->user_id = \Yii::$app->user->identity->id;
|
||
$data = $form->orderBuyGoodsView();
|
||
return $this->responseHandler($data);
|
||
}
|
||
|
||
/**
|
||
* showdoc
|
||
* @catalog 订单
|
||
* @title 商品订单列表
|
||
* @description 本接口提供商品订单列表
|
||
* @method get
|
||
* @url /api/order/order-goods-lists
|
||
* @param page 不必选 int 页码
|
||
* @param limit 不必选 int 条数
|
||
* @param status 不必选 string 订单状态0=全部1=待支付2=已支付3=退款/取消
|
||
* @return {"code":0,"msg":"ok","data":{"id":"1"}}
|
||
* @return_param id int 订单ID
|
||
* @return_param status int 订单状态0=已完成1=待支付2=用户申请售后3=已取消
|
||
* @return_param status_cn string 订单状态描述
|
||
* @return_param created_at_cn int 下单日期
|
||
* @return_param total_price string 总计
|
||
* @return_param count string 商品数量
|
||
* @return_param cover_pics array 商品图片
|
||
* @return_param sale_button bool 是否可以发起售后true=可以false=不可以
|
||
* @remark 可根据status与status_cn字段判断字体颜色,任选一个即可
|
||
* @author LLB
|
||
*/
|
||
public function actionOrderGoodsLists()
|
||
{
|
||
$form = new OrderGoodsForm();
|
||
$form->scenario = 'order_goods_lists';
|
||
$form->attributes = \Yii::$app->request->get();
|
||
$form->user_id = \Yii::$app->user->identity->id;
|
||
$data = $form->orderGoodsLists();
|
||
return $this->responseHandler($data);
|
||
}
|
||
|
||
/**
|
||
* showdoc
|
||
* @catalog 订单
|
||
* @title 判断选购商品是否可以跳转订单支付页面-轮询
|
||
* @description 本接口提供判断选购商品是否可以跳转订单支付页面
|
||
* @method get
|
||
* @url /api/order/order-goods-check
|
||
* @return {"code":0,"msg":"ok","data":{"id":"1"}}
|
||
* @remark
|
||
* @author LLB
|
||
*/
|
||
public function actionOrderGoodsCheck()
|
||
{
|
||
$form = new OrderGoodsForm();
|
||
$form->scenario = 'order_goods_check';
|
||
$form->user_id = \Yii::$app->user->isGuest ? 0 : \Yii::$app->user->identity->id;
|
||
$data = $form->orderGoodsCheck();
|
||
return $this->responseHandler($data);
|
||
}
|
||
|
||
/**
|
||
* showdoc
|
||
* @catalog 订单
|
||
* @title 商品订单详情
|
||
* @description 本接口提供商品订单详情
|
||
* @method get
|
||
* @url /api/order/order-goods-details
|
||
* @param order_id 必选 string 订单ID
|
||
* @return {"code":0,"msg":"ok","data":{"id":"1"}}
|
||
* @return_param id int 订单ID
|
||
* @return_param order_no int 订单编号
|
||
* @return_param status int 订单状态0=已支付1=未支付2=用户申请售后3=已取消
|
||
* @return_param pay_type int 支付方式0=余额支付1=微信支付
|
||
* @return_param created_at int 下单时间戳
|
||
* @return_param created_at_cn int 下单日期
|
||
* @return_param total_price string 总计
|
||
* @return_param discount string 会员折扣
|
||
* @return_param integral int 积分抵扣
|
||
* @return_param sure_price string 总计价格,为0或小于0不能发起售后
|
||
* @return_param account_integral string 账户积分
|
||
* @return_param detail array 商品数据
|
||
* @return_param detail.id string 订单商品记录ID
|
||
* @return_param detail.goods_id string 商品ID
|
||
* @return_param detail.num string 数量
|
||
* @return_param detail.name string 名称
|
||
* @return_param detail.price string 单价
|
||
* @return_param detail.unit string 单位
|
||
* @return_param detail.cover_pic string 缩略图
|
||
* @return_param detail.total_original_price string 商品总价,优惠前
|
||
* @return_param detail.total_price string 商品总价,优惠后
|
||
* @return_param timeout_cancel string 待支付剩余秒数,为0则不展示
|
||
* @return_param plugin_sign string 订单类型,包厢=box_book,商品=goods
|
||
* @return_param sale_button bool 是否可以发起售后true=可以false=不可以
|
||
* @remark
|
||
* @author LLB
|
||
*/
|
||
public function actionOrderGoodsDetails()
|
||
{
|
||
$form = new OrderGoodsForm();
|
||
$form->scenario = 'order_goods_lists';
|
||
$form->attributes = \Yii::$app->request->get();
|
||
$form->user_id = \Yii::$app->user->identity->id;
|
||
$data = $form->orderGoodsDetails();
|
||
return $this->responseHandler($data);
|
||
}
|
||
|
||
/**
|
||
* showdoc
|
||
* @catalog 订单
|
||
* @title 商品订单售后详情
|
||
* @description 本接口提供商品订单售后详情
|
||
* @method get
|
||
* @url /api/order/order-goods-sale-details
|
||
* @param order_id 必选 string 订单ID
|
||
* @return {"code":0,"msg":"ok","data":{"id":"1"}}
|
||
* @return_param type int 售后原因
|
||
* @return_param status int 售后状态,1=待处理2=已同意3=已拒绝4=已退款
|
||
* @return_param refund_price int 退款金额
|
||
* @return_param pay_type int 支付方式0=余额1=微信
|
||
* @remark
|
||
* @author LLB
|
||
*/
|
||
public function actionOrderGoodsSaleDetails()
|
||
{
|
||
$form = new OrderGoodsForm();
|
||
$form->scenario = 'order_goods_sale_details';
|
||
$form->order_id = \Yii::$app->request->get('order_id');
|
||
$form->user_id = \Yii::$app->user->identity->id;
|
||
$data = $form->orderGoodsSaleDetails();
|
||
return $this->responseHandler($data);
|
||
}
|
||
|
||
|
||
/**
|
||
* showdoc
|
||
* @catalog 小兔开门
|
||
* @title 小兔开门
|
||
* @description 本接口提供小兔开门
|
||
* @method get
|
||
* @url /api/order/xt-open
|
||
* @param order_id 必选 string 订单ID
|
||
* @param sn 必选 string 设备码
|
||
* @param open_type 必选 string 1-点击开门 2-开门二维码
|
||
* @return {"code":0,"msg":"ok","data":{"id":"1"}}
|
||
* @remark
|
||
* @author LLB
|
||
*/
|
||
public function actionXtOpen()
|
||
{
|
||
$form = new OrderForm();
|
||
$form->scenario = 'open_door';
|
||
$form->order_id = \Yii::$app->request->get('order_id');
|
||
$form->sn = \Yii::$app->request->get('sn');
|
||
$form->open_type = \Yii::$app->request->get('open_type');
|
||
$form->user_id = \Yii::$app->user->identity->id;
|
||
$data = $form->openDoor();
|
||
return $this->responseHandler($data);
|
||
}
|
||
|
||
/**
|
||
* showdoc
|
||
* @catalog 订单
|
||
* @title 订单列表-全部
|
||
* @description 本接口提供订单列表-全部
|
||
* @method get
|
||
* @url /api/order/search-all
|
||
* @param page 必选 string 页面,不传默认1
|
||
* @param limit 必选 string 条目,不传默认20
|
||
* @param status 必选 string 订单状态0=全部1=待支付2=已支付3=退款/取消
|
||
* @return {"code":0,"msg":"ok","data":{"id":"1"}}
|
||
* @remark
|
||
* @author LLB
|
||
*/
|
||
public function actionSearchAll()
|
||
{
|
||
$orderForm = new OrderForm();
|
||
$orderForm->page = \Yii::$app->request->get('page',1);
|
||
$orderForm->limit = \Yii::$app->request->get('limit',20);
|
||
$orderForm->status = \Yii::$app->request->get('status');
|
||
$orderForm->user_id = \Yii::$app->user->identity->id;
|
||
$data = $orderForm->searchAll();
|
||
return $this->responseHandler($data);
|
||
}
|
||
}
|