89 lines
2.6 KiB
PHP
89 lines
2.6 KiB
PHP
<?php
|
|
|
|
/**
|
|
* @author Any
|
|
* @description KISS
|
|
* @date 2021年10月12日
|
|
* @version 1.0.0
|
|
*
|
|
* _____LOG_____
|
|
*
|
|
*/
|
|
namespace app\modules\api\controllers\mall\integral;
|
|
|
|
use app\modules\api\behaviors\LoginBehavior;
|
|
use app\models\common\integral\mall\CommonIntegralMallOrderDataForm;
|
|
use app\models\common\integral\mall\CommonIntegralMallOrderSubmitForm;
|
|
use app\models\Order;
|
|
use app\modules\api\controllers\Controller;
|
|
use app\components\SysConst;
|
|
|
|
class OrderController extends Controller
|
|
{
|
|
public function behaviors() {
|
|
return array_merge(parent::behaviors(),[
|
|
'login' => [
|
|
'class' => LoginBehavior::className(),
|
|
'ignore' => [
|
|
]
|
|
]
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* hidedoc
|
|
* @catalog 积分商城/订单
|
|
* @title 订单预览
|
|
* @description 本接口提供订单预览
|
|
* @method get
|
|
* @url /api/mall/integral/preview
|
|
* @param goods_info 必选 array 商品信息[{goods_id:'',goods_attr_id:'',num:''}]
|
|
* @return {"code":0,"msg":"ok","data":{}}
|
|
* @return_param goods_list array 商品列表
|
|
* @return_param address object 收货地址
|
|
* @return_param pay_types array 支持支付类型
|
|
* @remark 备注
|
|
*/
|
|
public function actionPreview()
|
|
{
|
|
$form = new CommonIntegralMallOrderDataForm();
|
|
$form->attributes = \Yii::$app->request->get();
|
|
$form->user_id = \Yii::$app->user->identity->id;
|
|
$form->cx_mch_id = $this->cx_mch_id;
|
|
$data = $form->search();
|
|
return $this->responseHandler($data);
|
|
}
|
|
|
|
/**
|
|
* hidedoc
|
|
* @catalog 积分商城/订单
|
|
* @title 订单提交
|
|
* @description 本接口提供订单提交
|
|
* @method post
|
|
* @url /api/mall/integral/submit
|
|
* @param goods_info 必选 array 商品信息[{goods_id:'',goods_attr_id:'',goods_num:''}]
|
|
* @param address_id 必选 integer 收货地址ID
|
|
* @param pay_type 非必选 string 支付类型,默认积分支付
|
|
* @param remark 非必选 string 备注
|
|
* @return {"code":0,"msg":"ok","data":{}}
|
|
* @return_param pay_id int 合并支付ID
|
|
* @remark 备注
|
|
*/
|
|
public function actionSubmit()
|
|
{
|
|
if(!\Yii::$app->request->isPost){
|
|
$data = $this->invaildRequest();
|
|
return $this->responseHandler($data);
|
|
}
|
|
$form = new CommonIntegralMallOrderSubmitForm();
|
|
$form->attributes = \Yii::$app->request->post();
|
|
$form->user_id = \Yii::$app->user->identity->id;
|
|
$form->cx_mch_id = $this->cx_mch_id;
|
|
$data = $form->save();
|
|
return $this->responseHandler($data);
|
|
}
|
|
|
|
|
|
}
|
|
|