Commit 2e734f1e authored by Liu lu's avatar Liu lu

兼容前缀

parent 7574a3c7
...@@ -74,7 +74,7 @@ abstract class BaseModel extends Model ...@@ -74,7 +74,7 @@ abstract class BaseModel extends Model
$where_str = implode(',', $where_arr); $where_str = implode(',', $where_arr);
$sql = ""; $sql = "";
if ($keys_str && $datas_str && $where_str) { if ($keys_str && $datas_str && $where_str) {
$table = $this->getTable(); $table = env('DB_PREFIX','').$this->getTable();
$sql = " INSERT INTO $table ( $keys_str ) VALUES $datas_str ON DUPLICATE KEY UPDATE $where_str"; $sql = " INSERT INTO $table ( $keys_str ) VALUES $datas_str ON DUPLICATE KEY UPDATE $where_str";
} }
unset($keys_str, $where_str); unset($keys_str, $where_str);
...@@ -125,7 +125,7 @@ abstract class BaseModel extends Model ...@@ -125,7 +125,7 @@ abstract class BaseModel extends Model
$sql = sprintf( $sql = sprintf(
"UPDATE `%s` SET %s WHERE `%s` IN (%s) ", "UPDATE `%s` SET %s WHERE `%s` IN (%s) ",
$this->getTable(), $updates, $field, $fields env('DB_PREFIX','').$this->getTable(), $updates, $field, $fields
); );
return $this->getConnection()->update($sql); return $this->getConnection()->update($sql);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment