| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- /**
- * Created by PhpStorm.
- * User: admin
- * Date: 2019/12/1
- * Time: 13:55
- */
- namespace business\controllers;
- use Yii;
- use common\components\util;
- use biz\goods\services\GoodsService;
- class GoodsController extends BaseController
- {
-
- //商品列表 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->post();
- $data['merchantId'] = $this->merchantId;
- $info = GoodsService::addGoods($data);
- util::success($info);
- }
- //获取商品详情 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();
- }
-
- }
|