dever 6 lat temu
rodzic
commit
b46679b48c
2 zmienionych plików z 38 dodań i 5 usunięć
  1. 29 2
      database/model.php
  2. 9 3
      src/Api.php

+ 29 - 2
database/model.php

@@ -13,6 +13,18 @@ $fonts = array
 	3 => '中等',
 );
 
+$position_type = array
+(
+	1 => '左上角',
+	2 => '左下角',
+	3 => '右上角',
+	4 => '右下角',
+	5 => '居中',
+	6 => '上居中',
+	7 => '下居中',
+	8 => '自定义',
+);
+
 return array
 (
 	# 表名
@@ -97,14 +109,29 @@ return array
 			//'list'		=> true,
 		),
 
+		'position_type'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '模块位置',
+			'default' 	=> '8',
+			'desc' 		=> '请选择模块位置',
+			'match' 	=> 'is_numeric',
+			'update'	=> 'radio',
+			'option'	=> $position_type,
+			//'search'	=> 'select',
+			//'list'		=> true,
+			'control'	=> 'position_type',
+		),
+
 		'position'		=> array
 		(
 			'type' 		=> 'varchar-32',
-			'name' 		=> '模块位置-位置为top,left,如100,200',
+			'name' 		=> '模块位-位置为left,top,如100,200',
 			'default' 	=> '0,0',
-			'desc' 		=> '模块位置',
+			'desc' 		=> '模块位',
 			'match' 	=> 'is_string',
 			'update'	=> 'text',
+			'show'		=> 'position_type=8',
 		),
 
 		'width'		=> array

+ 9 - 3
src/Api.php

@@ -77,7 +77,12 @@ class Api
 			$set[$key] = $value['value'];
 		}
 		if (isset($set[$key])) {
-			$position = explode(',', $value['position']);
+			if ($value['position_type'] == 8) {
+				$position = explode(',', $value['position']);
+			} else {
+				$position = $value['position_type'];
+			}
+			
 			if ($value['type'] == 1) {
 				$param['method'] = 'mark';
 				$param['water'] = $set[$key];
@@ -89,8 +94,9 @@ class Api
 				$param['method'] = 'txt';
 				$param['name'] = $set[$key];
 				$param['color'] = $value['color'];
-				$param['top'] = $position[0];
-				$param['left'] = $position[1];
+				$param['position'] = $position;
+				//$param['top'] = $position[1];
+				//$param['left'] = $position[2];
 				$param['size'] = $value['size'];
 				$param['angle'] = $value['angle'];