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
c0a653b4
Commit
c0a653b4
authored
Sep 06, 2018
by
wwccw0591
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master_dev' of git.shenbd.com:qm-develop/shenbd into ccw
parents
6b865445
40d3c26a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
112 additions
and
1 deletion
+112
-1
MemberCenterService.php
application/models/Business/User/MemberCenterService.php
+1
-1
StoreOnlineGoodsClass.php
application/models/DAO/GoodsClass/StoreOnlineGoodsClass.php
+23
-0
storeOnlineGoodsClass.php
scripts/crontab/store/storeOnlineGoodsClass.php
+88
-0
No files found.
application/models/Business/User/MemberCenterService.php
View file @
c0a653b4
...
...
@@ -254,7 +254,7 @@ class MemberCenterServiceModel extends \Business\AbstractModel
// }
foreach
(
$list
as
$v
){
//if($stores['store_id'] && $stores['store_id']['open_flag'] == 1 && $stores['store_id']['store_state'] == 1) {
$goods
[]
=
array
(
'favid'
=>
$v
[
'favid'
],
'goodsCommonId'
=>
$v
[
'goods_commonid'
],
'goodsImage'
=>
\Our\ImageUtil
::
getGoodsImgUrl
(
$v
[
'goods_image'
],
\
our\Api
Const
::
goodsCollectionImgSize
),
'goodsName'
=>
$v
[
'goods_name'
],
'goodsPrice'
=>
$v
[
'goods_price'
],
'goodsId'
=>
$v
[
'goods_id'
]);
$goods
[]
=
array
(
'favid'
=>
$v
[
'favid'
],
'goodsCommonId'
=>
$v
[
'goods_commonid'
],
'goodsImage'
=>
\Our\ImageUtil
::
getGoodsImgUrl
(
$v
[
'goods_image'
],
\
Our\Image
Const
::
goodsCollectionImgSize
),
'goodsName'
=>
$v
[
'goods_name'
],
'goodsPrice'
=>
$v
[
'goods_price'
],
'goodsId'
=>
$v
[
'goods_id'
]);
// }
}
if
(
$where
)
{
...
...
application/models/DAO/GoodsClass/StoreOnlineGoodsClass.php
View file @
c0a653b4
...
...
@@ -112,6 +112,29 @@ class StoreOnlineGoodsClassModel extends \DAO\AbstractModel{
}
}
/**
* 商品详情发生改变存如缓存
* @param $goodsCommon goodsCommon详情
* @param int $type 操作类型(1:加,0:减)
* @return bool
*/
public
function
addGoodsToGoodsClassCache
(
$goodsCommon
,
$type
=
\Our\ApiConst
::
plus
){
if
(
!
$goodsCommon
){
return
false
;
}
$goodsClass
[
'gc_id_1'
]
=
$goodsCommon
[
'gc_id_1'
];
$goodsClass
[
'gc_id_2'
]
=
$goodsCommon
[
'gc_id_2'
];
$goodsClass
[
'gc_id_3'
]
=
$goodsCommon
[
'gc_id_3'
];
$goodsClass
[
'store_id'
]
=
$goodsCommon
[
'store_id'
];
$goodsClass
[
'gc_from'
]
=
\Our\ApiConst
::
zero
;
$this
->
addChangedGoodsClass
(
serialize
(
$goodsClass
),
$type
);
if
(
$goodsCommon
[
'goods_class_t_id'
]){
$goodsClass
[
'gc_id_3'
]
=
$goodsCommon
[
'goods_class_t_id'
];
$goodsClass
[
'gc_from'
]
=
\Our\ApiConst
::
zero
;
$this
->
addChangedGoodsClass
(
serialize
(
$goodsClass
),
$type
);
}
return
true
;
}
public
function
addChangedGoodsClass
(
$goodsClass
,
$type
=
\Our\ApiConst
::
plus
){
$key
=
'changedAddGoodsClass'
;
...
...
scripts/crontab/store/storeOnlineGoodsClass.php
0 → 100644
View file @
c0a653b4
<?php
/**
* User: liuyuzhen
* Date: 2018/9/5
* Time: 19:00
* Description:
*/
define
(
"APPLICATION_PATH"
,
realpath
(
dirname
(
__FILE__
)
.
'/../../../'
));
//指向public的上一级
require
APPLICATION_PATH
.
'/scripts/crontab/baseCli.php'
;
require
APPLICATION_PATH
.
'/scripts/crontab/common.php'
;
error_reporting
(
E_ALL
^
E_NOTICE
);
class
cliStoreOnlineGoodsClass
extends
basecli
{
const
CLI_ADMIN_ID
=
255
;
private
$bDoUnLock
=
FALSE
;
// 是否允许释放 LOCK 文件
private
$_debug
=
0
;
private
$lockFileName
;
private
$fromState
;
private
function
mkdirs
(
$dir
,
$mode
=
0777
)
{
if
(
is_dir
(
$dir
)
||
@
mkdir
(
$dir
,
$mode
))
{
return
TRUE
;
}
if
(
!
$this
->
mkdirs
(
dirname
(
$dir
),
$mode
))
{
return
FALSE
;
}
return
@
mkdir
(
$dir
,
$mode
);
}
/**
* 析构
*/
public
function
__destruct
()
{
parent
::
__destruct
();
if
(
$this
->
bDoUnLock
)
{
@
unlink
(
$this
->
lockFileName
);
}
}
protected
function
storeOnlineGoodsClass
(){
\Business\Goods\GoodsCommonServiceModel
::
getInstance
()
->
storeOnlineGoodsClass
();
}
protected
function
_runCli
()
{
$this
->
_debug
=
isset
(
$this
->
aArgv
[
1
])
?
intval
(
$this
->
aArgv
[
1
])
:
0
;
if
(
$this
->
_debug
)
{
echo
"*** Debug mode ***
\n
"
;
}
// Step: 02 检查是否已有相同CLI在运行中
$lockDir
=
$this
->
_getBaseFileName
(
'storeOnlineGoodsClass'
);
if
(
!
$this
->
mkdirs
(
$lockDir
)){
echo
'****create dir fail ****'
;
exit
;
}
$this
->
lockFileName
=
$lockDir
.
'.locks'
;
if
(
file_exists
(
$this
->
lockFileName
)
)
{
$stat
=
stat
(
$this
->
lockFileName
);
if
(
(
TIMESTAMP
-
$stat
[
'mtime'
])
>
24
*
60
*
60
*
2
)
{
echo
"文件被锁超过2天,被强制删除"
;
@
unlink
(
$this
->
lockFileName
);
}
else
{
$this
->
halt
(
'['
.
date
(
'Y-m-d H:i:s'
)
.
'] The CLI is running'
.
"
\n
"
);
}
}
$this
->
bDoUnLock
=
true
;
file_put_contents
(
$this
->
lockFileName
,
"running"
);
// CLI 独占锁
$this
->
storeOnlineGoodsClass
();
echo
'店铺在售商品分类更新成功'
.
"
\r\n
"
;
}
}
$oCli
=
new
cliShopkeeperIndex
(
TRUE
);
EXIT
;
?>
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