request->post(); $arr = []; if (isset($post['orderFlow'])) { $arr['orderFlow'] = $post['orderFlow']; } if (isset($post['thirdSend'])) { $arr['thirdSend'] = $post['thirdSend']; } if (isset($post['thirdSendFee'])) { $arr['thirdSendFee'] = $post['thirdSendFee']; } if (empty($arr)) { util::fail('没有需要修改'); } $shopId = $this->shopId; \bizHd\shop\classes\ShopExtClass::updateByCondition(['shopId' => $shopId], $arr); //零售端暂时同步更新 $shop = $this->shop; $lsShopId = $shop->lsShopId; \bizHd\shop\classes\ShopExtClass::updateByCondition(['shopId' => $lsShopId], $arr); util::complete('修改成功'); } //设置处理花材、扫码收款和直接收款使用的花材 ssh 20250905 public function actionSetItem() { $post = Yii::$app->request->post(); $shopId = $this->shopId; $shop = $this->shop; $lsShopId = $shop->lsShopId ?? 0; $lsExt = null; //零售端需要同步修改 if (!empty($lsShopId)) { $lsExt = \bizHd\shop\classes\ShopExtClass::getByCondition(['shopId' => $lsShopId], true); } $ext = \bizHd\shop\classes\ShopExtClass::getByCondition(['shopId' => $shopId], true); $losingItem = $post['losingItem'] ?? 0; if (!empty($losingItem)) { $info = ProductClass::getById($losingItem, true); if ($info->mainId != $this->mainId) { util::fail('不是你的花材呢,编号099323'); } $ext->losingItem = $losingItem; $ext->save(); if (!empty($lsExt)) { $lsExt->losingItem = $losingItem; $lsExt->save(); } } $zjGatheringItem = $post['zjGatheringItem'] ?? 0; if (!empty($zjGatheringItem)) { $info = ProductClass::getById($losingItem, true); if ($info->mainId != $this->mainId) { util::fail('不是你的花材呢,编号099324'); } $ext->zjGatheringItem = $zjGatheringItem; $ext->save(); if (!empty($lsExt)) { $lsExt->zjGatheringItem = $zjGatheringItem; $lsExt->save(); } } util::complete('修改成功'); } public function actionInfo() { $ext = $this->shopExt; $losingItemId = $ext->losingItem ?? 0; $losingItem = ProductClass::getById($losingItemId, true); $losingItemName = $losingItem->name ?? ''; $zjGatheringItemId = $ext->zjGatheringItem ?? 0; $zjGatheringItem = ProductClass::getById($zjGatheringItemId, true); $zjGatheringItemName = $zjGatheringItem->name ?? ''; $arr = $ext->attributes ?? []; $arr['losingItemName'] = $losingItemName; $arr['zjGatheringItemName'] = $zjGatheringItemName; $arr['main'] = $this->main; util::success($arr); } //添加外采打印机 ssh 20230618 public function actionAddWcPrint() { $shopAdmin = $this->shopAdmin; if (!isset($shopAdmin->super) || $shopAdmin->super != 1) { util::fail('超管才能修改'); } $shopId = $this->shopId; $ext = ShopExtClass::getByCondition(['shopId' => $shopId], true); $get = Yii::$app->request->get(); $wcPrintSn = $get['wcPrintSn'] ?? ''; $wcPrintKey = $get['wcPrintKey'] ?? ''; $wcPrintSn2 = $get['wcPrintSn2'] ?? ''; $wcPrintKey2 = $get['wcPrintKey2'] ?? ''; $wcPrintSn3 = $get['wcPrintSn3'] ?? ''; $wcPrintKey3 = $get['wcPrintKey3'] ?? ''; $shop = $this->shop; $default = $shop->default ?? 0; $shopName = $shop->shopName ?? ''; $sj = $this->sj; $sjName = $sj->name ?? ''; $name = $default == 1 && $shopName == '首店' ? $sjName : $sjName . ' ' . $shopName; if (empty($wcPrintSn) && !empty($wcPrintSn2)) { util::fail('请先填写小票机编号1'); } if (empty($wcPrintSn2) && !empty($wcPrintSn3)) { util::fail('请先填写小票机编号2'); } $hasFail = 0; if (!empty($wcPrintSn) && !empty($wcPrintKey)) { $print = new printUtil($wcPrintSn); $return = $print->addPrint($wcPrintKey, $name); if ($return) { $ext->wcPrintSn = $wcPrintSn; $ext->wcPrintKey = $wcPrintKey; $ext->save(); } else { $hasFail = 1; } } else { $ext->wcPrintSn = ''; $ext->wcPrintKey = ''; $ext->save(); } if (!empty($wcPrintSn2) && !empty($wcPrintKey2)) { $print = new printUtil($wcPrintSn2); $return = $print->addPrint($wcPrintKey2, $name); if ($return) { $ext->wcPrintSn2 = $wcPrintSn2; $ext->wcPrintKey2 = $wcPrintKey2; $ext->save(); } else { $hasFail = 1; } } else { $ext->wcPrintSn2 = ''; $ext->wcPrintKey2 = ''; $ext->save(); } if (!empty($wcPrintSn3) && !empty($wcPrintKey3)) { $print = new printUtil($wcPrintSn3); $return = $print->addPrint($wcPrintKey3, $name); if ($return) { $ext->wcPrintSn3 = $wcPrintSn3; $ext->wcPrintKey3 = $wcPrintKey3; $ext->save(); } else { $hasFail = 1; } } else { $ext->wcPrintSn3 = ''; $ext->wcPrintKey3 = ''; $ext->save(); } $wcPrintNum = 1; if (isset($ext->wcPrintSn2) && !empty($ext->wcPrintSn2)) { $wcPrintNum = 2; } if (isset($ext->wcPrintSn3) && !empty($ext->wcPrintSn3)) { $wcPrintNum = 3; } ShopExtClass::updateByCondition(['shopId' => $this->shopId], ['wcPrintNum' => $wcPrintNum]); if ($hasFail == 1) { util::success(['hasFail' => 1], '出现添加失败的情况'); } util::complete(); } //添加打印机 ssh 20210712 public function actionAddPrint() { $shopAdmin = $this->shopAdmin; if (isset($shopAdmin->super) == false || $shopAdmin->super != 1) { util::fail('超管才能修改'); } $hasFail = 0; $shopId = $this->shopId; $ext = ShopExtClass::getByCondition(['shopId' => $shopId], true); $get = Yii::$app->request->get(); $printSn = $get['printSn'] ?? ''; $printKey = $get['printKey'] ?? ''; $printLabelSn = $get['printLabelSn'] ?? ''; $printLabelKey = $get['printLabelKey'] ?? ''; $wlLabelSn = $get['wlLabelSn'] ?? ''; $wlLabelKey = $get['wlLabelKey'] ?? ''; $shop = $this->shop; $default = $shop->default ?? 0; $shopName = $shop->shopName ?? ''; $sj = $this->sj; $sjName = $sj->name ?? ''; $name = $default == 1 && $shopName == '首店' ? $sjName : $sjName . ' ' . $shopName; if (!empty($printSn) && !empty($printKey)) { $print = new printUtil($printSn); $return = $print->addPrint($printKey, $name); if ($return) { $ext->printSn = $printSn; $ext->printKey = $printKey; $ext->save(); } else { $hasFail = 1; } } else { $ext->printSn = ''; $ext->printKey = ''; $ext->save(); } if (!empty($printLabelSn) && !empty($printLabelKey)) { $labelPrint = new printUtil($printLabelSn); $return = $labelPrint->addPrint($printLabelKey, $name); if ($return) { $ext->printLabelSn = $printLabelSn; $ext->printLabelKey = $printLabelKey; $ext->save(); //将打印纸张设置为50X40 $labelPrint->times = 1; $content = '50,40'; $labelPrint->printLabelMsg($content); } else { $hasFail = 1; } } else { $ext->printLabelSn = ''; $ext->printLabelKey = ''; $ext->save(); } if (!empty($wlLabelSn) && !empty($wlLabelKey)) { $labelPrint = new printUtil($wlLabelSn); $return = $labelPrint->addPrint($wlLabelKey, $name); if ($return) { $ext->wlLabelSn = $wlLabelSn; $ext->wlLabelKey = $wlLabelKey; $ext->save(); //将打印纸张设置为60X100 $labelPrint->times = 1; $content = '60,100'; $labelPrint->printLabelMsg($content); } else { $hasFail = 1; } } else { $ext->wlLabelSn = ''; $ext->wlLabelKey = ''; $ext->save(); } if ($hasFail == 1) { util::success(['hasFail' => 1], '出现添加失败的情况'); } util::complete(); } //获取打印机信息 public function actionGetPrint() { $shopId = $this->shopId; $ext = ShopExtClass::getByCondition(['shopId' => $shopId]); util::success($ext); } //获取云喇叭信息 ssh 20220105 public function actionGetLb() { $shopId = $this->shopId; $ext = ShopExtClass::getByCondition(['shopId' => $shopId]); util::success($ext); } //添加喇叭 ssh 20220105 public function actionAddLb() { $shopAdmin = $this->shopAdmin; if (isset($shopAdmin->super) == false || $shopAdmin->super != 1) { util::fail('超管才能修改'); } $shopId = $this->shopId; $ext = ShopExtClass::getByCondition(['shopId' => $shopId], true); $get = Yii::$app->request->get(); $lbSn = $get['lbSn'] ?? ''; $lbVersion = $get['lbVersion'] ?? ''; $ext->lbSn = $lbSn; $ext->lbVersion = $lbVersion; $ext->save(); util::complete('设置成功'); } //小菊启用和停用 ssh 20211210 public function actionReplaceXj() { $act = Yii::$app->request->get('act', 'start'); $id = Yii::$app->request->get('id', 0); $xj = XjClass::getById($id, true); if (empty($xj)) { util::fail('没有找到小菊'); } $status = $act == 'start' ? 1 : 2; $xj->status = $status; $xj->save(); util::complete(); } }