| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
- namespace ghs\controllers;
- use biz\shop\classes\ShopExtClass;
- use common\components\printUtil;
- use common\components\util;
- use Yii;
- class ShopExtController extends BaseController
- {
- public $guestAccess = [];
- //添加打印机 shish 20210712
- public function actionAddPrint()
- {
- $shopId = $this->shopId;
- $ext = ShopExtClass::getByCondition(['shopId' => $shopId], true);
- $get = Yii::$app->request->get();
- $printSn = $get['printSn'] ?? '';
- $printKey = $get['printKey'] ?? '';
- $print = new printUtil($printSn);
- $shop = $this->shop;
- $shopName = $shop['shopName'] ?? '';
- $ext->printSn = $printSn;
- $ext->printKey = $printKey;
- $ext->save();
- $return = $print->addPrint($printKey, $shopName);
- if ($return) {
- util::complete();
- }
- util::fail();
- }
- //获取打印机信息
- public function actionGetPrint()
- {
- $shopId = $this->shopId;
- $ext = ShopExtClass::getByCondition(['shopId' => $shopId]);
- util::success($ext);
- }
- }
|