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
a998c550
authored
Apr 30, 2021
by
杜文军
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
优选
parent
5c2a0402
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
0 deletions
app/Model/BestGoodsModel.php
app/Model/InquiryModel.php
app/Model/BestGoodsModel.php
0 → 100644
View file @
a998c550
<?php
namespace
App\Model
;
use
Illuminate\Database\Eloquent\Model
;
class
BestGoodsModel
extends
Model
{
protected
$connection
=
'rfq'
;
protected
$table
=
'best_goods'
;
protected
$primaryKey
=
'id'
;
const
STATUS_ENABLE
=
1
;
// 有效
const
STATUS_DISABLE
=
2
;
// 无效
public
$timestamps
=
true
;
const
CREATED_AT
=
'create_time'
;
const
UPDATED_AT
=
'update_time'
;
public
function
GetList
(
$where
=
[],
$page
=
1
,
$limit
=
10
)
{
if
(
$where
)
{
$list
=
$this
->
where
(
$where
)
->
orderBy
(
'id'
,
'desc'
)
->
paginate
(
$limit
,
[
'*'
],
'p'
,
$page
)
->
toArray
();
}
else
{
$list
=
$this
->
select
()
->
orderBy
(
'id'
,
'desc'
)
->
paginate
(
$limit
,
[
'*'
],
'p'
,
$page
)
->
toArray
();
}
return
$list
;
}
public
function
getCountByWhere
(
$where
=
[])
{
if
(
$where
)
{
return
$this
->
where
(
$where
)
->
count
();
}
else
{
return
$this
->
count
();
}
}
public
function
GetListByIds
(
$ids
)
{
return
$this
->
whereIn
(
"id"
,
$ids
)
->
get
()
->
toArray
();
}
public
function
updateByIds
(
$ids
,
$data
)
{
return
$this
->
whereIn
(
"id"
,
$ids
)
->
update
(
$data
);
}
}
\ No newline at end of file
app/Model/InquiryModel.php
View file @
a998c550
...
...
@@ -124,6 +124,8 @@ class InquiryModel extends Model
$QuoteModel
=
new
QuoteModel
();
$InquiryItemsAssignModel
=
new
InquiryItemsAssignModel
();
$BestGoodsModel
=
new
BestGoodsModel
();
$Redis
=
\RedisDB
::
connection
();
foreach
(
$list
[
'data'
]
as
$k
=>
&
$v
)
{
$inquiry_items_id
=
$v
[
"id"
];
#明细id
...
...
@@ -173,6 +175,8 @@ class InquiryModel extends Model
// 查询历史报价数
$v
[
'history_quote_count'
]
=
$QuoteModel
->
GetHistoryQuotedCount
(
$v
[
'goods_name'
]);
// 查询优选匹配数
$v
[
'best_count'
]
=
$BestGoodsModel
->
getCountByWhere
([[
"goods_name"
,
'='
,
$v
[
'goods_name'
]],
[
"g_status"
,
'='
,
BestGoodsModel
::
STATUS_ENABLE
]]);
// 在Redis集合中检查是否有新的报价
if
(
$export
==
0
){
...
...
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