shish hace 9 meses
padre
commit
e859cad7d4
Se han modificado 1 ficheros con 6 adiciones y 1 borrados
  1. 6 1
      app-hd/controllers/GoodsController.php

+ 6 - 1
app-hd/controllers/GoodsController.php

@@ -12,6 +12,7 @@ use bizHd\goods\services\GoodsCategoryService;
 use bizHd\goods\services\GoodsSettingService;
 use bizHd\pictext\classes\PicTextGoodsClass;
 use common\components\printUtil;
+use common\components\stringUtil;
 use Yii;
 use common\components\util;
 use bizHd\goods\services\GoodsService;
@@ -45,7 +46,11 @@ class GoodsController extends BaseController
         $name = $info->name ?? '';
         $goodsSn = $info->sn ?? '';
         $price = floatval($info->price) ?? 0;
-        $content = '<TEXT x="30" y="45" font="12" w="2" h="2" r="0">' . $name . '</TEXT>';
+        if(stringUtil::getWordNum($name)>7){
+            $content = '<TEXT x="30" y="45" font="12" w="1" h="1" r="0">' . $name . '</TEXT>';
+        }else{
+            $content = '<TEXT x="30" y="45" font="12" w="2" h="2" r="0">' . $name . '</TEXT>';
+        }
         $content .= '<BC128 x="30" y="115" h="75" s="1" r="0" n="3" w="10">' . $goodsSn . '</BC128>';
         if ($price > 0) {
             $content .= '<TEXT x="30" y="250" font="12" w="2" h="2" r="0">' . $price . '元</TEXT>';