You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.3 KiB
55 lines
1.3 KiB
<?php
|
|
|
|
namespace api\controllers;
|
|
|
|
use yii\web\ForbiddenHttpException;
|
|
use Yii;
|
|
|
|
/**
|
|
* @author iron
|
|
* @email weiriron@gmail.com
|
|
*/
|
|
class OrderController extends CommonController
|
|
{
|
|
public $modelClass = 'common\models\ars\Order';
|
|
|
|
|
|
protected function getFilter()
|
|
{
|
|
$status = Yii::$app->request->getBodyParam('status');
|
|
$data = \Yii::$app->request->getBodyParams();
|
|
$data['user'] = true;
|
|
\Yii::$app->request->setBodyParams($data);
|
|
$array = ['user_id' => Yii::$app->user->getId()];
|
|
if ($status) {
|
|
$array['status'] = $status;
|
|
}
|
|
$filter = ['class' => 'yii\data\ActiveDataFilter',
|
|
'filter' => $array,
|
|
'searchModel' => ['class' => 'common\models\searchs\OrderSearch']];
|
|
return $filter;
|
|
}
|
|
|
|
public function actionCreate()
|
|
{
|
|
$originId = Yii::$app->request->getBodyParam('originId');
|
|
$count = Yii::$app->request->getBodyParam('count');
|
|
$skuId = Yii::$app->request->getBodyParam('skuId');
|
|
return Yii::$app->orderLogic->addGoods($originId, $count, $skuId);
|
|
}
|
|
|
|
/**
|
|
* @return mixed
|
|
* @throws \yii\base\InvalidConfigException
|
|
*/
|
|
public function actionUpdate()
|
|
{
|
|
$data = Yii::$app->request->getBodyParams();
|
|
return Yii::$app->orderLogic->update($data);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|