ItemController.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. namespace ghs\controllers;
  3. use biz\item\classes\PtItemClass;
  4. use bizGhs\item\classes\ItemClass;
  5. use bizGhs\item\services\ItemService;
  6. use common\components\util;
  7. use common\services\xhItemService;
  8. use Yii;
  9. class ItemController extends BaseController
  10. {
  11. public function actionList()
  12. {
  13. $classId = Yii::$app->request->get('classId', 0);
  14. $where['merchantId'] = $this->sjId;
  15. if (!empty($classId)) {
  16. $where['classId'] = $classId;
  17. }
  18. $list = ItemClass::getGhsItemList($where);
  19. util::success($list);
  20. }
  21. public function actionAdd()
  22. {
  23. $post = Yii::$app->request->post();
  24. $post['adminId'] = $this->adminId;
  25. // $post['shopId'] = $this->shopId;
  26. $post['merchantId'] = $this->sjId;
  27. ItemService::addGhsItem($post);
  28. util::complete('添加成功');
  29. }
  30. public function actionUpdate()
  31. {
  32. $data = Yii::$app->request->post();
  33. $data['adminId'] = $this->adminId;
  34. $data['merchantId'] = $this->sjId;
  35. ItemService::updateGshItem($data);
  36. util::complete('修改成功');
  37. }
  38. public function actionDelete()
  39. {
  40. $get = Yii::$app->request->get();
  41. $id = isset($get['id']) ? $get['id'] : 0;
  42. ItemService::deleteGhsItem($id, $this->shopId, $this->sjId, $this->adminId);
  43. util::complete('操作成功');
  44. }
  45. //获取平台里的花材信息
  46. public function actionPlatformItem()
  47. {
  48. $py = Yii::$app->request->get('py', '');
  49. $where = [];
  50. if ($py) {
  51. $where = ['py' => $py];
  52. }
  53. $list = PtItemClass::getItemList($where);
  54. util::success($list);
  55. }
  56. }