|
@@ -76,6 +76,13 @@ class Base {
|
|
*/
|
|
*/
|
|
private $tableName = null;
|
|
private $tableName = null;
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 错误信息
|
|
|
|
+ *
|
|
|
|
+ * @var array $__Error {code:0, msg:'', body:mixed}
|
|
|
|
+ */
|
|
|
|
+ public $__Error;
|
|
|
|
+
|
|
public function __construct(){
|
|
public function __construct(){
|
|
$this->cleanVars();
|
|
$this->cleanVars();
|
|
}
|
|
}
|
|
@@ -1200,6 +1207,23 @@ class Base {
|
|
]
|
|
]
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 排除操作符
|
|
|
|
+ *
|
|
|
|
+ * @param array $array1 数组1
|
|
|
|
+ * @param array $array2 数组2
|
|
|
|
+ * @return array
|
|
|
|
+ */
|
|
|
|
+ final public function array_diff_assoc($array1, $array2) {
|
|
|
|
+ $arr = array_diff_assoc($array1, $array2);
|
|
|
|
+ foreach($arr as $k => $v) {
|
|
|
|
+ if(is_numeric($k) && in_array($v, ['or', 'and'])) {
|
|
|
|
+ unset($arr[$k]);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return $arr;
|
|
|
|
+ }
|
|
/**
|
|
/**
|
|
* 更新
|
|
* 更新
|
|
*
|
|
*
|
|
@@ -1214,8 +1238,8 @@ class Base {
|
|
//检查是否有重复的
|
|
//检查是否有重复的
|
|
list($uniqueWhere, $uniqueOr, $exclude, $primaryKey) = $this->condition();
|
|
list($uniqueWhere, $uniqueOr, $exclude, $primaryKey) = $this->condition();
|
|
// 检查 unique 是否已经存在相关数据
|
|
// 检查 unique 是否已经存在相关数据
|
|
- $diffWhere = array_diff_assoc($uniqueWhere, $primaryKey);
|
|
|
|
- $diffOr = array_diff_assoc($uniqueOr, $primaryKey);
|
|
|
|
|
|
+ $diffWhere = $this->array_diff_assoc($uniqueWhere, $primaryKey);
|
|
|
|
+ $diffOr = $this->array_diff_assoc($uniqueOr, $primaryKey);
|
|
/*print_r(
|
|
/*print_r(
|
|
[
|
|
[
|
|
'where' => $uniqueWhere,
|
|
'where' => $uniqueWhere,
|
|
@@ -1295,8 +1319,8 @@ class Base {
|
|
]
|
|
]
|
|
);*/
|
|
);*/
|
|
// 检查 unique 是否已经存在相关数据
|
|
// 检查 unique 是否已经存在相关数据
|
|
- $diffWhere = array_diff_assoc($uniqueWhere, $primaryKey);
|
|
|
|
- $diffOr = array_diff_assoc($uniqueOr, $primaryKey);
|
|
|
|
|
|
+ $diffWhere = $this->array_diff_assoc($uniqueWhere, $primaryKey);
|
|
|
|
+ $diffOr = $this->array_diff_assoc($uniqueOr, $primaryKey);
|
|
/*$diffExclude = array_diff_assoc($exclude, $primaryKey);
|
|
/*$diffExclude = array_diff_assoc($exclude, $primaryKey);
|
|
|
|
|
|
print_r(
|
|
print_r(
|
|
@@ -1365,7 +1389,7 @@ class Base {
|
|
}
|
|
}
|
|
$incr[$key] = $value;
|
|
$incr[$key] = $value;
|
|
}
|
|
}
|
|
- $diff = array_diff_assoc($incr, $primary);
|
|
|
|
|
|
+ $diff = $this->array_diff_assoc($incr, $primary);
|
|
if(count($diff) == 0) {
|
|
if(count($diff) == 0) {
|
|
return Response::Fail(self::class .'::'. __FUNCTION__,
|
|
return Response::Fail(self::class .'::'. __FUNCTION__,
|
|
[
|
|
[
|