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
6c439f8a
authored
Apr 26, 2021
by
hcy001
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
更新自动报价
parent
9df7088c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
17 deletions
app/Http/Controllers/HdController.php
app/Model/QuoteModel.php
app/Http/Controllers/HdController.php
View file @
6c439f8a
...
...
@@ -25,20 +25,21 @@ class HdController extends Controller
//添加参数
private
function
cf
(){
$mongo
=
\DB
::
connection
(
"mongodb"
)
->
collection
(
"spu"
)
// ->where("****","***")
->
first
();
print_r
(
$mongo
);
die
();
$param
=
[
[
"spu_name"
=>
"RCP0603W110RGS3"
,
"brand_name"
=>
"vishay"
]
];
$res
=
(
new
SearchModel
())
->
getClassName
(
\GuzzleHttp\json_encode
(
$param
));
print_r
(
$res
);
return
;
$t
=
'{"0":{"inquiry_id":"1","inquiry_sn":"A161398670712345","inquiry_items_id":"1","currency":2,"goods_id":"353535","goods_name":"RCP0603W110RGS3","brand_id":"0","brand_name":"vishay","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"}}'
;
// $mongo = \DB::connection("mongodb")
// ->collection("spu")
//// ->where("****","***")
// ->first();
// print_r($mongo);
// die();
// $param = [
// ["spu_name"=>"RCP0603W110RGS3","brand_name"=>"vishay"]
// ];
// $res = (new SearchModel())->getClassName(\GuzzleHttp\json_encode($param));
// print_r($res);
//
// return;
# $t = '{"0":{"inquiry_id":"1","inquiry_sn":"A161398670712345","inquiry_items_id":"1","currency":2,"goods_id":"353535","goods_name":"RCP0603W110RGS3","brand_id":"0","brand_name":"vishay","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"}}';
$t
=
'{"0":{"inquiry_id":"109","inquiry_sn":"X2021042600489","inquiry_items_id":"300","currency":1,"goods_id":"41757","goods_name":"XC6210B332MR","brand_id":"4725","brand_name":"n//a","supplier_id":"10000","supplier_name":"猎芯自营","quote_number":"100","remark":"3-7工作日","price_rmb":"0.8457","status":1,"create_uid":1737,"create_name":"陈进"}}'
;
$res
=
(
new
QuoteModel
())
->
addBatch
(
$t
);
print_r
(
$res
);
die
();
...
...
app/Model/QuoteModel.php
View file @
6c439f8a
...
...
@@ -360,11 +360,15 @@ class QuoteModel extends Model
$v
[
'price_rmb'
]
=
$rate
?
number_format
(
$v
[
'price_origin'
]
*
$rate
,
6
)
:
0
;
// 需计算汇率(排序用)
}
$quote_sn
=
$this
->
where
([
"inquiry_items_id"
=>
$inquiry_items_id
,
"raw_goods_sn"
=>
$v
[
"raw_goods_sn"
]])
->
value
(
"quote_sn"
);
if
(
@
$v
[
"supplier_name"
]
==
"猎芯自营"
){
$quote_sn
=
$this
->
where
([
"inquiry_items_id"
=>
$inquiry_items_id
,
"goods_id"
=>
$v
[
"goods_id"
],
"supplier_name"
=>
"猎芯自营"
])
->
value
(
"quote_sn"
);
}
else
{
$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
)
;
$this
->
where
([
"quote_sn"
=>
$quote_sn
])
->
update
(
$v
)
;
$currency_sign
=
array_get
(
Config
(
'quote.currency_sign'
),
$v
[
'currency'
],
'¥'
);
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