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
61e2db8c
Commit
61e2db8c
authored
Jan 24, 2019
by
zhz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
邀请人相关
parent
bfb185c4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
96 additions
and
10 deletions
+96
-10
Member.php
application/controllers/Member.php
+1
-1
StoreService.php
application/models/Business/Store/StoreService.php
+12
-8
StoreDrainageAmount.php
application/models/DAO/Store/StoreDrainageAmount.php
+1
-1
tryStoreExamine.php
scripts/crontab/store/tryStoreExamine.php
+82
-0
No files found.
application/controllers/Member.php
100755 → 100644
View file @
61e2db8c
...
@@ -159,7 +159,7 @@ class MemberController extends \Our\Controller_AbstractApi {
...
@@ -159,7 +159,7 @@ class MemberController extends \Our\Controller_AbstractApi {
* 该微信是否添加过邀请人
* 该微信是否添加过邀请人
*/
*/
public
function
hasAddInviterAction
()
{
public
function
hasAddInviterAction
()
{
$result
=
$this
->
memberService
->
a
ddInviter
(
$this
->
memberId
);
$result
=
$this
->
memberService
->
hasA
ddInviter
(
$this
->
memberId
);
$this
->
success
(
$result
);
$this
->
success
(
$result
);
}
}
}
}
application/models/Business/Store/StoreService.php
100755 → 100644
View file @
61e2db8c
...
@@ -1333,9 +1333,10 @@ class StoreServiceModel extends \Business\AbstractModel{
...
@@ -1333,9 +1333,10 @@ class StoreServiceModel extends \Business\AbstractModel{
public
function
tryStoreExamine
()
{
public
function
tryStoreExamine
()
{
$storeDrainageAmountDao
=
\DAO\Store\StoreDrainageAmountModel
::
getInstance
();
$storeDrainageAmountDao
=
\DAO\Store\StoreDrainageAmountModel
::
getInstance
();
$storeClassPayLogDao
=
\DAO\Store\StoreClassPayLogModel
::
getInstance
();
$storeClassPayLogDao
=
\DAO\Store\StoreClassPayLogModel
::
getInstance
();
$storeUtil
=
\Store\StoreUtil
::
getInstance
();
$pageBegin
=
\Our\PageConst
::
taskPageBegin
;
$pageBegin
=
\Our\PageConst
::
taskPageBegin
;
while
(
true
)
{
while
(
true
)
{
$stores
=
$storeDrainageAmountDao
->
getStoreAndDrainageAmount
(
array
(
'han_store
.store_end_time'
=>
array
(
'between'
,
TIMESTAMP
-
\Our\ApiConst
::
oneDaySecond
,
TIMESTAMP
),
'han_store_drainage_amount.gmt_examine'
=>
0
),
'han_store.store_citycode,han_store.member_id
,han_store_drainage_amount.*'
,
array
(
$pageBegin
,
1000
));
$stores
=
$storeDrainageAmountDao
->
getStoreAndDrainageAmount
(
array
(
'han_store
_full.store_end_time'
=>
array
(
'between'
,
TIMESTAMP
-
\Our\ApiConst
::
oneDaySecond
,
TIMESTAMP
),
'han_store_drainage_amount.gmt_examine'
=>
0
),
'han_store_full.store_citycode,han_store_full.member_id,han_store_full.contract_time,han_store_full.store_end_time,han_store_full.store_phone
,han_store_drainage_amount.*'
,
array
(
$pageBegin
,
1000
));
// $stores = $storeDrainageAmountDao->getStoreAndDrainageAmount(array('han_store.store_end_time'=>array('between',0,1648209008),'han_store_drainage_amount.gmt_examine'=>0),'han_store.store_citycode,han_store.member_id,han_store_drainage_amount.*',array($pageBegin,1000));
// $stores = $storeDrainageAmountDao->getStoreAndDrainageAmount(array('han_store.store_end_time'=>array('between',0,1648209008),'han_store_drainage_amount.gmt_examine'=>0),'han_store.store_citycode,han_store.member_id,han_store_drainage_amount.*',array($pageBegin,1000));
if
(
empty
(
$stores
))
{
if
(
empty
(
$stores
))
{
break
;
break
;
...
@@ -1343,16 +1344,19 @@ class StoreServiceModel extends \Business\AbstractModel{
...
@@ -1343,16 +1344,19 @@ class StoreServiceModel extends \Business\AbstractModel{
foreach
(
$stores
as
$store
)
{
foreach
(
$stores
as
$store
)
{
if
(
$store
[
'amount'
]
>=
400
)
{
if
(
$store
[
'amount'
]
>=
400
)
{
//自动免费续费 当前签约分类租金2个月
//自动免费续费 当前签约分类租金2个月
$storeUtil
->
calcChargeMoney
(
array
(
'month'
=>
2
,
'store_end_time'
=>
$store
[
'store_end_time'
],
'contract_time'
=>
$store
[
'contract_time'
]));
}
elseif
(
$store
[
'amount'
]
>=
300
)
{
}
elseif
(
$store
[
'amount'
]
>=
300
)
{
//自动免费续费 当前签约分类租金1个月
//自动免费续费 当前签约分类租金1个月
}
elseif
(
$store
[
'amount'
]
<
30
)
{
$storeUtil
->
calcChargeMoney
(
array
(
'month'
=>
1
,
'store_end_time'
=>
$store
[
'store_end_time'
],
'contract_time'
=>
$store
[
'contract_time'
]));
//查看是否有签约分类续费记录
$log
=
$storeClassPayLogDao
->
getStoreClassPayLog
(
array
(
'store_id'
=>
$store
[
'store_id'
],
'pay_state'
=>
1
));
if
(
empty
(
$log
))
{
//店铺下架,下架理由为 试用期考核不合格 并且 发送短信
$this
->
storeClose
(
$store
,
\Our\NameConst
::
tryStoreExamineFail
);
}
}
}
// elseif ($store['amount'] < 30) {
// //查看是否有签约分类续费记录
// $log = $storeClassPayLogDao->getStoreClassPayLog(array('store_id'=>$store['store_id'],'pay_state'=>1));
// if(empty($log)) {
// //店铺下架,下架理由为 试用期考核不合格 并且 发送短信
// $this->storeClose($store,\Our\NameConst::tryStoreExamineFail);
// }
// }
$storeDrainageAmountDao
->
editDrainage
(
array
(
'store_id'
=>
$store
[
'store_id'
]),
array
(
'gmt_examine'
=>
TIMESTAMP
));
$storeDrainageAmountDao
->
editDrainage
(
array
(
'store_id'
=>
$store
[
'store_id'
]),
array
(
'gmt_examine'
=>
TIMESTAMP
));
}
}
$pageBegin
=
(
$pageBegin
+
1
)
*
1000
;
$pageBegin
=
(
$pageBegin
+
1
)
*
1000
;
...
...
application/models/DAO/Store/StoreDrainageAmount.php
View file @
61e2db8c
...
@@ -69,7 +69,7 @@ class StoreDrainageAmountModel extends \DAO\AbstractModel
...
@@ -69,7 +69,7 @@ class StoreDrainageAmountModel extends \DAO\AbstractModel
if
(
is_array
(
$where
))
{
if
(
is_array
(
$where
))
{
$where
=
$this
->
db
->
getSqlWhereByArray
(
$where
);
$where
=
$this
->
db
->
getSqlWhereByArray
(
$where
);
}
}
$result
=
$this
->
db
->
select
(
$field
)
->
from
(
'han_store
'
)
->
join
(
$this
->
_tableName
,
'han_store
.store_id = han_store_drainage_amount.store_id'
,
'inner'
)
->
where
(
$where
)
->
fetchAll
();
$result
=
$this
->
db
->
select
(
$field
)
->
from
(
'han_store
_full'
)
->
join
(
$this
->
_tableName
,
'han_store_full
.store_id = han_store_drainage_amount.store_id'
,
'inner'
)
->
where
(
$where
)
->
fetchAll
();
return
$result
;
return
$result
;
}
}
public
function
editDrainage
(
$where
,
$data
)
public
function
editDrainage
(
$where
,
$data
)
...
...
scripts/crontab/store/tryStoreExamine.php
0 → 100644
View file @
61e2db8c
<?php
/**
* 试用期的店铺考核
* 执行时间:每个月1号00:05
*/
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
cliSaleOrder
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
tryStoreExamine
(){
\Business\Store\StoreServiceModel
::
getInstance
()
->
tryStoreExamine
();
}
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
(
'store'
);
if
(
!
$this
->
mkdirs
(
$lockDir
)){
echo
'****create dir fail ****'
;
exit
;
}
$this
->
lockFileName
=
$lockDir
.
'/tryStoreExamine.locks'
;
if
(
file_exists
(
$this
->
lockFileName
)
)
{
$stat
=
stat
(
$this
->
lockFileName
);
if
(
(
TIMESTAMP
-
$stat
[
'mtime'
])
>
3600
)
{
echo
"文件被锁超过3600秒,被强制删除"
;
@
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
->
tryStoreExamine
();
echo
'试用期的店铺考核完成'
.
"
\r\n
"
;
}
}
$oCli
=
new
cliSaleOrder
(
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