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
24fa1dec
authored
Mar 05, 2021
by
hcy001
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
1
parent
335dfec3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
58 additions
and
15 deletions
app/Http/Controllers/ApiController.php
app/Model/CommonModel.php
app/Model/InquiryItemsModel.php
app/Model/InquiryModel.php
app/Model/QuoteModel.php
app/Http/Controllers/ApiController.php
View file @
24fa1dec
...
...
@@ -71,7 +71,7 @@ class ApiController extends Controller
}
//创建询价明细
private
function
ApiCreateOneItems
(
$input
,
$id
){
Export
((
new
InquiryItemsModel
())
->
addItems
(
1
,[
$input
]
));
Export
((
new
InquiryItemsModel
())
->
addItems
(
$input
));
}
//更新询价明细
private
function
ApiUpdateOneItems
(
$input
,
$id
){
...
...
@@ -165,6 +165,10 @@ class ApiController extends Controller
{
Export
((
new
QuoteModel
())
->
import
(
$input
));
}
// 批量导入询价
public
function
ApiImportInquiry
(
$input
,
$id
)
{
Export
((
new
InquiryItemsModel
())
->
import
(
$input
));
}
}
app/Model/CommonModel.php
View file @
24fa1dec
...
...
@@ -10,11 +10,44 @@ use DB;
class
CommonModel
extends
Model
{
//搜索联营品牌
public
function
BrandList
(
$k
)
public
function
BrandList
(
$k
,
$types
=
1
)
{
$brandInfo
=
DB
::
connection
(
"spu"
)
->
select
(
"select brand_id as value,brand_name as name from lie_brand where brand_name like '%"
.
$k
.
"%' limit 10"
);
echo
json_encode
(
$brandInfo
,
JSON_UNESCAPED_UNICODE
)
;
exit
();
$dbspu
=
DB
::
connection
(
"spu"
);
if
(
$types
==
1
)
{
#模糊搜索
$brandInfo
=
$dbspu
->
select
(
"select brand_id as value,brand_name as name from lie_brand where brand_name like '%"
.
$k
.
"%' limit 10"
);
echo
json_encode
(
$brandInfo
,
JSON_UNESCAPED_UNICODE
)
;
exit
();
}
else
{
$brandInfo
=
$dbspu
->
select
(
"select brand_id as brand_id,brand_name as name from lie_brand where brand_name = '"
.
$k
.
"' limit 1"
);
if
(
!
$brandInfo
){
return
false
;
}
else
{
return
$brandInfo
[
0
][
"brand_id"
];
}
}
}
/*
* 查询采购名称
*/
public
function
UserList
(
$k
,
$types
=
1
){
$dbcms
=
DB
::
connection
();
if
(
$types
==
1
)
{
#模糊搜索
$purInfo
=
$dbcms
->
select
(
"select userId as value,name as name from user_info where name like '%"
.
$k
.
"%' limit 10"
);
echo
json_encode
(
$purInfo
,
JSON_UNESCAPED_UNICODE
)
;
exit
();
}
else
{
$k
=
explode
(
","
,
$k
);
$str
=
[];
foreach
(
$k
as
$k
=>
$b
){
$purInfo
=
$dbcms
->
select
(
"select userId as uid,name as user_name from user_info where name = '"
.
$b
.
"'"
);
if
(
!
$purInfo
){
return
false
;
}
array_push
(
$str
,[
"uid"
=>
$purInfo
[
0
][
"uid"
],
"user_name"
=>
$purInfo
[
0
][
"user_name"
]]);
}
return
$str
;
}
}
//导出pdf
...
...
@@ -48,14 +81,6 @@ class CommonModel extends Model
echo
json_encode
(
$temp
,
JSON_UNESCAPED_UNICODE
)
;
}
/*
* 查询采购名称
*/
public
function
UserList
(
$k
){
$purInfo
=
DB
::
connection
()
->
select
(
"select userId as value,name as name from user_info where name like '%"
.
$k
.
"%' limit 10"
);
echo
json_encode
(
$purInfo
,
JSON_UNESCAPED_UNICODE
)
;
}
// 搜索供应商
public
function
SupplierList
(
$k
)
{
...
...
app/Model/InquiryItemsModel.php
View file @
24fa1dec
This diff is collapsed.
Click to expand it.
app/Model/InquiryModel.php
View file @
24fa1dec
...
...
@@ -294,6 +294,15 @@ class InquiryModel extends Model
return
$inqueryId
;
}
//生成草稿id
public
function
FindInquirySn
(
$inquiry_id
=
''
){
$result
=
$this
->
where
(
'id'
,
'='
,
$inquiry_id
)
->
select
(
'inquiry_sn'
)
->
first
();
if
(
!
$result
){
return
false
;
}
else
{
return
$result
->
inquiry_sn
;
}
}
...
...
app/Model/QuoteModel.php
View file @
24fa1dec
...
...
@@ -240,6 +240,7 @@ class QuoteModel extends Model
// 报价导入
public
function
import
(
$input
)
{
$inquiry_id
=
@
$input
[
"inquiry_id"
];
$file
=
$_FILES
[
'file'
];
// $request->file('file')
$filePath
=
$file
[
'tmp_name'
];
// 临时路径
...
...
@@ -252,10 +253,14 @@ class QuoteModel extends Model
if
(
empty
(
$excel
))
return
[
1
,
'未获取到模板内容,请检查模板内容数据格式'
];
$map
=
Config
(
'quote.import_quote_map'
);
if
(
count
(
$map
)
!=
count
(
$excel
[
0
]))
return
[
2
,
'导入模板错误'
];
$excel
=
$this
->
handleExcelData
(
$excel
,
$map
);
// 处理数据
$excel
=
$this
->
handleExcelData
(
$excel
,
$map
);
// 处理数据
print_r
(
$excel
);
$valid
=
$this
->
excelValid
(
$excel
);
// 验证excel内容
if
(
$valid
[
0
]
!=
0
)
return
$valid
;
...
...
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