Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
黄成意
/
php_frq_api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
32756e23
authored
May 19, 2021
by
hcy001
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'master' of
ssh://119.23.72.7:22611/q578953158/php_frq_api
parents
0caa8847
07ce0c80
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
12 deletions
app/Model/CommonModel.php
app/Model/QuoteModel.php
config/app.php
app/Model/CommonModel.php
View file @
32756e23
...
@@ -7,6 +7,7 @@ use Request;
...
@@ -7,6 +7,7 @@ use Request;
use
DB
;
use
DB
;
use
App\Model\CmsModel
;
use
App\Model\CmsModel
;
use
App\Model\Mongo\SpuModel
;
use
App\Model\Mongo\SpuModel
;
use
App\Http\Controllers\PermController
;
//公共模型
//公共模型
class
CommonModel
extends
Model
class
CommonModel
extends
Model
...
@@ -86,10 +87,27 @@ class CommonModel extends Model
...
@@ -86,10 +87,27 @@ class CommonModel extends Model
/*
/*
* 查询采购名称
* 查询采购名称
*/
*/
public
function
UserList
(
$k
,
$types
=
1
){
public
function
UserList
(
$k
,
$types
=
1
)
{
$dbcms
=
DB
::
connection
();
$dbcms
=
DB
::
connection
();
if
(
$types
==
1
)
{
#模糊搜索
if
(
$types
==
1
)
{
#模糊搜索
$purInfo
=
$dbcms
->
select
(
"select userId as value,name as name from user_info where name like '%"
.
$k
.
"%' limit 10"
);
$perm
=
new
PermController
;
$perm
->
getSubDepartmentId
(
8
,
$department_ids
);
// 获取采购所有部门
$CmsModel
=
new
CmsModel
;
$purInfo
=
$CmsModel
->
where
(
'status'
,
0
)
->
whereIn
(
'department_id'
,
$department_ids
)
->
where
(
function
(
$query
)
use
(
$k
)
{
if
(
$k
)
{
$query
->
where
(
'name'
,
'like'
,
'%'
.
$k
.
'%'
);
}
})
->
select
(
'userId as value'
,
'name'
)
->
get
()
->
toArray
();
// $purInfo = $dbcms->select("select userId as value,name as name from user_info where department_id in (".json_encode($department_ids).") and status = 0 and name like '%".$k."%'");
echo
json_encode
(
$purInfo
,
JSON_UNESCAPED_UNICODE
)
;
echo
json_encode
(
$purInfo
,
JSON_UNESCAPED_UNICODE
)
;
exit
();
exit
();
}
else
{
}
else
{
...
...
app/Model/QuoteModel.php
View file @
32756e23
...
@@ -164,12 +164,12 @@ class QuoteModel extends Model
...
@@ -164,12 +164,12 @@ class QuoteModel extends Model
'it.brand_name'
,
'it.brand_name'
,
'it.inquiry_number'
'it.inquiry_number'
];
];
if
(
$map
)
{
//
if ($map) {
$list
=
$this
->
commonQuery
(
$map
,
$input
);
$list
=
$this
->
commonQuery
(
$map
,
$input
);
}
else
{
//
} else {
$list
=
$this
->
from
(
'quote as q'
)
//
$list = $this->from('quote as q')
->
join
(
'inquiry_items as it'
,
'q.inquiry_items_id'
,
'='
,
'it.id'
);
//
->join('inquiry_items as it', 'q.inquiry_items_id', '=', 'it.id');
}
//
}
$map
[
'create_uid'
]
=
isset
(
$input
[
'create_uid'
])
?
$input
[
'create_uid'
]
:
''
;
// 报价制单人
$map
[
'create_uid'
]
=
isset
(
$input
[
'create_uid'
])
?
$input
[
'create_uid'
]
:
''
;
// 报价制单人
if
(
$type
==
1
)
{
if
(
$type
==
1
)
{
...
@@ -335,12 +335,18 @@ class QuoteModel extends Model
...
@@ -335,12 +335,18 @@ class QuoteModel extends Model
return
$data
;
return
$data
;
}
}
// 通用查询
/**
public
function
commonQuery
(
$map
,
$input
,
$type
=
1
)
* 通用查询
* @param [type] $map [description]
* @param [type] $input [description]
* @param integer $query_type [类型,1-返回sql,2-返回数量]
* @return [type] [description]
*/
public
function
commonQuery
(
$map
,
$input
,
$query_type
=
1
)
{
{
$list
=
$this
->
from
(
'quote as q'
)
->
join
(
'inquiry_items as it'
,
'q.inquiry_items_id'
,
'='
,
'it.id'
);
$list
=
$this
->
from
(
'quote as q'
)
->
join
(
'inquiry_items as it'
,
'q.inquiry_items_id'
,
'='
,
'it.id'
);
if
(
isset
(
$
type
)
&&
$type
==
4
)
{
if
(
isset
(
$
input
[
'type'
])
&&
$input
[
'type'
]
==
4
)
{
$list
=
$list
->
leftJoin
(
'inquiry as i'
,
'it.inquiry_id'
,
'='
,
'i.id'
);
$list
=
$list
->
leftJoin
(
'inquiry as i'
,
'it.inquiry_id'
,
'='
,
'i.id'
);
$perm
=
new
PermController
;
$perm
=
new
PermController
;
...
@@ -388,7 +394,7 @@ class QuoteModel extends Model
...
@@ -388,7 +394,7 @@ class QuoteModel extends Model
}
}
});
});
if
(
$type
==
1
)
return
$list
;
if
(
$
query_
type
==
1
)
return
$list
;
return
$list
->
where
(
'q.create_uid'
,
$input
[
'user_id'
])
->
whereNotIn
(
'q.status'
,
[
0
,
-
1
])
->
count
();
return
$list
->
where
(
'q.create_uid'
,
$input
[
'user_id'
])
->
whereNotIn
(
'q.status'
,
[
0
,
-
1
])
->
count
();
}
}
...
...
config/app.php
View file @
32756e23
...
@@ -91,7 +91,7 @@ return [
...
@@ -91,7 +91,7 @@ return [
|
|
*/
*/
'key'
=>
env
(
'APP_KEY'
)
,
'key'
=>
"base64:JzR5tuUk6qEKrnTb2cKRN8g9V/QKJSh1uLSwFBwjkO8="
,
'cipher'
=>
'AES-256-CBC'
,
'cipher'
=>
'AES-256-CBC'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment