|
|
@@ -54,7 +54,8 @@ class ShopExtController extends BaseController
|
|
|
$get = Yii::$app->request->get();
|
|
|
$printSn = $get['printSn'] ?? '';
|
|
|
$printKey = $get['printKey'] ?? '';
|
|
|
- $print = new printUtil($printSn);
|
|
|
+ $printLabelSn = $get['printLabelSn'] ?? '';
|
|
|
+ $printLabelKey = $get['printLabelKey'] ?? '';
|
|
|
$shop = $this->shop;
|
|
|
$default = $shop->default ?? 0;
|
|
|
$shopName = $shop->shopName ?? '';
|
|
|
@@ -62,21 +63,32 @@ class ShopExtController extends BaseController
|
|
|
$sjName = $sj->name ?? '';
|
|
|
$name = $default == 1 ? $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();
|
|
|
- util::complete('添加成功');
|
|
|
}
|
|
|
- }
|
|
|
- if (empty($printSn) && empty($printKey)) {
|
|
|
+ } else {
|
|
|
$ext->printSn = '';
|
|
|
$ext->printKey = '';
|
|
|
$ext->save();
|
|
|
- util::complete('修改成功');
|
|
|
}
|
|
|
- util::fail('添加失败');
|
|
|
+ if (!empty($printLabelSn) && !empty($printLabelKey)) {
|
|
|
+ $labelPrint = new printUtil($printLabelSn);
|
|
|
+ $return = $labelPrint->addPrint($printLabelKey, $name);
|
|
|
+ if ($return) {
|
|
|
+ $ext->printSn = $printLabelSn;
|
|
|
+ $ext->printKey = $printLabelKey;
|
|
|
+ $ext->save();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ $ext->printLabelSn = '';
|
|
|
+ $ext->printLabelKey = '';
|
|
|
+ $ext->save();
|
|
|
+ }
|
|
|
+ util::complete('提交成功');
|
|
|
}
|
|
|
|
|
|
//获取打印机信息
|