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
7764861f
authored
Mar 16, 2021
by
hcy001
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
1
parent
67baa6cb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
7 deletions
app/Http/Controllers/HdController.php
app/Model/QuoteModel.php
app/Http/Controllers/HdController.php
View file @
7764861f
...
...
@@ -22,7 +22,7 @@ class HdController extends Controller
}
//添加参数
private
function
cf
(){
$t
=
'{"
data":{"0":{"inquiry_sn":"A161398670712345","inquiry_items_id":"1","currency":2,"goods_id":"353535","goods_name":"LM358","brand_id":"0","brand_name":"TI","supplier_id":7,"supplier_name":"digikey","quote_number":"25","status":1,"create_uid":0,"create_name":"digikey","create_time":1615880179,"update_time":1615880179,"price_origin":0.37,"raw_goods_sn":"497-1591-1-ND","raw_goods_packing":"Cut Tape (CT)","raw_brand_nam e":"STMicroelectronics"},"1":{"inquiry_sn":"A161398670712345","inquiry_items_id":"1","currency":2,"goods_id":"353535","goods_name":"LM358","brand_id":"0","brand_name":"TI","supplier_id":7,"supplier_name":"d igikey","quote_number":"25","status":1,"create_uid":0,"create_name":"digikey","create_time":1615880179,"update_time":1615880179,"price_origin":0.37,"raw_goods_sn":"497-1591-6-ND","raw_goods_packing":"Digi-R eel®","raw_brand_name":"STMicroelectronics"},"2":{"inquiry_sn":"A161398670712345","inquiry_items_id":"1","currency":2,"goods_id":"353535","goods_name":"LM358","brand_id":"0","brand_name":"TI","supplier_id":7,"supplier_name":"digikey","quote_number":"25","status":1,"create_uid":0,"create_name":"digikey","create_time":1615880179,"update_time":1615880179,"price_origin":0.65,"raw_goods_sn":"LM358DTCT-ND","raw_goo ds_packing":"Cut Tape (CT)","raw_brand_name":"Rohm Semiconductor"},"3":{"inquiry_sn":"A161398670712345","inquiry_items_id":"1","currency":2,"goods_id":"353535","goods_name":"LM358","brand_id":"0","brand_nam e":"TI","supplier_id":7,"supplier_name":"digikey","quote_number":"25","status":1,"create_uid":0,"create_name":"digikey","create_time":1615880179,"update_time":1615880179,"price_origin":0.65,"raw_goods_sn":" LM358DTDKR-ND","raw_goods_packing":"Digi-Reel®","raw_brand_name":"Rohm Semiconductor"}
}}'
;
$t
=
'{"
0":{"inquiry_id":"1","inquiry_sn":"A161398670712345","inquiry_items_id":"1","currency":2,"goods_id":"353535","goods_name":"LM358","brand_id":"0","brand_name":"TI","supplier_id":7,"supplier_name":"digikey","quote_number":"25","status":1,"create_uid":0,"create_name":"digikey","price_origin":2.9,"raw_goods_sn":"1597-1134-ND","raw_goods_packing":"Bulk","raw_brand_name":"Seeed Technology Co., Ltd"
}}'
;
$res
=
(
new
QuoteModel
())
->
addBatch
(
$t
);
}
...
...
app/Model/QuoteModel.php
View file @
7764861f
...
...
@@ -225,7 +225,7 @@ class QuoteModel extends Model
$input
=
json_decode
(
$indata
,
true
);
if
(
!
$input
||
count
(
$input
)
==
0
)
return
[
1
,
'数据不得为空'
];
// 询价明细单状态
$inquiry_items_id
=
$input
[
0
]
[
'inquiry_items_id'
];
$inquiry_items_id
=
current
(
$input
)
[
'inquiry_items_id'
];
$inquiry_items_status
=
InquiryItemsModel
::
where
(
'id'
,
$inquiry_items_id
)
->
value
(
'status'
);
if
(
$inquiry_items_status
==
-
1
)
return
[
1
,
'新增报价失败,该询价明细已关闭'
];
...
...
@@ -237,22 +237,21 @@ class QuoteModel extends Model
#拼接批量插入明细
foreach
(
$input
as
$k
=>&
$v
){
$
check
=
$this
->
where
([
"inquiry_items_id"
=>
$inquiry_items_id
,
"raw_goods_sn"
=>
$v
[
"raw_goods_sn"
]])
->
first
(
);
if
(
$
check
){
#存在更新
$
quote_sn
=
$this
->
where
([
"inquiry_items_id"
=>
$inquiry_items_id
,
"raw_goods_sn"
=>
$v
[
"raw_goods_sn"
]])
->
value
(
"quote_sn"
);
if
(
$
quote_sn
){
#存在更新
$v
[
"create_time"
]
=
time
();
$this
->
where
([
"inquiry_items_id"
=>
$inquiry_items_id
,
"raw_goods_sn"
=>
$v
[
"raw_goods_sn"
]])
->
update
(
$v
)
;
OpLogModel
::
log
([
'types'
=>
2
,
'relation_id'
=>
$inquiry_items_id
,
'relation_sn'
=>
$
check
->
quote_sn
,
'content'
=>
'自动报价-更新,价格:'
+
(
$v
[
"currency"
]
==
"1"
?
"¥"
.
$v
[
"
"
]
:
"$"
.
$v
[
"
"
]),
'relation_sn'
=>
$quote_sn
,
'content'
=>
'自动报价-更新,价格:'
+
(
$v
[
"currency"
]
==
"1"
?
"¥"
.
$v
[
"
price_rmb"
]
:
"$"
.
$v
[
"price_origin
"
]),
'create_name'
=>
"系统"
,
]);
}
else
{
$v
[
"quote_sn"
]
=
createSn
(
$QuoteModel
,
'quote_sn'
,
'B'
);
$v
[
"create_time"
]
=
time
();
$v
[
"update_time"
]
=
time
();
print_r
(
$v
);
$this
->
insert
(
$v
);
OpLogModel
::
log
([
...
...
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