diff --git a/models/GoodsAttr.php b/models/GoodsAttr.php index 37682cb..f43a2e4 100644 --- a/models/GoodsAttr.php +++ b/models/GoodsAttr.php @@ -52,7 +52,7 @@ class GoodsAttr extends \yii\db\ActiveRecord return [ 'id' => 'ID', 'cx_mch_id' => '平台商户ID', - 'goods_id' => '商品ID', + 'goods_idgoods_id' => '商品ID', 'sign_id' => '规格ID标识,规格:规格值', 'stock' => '库存', 'price' => '价格', diff --git a/models/common/CommonGoodsEditForm.php b/models/common/CommonGoodsEditForm.php index 9cda94d..f55cab0 100644 --- a/models/common/CommonGoodsEditForm.php +++ b/models/common/CommonGoodsEditForm.php @@ -149,11 +149,6 @@ class CommonGoodsEditForm extends Model //保存商品基础信息 $res1 = $this->saveGoodsCat(); - $res2 = $this->saveGoodsAttr(); - if ($res2['code'] != 0) { - $t->rollBack(); - return $res2; - } if ($res['code'] != 0) { $t->rollBack(); @@ -163,12 +158,15 @@ class CommonGoodsEditForm extends Model return $res1; } - if (!$this->model->save()) { $t->rollBack(); return $this->getModelError($this->model); } - + $res2 = $this->saveGoodsAttr(); + if ($res2['code'] != 0) { + $t->rollBack(); + return $res2; + } $t->commit(); return $this->apiReturnSuccess('保存成功'); } diff --git a/modules/admin/controllers/mall/GoodsController.php b/modules/admin/controllers/mall/GoodsController.php index b59c0ed..85b05a8 100644 --- a/modules/admin/controllers/mall/GoodsController.php +++ b/modules/admin/controllers/mall/GoodsController.php @@ -150,7 +150,7 @@ class GoodsController extends Controller 'is_delete' => 0, 'type' => Cat::TYPE_GOODS, ]) - ->orderBy(['sort' => SORT_ASC, 'created_at' => SORT_DESC]) + ->orderBy(['sort' => SORT_ASC, 'id' => SORT_DESC]) ->select('id,name')->asArray()->all(); $cat_list1 = Cat1::find() @@ -159,7 +159,7 @@ class GoodsController extends Controller 'is_delete' => 0, 'type' => Cat::TYPE_GOODS, ]) - ->orderBy(['sort' => SORT_ASC, 'created_at' => SORT_DESC]) + ->orderBy(['sort' => SORT_ASC, 'id' => SORT_DESC]) ->select('id,name')->asArray()->all(); $cat_list2 = Cat2::find() @@ -168,7 +168,7 @@ class GoodsController extends Controller 'is_delete' => 0, 'type' => Cat::TYPE_GOODS, ]) - ->orderBy(['sort' => SORT_ASC, 'created_at' => SORT_DESC]) + ->orderBy(['sort' => SORT_ASC, 'id' => SORT_DESC]) ->select('id,name')->asArray()->all(); $cat_list3 = Cat3::find() @@ -177,7 +177,7 @@ class GoodsController extends Controller 'is_delete' => 0, 'type' => Cat::TYPE_GOODS, ]) - ->orderBy(['sort' => SORT_ASC, 'created_at' => SORT_DESC]) + ->orderBy(['sort' => SORT_ASC, 'id' => SORT_DESC]) ->select('id,name')->asArray()->all(); $cat_list4 = Cat4::find() @@ -186,7 +186,7 @@ class GoodsController extends Controller 'is_delete' => 0, 'type' => Cat::TYPE_GOODS, ]) - ->orderBy(['sort' => SORT_ASC, 'created_at' => SORT_DESC]) + ->orderBy(['sort' => SORT_ASC, 'id' => SORT_DESC]) ->select('id,name')->asArray()->all();