| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?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
- {
- //index,view,create,update,delete,options
- public $enableCsrfValidation = false;
- 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);
- }
- }
|