Skip to content

Commit

Permalink
Update CurdService.php
Browse files Browse the repository at this point in the history
  • Loading branch information
funadmin authored Feb 18, 2023
1 parent 4b45224 commit c82f65e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/curd/service/CurdService.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,11 @@ protected function setArg()
$this->joinModel = $this->config['joinModel'] ?: $this->joinTable;
$this->joinMethod = $this->config['joinMethod'];
$this->joinForeignKey = $this->config['joinForeignKey'];
if (count($this->joinForeignKey) == 1 && strpos($this->joinForeignKey[0], ',')) {
if ($this->joinForeignKey && count($this->joinForeignKey) == 1 && strpos($this->joinForeignKey[0], ',')) {
$this->joinForeignKey = array_filter(explode(',', ($this->joinForeignKey[0])));
}
$this->joinPrimaryKey = $this->config['joinPrimaryKey'];
if (count($this->joinPrimaryKey) == 1 && strpos($this->joinPrimaryKey[0], ',')) {
if ($this->joinForeignKey && count($this->joinPrimaryKey) == 1 && strpos($this->joinPrimaryKey[0], ',')) {
$this->joinPrimaryKey = array_filter(explode(',', ($this->joinPrimaryKey[0])));
}
$this->selectFields = $this->config['selectFields'];
Expand Down Expand Up @@ -495,7 +495,7 @@ protected function makeModel()
) {
//关联模型搜索属性
$model = isset($this->joinModel[$i]) ? $this->joinModel[$i] : $this->joinModel[0];
if (count($this->joinTable) == 1) {
if ($this->joinTable && count($this->joinTable) == 1) {
$value = isset($this->selectFields[0]) ? $this->selectFields[0] : 'title';
} else {
$value = isset($this->selectFields[$i]) ? $this->selectFields[$i] : 'title';
Expand Down Expand Up @@ -1107,7 +1107,7 @@ protected function getFieldList($field = '*')
if (in_array($v['DATA_TYPE'], ['tinyint', 'set', 'enum']) and $v['type'] != '_id') {
$comment = explode('=', $v['comment']);
if (!in_array($v['name'], $this->config['ignoreFields'])) {
if (count($comment) != 2) {
if ($comment && count($comment) != 2) {
$v['type'] = 'text';
} else {
if ($v['DATA_TYPE'] == 'tinyint') $v['type'] = 'radio';
Expand Down

0 comments on commit c82f65e

Please sign in to comment.