ItemController.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. namespace ghs\controllers;
  3. use bizGhs\item\classes\ItemClass;
  4. use bizGhs\item\services\ItemService;
  5. use common\components\util;
  6. use Yii;
  7. class ItemController extends BaseController
  8. {
  9. public function actionList()
  10. {
  11. //classId
  12. $classId = Yii::$app->request->get('classId',0);
  13. $where['merchantId'] = $this->ghsId;
  14. $where['classId'] = $classId;
  15. $list = ItemClass::getGhsItemList($where);
  16. util::success($list);
  17. }
  18. public function actionAdd()
  19. {
  20. $post = Yii::$app->request->post();
  21. $post['adminId'] = $this->adminId;
  22. $post['shopId'] = $this->shopId;
  23. $post['merchantId'] = $this->ghsId;
  24. ItemService::addGhsItem($post);
  25. util::complete('添加成功');
  26. }
  27. public function actionUpdate()
  28. {
  29. $data = Yii::$app->request->post();
  30. $data['adminId'] = $this->adminId;
  31. $data['merchantId'] = $this->ghsId;
  32. ItemService::updateGshItem($data);
  33. util::complete('修改成功');
  34. }
  35. public function actionDelete()
  36. {
  37. $get = Yii::$app->request->get();
  38. $id = isset($get['id']) ? $get['id'] : 0;
  39. ItemService::deleteGhsItem($id,$this->shopId,$this->adminId);
  40. util::complete('操作成功');
  41. }
  42. }