Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
goods
Project
Project
Details
Activity
Releases
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
bp
goods
Commits
a4d37df8
Commit
a4d37df8
authored
Sep 02, 2021
by
jianghaiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'colonel' into test
parents
ef07fcec
5b7ba7b4
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
94 additions
and
87 deletions
+94
-87
ColonelDistributorPayInfo.php
...tion/models/marketing/mysql/ColonelDistributorPayInfo.php
+1
-1
MarketingPindan.php
application/models/marketing/mysql/MarketingPindan.php
+1
-0
ColonelOrder.php
application/modules/Job/controllers/ColonelOrder.php
+0
-16
ColonelWallet.php
application/modules/Job/controllers/ColonelWallet.php
+0
-16
Colonelorder.php
application/modules/Job/controllers/Colonelorder.php
+31
-21
Colonelwallet.php
application/modules/Job/controllers/Colonelwallet.php
+16
-10
ColonelService.php
application/services/marketing/ColonelService.php
+1
-1
MarketingService.php
application/services/marketing/MarketingService.php
+28
-7
UserService.php
application/services/user/UserService.php
+8
-13
run-colonel-order.job
deploy/job/run-colonel-order.job
+1
-1
run-colonel-wallet.job
deploy/job/run-colonel-wallet.job
+1
-1
cli.php
public/cli.php
+3
-0
job.php
public/job.php
+3
-0
No files found.
application/models/marketing/mysql/ColonelDistributorPayInfo.php
View file @
a4d37df8
...
...
@@ -8,7 +8,7 @@ class ColonelDistributorPayInfo extends MysqlBase
{
const
TABLE_NAME
=
'colonel_distributor_pay_info'
;
const
CONFIG_INDEX
=
'marketing'
;
const
PRIMARY_KEY
=
'
colonel_distributor_
pay_info_id'
;
const
PRIMARY_KEY
=
'pay_info_id'
;
const
TYPE_NEW_USER
=
1
;
const
TYPE_FINISH_TARGET
=
2
;
...
...
application/models/marketing/mysql/MarketingPindan.php
View file @
a4d37df8
...
...
@@ -13,6 +13,7 @@ class MarketingPindan extends MysqlBase
const
ACTIVITY_STATUS_NO_START
=
1
;
const
ACTIVITY_STATUS_IN_PROGRESS
=
2
;
const
ACTIVITY_STATUS_FINISHED
=
3
;
const
ACTIVITY_STATUS_START_TODAY
=
4
;
//今日上新
public
static
function
getRecord
(
$where
,
$colums
=
[])
{
...
...
application/modules/Job/controllers/ColonelOrder.php
deleted
100644 → 0
View file @
ef07fcec
<?php
/**
* Created by PhpStorm.
* User: pengfei@yidian-inc.com
* Date: 2021/8/31 1:36 下午
*/
use
App\Base\Job
;
class
ColonelOrderController
extends
Job
{
public
function
indexAction
()
{
\Yaf\Application
::
app
()
->
bootstrap
()
->
getDispatcher
()
->
dispatch
(
new
\Yaf\Request\Simple
(
''
,
'cli'
,
'colonelorder'
,
'index'
,
[]));
}
}
\ No newline at end of file
application/modules/Job/controllers/ColonelWallet.php
deleted
100644 → 0
View file @
ef07fcec
<?php
/**
* Created by PhpStorm.
* User: pengfei@yidian-inc.com
* Date: 2021/8/31 2:28 下午
*/
use
App\Base\Job
;
class
ColonelWalletController
extends
Job
{
public
function
indexAction
()
{
\Yaf\Application
::
app
()
->
bootstrap
()
->
getDispatcher
()
->
dispatch
(
new
\Yaf\Request\Simple
(
''
,
'cli'
,
'colonelwallet'
,
'index'
,
[]));
}
}
\ No newline at end of file
application/modules/
Cli
/controllers/Colonelorder.php
→
application/modules/
Job
/controllers/Colonelorder.php
View file @
a4d37df8
<?php
/**
* Created by PhpStorm.
* User: pengfei@yidian-inc.com
* Date: 2021/8/31 1:36 下午
*/
use
App\Base\Job
;
use
Api\PhpServices\Idgen\Idgen
;
use
Api\PhpUtils\Log\FileLog
;
use
App\Base\Cli
;
use
App\Models\marketing\mysql\ColonelDistributorColonel
;
use
App\Models\marketing\mysql\ColonelDistributorConfig
;
use
App\Models\marketing\mysql\ColonelDistributorInviteOrderNum
;
...
...
@@ -11,10 +16,7 @@ use App\Exception\custom\InterfaceException;
use
Api\PhpUtils\Http\HttpUtil
;
use
App\Models\user\mysql\UserWechatBind
;
/**
* php public/cli.php colonelorder index
*/
class
ColonelorderController
extends
Cli
class
ColonelOrderController
extends
Job
{
const
DEFAULT_USER_BATCH_SIZE
=
100
;
...
...
@@ -36,21 +38,25 @@ class ColonelorderController extends Cli
public
function
indexAction
()
{
FileLog
::
info
(
"colonel_distributor_order"
,
'团长分销-计算奖励脚本:start'
);
$userIdList
=
$this
->
getColonelUserIds
();
if
(
empty
(
$userIdList
)
||
empty
(
$this
->
colonelConfigList
))
{
return
true
;
}
if
(
!
empty
(
$userIdList
))
{
$userIdList
=
array_chunk
(
$userIdList
,
self
::
DEFAULT_USER_BATCH_SIZE
);
$colonelPayInfoData
=
[];
foreach
(
$userIdList
as
$userIds
)
{
$batchPayInfoData
=
[];
// 完成目标单数
$batchPayInfoData
[]
=
$this
->
getInviteOrderData
(
$userIds
);
if
(
$inviteOrderData
=
$this
->
getInviteOrderData
(
$userIds
))
{
$colonelPayInfoData
=
array_merge
(
$colonelPayInfoData
,
$inviteOrderData
);
}
// 邀请新用户奖励
$batchPayInfoData
[]
=
$this
->
getInviteNewUserData
(
$userIds
);
$colonelPayInfoData
=
array_merge
(
$colonelPayInfoData
,
$batchPayInfo
Data
);
if
(
$inviteNewUserData
=
$this
->
getInviteNewUserData
(
$userIds
))
{
$colonelPayInfoData
=
array_merge
(
$colonelPayInfoData
,
$inviteNewUser
Data
);
}
return
$this
->
handleSavePayInfo
(
$colonelPayInfoData
);
}
$this
->
handleSavePayInfo
(
$colonelPayInfoData
);
}
FileLog
::
info
(
"colonel_distributor_order"
,
'团长分销-计算奖励脚本:end'
);
echo
"success"
;
}
/**
...
...
@@ -60,6 +66,7 @@ class ColonelorderController extends Cli
*/
public
function
handleSavePayInfo
(
$colonelPayInfoData
)
{
FileLog
::
info
(
"colonel_distributor_order"
,
'团长分销-计算奖励脚本:colonelPayInfoCount='
.
count
(
$colonelPayInfoData
));
if
(
!
empty
(
$colonelPayInfoData
))
{
$data
=
$this
->
addIdgenId
(
$colonelPayInfoData
);
try
{
...
...
@@ -113,8 +120,11 @@ class ColonelorderController extends Cli
public
function
getInviteOrderData
(
$userIds
)
{
//完成目标单数
$inviteOrderNumList
=
$this
->
getInviteOrderNum
(
$userIds
,
$this
->
yesterday
,
$this
->
today
);
$inviteOrderData
=
[];
if
(
empty
(
$this
->
colonelConfigList
))
{
return
$inviteOrderData
;
}
$inviteOrderNumList
=
$this
->
getInviteOrderNum
(
$userIds
,
$this
->
yesterday
,
$this
->
today
);
foreach
(
$inviteOrderNumList
as
$orderNum
)
{
foreach
(
$this
->
colonelConfigList
as
$config
)
{
if
(
!
empty
(
$orderNum
[
"num"
])
&&
$orderNum
[
"num"
]
>=
$config
[
"assess_order_num"
])
{
...
...
@@ -181,7 +191,7 @@ class ColonelorderController extends Cli
[
"colonel_user_id"
=>
$colonelUserIds
,
"date[>=]"
=>
$startTime
,
"date[<
=
]"
=>
$endTime
,
"date[<]"
=>
$endTime
,
],
[]
);
...
...
application/modules/
Cli
/controllers/Colonelwallet.php
→
application/modules/
Job
/controllers/Colonelwallet.php
View file @
a4d37df8
<?php
/**
* Created by PhpStorm.
* User: pengfei@yidian-inc.com
* Date: 2021/8/31 2:28 下午
*/
use
App\Base\Job
;
use
Api\PhpUtils\Log\FileLog
;
use
App\Base\Cli
;
use
App\Models\marketing\mysql\ColonelDistributorPayInfo
;
use
App\Exception\custom\InterfaceException
;
use
Api\PhpUtils\Http\HttpUtil
;
/**
* php public/cli.php colonelwallet index
*/
class
ColonelwalletController
extends
Cli
class
ColonelWalletController
extends
Job
{
public
function
indexAction
()
{
FileLog
::
info
(
"colonel_distributor_wallet"
,
'团长分销-奖励钱包脚本:start'
);
$yesterday
=
date
(
"Y-m-d"
,
strtotime
(
"-1 day"
));
$payInfoList
=
$this
->
getPayInfo
(
$yesterday
);
FileLog
::
info
(
"colonel_distributor_wallet"
,
'团长分销-奖励钱包脚本:payInfoCount='
.
count
(
$payInfoList
));
if
(
!
empty
(
$payInfoList
))
{
if
(
$this
->
toWallet
(
$payInfoList
))
{
if
(
$this
->
deductingInventory
(
$payInfoList
))
{
$this
->
handlePayInfoStatus
(
array_column
(
$payInfoList
,
'colonel_distributor_pay_info_id'
));
if
(
$this
->
toWallet
(
$payInfoList
))
{
$this
->
handlePayInfoStatus
(
array_column
(
$payInfoList
,
'pay_info_id'
));
}
}
}
FileLog
::
info
(
"colonel_distributor_wallet"
,
'团长分销-奖励钱包脚本:end'
);
echo
"success"
;
}
/**
...
...
@@ -129,6 +135,6 @@ class ColonelwalletController extends Cli
*/
public
function
handlePayInfoStatus
(
array
$payInfoIds
)
{
return
ColonelDistributorPayInfo
::
updateRecord
([
'status'
=>
ColonelDistributorPayInfo
::
STATUS_USE
],
[
'id'
=>
$payInfoIds
]);
return
ColonelDistributorPayInfo
::
updateRecord
([
'status'
=>
ColonelDistributorPayInfo
::
STATUS_USE
],
[
'
pay_info_
id'
=>
$payInfoIds
]);
}
}
\ No newline at end of file
application/services/marketing/ColonelService.php
View file @
a4d37df8
...
...
@@ -93,7 +93,7 @@ class ColonelService
foreach
(
$result
[
'result'
]
as
&
$applyVal
)
{
$applyVal
[
'user_avatar'
]
=
!
empty
(
$userMap
[
$applyVal
[
'user_id'
]][
'user_avatar'
])
?
$userMap
[
$applyVal
[
'user_id'
]][
'user_avatar'
]
:
''
;
// take_place_status 是否可以添加自提点 - 已审核通过并且未添加过自提点
$applyVal
[
'take_place_status'
]
=
0
;
$applyVal
[
'take_place_status'
]
=
2
;
if
(
$applyVal
[
'audit_status'
]
==
ColonelDistributorColonelApply
::
STATUS_PASS
)
{
if
(
empty
(
$takePlaceMap
[
$applyVal
[
'colonel_apply_id'
]][
'take_place_id'
]))
{
$applyVal
[
'take_place_status'
]
=
1
;
...
...
application/services/marketing/MarketingService.php
View file @
a4d37df8
...
...
@@ -273,6 +273,17 @@ class MarketingService
$params
[
'page'
]
=
!
empty
(
$params
[
'page'
])
?
$params
[
'page'
]
:
1
;
$limit
=
!
empty
(
$params
[
'page_size'
])
?
$params
[
'page_size'
]
:
20
;
$page
=
(
$params
[
'page'
]
-
1
)
*
$limit
;
//排序规则
$sortField
=
$params
[
'sort_field'
]
??
'update_time'
;
$sortType
=
isset
(
$params
[
'sort_type'
])
?
strtoupper
(
$params
[
'sort_type'
])
:
'desc'
;
//验证sort合法性
if
(
!
in_array
(
$params
[
'sort_field'
],[
'create_time'
,
'update_time'
,
'end_time'
,
'start_time'
]))
{
$sortField
=
'update_time'
;
}
if
(
!
in_array
(
$params
[
'sort_type'
],[
'asc'
,
'desc'
]))
{
$sortType
=
'DESC'
;
}
$where
[
"marketing_type"
]
=
Marketing
::
MARKETING_TYPE_PINDAN
;
if
(
!
empty
(
$params
[
'marketing_name'
]))
{
...
...
@@ -288,18 +299,27 @@ class MarketingService
}
elseif
(
$params
[
"activity_status"
]
==
MarketingPindan
::
ACTIVITY_STATUS_IN_PROGRESS
)
{
$where
[
"start_time[<=]"
]
=
$now
;
$where
[
"end_time[>=]"
]
=
$now
;
//七日内开始的活动
if
(
!
empty
(
$params
[
'from'
])
&&
$params
[
'from'
]
==
1
)
{
$beforeSevenDay
=
date
(
"Y-m-d H:i:s"
,
strtotime
(
"-7 day"
));
$where
[
"start_time[>]"
]
=
$beforeSevenDay
;
}
}
elseif
(
$params
[
"activity_status"
]
==
MarketingPindan
::
ACTIVITY_STATUS_FINISHED
)
{
$where
[
"end_time[<]"
]
=
$now
;
}
if
(
!
empty
(
$params
[
'from'
]))
{
//七日内结束的活动
if
(
!
empty
(
$params
[
'from'
])
&&
$params
[
'from'
]
==
1
)
{
$beforeSevenDay
=
date
(
"Y-m-d H:i:s"
,
strtotime
(
"-7 day"
));
$where
[
"start_time[>]"
]
=
$beforeSevenDay
;
$where
[
"end_time[>]"
]
=
$beforeSevenDay
;
}
}
elseif
(
$params
[
"activity_status"
]
==
MarketingPindan
::
ACTIVITY_STATUS_START_TODAY
)
{
//今日上新-未开始
$where
[
"start_time[>]"
]
=
$now
;
$where
[
"start_time[<=]"
]
=
date
(
"Y-m-d 00:00:00"
,
strtotime
(
'+1 days'
));
$where
[
"end_time[>=]"
]
=
$now
;
}
$where
[
'life_account_id'
]
=
self
::
getPublicLifeAccountId
();
$where
[
'ORDER'
]
=
[
"update_time"
=>
"DESC"
];
$where
[
'ORDER'
]
=
[
$sortField
=>
$sortType
];
$where
[
'LIMIT'
]
=
[
$page
,
$limit
];
$list
=
Marketing
::
select
([
"marketing_id"
,
"marketing_name"
,
"start_time"
,
"end_time"
,
"online_status"
,
"update_time"
,
"create_time"
]
...
...
@@ -1085,6 +1105,7 @@ class MarketingService
$allHaveBuyGoodsSkuIds
=
array_keys
(
$allHaveBuyGoodsStatistics
);
if
(
in_array
(
$item
[
"goods_sku_id"
],
$allHaveBuyGoodsSkuIds
))
{
$goodsSkuList
[
$key
][
"all_have_buy_goods_count"
]
=
$allHaveBuyGoodsStatistics
[
$item
[
"goods_sku_id"
]];
$goodsSkuList
[
$key
][
"total_amount_sold"
]
=
$allHaveBuyGoodsStatistics
[
$item
[
"goods_sku_id"
]];
}
}
...
...
application/services/user/UserService.php
View file @
a4d37df8
...
...
@@ -92,10 +92,16 @@ class UserService
return
$user
;
}
/**
* 绑定手机号
* @param $params
* @return \Api\PhpUtils\Mysql\MysqlBase
* @throws UserException
* @throws \App\Exception\custom\CodeSpecialException
* @throws \App\Exception\custom\InterfaceException
*/
public
static
function
bindPhone
(
$params
)
{
$openid
=
!
empty
(
$params
[
'openid'
])
?
$params
[
'openid'
]
:
''
;
$encryptedData
=
!
empty
(
$params
[
'encryptedData'
])
?
$params
[
'encryptedData'
]
:
''
;
$iv
=
!
empty
(
$params
[
'iv'
])
?
$params
[
'iv'
]
:
''
;
...
...
@@ -116,19 +122,11 @@ class UserService
throw
new
UserException
([
'cus'
=>
5
]);
}
//解密
$decryptData
=
[];
$wXBizDataCrypt
=
new
WxBizDataCrypt
(
$appid
,
$sessionKey
);
$errCode
=
$wXBizDataCrypt
->
decryptData
(
$encryptedData
,
$iv
,
$decryptData
);
if
(
$errCode
)
{
throw
new
UserException
([
'cus'
=>
6
]);
}
...
...
@@ -139,7 +137,6 @@ class UserService
}
$phoneNumber
=
strval
(
$decryptData
[
'phoneNumber'
]);
//判断是否已
$user
=
UserWechatBind
::
getRecord
([
'phone'
=>
$phoneNumber
]);
if
(
!
empty
(
$user
)
&&
$openid
!=
$user
[
'openid'
])
{
...
...
@@ -164,8 +161,6 @@ class UserService
throw
new
UserException
([
'cus'
=>
8
]);
}
CommonService
::
isNewUser
(
$params
);
$isNewUser
=
CommonService
::
isNewUser
([
'openid'
=>
$openid
]);
if
(
!
empty
(
$isNewUser
)
&&
$isNewUser
[
'is_new_user'
]
==
1
)
{
$userInfo
[
'is_pop_up'
]
=
1
;
...
...
deploy/job/run-colonel-order.job
View file @
a4d37df8
type=command
command=bash docker run --rm -e LANG=en_US.UTF-8 -e TZ=Asia/Shanghai --net=bridge -h "`hostname`" --cap-add SYS_PTRACE --privileged docker2.yidian.com:5000/publish/bp-goods-azkaban-test-10-image /bin/bash -c "cd /home/services && sh start_job.sh test ColonelOrder index"
\ No newline at end of file
command=bash docker run --rm -e LANG=en_US.UTF-8 -e TZ=Asia/Shanghai --net=bridge -h "`hostname`" --cap-add SYS_PTRACE --privileged docker2.yidian.com:5000/publish/bp-goods-azkaban-test-10-image /bin/bash -c "cd /home/services && sh start_job.sh test ColonelOrder index a=3&b=4"
\ No newline at end of file
deploy/job/run-colonel-wallet.job
View file @
a4d37df8
type=command
command=bash docker run --rm -e LANG=en_US.UTF-8 -e TZ=Asia/Shanghai --net=bridge -h "`hostname`" --cap-add SYS_PTRACE --privileged docker2.yidian.com:5000/publish/bp-goods-azkaban-test-10-image /bin/bash -c "cd /home/services && sh start_job.sh test ColonelWallet index"
command=bash docker run --rm -e LANG=en_US.UTF-8 -e TZ=Asia/Shanghai --net=bridge -h "`hostname`" --cap-add SYS_PTRACE --privileged docker2.yidian.com:5000/publish/bp-goods-azkaban-test-10-image /bin/bash -c "cd /home/services && sh start_job.sh test ColonelWallet index
a=3&b=4
"
dependencies=run-colonel-order
\ No newline at end of file
public/cli.php
View file @
a4d37df8
...
...
@@ -35,6 +35,9 @@ if ($param) {
$_SERVER
[
'SERVER_NAME'
]
=
'daemon.goods'
;
$_SERVER
[
'REMOTE_ADDR'
]
=
'127.0.0.1'
;
if
(
empty
(
$_SERVER
[
'SERVER_ADDR'
]))
{
$_SERVER
[
'SERVER_ADDR'
]
=
'azkaban-127.0.0.1'
;
}
$application
->
bootstrap
()
->
getDispatcher
()
->
dispatch
(
new
Yaf\Request\Simple
(
""
,
$module
,
$controller
,
$method
,
$param
));
...
...
public/job.php
View file @
a4d37df8
...
...
@@ -35,6 +35,9 @@ if ($param) {
$_SERVER
[
'SERVER_NAME'
]
=
'job.goods'
;
$_SERVER
[
'REMOTE_ADDR'
]
=
'127.0.0.1'
;
if
(
empty
(
$_SERVER
[
'SERVER_ADDR'
]))
{
$_SERVER
[
'SERVER_ADDR'
]
=
'azkaban-127.0.0.1'
;
}
$application
->
bootstrap
()
->
getDispatcher
()
->
dispatch
(
new
Yaf\Request\Simple
(
""
,
$module
,
$controller
,
$method
,
$param
));
...
...
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