|
|
@@ -41,10 +41,10 @@ class TaskBusiness
|
|
|
|
|
|
if (empty($has) && !empty($usersData)) {
|
|
|
|
|
|
- $goodslist = Db::table('wa_goods')->where('id',$cronTask->goods_id)->first();
|
|
|
- if(!empty($goodslist->original_bonus)){
|
|
|
+ $goodslist = Db::table('wa_goods')->where('id', $cronTask->goods_id)->first();
|
|
|
+ if (!empty($goodslist->original_bonus)) {
|
|
|
StreamBusiness::addStream($usersData->id, $goodslist->original_bonus, streamType9, moldType7, moldTypefild7, $taskId);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
StreamBusiness::addStream($usersData->id, $goodslist->bonus, streamType9, moldType7, moldTypefild7, $taskId);
|
|
|
}
|
|
|
if (!empty($usersData->pid) && !empty($cronTask->rebate)) {
|
|
|
@@ -128,49 +128,45 @@ class TaskBusiness
|
|
|
{
|
|
|
Db::beginTransaction();
|
|
|
try {
|
|
|
- $cronTask = Db::table('wa_cron_task_sign_two')->where('id', $taskId)->lockForUpdate()->first();
|
|
|
+ $cronTask = Db::table('wa_cron_task_four')->where('id', $taskId)->lockForUpdate()->first();
|
|
|
if (empty($cronTask)) {
|
|
|
throw new \Exception('没有查询当任务!');
|
|
|
}
|
|
|
-
|
|
|
- if ($cronTask->dividend_time >= time()) {
|
|
|
- /** @var $has 查询今天是否已经发奖 */
|
|
|
- $has = Db::table('wa_stream')
|
|
|
- ->where('user_id', $cronTask->user_id)
|
|
|
- ->where('type', streamType19)
|
|
|
- ->where('mold', moldType1)
|
|
|
- ->whereBetween('add_time', [strtotime(date('Y-m-d') . ' 00:00:00'), strtotime(date('Y-m-d') . ' 23:59:59')])
|
|
|
- ->where('source_id', $taskId)
|
|
|
- ->exists();
|
|
|
- /** @var $usersData 查询会员信息 */
|
|
|
- $usersData = Db::table('wa_users')->where('id', $cronTask->user_id)->first();
|
|
|
-
|
|
|
- if (empty($has) && !empty($usersData)) {
|
|
|
- StreamBusiness::addStream($usersData->id, $cronTask->highest_pay_price, streamType19, moldType5, moldTypefild5, $taskId);
|
|
|
- StreamBusiness::addStream($usersData->id, $cronTask->day, streamType19, moldType1, moldTypefild1, $taskId);
|
|
|
- Db::table('wa_users')->where('id', $usersData->id)->increment('raffle_num', $cronTask->bl);
|
|
|
- Db::table('wa_users')->where('id', $usersData->id)->increment('accumulate_raffle_num', $cronTask->bl);
|
|
|
- }
|
|
|
-
|
|
|
-// $hasone = Db::table('wa_stream')
|
|
|
-// ->where('user_id', $cronTask->user_id)
|
|
|
-// ->where('type', streamType20)
|
|
|
-// ->where('mold', moldType6)
|
|
|
-// ->whereBetween('add_time', [strtotime(date('Y-m-d') . ' 00:00:00'), strtotime(date('Y-m-d') . ' 23:59:59')])
|
|
|
-// ->exists();
|
|
|
-// if(empty($hasone)){
|
|
|
-// StreamBusiness::addStream($usersData->id, 1, streamType20, moldType6, moldTypefild6);
|
|
|
-// }
|
|
|
-
|
|
|
- Db::table('wa_cron_task_sign_two')->where('id', $taskId)->update([
|
|
|
- 'day_dividend_time' => strtotime(date('Y-m-d', strtotime('+1 days')) . ' 01:00:00'),
|
|
|
- 'is_day' => 2
|
|
|
- ]);
|
|
|
- } else {
|
|
|
- Db::table('wa_cron_task_sign_two')->where('id', $taskId)->update([
|
|
|
+ $proder = Db::table('wa_payorder')->where('id', $cronTask->order_id)->first();
|
|
|
+ if (empty($proder)) {
|
|
|
+ Db::table('wa_cron_task')->where('id', $taskId)->update([
|
|
|
'is_finish' => 2
|
|
|
]);
|
|
|
}
|
|
|
+
|
|
|
+ /** @var $has 查询今天是否已经发奖 */
|
|
|
+ $has = Db::table('wa_stream')
|
|
|
+ ->where('user_id', $cronTask->user_id)
|
|
|
+ ->where('type', streamType37)
|
|
|
+ ->where('mold', moldType12)
|
|
|
+ ->whereBetween('add_time', [strtotime(date('Y-m-d') . ' 00:00:00'), strtotime(date('Y-m-d') . ' 23:59:59')])
|
|
|
+ ->where('source_id', $taskId)
|
|
|
+ ->exists();
|
|
|
+ /** @var $usersData 查询会员信息 */
|
|
|
+ $usersData = Db::table('wa_users')->where('id', $cronTask->user_id)->first();
|
|
|
+
|
|
|
+ if (empty($has) && !empty($usersData)) {
|
|
|
+ $goodslist = Db::table('wa_goods')->where('id', $cronTask->goods_id)->first();
|
|
|
+ if(!empty($goodslist->bonus)){
|
|
|
+ StreamBusiness::addStream($usersData->id, $goodslist->bonus, streamType37, moldType12, moldTypefild12, $taskId);
|
|
|
+ }
|
|
|
+ if($usersData->money_thirteen<$usersData->accumulate_thirteen){
|
|
|
+ Db::table('wa_users')->where('id', $usersData->id)->update(['money_thirteen'=>$usersData->accumulate_thirteen]);
|
|
|
+ }
|
|
|
+ if($usersData->money_fourteen<$usersData->accumulate_fourteen){
|
|
|
+ Db::table('wa_users')->where('id', $usersData->id)->update(['money_fourteen'=>$usersData->accumulate_fourteen]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Db::table('wa_cron_task_sign_two')->where('id', $taskId)->update([
|
|
|
+ 'day_dividend_time' => strtotime(date('Y-m-d', strtotime('+1 days')) . ' 00:00:00'),
|
|
|
+ 'is_day' => 2
|
|
|
+ ]);
|
|
|
+
|
|
|
Db::commit();
|
|
|
} catch (\Throwable $exception) {
|
|
|
Db::rollBack();
|