|
|
@@ -737,13 +737,14 @@ class User extends BaseController
|
|
737
|
737
|
$params['status'] = 1;
|
|
738
|
738
|
$res = $this->repository->add_cer($params, $member_id);
|
|
739
|
739
|
if ($res) {
|
|
|
740
|
+ $userRepository = app()->make(UserRepository::class);
|
|
740
|
741
|
//赠送积分 完善实名送90个积分,同时送邀请人50个积分
|
|
741
|
|
- $this->sign_add($member_id, 90,1,'完善实名系统赠送90个积分','','');
|
|
|
742
|
+ $userRepository->sign_add($member_id, 90,1,'完善实名系统赠送90个积分','','', '', 1, '', 1);
|
|
742
|
743
|
$member_info = Db::name('user')->where( array('uid' => $member_id) )->find();
|
|
743
|
744
|
if($member_info['spread_uid']){
|
|
744
|
745
|
//好友完善实名系统赠送50个积分
|
|
745
|
746
|
$spreadUid = $member_info['spread_uid'];
|
|
746
|
|
- $this->sign_add($spreadUid, 50,1,'好友完善实名系统赠送50个积分','','');
|
|
|
747
|
+ $userRepository->sign_add($spreadUid, 50,1,'好友完善实名系统赠送50个积分','','', '', 1, '', 1);
|
|
747
|
748
|
}
|
|
748
|
749
|
return app('json')->success($res);
|
|
749
|
750
|
} else {
|
|
|
@@ -757,47 +758,6 @@ class User extends BaseController
|
|
757
|
758
|
|
|
758
|
759
|
|
|
759
|
760
|
/**
|
|
760
|
|
- * @param int $uid 用户ID
|
|
761
|
|
- * @param string $score 积分
|
|
762
|
|
- * @param int $status 积分状态
|
|
763
|
|
- * @param string $mark 备注
|
|
764
|
|
- * @param string $has_qian 连续签到天数
|
|
765
|
|
- * @param string $today_signintime 签到时间
|
|
766
|
|
- * @param int $order_id 订单ID
|
|
767
|
|
- * @param int $pm 1-收入。2-支出
|
|
768
|
|
- * @param string $order_type
|
|
769
|
|
- * @throws DbException
|
|
770
|
|
- */
|
|
771
|
|
- public function sign_add($uid, $score, $status, $mark, $has_qian = '', $today_signintime = '', $order_id = 0, $pm = 1, $order_type = '',$type='',$settlement_time = '')
|
|
772
|
|
- {
|
|
773
|
|
- if(!in_array($type,[1,2])){
|
|
774
|
|
- // 其他情况都直接返回,因为目前只有365专区购买才可以获得
|
|
775
|
|
- return false;
|
|
776
|
|
- }
|
|
777
|
|
-
|
|
778
|
|
- $ins_data['uid'] = $uid;
|
|
779
|
|
- $ins_data['continuity_day'] = $has_qian;
|
|
780
|
|
- $ins_data['reward_socre'] = $score;
|
|
781
|
|
- $ins_data['signin_time'] = $today_signintime;
|
|
782
|
|
- $ins_data['addtime'] = time();
|
|
783
|
|
- $ins_data['status'] = $status;
|
|
784
|
|
- $ins_data['mark'] = $mark;
|
|
785
|
|
- $ins_data['type'] = $type;
|
|
786
|
|
- $ins_data['settlement_time'] = $settlement_time;// 结算时间 真正到了结算时间会结算
|
|
787
|
|
- $ins_data['order_id'] = $order_id;
|
|
788
|
|
- $ins_data['pm'] = $pm;
|
|
789
|
|
- $ins_data['order_type'] = $order_type;
|
|
790
|
|
- Db::name('user_sign_score')->insertGetId($ins_data);
|
|
791
|
|
-
|
|
792
|
|
- if($pm == 1 && $status == 1){
|
|
793
|
|
- Db::name('user')->where('uid',$uid)->inc('score', $score)->update();
|
|
794
|
|
- }
|
|
795
|
|
- if($pm == 2){
|
|
796
|
|
- Db::name('user')->where('uid', $uid)->dec('score', $score)->update();
|
|
797
|
|
- }
|
|
798
|
|
- }
|
|
799
|
|
-
|
|
800
|
|
- /**
|
|
801
|
761
|
* 申请代理
|
|
802
|
762
|
* name:公司名称
|
|
803
|
763
|
* identity:身份
|
|
|
@@ -2621,6 +2581,9 @@ class User extends BaseController
|
|
2621
|
2581
|
$uid = $this->request->uid();//签到用户
|
|
2622
|
2582
|
$user = Db::name('user')->where('uid', $uid)->field("spread_uid,first_sign")->find();//上级用户
|
|
2623
|
2583
|
|
|
|
2584
|
+ //第一天签到获得2积分,第二天获得4积分,第三天获得6积分,第四天获得 10 积分,第五天获得 14积分第六天获得 20积分,
|
|
|
2585
|
+ //连续签到从第七天开始,每日签到获得3积分,第七天连续签到额外奖励 38积分,第 14 天连续签到额外奖励 68 积分,第 21天连续签到额外奖励 128 积分第 30 天连续签到额外奖励 188 积分
|
|
|
2586
|
+
|
|
2624
|
2587
|
//前6天积分
|
|
2625
|
2588
|
$score = [
|
|
2626
|
2589
|
2,//1
|
|
|
@@ -2653,39 +2616,52 @@ class User extends BaseController
|
|
2653
|
2616
|
$has_qian = $yes_signin_info['continuity_day'] + 1;
|
|
2654
|
2617
|
$has_qian = $has_qian > 30 ? 1 : $has_qian;
|
|
2655
|
2618
|
}
|
|
|
2619
|
+ $get_score = 0;
|
|
|
2620
|
+ $get_gw_score = 0;
|
|
2656
|
2621
|
if ($has_qian <= 6) {
|
|
2657
|
2622
|
$get_score = $score[$has_qian - 1];
|
|
2658
|
2623
|
} else {
|
|
2659
|
2624
|
$get_score = $scoreS;
|
|
2660
|
2625
|
if (isset($scoreExtra[$has_qian])) {
|
|
2661
|
|
- $get_score = $scoreS + $scoreExtra[$has_qian];
|
|
|
2626
|
+ $get_gw_score = $scoreExtra[$has_qian];
|
|
2662
|
2627
|
}
|
|
2663
|
2628
|
}
|
|
2664
|
2629
|
|
|
2665
|
2630
|
$userRepository = app()->make(UserRepository::class);
|
|
2666
|
|
- $userRepository->sign_add($uid, $get_score, 1, '签到赠送积分', $has_qian, $today_signintime, '');
|
|
|
2631
|
+ $userRepository->sign_add($uid, $get_score, 1, '签到赠送积分', $has_qian, $today_signintime, '', 1, '', 1);
|
|
|
2632
|
+ if($get_gw_score > 0){
|
|
|
2633
|
+ $userRepository->sign_add($uid, $get_gw_score,1,'连续签到赠送额外奖励积分', $has_qian, $today_signintime, '', 1, '', 1);
|
|
|
2634
|
+ }
|
|
|
2635
|
+
|
|
2667
|
2636
|
|
|
2668
|
2637
|
//首次签到
|
|
2669
|
2638
|
if ($user['first_sign'] == 0) {
|
|
|
2639
|
+ //首次签到送30积分,同时赠送邀请人30积分
|
|
|
2640
|
+ $userRepository->sign_add($uid, 30,1,'首次签到送30积分','','', '', 1, '', 1);
|
|
|
2641
|
+ $member_info = Db::name('user')->where( array('uid' => $uid) )->find();
|
|
|
2642
|
+ if($member_info['spread_uid']){
|
|
|
2643
|
+ $spreadUid = $member_info['spread_uid'];
|
|
|
2644
|
+ $userRepository->sign_add($spreadUid, 30,1,'邀请人首次签到送30积分','','', '', 1, '', 1);
|
|
|
2645
|
+ }
|
|
2670
|
2646
|
Db::name('user')->where('uid', $uid)->update(['first_sign' => 1]);
|
|
2671
|
2647
|
} elseif ($user['first_sign'] == 1 && $has_qian == 1) {
|
|
2672
|
2648
|
Db::name('user')->where('uid', $uid)->update(['first_sign' => 2]);
|
|
2673
|
2649
|
}
|
|
2674
|
2650
|
|
|
2675
|
|
- //非首次签到,第一天,断签
|
|
2676
|
|
- //好友连续签到3天 奖励50
|
|
2677
|
|
- //好友连续签到14天 奖励100
|
|
2678
|
|
- //好友联系签到30天 奖励300
|
|
2679
|
|
- if ($user['first_sign'] < 2) {
|
|
2680
|
|
- if ($has_qian == 3) {
|
|
2681
|
|
- $userRepository->sign_add($user['spread_uid'], 50, 1, '好友签到赠送积分', '', $today_signintime, '');
|
|
2682
|
|
- } elseif ($has_qian == 14) {
|
|
2683
|
|
- $userRepository->sign_add($user['spread_uid'], 100, 1, '好友签到赠送积分', '', $today_signintime, '');
|
|
2684
|
|
- } elseif ($has_qian == 30) {
|
|
2685
|
|
- $userRepository->sign_add($user['spread_uid'], 300, 1, '好友签到赠送积分', '', $today_signintime, '');
|
|
2686
|
|
- Db::name('user')->where('uid', $uid)->update(['first_sign' => 3]);
|
|
2687
|
|
- }
|
|
2688
|
|
- }
|
|
|
2651
|
+ // //非首次签到,第一天,断签
|
|
|
2652
|
+ // //好友连续签到3天 奖励50
|
|
|
2653
|
+ // //好友连续签到14天 奖励100
|
|
|
2654
|
+ // //好友联系签到30天 奖励300
|
|
|
2655
|
+ // if ($user['first_sign'] < 2) {
|
|
|
2656
|
+ // if ($has_qian == 3) {
|
|
|
2657
|
+ // $userRepository->sign_add($user['spread_uid'], 50, 1, '好友签到赠送积分', '', $today_signintime, '');
|
|
|
2658
|
+ // } elseif ($has_qian == 14) {
|
|
|
2659
|
+ // $userRepository->sign_add($user['spread_uid'], 100, 1, '好友签到赠送积分', '', $today_signintime, '');
|
|
|
2660
|
+ // } elseif ($has_qian == 30) {
|
|
|
2661
|
+ // $userRepository->sign_add($user['spread_uid'], 300, 1, '好友签到赠送积分', '', $today_signintime, '');
|
|
|
2662
|
+ // Db::name('user')->where('uid', $uid)->update(['first_sign' => 3]);
|
|
|
2663
|
+ // }
|
|
|
2664
|
+ // }
|
|
2689
|
2665
|
|
|
2690
|
2666
|
return app('json')->success('签到成功', ['score' => $get_score]);
|
|
2691
|
2667
|
}
|