From c1689e823321c3340b03c1980d4d801b040dda15 Mon Sep 17 00:00:00 2001 From: dengbw Date: Fri, 3 Sep 2021 15:55:58 +0800 Subject: [PATCH] bobing_903_3 --- api/controllers/wxapp/bobing/Home.php | 41 ++++++++++++++------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/api/controllers/wxapp/bobing/Home.php b/api/controllers/wxapp/bobing/Home.php index 94a5d74f..5b83871b 100644 --- a/api/controllers/wxapp/bobing/Home.php +++ b/api/controllers/wxapp/bobing/Home.php @@ -43,9 +43,10 @@ class Home extends Wxapp $bo_nums = 0;//$this->mdBobingUser->boNums($this->appConfig['act_key']) $this->data['bodata'] = array('title' => "累计博饼次数", 'content' => $this->appConfig['content'], 'bo_nums' => $bo_nums); $lucky_car[] = array('title' => '', 'img' => $this->mdBobingUser->appImg('index-tip'), 'url' => '/pages/buyCar/detail/index?id=' . $this->car_id); + $share = array('title' => '送你100元现金,帮我博取iPhone13、汽车大奖', 'img' => $this->mdBobingUser->appImg('share_tip', $this->car_id)); $this->data['lucky_car'] = $lucky_car; $this->data['group'] = $this->appConfig['group']; - $this->data['title'] = $this->appConfig['title']; + $this->data['share'] = $share; return $this->data; } @@ -308,27 +309,29 @@ class Home extends Wxapp if ($re_u) { $credit = $re_u['credit']; $car_gold = $re_u['car_gold'] + $re_u['buy_car_gold']; - $where = array('app_id' => $this->appConfig['app_id'], 'act_key' => $this->appConfig['act_key']); - $re_u = $this->mdBobingUserCredit->select(array_merge($where, array('uid' => $this->myuid, 'lottery>' => 0)), 'lottery DESC', 0, 0, 'lottery'); - if ($re_u) { - $tipsAry = array(); - foreach ($re_u as $key => $value) { - if ($value['lottery'] == 1) { - $tipsAry[] = '购物卡1张'; - } else if ($value['lottery'] == 2) { - $tipsAry[] = 'iPhone13手机一只'; - } else if ($value['lottery'] == 3) { - $tipsAry[] = '新能源汽车一台'; + if ($credit) { + $where = array('app_id' => $this->appConfig['app_id'], 'act_key' => $this->appConfig['act_key']); + $re_u = $this->mdBobingUserCredit->select(array_merge($where, array('uid' => $this->myuid, 'lottery>' => 0)), 'lottery DESC', 0, 0, 'lottery'); + if ($re_u) { + $tipsAry = array(); + foreach ($re_u as $key => $value) { + if ($value['lottery'] == 1) { + $tipsAry[] = '购物卡1张'; + } else if ($value['lottery'] == 2) { + $tipsAry[] = 'iPhone13手机一只'; + } else if ($value['lottery'] == 3) { + $tipsAry[] = '新能源汽车一台'; + } } + $tips = '
您已中奖' . implode(',', $tipsAry) . '
'; + } else { + $sum = $this->mdBobingUser->count($where); + $row = $this->mdBobingUser->count(array_merge($where, array('credit<=' => $credit))); + $percentage = round($row / $sum * 100, 2); + $tips = '
您已打败全闽南' . $percentage . '%的用户
'; } - $tips = '
您已中奖' . implode(',', $tipsAry) . '
'; - } else { - $sum = $this->mdBobingUser->count($where); - $row = $this->mdBobingUser->count(array_merge($where, array('credit<=' => $credit))); - $percentage = round($row / $sum * 100, 2); - $tips = '
您已打败全闽南' . $percentage . '%的用户
'; + $tips = $tips . '
继续邀请好友助力博饼,冲刺大奖吧~
'; } - $tips = $tips . '
继续邀请好友助力博饼,冲刺大奖吧~
'; } $menulist[] = array('title' => '9.9抢500购车金', 'url' => 'buy_car_gold', 'img' => $this->mdBobingUser->appImg('icon-mine-1')); $menulist[] = array('title' => '预约试驾', 'url' => '/pages/buyCar/detail/index?id=' . $this->car_id, 'img' => $this->mdBobingUser->appImg('icon-mine-4'));