ItemController.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. $headers = Yii::$app->getRequest()->getHeaders();
  25. $appVersion = $headers->get('appVersion');
  26. if ($appVersion != 3) {
  27. util::fail('请先升级系统');
  28. }
  29. $get = Yii::$app->request->get();
  30. $isCashier = $get['isCashier'] ?? 0;
  31. $mainId = $this->mainId;
  32. if ($isCashier == 1) {
  33. //去掉收银台提示价格更新
  34. $staffId = $this->shopAdminId;
  35. Yii::$app->redis->executeCommand('DEL', ['cashier_' . $mainId . '_' . $staffId . '_may_refresh']);
  36. }
  37. $where['mainId'] = $mainId;
  38. $where['delStatus'] = 0;
  39. $where['status'] = 1;
  40. $list = \bizHd\item\classes\ItemClass::getShowList($where);
  41. util::success(['list' => $list]);
  42. }
  43. public function actionAdd()
  44. {
  45. util::fail('开发中');
  46. }
  47. public function actionBatchAdd()
  48. {
  49. util::fail('开发中');
  50. }
  51. public function actionDelete()
  52. {
  53. util::fail('不能删除哦!');
  54. }
  55. //获取平台里的花材信息
  56. public function actionPlatformItem()
  57. {
  58. $py = Yii::$app->request->get('py', '');
  59. $where = [];
  60. if ($py) {
  61. $where = ['py' => $py];
  62. }
  63. $list = PtItemClass::getItemList($where);
  64. util::success($list);
  65. }
  66. }