|
|
@@ -15,40 +15,45 @@ use biz\goods\services\GoodsService;
|
|
|
|
|
|
class GoodsController extends BaseController
|
|
|
{
|
|
|
- //index,view,create,update,delete,options
|
|
|
-
|
|
|
- public function actionList()
|
|
|
- {
|
|
|
- $where = null;
|
|
|
- $list = GoodsService::getGoodsList($where);
|
|
|
- util::success($list);
|
|
|
- }
|
|
|
-
|
|
|
- public function actionCreate()
|
|
|
- {
|
|
|
- $data = Yii::$app->request->get();
|
|
|
- GoodsService::add($data);
|
|
|
- }
|
|
|
-
|
|
|
- public function actionView()
|
|
|
- {
|
|
|
- $id = Yii::$app->request->get('id');
|
|
|
- $good = GoodsService::getById($id);
|
|
|
- util::success($good);
|
|
|
- }
|
|
|
-
|
|
|
- public function actionUpdate()
|
|
|
- {
|
|
|
- $data = Yii::$app->request->get();
|
|
|
- $id = $data['id'];
|
|
|
- $re = GoodsService::updateById($id, $data);
|
|
|
- util::success($re);
|
|
|
- }
|
|
|
-
|
|
|
- public function actionDelete()
|
|
|
- {
|
|
|
- $id = Yii::$app->request->get('id');
|
|
|
- $good = GoodsService::deleteById($id);
|
|
|
- //util::success($good);
|
|
|
- }
|
|
|
+
|
|
|
+ //商品列表 shish 2019.12.7
|
|
|
+ public function actionList()
|
|
|
+ {
|
|
|
+ $where = ['merchantId' => $this->merchantId];
|
|
|
+ $list = GoodsService::getGoodsList($where);
|
|
|
+ util::success($list);
|
|
|
+ }
|
|
|
+
|
|
|
+ //新建商品 shish 2019.12.7
|
|
|
+ public function actionAdd()
|
|
|
+ {
|
|
|
+ $data = Yii::$app->request->get();
|
|
|
+ GoodsService::add($data);
|
|
|
+ }
|
|
|
+
|
|
|
+ //获取商品详情 shish 2019.12.7
|
|
|
+ public function actionDetail()
|
|
|
+ {
|
|
|
+ $id = Yii::$app->request->get('id');
|
|
|
+ $goods = GoodsService::getGoodsInfo($id);
|
|
|
+ util::success($goods);
|
|
|
+ }
|
|
|
+
|
|
|
+ //更新商品 shish 2019.12.7
|
|
|
+ public function actionUpdate()
|
|
|
+ {
|
|
|
+ $data = Yii::$app->request->get();
|
|
|
+ $id = $data['id'];
|
|
|
+ $re = GoodsService::updateById($id, $data);
|
|
|
+ util::success($re);
|
|
|
+ }
|
|
|
+
|
|
|
+ //删除商品 shish 2019.12.7
|
|
|
+ public function actionDelete()
|
|
|
+ {
|
|
|
+ $id = Yii::$app->request->get('id', 0);
|
|
|
+ GoodsService::deleteGoods($id, $this->admin);
|
|
|
+ util::success();
|
|
|
+ }
|
|
|
+
|
|
|
}
|