|
|
@@ -148,26 +148,32 @@ class SystemUserTask extends BaseModel
|
|
|
* */
|
|
|
public static function ConsumptionAmount($task_id, $uid = 0, $start_time = 0, $number = 0)
|
|
|
{
|
|
|
- @file_put_contents('quanju.txt', "-怎么现在又不行了\r\n", 8);
|
|
|
- $isComplete = false;
|
|
|
+ try {
|
|
|
+ @file_put_contents('quanju.txt', "-直推下级咋回事啊\r\n", 8);
|
|
|
+ $isComplete = false;
|
|
|
// $SumPayPrice = StoreOrder::where('paid', 1)->where('refund_status', 0)->where('is_del', 0)->where('uid', $uid)->where('add_time', '>', $start_time)->sum('pay_price');
|
|
|
- $reincarnation = User::where('user',$uid)->value('reincarnation');
|
|
|
- @file_put_contents('quanju.txt', $reincarnation."-转生\r\n", 8);
|
|
|
-
|
|
|
- if ($reincarnation == 1){
|
|
|
- $SumPayPrice = UserReincarnation::where('uid', $uid)->value('achievement');
|
|
|
- }else{
|
|
|
- $directSubordinateUids = User::where('spread_uid', $uid)->column('uid');
|
|
|
- $personal_achievement = 0;
|
|
|
- if (!empty($directSubordinateUids)) {
|
|
|
- $personal_achievement = User::whereIn('uid', $directSubordinateUids)
|
|
|
- ->sum('achievement');
|
|
|
- }
|
|
|
- @file_put_contents('quanju.txt', $personal_achievement."-咋回事啊\r\n", 8);
|
|
|
+ $reincarnation = User::where('user',$uid)->value('reincarnation');
|
|
|
+ @file_put_contents('quanju.txt', $reincarnation."-转生\r\n", 8);
|
|
|
+
|
|
|
+ if ($reincarnation == 1){
|
|
|
+ $SumPayPrice = UserReincarnation::where('uid', $uid)->value('achievement');
|
|
|
+ }else{
|
|
|
+ $directSubordinateUids = User::where('spread_uid', $uid)->column('uid');
|
|
|
+ $personal_achievement = 0;
|
|
|
+ if (!empty($directSubordinateUids)) {
|
|
|
+ $personal_achievement = User::whereIn('uid', $directSubordinateUids)
|
|
|
+ ->sum('achievement');
|
|
|
+ }
|
|
|
+ @file_put_contents('quanju.txt', $personal_achievement."-咋回事啊\r\n", 8);
|
|
|
|
|
|
- $SumPayPrice =$personal_achievement;
|
|
|
+ $SumPayPrice =$personal_achievement;
|
|
|
+ }
|
|
|
+ if ($SumPayPrice >= $number) $isComplete = UserTaskFinish::setFinish($uid, $task_id) ? true : false;
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ @file_put_contents('quanju.txt', json_encode(['line' => $e->getLine(), 'message' => $e->getMessage(), 'file' => $e->getFile()]) . "-报错内容\r\n", 8);
|
|
|
+ return app('json')->fail('生成图片时,系统错误', ['line' => $e->getLine(), 'message' => $e->getMessage(), 'file' => $e->getFile()]);
|
|
|
}
|
|
|
- if ($SumPayPrice >= $number) $isComplete = UserTaskFinish::setFinish($uid, $task_id) ? true : false;
|
|
|
+
|
|
|
return ['还需消费{$num}元', $SumPayPrice, $isComplete];
|
|
|
}
|
|
|
/**
|