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
15035075
Commit
15035075
authored
Aug 27, 2018
by
zhz
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master_dev' of git.shenbd.com:qm-develop/shenbd into master_dev
parents
487f83e6
2e4fd0e5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
1062 additions
and
7 deletions
+1062
-7
PathConst.php
application/library/Our/PathConst.php
+1
-0
CouponService.php
application/models/Business/Coupon/CouponService.php
+22
-4
GoodsClassService.php
application/models/Business/Goods/GoodsClassService.php
+12
-0
OrderService.php
application/models/Business/Order/OrderService.php
+1
-1
ShopkeeperService.php
application/models/Business/Store/ShopkeeperService.php
+46
-0
StoreService.php
application/models/Business/Store/StoreService.php
+12
-0
Coupon.php
application/models/DAO/Coupon/Coupon.php
+1
-0
Order.php
application/models/DAO/Order/Order.php
+4
-2
GoodsCommonStorage.php
application/models/DAO/Storage/GoodsCommonStorage.php
+329
-0
GoodsImagesStorage.php
application/models/DAO/Storage/GoodsImagesStorage.php
+52
-0
GoodsStorage.php
application/models/DAO/Storage/GoodsStorage.php
+409
-0
grow.php
scripts/crontab/growGoodsStores/grow.php
+87
-0
orders.php
scripts/crontab/shopkeeper/orders.php
+86
-0
No files found.
application/library/Our/PathConst.php
View file @
15035075
...
...
@@ -30,6 +30,7 @@ class PathConst {
const
cutVertical
=
'|'
;
//统计store_member_statistic表最后更新时间
const
orderGoodsCreateTime
=
"/orderGoodsCreateTime.conf"
;
const
orderLastCreateTime
=
"/orderLastCreateTime.conf"
;
const
favoritesStoreFavTimeConf
=
"/favoritesStoreFavTime.conf"
;
const
orderPaymentTimeConf
=
"/orderPaymentTime.conf"
;
...
...
application/models/Business/Coupon/CouponService.php
View file @
15035075
...
...
@@ -118,7 +118,7 @@ class CouponServiceModel extends \Business\AbstractModel{
$whereSql
=
' coupon_state ='
.
\Our\ApiConst
::
couponUnused
.
' and member_id ='
.
$memberId
.
' and out_time > '
.
time
();
$memberCoupons
=
$memberCouponDao
->
getList
(
$whereSql
);
}
else
{
//不允许领用多张的优惠券
$memberCoupons
=
\Our\RedisHelper
::
cachedFunction
(
\Redis\Db13\MemberCouponRedisModel
::
getInstance
(),
array
(
&
$memberCouponDao
,
'getList'
),
array
(
array
(
'coupon_id'
=>
$where
[
'couponId'
],
'member_id'
=>
$memberId
)),
\Our\ApiConst
::
oneHour
);
$memberCoupons
=
\Our\RedisHelper
::
cachedFunction
(
\Redis\Db13\MemberCouponRedisModel
::
getInstance
(),
array
(
&
$memberCouponDao
,
'getList'
),
array
(
array
(
'coupon_id'
=>
$where
[
'couponId'
],
'member_id'
=>
$memberId
)),
\Our\ApiConst
::
oneHour
,
array
(
$where
[
'couponId'
])
);
}
if
(
$memberCoupons
&&
count
(
$memberCoupons
)
>
0
){
$result
[
'isGet'
]
=
\Our\ApiConst
::
one
;
...
...
@@ -167,6 +167,8 @@ class CouponServiceModel extends \Business\AbstractModel{
return
true
;
}
public
function
receiveCouponBatch
(
$coupons
,
$memberId
,
$orderId
=
\Our\ApiConst
::
zero
){
$dbName
=
\Our\DbNameConst
::
masterDBConnectName
;
$couponDao
=
\DAO\Coupon\CouponModel
::
getInstance
(
$dbName
);
...
...
@@ -256,7 +258,7 @@ class CouponServiceModel extends \Business\AbstractModel{
public
function
getStorePromotionCouponTitles
(
$where
){
$this
->
validCouponStore
(
$where
);
$couponDao
=
\DAO\Coupon\CouponModel
::
getInstance
();
$couponTitles
=
\Our\RedisHelper
::
cachedFunction
(
\Redis\Db13\CouponRedisModel
::
getInstance
(),
array
(
&
$couponDao
,
'getStorePromotionCouponList'
),
array
(
$where
[
'storeId'
]),
\Our\ApiConst
::
oneHour
);
$couponTitles
=
\Our\RedisHelper
::
cachedFunction
(
\Redis\Db13\CouponRedisModel
::
getInstance
(),
array
(
&
$couponDao
,
'getStorePromotionCouponList'
),
array
(
$where
[
'storeId'
]),
\Our\ApiConst
::
oneHour
,
array
(
$where
[
'storeId'
])
);
return
$couponTitles
;
}
...
...
@@ -266,7 +268,7 @@ class CouponServiceModel extends \Business\AbstractModel{
public
function
getStoreCoupons
(
$where
,
$memberId
=
null
){
$couponDao
=
\DAO\Coupon\CouponModel
::
getInstance
();
$couponDao
->
validStoreCouponParam
(
$where
);
$couponList
=
\Our\RedisHelper
::
cachedFunction
(
\Redis\Db13\CouponRedisModel
::
getInstance
(),
array
(
&
$this
,
'getStoreCouponsById'
),
array
(
$where
[
'storeId'
],
$memberId
),
\Our\ApiConst
::
oneHour
);
$couponList
=
\Our\RedisHelper
::
cachedFunction
(
\Redis\Db13\CouponRedisModel
::
getInstance
(),
array
(
&
$this
,
'getStoreCouponsById'
),
array
(
$where
[
'storeId'
],
$memberId
),
\Our\ApiConst
::
oneHour
,
array
(
$where
[
'storeId'
])
);
if
(
$couponList
){
$couponList
=
array_values
(
$couponList
);
}
...
...
@@ -277,7 +279,7 @@ class CouponServiceModel extends \Business\AbstractModel{
$this
->
validCouponStore
(
$where
);
$couponDao
=
\DAO\Coupon\CouponModel
::
getInstance
();
$couponDao
->
validStoreCouponParam
(
$where
);
$couponList
=
\Our\RedisHelper
::
cachedFunction
(
\Redis\Db13\CouponRedisModel
::
getInstance
(),
array
(
&
$this
,
'getStoreCouponsById'
),
array
(
$where
[
'storeId'
],
$memberId
,
true
),
\Our\ApiConst
::
oneHour
);
$couponList
=
\Our\RedisHelper
::
cachedFunction
(
\Redis\Db13\CouponRedisModel
::
getInstance
(),
array
(
&
$this
,
'getStoreCouponsById'
),
array
(
$where
[
'storeId'
],
$memberId
,
true
),
\Our\ApiConst
::
oneHour
,
array
(
$where
[
'storeId'
])
);
if
(
$couponList
){
$couponList
=
array_values
(
$couponList
);
if
(
count
(
$couponList
)
>=
\Our\ApiConst
::
defaultCouponTitleLength
){
...
...
@@ -356,6 +358,22 @@ class CouponServiceModel extends \Business\AbstractModel{
return
$couponList
;
}
/**
* 删除店铺优惠券缓存
* @param $storeId 店铺ID
* @param bool $couponId 指定优惠券ID
* @throws \Our\Exception
*/
public
function
deleteCouponCache
(
$storeId
,
$couponId
=
false
){
$couponDao
=
\DAO\Coupon\CouponModel
::
getInstance
();
$memberCouponDao
=
\DAO\Coupon\MemberCouponModel
::
getInstance
();
if
(
$couponId
){
\Our\RedisHelper
::
delCachedFunction
(
\Redis\Db13\MemberCouponRedisModel
::
getInstance
(),
array
(
&
$memberCouponDao
,
'getList'
),
array
(),
array
(
$couponId
));
}
\Our\RedisHelper
::
delCachedFunction
(
\Redis\Db13\CouponRedisModel
::
getInstance
(),
array
(
&
$couponDao
,
'getStorePromotionCouponList'
),
array
(),
array
(
$storeId
));
\Our\RedisHelper
::
delCachedFunction
(
\Redis\Db13\CouponRedisModel
::
getInstance
(),
array
(
&
$this
,
'getStoreCouponsById'
),
array
(),
array
(
$storeId
));
}
/**
* 类实例
*/
...
...
application/models/Business/Goods/GoodsClassService.php
View file @
15035075
...
...
@@ -333,6 +333,18 @@ class GoodsClassServiceModel extends \Business\AbstractModel{
return
$adv
;
}
/**
* 删除店铺分类顶部缓存
* @param $gcId
* @param $storeId
*/
public
function
deleteStoreTopClassAdvsFromCache
(
$storeId
,
$gcId
){
$goodsClassImageDao
=
\DAO\Adv\GoodsClassImageModel
::
getInstance
();
\Our\RedisHelper
::
delCachedFunction
(
\Redis\Db9\GoodsClassImageRedisModel
::
getInstance
(),
array
(
&
$this
,
'getStoreTopClassAdvs'
),
array
(
$storeId
,
$gcId
));
\Our\RedisHelper
::
delCachedFunction
(
\Redis\Db9\GoodsClassImageRedisModel
::
getInstance
(),
array
(
&
$goodsClassImageDao
,
'find'
),
array
(
array
(
'store_id'
=>
$storeId
,
'gc_id'
=>
$gcId
)));
}
public
function
getStoreTopClassAdvs
(
$storeId
,
$gcId
){
$goodsClassImage
=
\DAO\Adv\GoodsClassImageModel
::
getInstance
()
->
findByStoreIdAndGcId
(
$storeId
,
$gcId
);
$adv
[
'isSwiper'
]
=
\Our\ApiConst
::
zero
;
...
...
application/models/Business/Order/OrderService.php
View file @
15035075
...
...
@@ -240,7 +240,7 @@ class OrderServiceModel extends \Business\AbstractModel
if
(
$res
){
if
(
$memberId
)
{
$orderDao
->
deleteOrderCache
(
$memberId
,
$orderId
);
$memberDao
->
fromOrderStateToOrderState
(
$memberId
,
$order
[
'order_state'
],
ApiConst
::
orderStateCancel
);
//
$memberDao->fromOrderStateToOrderState($memberId,$order['order_state'],ApiConst::orderStateCancel);
}
}
return
$res
;
...
...
application/models/Business/Store/ShopkeeperService.php
View file @
15035075
...
...
@@ -468,6 +468,52 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
}
while
(
$storeMemberStatisticData
);
file_put_contents
(
$this
->
baseDir
.
PathConst
::
orderGoodsCreateTime
,
TIMESTAMP
);
}
//创建索引
public
function
createOrdersIndex
()
{
$orderGoodDao
=
\DAO\Order\OrderGoodsModel
::
getInstance
(
DbNameConst
::
salveDBConnectName
);
$orderDao
=
\DAO\Order\OrderModel
::
getInstance
(
DbNameConst
::
salveDBConnectName
);
$gmtCreate
=
file_get_contents
(
$this
->
baseDir
.
PathConst
::
orderLastCreateTime
);
$gmtCreate
=
!
empty
(
$gmtCreate
)
?
$gmtCreate
:
ApiConst
::
zero
;
$beginTime
=
$gmtCreate
;
$this
->
taskIndex
=
PageConst
::
taskPageBegin
;
$this
->
taskSize
=
PageConst
::
taskPageSize
;
do
{
$addDatas
=
array
();
$where
[
'add_time'
]
=
Common
::
format
(
" add_time>=
{
0
}
and add_time<"
,
$beginTime
,
TIMESTAMP
);
$orders
=
$orderDao
->
getList
(
$where
,
$orderDao
->
_primaryKey
,
$this
->
taskIndex
,
$this
->
taskSize
,
$orderField
=
'add_time'
,
$sort
=
'desc'
);
if
(
!
empty
(
$orders
[
'list'
])){
$orderIds
=
array_column
(
$orders
[
'list'
],
$orderDao
->
_primaryKey
);
$resultOrders
=
array
();
foreach
(
$orders
as
$order
){
}
}
$storeMemberStatisticData
=
$orderGoodDao
->
getMemberStoreStaticsByCreateTime
(
$beginTime
,
$this
->
taskIndex
,
$this
->
taskSize
);
$storeMemberStatisticData
=
isset
(
$storeMemberStatisticData
[
'list'
])
?
$storeMemberStatisticData
[
'list'
]
:
false
;
if
(
$storeMemberStatisticData
){
$this
->
taskIndex
++
;
foreach
(
$storeMemberStatisticData
as
$value
){
$addDatas
[
$value
[
'buyerId'
]
.
'-'
.
$value
[
'storeId'
]][
'storeId'
]
=
$value
[
'storeId'
];
$addDatas
[
$value
[
'buyerId'
]
.
'-'
.
$value
[
'storeId'
]][
'memberId'
]
=
$value
[
'buyerId'
];
if
(
isset
(
$addDatas
[
$value
[
'buyerId'
]
.
'-'
.
$value
[
'storeId'
]][
'orderGoodsCount'
])){
$addDatas
[
$value
[
'buyerId'
]
.
'-'
.
$value
[
'storeId'
]][
'orderGoodsCount'
]
+=
$value
[
'goodsNum'
];
}
else
{
$addDatas
[
$value
[
'buyerId'
]
.
'-'
.
$value
[
'storeId'
]][
'orderGoodsCount'
]
=
$value
[
'goodsNum'
];
}
if
(
isset
(
$addDatas
[
$value
[
'buyerId'
]
.
'-'
.
$value
[
'storeId'
]][
'orderTotal'
])){
$addDatas
[
$value
[
'buyerId'
]
.
'-'
.
$value
[
'storeId'
]][
'orderTotal'
]
+=
$value
[
'goodsPrice'
];
}
else
{
$addDatas
[
$value
[
'buyerId'
]
.
'-'
.
$value
[
'storeId'
]][
'orderTotal'
]
=
$value
[
'goodsPrice'
];
}
}
}
$addDatas
=
array_values
(
$addDatas
);
$storeMemberStatisticDao
->
addAll
(
$addDatas
);
}
while
(
$orders
);
file_put_contents
(
$this
->
baseDir
.
PathConst
::
orderLastCreateTime
,
TIMESTAMP
);
}
public
function
reduceRefundModel
(
$storeMemberDatas
){
$convertStoreMember
=
array
();
...
...
application/models/Business/Store/StoreService.php
View file @
15035075
...
...
@@ -881,6 +881,18 @@ class StoreServiceModel extends \Business\AbstractModel{
$gc_names
=
\Our\RedisHelper
::
cachedFunction
(
\Redis\Db4\GoodsClassImageRedisModel
::
getInstance
(),
array
(
&
$this
,
'getRecommendClass'
),
array
(
$storeId
),
\Our\ApiConst
::
oneDaySecond
,
array
(
$storeId
));
return
$gc_names
;
}
/**
* 删除首页店铺及分类缓存
* @param $cityCode
*/
public
function
deleteStoreAndStoreClassCacheByCitycode
(
$cityCode
){
\DAO\QmStoreClassModel
::
getInstance
()
->
delStoreClassesCache
(
$cityCode
);
$storeDao
=
\DAO\StoreModel
::
getInstance
();
$storeDao
->
delNearbyStoresCache
(
$cityCode
);
$storeDao
->
delStoresCacheByCityCode
(
$cityCode
);
}
/**
*/
private
static
$_instance
=
null
;
...
...
application/models/DAO/Coupon/Coupon.php
View file @
15035075
...
...
@@ -394,6 +394,7 @@ class CouponModel extends \DAO\AbstractModel {
return
false
;
}
/**
* 满额赠礼品券
* @param $coupon
...
...
application/models/DAO/Order/Order.php
View file @
15035075
...
...
@@ -32,7 +32,7 @@ class OrderModel extends \DAO\AbstractModel
*
* @var string
*/
p
rotected
$_primaryKey
=
'order_id'
;
p
ublic
$_primaryKey
=
'order_id'
;
public
$errorMessage
;
public
function
init
()
...
...
@@ -300,7 +300,7 @@ class OrderModel extends \DAO\AbstractModel
$where
=
$this
->
db
->
getSqlWhereByArray
(
$where
);
}
$orders
=
$this
->
lists
(
$where
,
$order
,
$field
,
$pageIndex
,
$pageSize
);
return
$orders
?
$orders
:
array
();
return
$orders
[
'list'
]
?
$orders
:
array
();
}
//待收货获取订单状态信息
...
...
@@ -843,6 +843,8 @@ class OrderModel extends \DAO\AbstractModel
public
function
getCancelUnpayedOrderTimeCache
(){
$res
=
\Redis\Db5\OrderRedisModel
::
getInstance
()
->
tableCacheGet
(
\Our\NameConst
::
cancelUnPayedOrderTimePrefix
);
echo
'abcd'
.
json_encode
(
$res
);
return
\Redis\Db5\OrderRedisModel
::
getInstance
()
->
tableCacheGet
(
\Our\NameConst
::
cancelUnPayedOrderTimePrefix
);
}
...
...
application/models/DAO/Storage/GoodsCommonStorage.php
0 → 100644
View file @
15035075
This diff is collapsed.
Click to expand it.
application/models/DAO/Storage/GoodsImagesStorage.php
0 → 100644
View file @
15035075
<?php
namespace
DAO\Storage
;
class
GoodsImagesStorageModel
extends
\DAO\AbstractModel
{
/**
* 表名
*
* @var string
*/
protected
$_tableName
=
'han_goods_images_storage'
;
/**
* 主键
*
* @var string
*/
protected
$_primaryKey
=
'goods_image_id'
;
public
function
init
(){
}
public
function
getListByCommonId
(
$goodsCommonId
,
$field
){
$this
->
setDb
();
return
$this
->
db
->
select
(
$field
)
->
from
(
$this
->
_tableName
)
->
where
(
array
(
'goods_commonid'
=>
$goodsCommonId
))
->
fetchAll
();
}
/**
* 类实例
*
* @var \DAO\UserModel
*/
private
static
$_instance
=
null
;
/**
* 获取类实例
*
* @return \DAO\UserModel
*/
public
static
function
getInstance
()
{
if
(
!
(
self
::
$_instance
instanceof
self
))
{
self
::
$_instance
=
new
self
();
}
return
self
::
$_instance
;
}
}
application/models/DAO/Storage/GoodsStorage.php
0 → 100644
View file @
15035075
This diff is collapsed.
Click to expand it.
scripts/crontab/growGoodsStores/grow.php
0 → 100644
View file @
15035075
<?php
/**
* 生成店铺订单索引
* 执行时间:每分钟执行一次
*
* @author chenjiebin <sjlinyu@qq.com>
*/
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
cliGrow
extends
basecli
{
const
CLI_ADMIN_ID
=
255
;
private
$bDoUnLock
=
FALSE
;
// 是否允许释放 LOCK 文件
private
$_debug
=
0
;
private
$lockFileName
;
public
$key
=
''
;
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
_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
(
'shopkeeper'
);
if
(
!
$this
->
mkdirs
(
$lockDir
))
{
echo
'****create dir fail ****'
;
exit
;
}
$this
->
lockFileName
=
$lockDir
.
DS
.
'grow.locks'
;
if
(
file_exists
(
$this
->
lockFileName
))
{
$stat
=
stat
(
$this
->
lockFileName
);
if
((
TIMESTAMP
-
$stat
[
'mtime'
])
>
1800
)
{
echo
"文件被锁超过1800秒,被强制删除"
;
@
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 独占锁
$goodsCommonStrorageDao
=
\DAO\Storage\GoodsCommonStorageModel
::
getInstance
();
$goodsStorageDao
=
\DAO\Storage\GoodsStorageModel
::
getInstance
();
$goodsImagesStorageDao
=
\DAO\Storage\GoodsImagesStorageModel
::
getInstance
();
try
{
$goodsCommonStrorageDao
->
createTestData
();
}
catch
(
Exception
$ex
)
{
throw
new
Exception
(
$ex
->
getCode
()
.
'|'
.
$ex
->
getMessage
());
}
echo
'店铺订单索引生成成功'
.
date
(
'Y-m-d H:i:s'
,
TIMESTAMP
)
.
"
\r\n
"
;
}
}
$oCli
=
new
cliGrow
(
TRUE
);
EXIT
;
?>
scripts/crontab/shopkeeper/orders.php
0 → 100644
View file @
15035075
<?php
/**
* 生成店铺订单索引
* 执行时间:每分钟执行一次
*
* @author chenjiebin <sjlinyu@qq.com>
*/
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
cliShopkeeperOrders
extends
basecli
{
const
CLI_ADMIN_ID
=
255
;
private
$bDoUnLock
=
FALSE
;
// 是否允许释放 LOCK 文件
private
$_debug
=
0
;
private
$lockFileName
;
public
$key
=
''
;
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
_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
(
'shopkeeper'
);
if
(
!
$this
->
mkdirs
(
$lockDir
))
{
echo
'****create dir fail ****'
;
exit
;
}
$this
->
lockFileName
=
$lockDir
.
DS
.
'orders.locks'
;
if
(
file_exists
(
$this
->
lockFileName
))
{
$stat
=
stat
(
$this
->
lockFileName
);
if
((
TIMESTAMP
-
$stat
[
'mtime'
])
>
1800
)
{
echo
"文件被锁超过1800秒,被强制删除"
;
@
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 独占锁
$shopkeeperService
=
\Business\Store\ShopkeeperServiceModel
::
getInstance
();
$shopkeeperService
->
baseDir
=
\Our\Common
::
getConfig
(
'out.config'
);
try
{
$shopkeeperService
->
createOrdersIndex
();
}
catch
(
Exception
$ex
)
{
throw
new
Exception
(
$ex
->
getCode
()
.
'|'
.
$ex
->
getMessage
());
}
echo
'店铺订单索引生成成功'
.
date
(
'Y-m-d H:i:s'
,
TIMESTAMP
)
.
"
\r\n
"
;
}
}
$oCli
=
new
cliShopkeeperOrders
(
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