Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
my-yaf-project
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenchuanwen
my-yaf-project
Commits
db4aa47c
Commit
db4aa47c
authored
Sep 07, 2018
by
liuyuzhen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
定时器
parent
72dbd34d
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
17 deletions
+26
-17
GoodsCommonService.php
application/models/Business/Goods/GoodsCommonService.php
+12
-7
StoreTopSaleGoods.php
application/models/DAO/Goods/StoreTopSaleGoods.php
+3
-3
StoreOnlineGoodsClass.php
application/models/DAO/GoodsClass/StoreOnlineGoodsClass.php
+1
-1
Abstract.php
application/models/Redis/Db4/Abstract.php
+2
-6
test.php
public/test.php
+8
-0
No files found.
application/models/Business/Goods/GoodsCommonService.php
View file @
db4aa47c
...
@@ -1175,18 +1175,23 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
...
@@ -1175,18 +1175,23 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$topSaleList
=
array
();
$topSaleList
=
array
();
for
(
$i
=
0
;
$i
<
2000
;
$i
++
){
for
(
$i
=
0
;
$i
<
2000
;
$i
++
){
$storeId
=
$storeTopSaleGoodsModel
->
getChangedSaleStoreId
();
$storeId
=
$storeTopSaleGoodsModel
->
getChangedSaleStoreId
();
if
(
$storeId
!
==
false
){
if
(
$storeId
=
==
false
){
break
;
break
;
}
}
if
(
$storeIds
&&!
(
$storeIds
&&
in_array
(
$storeId
,
$storeIds
))){
if
(
$storeId
){
$topSaleList
=
$storeTopSaleGoodsModel
->
getStoreTopSaleGoodsListByStoreId
(
$storeId
);
if
((
$storeIds
&&
in_array
(
$storeId
,
$storeIds
))){
$storeTopSaleList
=
$this
->
getNewStoreTopSaleGoodsList
(
$topSaleList
,
$storeId
);
continue
;
}
$topSaleListTemp
=
$storeTopSaleGoodsModel
->
getStoreTopSaleGoodsListByStoreId
(
$storeId
);
$storeTopSaleList
=
$this
->
getNewStoreTopSaleGoodsList
(
$topSaleListTemp
,
$storeId
);
$topSaleList
=
$topSaleList
?
array_merge
(
$topSaleList
,
$storeTopSaleList
)
:
$storeTopSaleList
;
$topSaleList
=
$topSaleList
?
array_merge
(
$topSaleList
,
$storeTopSaleList
)
:
$storeTopSaleList
;
}
}
}
}
\Our\Log
::
getInstance
()
->
write
(
json_encode
(
$topSaleList
));
if
(
$topSaleList
){
$result
=
$storeTopSaleGoodsModel
->
insertAllOrUpdate
(
$topSaleList
);
$result
=
$storeTopSaleGoodsModel
->
insertAllOrUpdate
(
$topSaleList
);
\Our\Log
::
getInstance
()
->
write
(
'店铺销量更新'
.
(
$result
?
'success'
:
'fail'
));
\Our\Log
::
getInstance
()
->
write
(
'店铺销量更新'
.
(
$result
?
'success'
:
'fail'
));
}
\Our\Log
::
getInstance
()
->
write
(
'本次没有店铺数据需要更新'
);
}
}
/**
/**
...
...
application/models/DAO/Goods/StoreTopSaleGoods.php
View file @
db4aa47c
...
@@ -94,7 +94,7 @@ FROM han_goods_common t1 where t1.goods_state={1} and t1.goods_verify={2} and t1
...
@@ -94,7 +94,7 @@ FROM han_goods_common t1 where t1.goods_state={1} and t1.goods_verify={2} and t1
left join han_goods_score_statistics b
left join han_goods_score_statistics b
on a.goods_commonid = b.goods_commonid
on a.goods_commonid = b.goods_commonid
WHERE a.group_id<=3 AND a.sale_num>0 '
,
\Our\ApiConst
::
defaultGoodsScore
,
\Our\ApiConst
::
onlineGoodsState
,
\Our\ApiConst
::
onlineGoodsVerify
,
$storeId
);
WHERE a.group_id<=3 AND a.sale_num>0 '
,
\Our\ApiConst
::
defaultGoodsScore
,
\Our\ApiConst
::
onlineGoodsState
,
\Our\ApiConst
::
onlineGoodsVerify
,
$storeId
);
$list
=
$this
->
db
->
query
(
$sql
)
->
fetchAll
()
;
$list
=
$this
->
db
->
query
(
$sql
)
->
rows
;
return
$list
;
return
$list
;
}
}
...
@@ -113,7 +113,7 @@ on t1.goods_commonid = t2.goods_commonid
...
@@ -113,7 +113,7 @@ on t1.goods_commonid = t2.goods_commonid
where t1.
where t1.
) a
) a
WHERE a.group_id<=3 AND a.sale_num>0 and a.goods_state=1 and a.goods_verify=1 ORDER BY a.store_id ,a.group_id'
;
WHERE a.group_id<=3 AND a.sale_num>0 and a.goods_state=1 and a.goods_verify=1 ORDER BY a.store_id ,a.group_id'
;
$list
=
$this
->
db
->
query
(
$sql
)
->
fetchAll
()
;
$list
=
$this
->
db
->
query
(
$sql
)
->
rows
;
return
$list
;
return
$list
;
}
}
...
@@ -123,7 +123,7 @@ WHERE a.group_id<=3 AND a.sale_num>0 and a.goods_state=1 and a.goods_verify=1 OR
...
@@ -123,7 +123,7 @@ WHERE a.group_id<=3 AND a.sale_num>0 and a.goods_state=1 and a.goods_verify=1 OR
$baseSql
=
"insert into
{
$this
->
_tableName
}
(store_id,goods_commonid,goods_score,rank,goods_name,goods_image) values"
;
$baseSql
=
"insert into
{
$this
->
_tableName
}
(store_id,goods_commonid,goods_score,rank,goods_name,goods_image) values"
;
$insertAllSql
=
$baseSql
;
$insertAllSql
=
$baseSql
;
for
(
$i
=
0
;
$i
<
count
(
$datas
);
$i
++
)
{
for
(
$i
=
0
;
$i
<
count
(
$datas
);
$i
++
)
{
$addSql
=
\Our\Common
::
format
(
"(
{
0},{1},{2},{3},{4},{5
}
),"
,
$datas
[
$i
][
'store_id'
],
$datas
[
$i
][
'goods_commonid'
],
$datas
[
$i
][
'goods_score'
],
$datas
[
$i
][
'rank'
],
$datas
[
$i
][
'goods_name'
],
$datas
[
$i
][
'goods_image'
]);
$addSql
=
\Our\Common
::
format
(
"(
'
{
0}','{1}','{2}','{3}','{4}','{5
}
'
),"
,
$datas
[
$i
][
'store_id'
],
$datas
[
$i
][
'goods_commonid'
],
$datas
[
$i
][
'goods_score'
],
$datas
[
$i
][
'rank'
],
$datas
[
$i
][
'goods_name'
],
$datas
[
$i
][
'goods_image'
]);
$insertAllSql
.=
$addSql
;
$insertAllSql
.=
$addSql
;
if
(
$i
%
1000
==
0
&&
$i
!=
0
)
{
if
(
$i
%
1000
==
0
&&
$i
!=
0
)
{
$insertAllSql
=
rtrim
(
$insertAllSql
,
','
);
$insertAllSql
=
rtrim
(
$insertAllSql
,
','
);
...
...
application/models/DAO/GoodsClass/StoreOnlineGoodsClass.php
View file @
db4aa47c
...
@@ -133,7 +133,7 @@ class StoreOnlineGoodsClassModel extends \DAO\AbstractModel{
...
@@ -133,7 +133,7 @@ class StoreOnlineGoodsClassModel extends \DAO\AbstractModel{
$this
->
addChangedGoodsClass
(
serialize
(
$goodsClass
),
$type
);
$this
->
addChangedGoodsClass
(
serialize
(
$goodsClass
),
$type
);
if
(
$goodsCommon
[
'goods_class_t_id'
]){
if
(
$goodsCommon
[
'goods_class_t_id'
]){
$goodsClass
[
'gc_id_3'
]
=
$goodsCommon
[
'goods_class_t_id'
];
$goodsClass
[
'gc_id_3'
]
=
$goodsCommon
[
'goods_class_t_id'
];
$goodsClass
[
'gc_from'
]
=
\Our\ApiConst
::
zero
;
$goodsClass
[
'gc_from'
]
=
\Our\ApiConst
::
one
;
$this
->
addChangedGoodsClass
(
serialize
(
$goodsClass
),
$type
);
$this
->
addChangedGoodsClass
(
serialize
(
$goodsClass
),
$type
);
}
}
return
true
;
return
true
;
...
...
application/models/Redis/Db4/Abstract.php
View file @
db4aa47c
...
@@ -96,12 +96,8 @@ class AbstractModel extends \Redis\AbstractModel {
...
@@ -96,12 +96,8 @@ class AbstractModel extends \Redis\AbstractModel {
return
$this
->
lpush
(
$this
->
calcKey
(
$h
),
$value
);
return
$this
->
lpush
(
$this
->
calcKey
(
$h
),
$value
);
}
}
public
function
tableLPop
(
$h
){
public
function
tableLPop
(
$h
){
if
(
$res
=
$this
->
lpop
(
$this
->
calcKey
(
$h
))){
$res
=
$this
->
lpop
(
$this
->
calcKey
(
$h
));
return
$res
;
return
$res
;
}
else
{
return
false
;
}
}
}
public
function
tableSRandMember
(
$h
,
$count
=
null
){
public
function
tableSRandMember
(
$h
,
$count
=
null
){
return
$this
->
sRandMember
(
$this
->
calcKey
(
$h
),
$count
);
return
$this
->
sRandMember
(
$this
->
calcKey
(
$h
),
$count
);
...
...
public/test.php
100755 → 100644
View file @
db4aa47c
<?php
<?php
$redis
=
new
Redis
();
$redis
->
connect
(
'192.168.134.18'
,
'6379'
);
$redis
->
rPush
(
'test'
,
0
);
$res
=
$redis
->
lPop
(
'test'
);
var_dump
(
$res
);
$res1
=
$redis
->
lPop
(
'test'
);
var_dump
(
$res1
);
exit
;
function
is_https
()
{
function
is_https
()
{
if
(
!
empty
(
$_SERVER
[
'HTTPS'
])
&&
strtolower
(
$_SERVER
[
'HTTPS'
])
!==
'off'
)
{
if
(
!
empty
(
$_SERVER
[
'HTTPS'
])
&&
strtolower
(
$_SERVER
[
'HTTPS'
])
!==
'off'
)
{
return
true
;
return
true
;
...
...
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