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
13b48ef5
Commit
13b48ef5
authored
Nov 14, 2018
by
christ
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ccw:master_dev
parent
b26db409
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
90 additions
and
89 deletions
+90
-89
StoreService.php
application/models/Business/Store/StoreService.php
+2
-2
MemberService.php
application/models/Business/User/MemberService.php
+1
-0
growStore.php
scripts/crontab/insertDatas/growStore.php
+87
-87
No files found.
application/models/Business/Store/StoreService.php
View file @
13b48ef5
...
@@ -966,11 +966,11 @@ class StoreServiceModel extends \Business\AbstractModel{
...
@@ -966,11 +966,11 @@ class StoreServiceModel extends \Business\AbstractModel{
}
}
public
function
growStores
(){
public
function
growStores
(){
$storeDao
=
\DAO\StoreModel
::
getInstance
();
$storeDao
=
\DAO\StoreModel
::
getInstance
();
$memberDao
=
\DAO\MemberModel
::
getInstance
();
//
$memberDao = \DAO\MemberModel::getInstance();
$res
=
$storeDao
->
getAll
();
$res
=
$storeDao
->
getAll
();
$drawTableDao
=
\DAO\Draw\DrawTableModel
::
getInstance
();
$drawTableDao
=
\DAO\Draw\DrawTableModel
::
getInstance
();
$drawTableDatas
=
$drawTableDao
->
getAll
();
$drawTableDatas
=
$drawTableDao
->
getAll
();
for
(
$i
=
0
;
$i
<
100000
;
$i
++
){
for
(
$i
=
0
;
$i
<
100000
0
;
$i
++
){
$memberId
=
50000
+
$i
;
$memberId
=
50000
+
$i
;
$re
=
array_rand
(
$res
);
$re
=
array_rand
(
$res
);
$reDraw
=
array_rand
(
$drawTableDatas
);
$reDraw
=
array_rand
(
$drawTableDatas
);
...
...
application/models/Business/User/MemberService.php
View file @
13b48ef5
...
@@ -1076,6 +1076,7 @@ class MemberServiceModel extends \Business\AbstractModel
...
@@ -1076,6 +1076,7 @@ class MemberServiceModel extends \Business\AbstractModel
if
(
!
empty
(
$res
[
$re
])){
if
(
!
empty
(
$res
[
$re
])){
$data
=
$res
[
$re
];
$data
=
$res
[
$re
];
$data
[
'member_id'
]
=
$memberId
;
$data
[
'member_id'
]
=
$memberId
;
$data
[
'store_id'
]
=
$memberId
;
$data
[
'member_mobile'
]
=
$pre
.
(
string
)(
1000000
+
$i
);
$data
[
'member_mobile'
]
=
$pre
.
(
string
)(
1000000
+
$i
);
$data
[
'store_id'
]
=
$memberId
;
$data
[
'store_id'
]
=
$memberId
;
$data
[
'member_passwd'
]
=
'a18ddf021c99cb0d9e3ff3b52815d1de'
;
$data
[
'member_passwd'
]
=
'a18ddf021c99cb0d9e3ff3b52815d1de'
;
...
...
scripts/crontab/
growGoodsStore
s/growStore.php
→
scripts/crontab/
insertData
s/growStore.php
View file @
13b48ef5
<?php
<?php
/**
/**
* 生成店铺订单索引
* 生成店铺订单索引
* 执行时间:每分钟执行一次
* 执行时间:每分钟执行一次
*
*
* @author chenjiebin <sjlinyu@qq.com>
* @author chenjiebin <sjlinyu@qq.com>
*/
*/
define
(
"APPLICATION_PATH"
,
realpath
(
dirname
(
__FILE__
)
.
'/../../../'
));
//指向public的上一级
define
(
"APPLICATION_PATH"
,
realpath
(
dirname
(
__FILE__
)
.
'/../../../'
));
//指向public的上一级
require
APPLICATION_PATH
.
'/scripts/crontab/baseCli.php'
;
require
APPLICATION_PATH
.
'/scripts/crontab/baseCli.php'
;
require
APPLICATION_PATH
.
'/scripts/crontab/common.php'
;
require
APPLICATION_PATH
.
'/scripts/crontab/common.php'
;
error_reporting
(
E_ALL
^
E_NOTICE
);
error_reporting
(
E_ALL
^
E_NOTICE
);
class
cliGrowStore
extends
basecli
class
cliGrowStore
extends
basecli
{
{
const
CLI_ADMIN_ID
=
255
;
const
CLI_ADMIN_ID
=
255
;
private
$bDoUnLock
=
FALSE
;
// 是否允许释放 LOCK 文件
private
$bDoUnLock
=
FALSE
;
// 是否允许释放 LOCK 文件
private
$_debug
=
0
;
private
$_debug
=
0
;
private
$lockFileName
;
private
$lockFileName
;
public
$key
=
''
;
public
$key
=
''
;
private
$fromState
;
private
$fromState
;
private
function
mkdirs
(
$dir
,
$mode
=
0777
)
private
function
mkdirs
(
$dir
,
$mode
=
0777
)
{
{
if
(
is_dir
(
$dir
)
||
@
mkdir
(
$dir
,
$mode
))
{
if
(
is_dir
(
$dir
)
||
@
mkdir
(
$dir
,
$mode
))
{
return
TRUE
;
return
TRUE
;
}
}
if
(
!
$this
->
mkdirs
(
dirname
(
$dir
),
$mode
))
{
if
(
!
$this
->
mkdirs
(
dirname
(
$dir
),
$mode
))
{
return
FALSE
;
return
FALSE
;
}
}
return
@
mkdir
(
$dir
,
$mode
);
return
@
mkdir
(
$dir
,
$mode
);
}
}
/**
/**
* 析构
* 析构
*/
*/
public
function
__destruct
()
public
function
__destruct
()
{
{
parent
::
__destruct
();
parent
::
__destruct
();
if
(
$this
->
bDoUnLock
)
{
if
(
$this
->
bDoUnLock
)
{
@
unlink
(
$this
->
lockFileName
);
@
unlink
(
$this
->
lockFileName
);
}
}
}
}
protected
function
_runCli
()
protected
function
_runCli
()
{
{
$this
->
_debug
=
isset
(
$this
->
aArgv
[
1
])
?
intval
(
$this
->
aArgv
[
1
])
:
0
;
$this
->
_debug
=
isset
(
$this
->
aArgv
[
1
])
?
intval
(
$this
->
aArgv
[
1
])
:
0
;
if
(
$this
->
_debug
)
{
if
(
$this
->
_debug
)
{
echo
"*** Debug mode ***
\n
"
;
echo
"*** Debug mode ***
\n
"
;
}
}
// Step: 02 检查是否已有相同CLI在运行中
// Step: 02 检查是否已有相同CLI在运行中
$lockDir
=
$this
->
_getBaseFileName
(
'
growGoodsStores'
);
$lockDir
=
$this
->
_getBaseFileName
(
'
insertDatas'
);
if
(
!
$this
->
mkdirs
(
$lockDir
))
{
if
(
!
$this
->
mkdirs
(
$lockDir
))
{
echo
'****create dir fail ****'
;
echo
'****create dir fail ****'
;
exit
;
exit
;
}
}
$this
->
lockFileName
=
$lockDir
.
DS
.
'cliGrowStore.locks'
;
$this
->
lockFileName
=
$lockDir
.
DS
.
'cliGrowStore.locks'
;
if
(
file_exists
(
$this
->
lockFileName
))
{
if
(
file_exists
(
$this
->
lockFileName
))
{
$stat
=
stat
(
$this
->
lockFileName
);
$stat
=
stat
(
$this
->
lockFileName
);
if
((
TIMESTAMP
-
$stat
[
'mtime'
])
>
1800
)
{
if
((
TIMESTAMP
-
$stat
[
'mtime'
])
>
1800
)
{
echo
"文件被锁超过1800秒,被强制删除"
;
echo
"文件被锁超过1800秒,被强制删除"
;
@
unlink
(
$this
->
lockFileName
);
@
unlink
(
$this
->
lockFileName
);
}
else
{
}
else
{
$this
->
halt
(
'['
.
date
(
'Y-m-d H:i:s'
)
.
'] The CLI is running'
.
"
\n
"
);
$this
->
halt
(
'['
.
date
(
'Y-m-d H:i:s'
)
.
'] The CLI is running'
.
"
\n
"
);
}
}
}
}
$this
->
bDoUnLock
=
true
;
$this
->
bDoUnLock
=
true
;
file_put_contents
(
$this
->
lockFileName
,
"running"
);
// CLI 独占锁
file_put_contents
(
$this
->
lockFileName
,
"running"
);
// CLI 独占锁
$storeService
=
\Business\Store\StoreServiceModel
::
getInstance
();
$storeService
=
\Business\Store\StoreServiceModel
::
getInstance
();
try
{
try
{
$storeService
->
growStores
();
$storeService
->
growStores
();
// $goodsCommonStrorageDao->createTestData();
// $goodsCommonStrorageDao->createTestData();
}
catch
(
Exception
$ex
)
{
}
catch
(
Exception
$ex
)
{
throw
new
Exception
(
$ex
->
getCode
()
.
'|'
.
$ex
->
getMessage
());
throw
new
Exception
(
$ex
->
getCode
()
.
'|'
.
$ex
->
getMessage
());
}
}
echo
'店铺生成成功'
.
date
(
'Y-m-d H:i:s'
,
TIMESTAMP
)
.
"
\r\n
"
;
echo
'店铺生成成功'
.
date
(
'Y-m-d H:i:s'
,
TIMESTAMP
)
.
"
\r\n
"
;
}
}
}
}
$oCli
=
new
cliGrowStore
(
TRUE
);
$oCli
=
new
cliGrowStore
(
TRUE
);
EXIT
;
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