ItemController.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. namespace hd\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 Yii;
  8. class ItemController extends BaseController
  9. {
  10. //检测是否要刷新
  11. public function actionCheckRefresh()
  12. {
  13. $mainId = $this->mainId;
  14. $staffId = $this->shopAdminId;
  15. $respond = Yii::$app->redis->executeCommand('GET', ['cashier_' . $mainId . '_' . $staffId . '_may_refresh']);
  16. if ($respond == 'yes') {
  17. util::success(['remind' => 1]);
  18. }
  19. util::complete();
  20. }
  21. //列出所有花材,包括特价花材列表 ssh 20220315
  22. public function actionShowList()
  23. {
  24. $get = Yii::$app->request->get();
  25. $isCashier = $get['isCashier'] ?? 0;
  26. $mainId = $this->mainId;
  27. if ($isCashier == 1) {
  28. //去掉收银台提示价格更新
  29. $staffId = $this->shopAdminId;
  30. Yii::$app->redis->executeCommand('DEL', ['cashier_' . $mainId . '_' . $staffId . '_may_refresh']);
  31. }
  32. $where['mainId'] = $mainId;
  33. $where['delStatus'] = 0;
  34. $where['status'] = 1;
  35. $list = \bizHd\item\classes\ItemClass::getShowList($where);
  36. util::success(['list' => $list]);
  37. }
  38. public function actionAdd()
  39. {
  40. util::fail('开发中');
  41. }
  42. public function actionBatchAdd()
  43. {
  44. util::fail('开发中');
  45. }
  46. public function actionDelete()
  47. {
  48. util::fail('不能删除哦!');
  49. }
  50. //获取平台里的花材信息
  51. public function actionPlatformItem()
  52. {
  53. $py = Yii::$app->request->get('py', '');
  54. $where = [];
  55. if ($py) {
  56. $where = ['py' => $py];
  57. }
  58. $list = PtItemClass::getItemList($where);
  59. util::success($list);
  60. }
  61. }