|
|
@@ -79,18 +79,19 @@ class GoodsController extends BaseController
|
|
|
public function actionSort()
|
|
|
{
|
|
|
$id = Yii::$app->request->get('id', 0);
|
|
|
- $cId = Yii::$app->request->get('cId', -1);
|
|
|
+ $cId = Yii::$app->request->get('cId', 0);
|
|
|
$inTurn = Yii::$app->request->get('inTurn', 0);
|
|
|
//验证商品
|
|
|
$info = GoodsService::getById($id);
|
|
|
GoodsService::valid($info, $this->merchantId);
|
|
|
- if ($cId != -1) {
|
|
|
+ if ($cId != 0) {
|
|
|
//验证分类
|
|
|
$category = CategoryService::getById($cId);
|
|
|
CategoryService::valid($category, $this->merchantId);
|
|
|
GoodsCategoryService::updateByCondition(['cId' => $cId, 'gId' => $id], ['inTurn' => $inTurn]);
|
|
|
} else {
|
|
|
GoodsService::updateById($id, ['inTurn' => $inTurn]);
|
|
|
+ GoodsCategoryService::updateByCondition(['gId' => $id], ['inTurn' => $inTurn]);
|
|
|
}
|
|
|
util::complete('操作成功');
|
|
|
}
|