| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?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->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();
- }
- }
|