ItemController.php 2.1 KB

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