| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- <?php
- namespace hd\controllers;
- use biz\item\classes\PtItemClass;
- use bizGhs\item\classes\ItemClass;
- use bizGhs\item\services\ItemService;
- use common\components\util;
- use Yii;
- class ItemController extends BaseController
- {
- //检测是否要刷新
- public function actionCheckRefresh()
- {
- $mainId = $this->mainId;
- $staffId = $this->shopAdminId;
- $respond = Yii::$app->redis->executeCommand('GET', ['cashier_' . $mainId . '_' . $staffId . '_may_refresh']);
- if ($respond == 'yes') {
- util::success(['remind' => 1]);
- }
- util::complete();
- }
- //列出所有花材,包括特价花材列表 ssh 20220315
- public function actionShowList()
- {
- $get = Yii::$app->request->get();
- $isCashier = $get['isCashier'] ?? 0;
- $mainId = $this->mainId;
- if ($isCashier == 1) {
- //去掉收银台提示价格更新
- $staffId = $this->shopAdminId;
- Yii::$app->redis->executeCommand('DEL', ['cashier_' . $mainId . '_' . $staffId . '_may_refresh']);
- }
- $where['mainId'] = $mainId;
- $where['delStatus'] = 0;
- $list = \bizHd\item\classes\ItemClass::getShowList($where);
- util::success(['list' => $list]);
- }
- public function actionAdd()
- {
- $post = Yii::$app->request->post();
- $post['adminId'] = $this->adminId;
- $post['sjId'] = $this->sjId;
- $post['shopId'] = $this->shopId;
- $post['mainId'] = $this->mainId;
- ItemService::addGhsItem($post);
- util::complete('添加成功');
- }
- public function actionBatchAdd()
- {
- $post = Yii::$app->request->post();
- //[{itemId:1000,classId:2,cost:1,addPrice:1,stockWarning:1}]
- $data = $post['data'];
- if (empty($data)) {
- util::fail("参数错误");
- }
- $data = json_decode($data, true);
- if (!is_array($data) || empty($data)) {
- util::fail("参数格式错误");
- }
- foreach ($data as $v) {
- $v['adminId'] = $this->adminId;
- $v['sjId'] = $this->sjId;
- ItemService::addGhsItem($v);
- }
- util::complete('添加成功');
- }
- public function actionDelete()
- {
- util::fail('不能删除哦!');
- }
- //获取平台里的花材信息
- public function actionPlatformItem()
- {
- $py = Yii::$app->request->get('py', '');
- $where = [];
- if ($py) {
- $where = ['py' => $py];
- }
- $list = PtItemClass::getItemList($where);
- util::success($list);
- }
- }
|