diff --git a/api/controllers/wxapp/bobing/Bobing.php b/api/controllers/wxapp/bobing/Bobing.php index 102d9641..51c54265 100644 --- a/api/controllers/wxapp/bobing/Bobing.php +++ b/api/controllers/wxapp/bobing/Bobing.php @@ -45,10 +45,15 @@ class Bobing extends Wxapp //$cf_uid = 14; $where = array('act_key' => $this->appConfig['act_key'], 'app_id' => $this->app_id, 'uid' => $this->uid); $re_u = $this->mdBobingUser->get($where); + $credit = $percentage = 0; if ($re_u) { + $credit = $re_u['credit']; if (!$cf_uid && $re_u['if_kz'] == 0) {//更新开桌 $this->mdBobingUser->update(array("if_kz" => 1), $where); } + $sum = $this->mdBobingUser->count(array('app_id' => $this->app_id, 'act_key' => $this->appConfig['act_key'])); + $row = $this->mdBobingUser->count(array('app_id' => $this->app_id, 'act_key' => $this->appConfig['act_key'], 'credit<=' => $credit)); + $percentage = round($row / $sum * 100, 2); } else { $if_kz = $cf_uid ? 0 : 1; $addUser = array_merge($where, array('if_kz' => $if_kz, 'c_time' => time())); @@ -57,7 +62,7 @@ class Bobing extends Wxapp throw new Hd_exception('开桌失败,请重试', API_CODE_FAIL); } } - $share = array('title' => '狸车分享标题', 'content' => '
目前累计***幸运分,打败全闽南97.77%的用户,
+ $share = array('title' => $this->appConfig['content'], 'content' => '
目前累计' . $credit . '幸运分,打败全闽南' . $percentage . '%的用户,
继续邀请好友助力博饼,
冲刺购物卡、苹果手机、汽车大奖~
添加小狸微信,还可立即获得288幸运分!
' , 'img' => 'https://qs.haodian.cn/wechat_app/liche/bobing/2021/share-tip.jpg', 'posters' => 'https://qs.haodian.cn/wechat_app/liche/bobing/2021/posterbg.jpg'); $result['valid_nums'] = $this->get_valid_nums($cf_uid); @@ -100,8 +105,7 @@ class Bobing extends Wxapp return $result; } $status = 0; - $data['title'] = $result['title']; - $data['content'] = $result['content']; + $data['popup'] = $result['popup']; //status 3抽到购车金4抽到红包 $log = $cf_uid ? $nickname . "为桌长博到{$result['credit']}幸运分" : "桌长博到{$result['credit']}幸运分"; if ($result['car_gold'] > 0) { diff --git a/api/controllers/wxapp/bobing/Home.php b/api/controllers/wxapp/bobing/Home.php index 80da8e9b..be158b0c 100644 --- a/api/controllers/wxapp/bobing/Home.php +++ b/api/controllers/wxapp/bobing/Home.php @@ -39,10 +39,11 @@ class Home extends Wxapp */ protected function get() { - $this->data['bodata'] = array('title' => "累计博饼次数", 'content' => $this->appConfig['content'] - , 'bo_nums' => $this->mdBobingUser->boNums($this->appConfig['act_key'])); + //$bo_nums = $this->mdBobingUser->boNums($this->appConfig['act_key']); + $bo_nums = 0; + $this->data['bodata'] = array('title' => "累计博饼次数", 'content' => $this->appConfig['content'], 'bo_nums' => $bo_nums); $lucky_car[] = array('title' => '雷丁芒果开回家', 'img' => 'https://qs.haodian.cn/wechat_app/liche/bobing/2021/index-tip.jpg' - , 'url' => '/bobing/pages/game/index'); + , 'url' => '/pages/buyCar/detail/index?id=13'); $this->data['lucky_car'] = $lucky_car; $this->data['group'] = $this->appConfig['group']; $this->data['title'] = $this->appConfig['title']; @@ -110,7 +111,7 @@ class Home extends Wxapp $size = $params['size'] ? intval($params['size']) : 100; $bo_date = date('Y-m-d'); $list = array(); - $where = array('app_id' => $this->app_id, 'act_key' => $this->appConfig['act_key'], 'bo_date' => $bo_date); + $where = array('app_id' => $this->app_id, 'act_key' => $this->appConfig['act_key'], 'bo_date' => $bo_date, 'credit >' => 0); $total = $this->mdBobingUserCredit->count($where); if ($total) { $res_c = $this->mdBobingUserCredit->select($where, 'credit desc,u_time asc', $page, $size, 'uid,credit'); @@ -139,7 +140,7 @@ class Home extends Wxapp $page = $params['page'] ? intval($params['page']) : 1; $size = $params['size'] ? intval($params['size']) : 100; $list = array(); - $where = array('app_id' => $this->app_id, 'act_key' => $this->appConfig['act_key']); + $where = array('app_id' => $this->app_id, 'act_key' => $this->appConfig['act_key'], 'credit >' => 0); $total = $this->mdBobingUser->count($where); if ($total) { $res_c = $this->mdBobingUser->select($where, 'credit desc,u_time asc', $page, $size, 'uid,credit'); @@ -230,9 +231,14 @@ class Home extends Wxapp { $credit = $car_gold = 0; $re_u = $this->mdBobingUser->get(array('app_id' => $this->app_id, 'act_key' => $this->appConfig['act_key'], 'uid' => $this->uid)); + $tips = ''; if ($re_u) { $credit = $re_u['credit']; $car_gold = $re_u['car_gold'] + $re_u['buy_car_gold']; + $sum = $this->mdBobingUser->count(array('app_id' => $this->app_id, 'act_key' => $this->appConfig['act_key'])); + $row = $this->mdBobingUser->count(array('app_id' => $this->app_id, 'act_key' => $this->appConfig['act_key'], 'credit<=' => $credit)); + $percentage = round($row / $sum * 100, 2); + $tips = '
您已打败全闽南' . $percentage . '%的用户
继续邀请好友助力博饼,冲刺大奖吧~
'; } $img_url = 'https://qs.haodian.cn/wechat_app/liche'; $menulist[] = array('title' => '9.9抢500购车金', 'url' => 'buy_car_gold', 'img' => $img_url . '/bobing/2021/icon-mine-1.png'); @@ -244,7 +250,7 @@ class Home extends Wxapp "title" => $this->appConfig['title'], "credit" => array('title' => '幸运分', 'value' => $credit), "car_gold" => array('title' => '购车金', 'value' => $car_gold), - "tips" => '
您已打败全闽南97.77%的用户
继续邀请好友助力博饼,冲刺大奖吧~
', + "tips" => $tips, "menulist" => $menulist ); return $data; diff --git a/api/libraries/bobing/Bo.php b/api/libraries/bobing/Bo.php index c026619d..f92bdd37 100644 --- a/api/libraries/bobing/Bo.php +++ b/api/libraries/bobing/Bo.php @@ -28,7 +28,9 @@ class Bo extends Base public function kz_bo() { if ($this->valid_nums <= 0) { - return array('status' => 1, 'title' => '邀请好友', 'content' => '
您的博饼次数已用完啦
立即邀请好友助力博饼,
冲刺购物卡、苹果手机、汽车大奖
'); + $content = '
您的博饼次数已用完啦
立即邀请好友助力博饼,
冲刺购物卡、苹果手机、汽车大奖
'; + $popup = array('title' => '邀请好友', 'content' => $content, 'btn' => array('title' => '立即邀请', 'url' => '/bobing/pages/game/invite/index')); + return array('status' => 1, 'popup' => $popup); } $mc = &load_cache(); $key = 'LiChe_bobing_' . $this->act_key . $this->app_id . $this->uid; @@ -52,7 +54,7 @@ class Bo extends Base $data['ua'] = $_SERVER['HTTP_USER_AGENT']; $data['type'] = 0; $data['c_time'] = time(); - $content = $title = ''; + $popup = ''; $re_u = $this->ci->bobing_user_model->get(array('app_id' => $data['app_id'], 'act_key' => $data['act_key'], 'uid' => $this->uid)); if ($re_u['car_gold'] < $this->appConfig['max_car_gold']) {//购车金小于购车金设定值 if ($this->appConfig['ratio_car_gold'] && $this->appConfig['ratio_car_gold'] >= rand(1, 100)) {//购车金概率 @@ -61,8 +63,8 @@ class Bo extends Base $car_gold = $this->appConfig['max_car_gold'] - $re_u['car_gold']; } $data['car_gold'] = $car_gold; - $content = '您博到购车金' . $car_gold . '元'; - $title = '恭喜您'; + $content = '恭喜您,博到' . $car_gold . '元购车金,您已累计博得' . ($re_u['car_gold'] + $car_gold) . '元购车金'; + $popup = array('title' => '恭喜您', 'content' => $content, 'btn' => array('title' => '立即使用购车金', 'url' => '/pages/buyCar/detail/index?id=13')); } } $re_l = $this->add_log($data); @@ -72,8 +74,7 @@ class Bo extends Base $data['level_name'] = $this->ci->dice->getResultName(); $data['status'] = 0; $data['lid'] = $re_l['lid']; - $data['title'] = $title; - $data['content'] = $content; + $data['popup'] = $popup; return $data; } @@ -90,7 +91,9 @@ class Bo extends Base if ($this->valid_nums <= 0) { $re_u = $this->ci->bobing_user_model->get(array('app_id' => $data['app_id'], 'act_key' => $data['act_key'], 'uid' => $this->uid)); $credit = intval($re_u['credit']); - return array('status' => 2, 'title' => '立即开桌', 'content' => '
您已获得' . $credit . '积分,
立即开桌获得更多幸运分,
冲刺购物卡、苹果手机、汽车大奖
'); + $content = '
您已获得' . $credit . '积分,
立即开桌获得更多幸运分,
冲刺购物卡、苹果手机、汽车大奖
'; + $popup = array('title' => '开桌', 'content' => $content, 'btn' => array('title' => '立即开桌', 'url' => '/bobing/pages/game/index')); + return array('status' => 2, 'popup' => $popup); } $mc = &load_cache(); $key = 'LiChe_bobing_' . $this->act_key . $this->app_id . $this->uid; @@ -113,7 +116,7 @@ class Bo extends Base $data['ip'] = get_client_ip(); $data['ua'] = $_SERVER['HTTP_USER_AGENT']; $data['type'] = 1; - $content = $title = ''; + $popup = ''; $re_u = $this->ci->bobing_user_model->get(array('app_id' => $data['app_id'], 'act_key' => $data['act_key'], 'uid' => $data['uid'])); if ($re_u['car_gold'] < $this->appConfig['max_car_gold']) {//购车金小于购车金设定值 if ($this->appConfig['ratio_car_gold'] && $this->appConfig['ratio_car_gold'] >= rand(1, 100)) {//购车金概率 @@ -122,8 +125,9 @@ class Bo extends Base $car_gold = $this->appConfig['max_car_gold'] - $re_u['car_gold']; } $data['car_gold'] = $car_gold; - $content = '为桌长博到购车金' . $car_gold . '元'; - $title = '恭喜您'; + $content = '
恭喜您
帮助好友博到博到' . $car_gold . '元购车金和' . $data['credit'] . '幸运分,
您的好友离汽车大奖更进一步了!
'; + $popup = array('title' => '恭喜您', 'content' => $content, 'btn' => array('title' => '我也要开桌博取汽车大奖' + , 'url' => '/bobing/pages/game/index')); } } $hong_bao_day = $this->ci->bobing_user_model->hongBaoDay($data['act_key']); @@ -135,8 +139,6 @@ class Bo extends Base $hong_bao = '0.3'; //'0.' . rand(30, 68);//0.30到0.68红包 $data['hong_bao'] = $hong_bao; $data['status'] = 1; - $content = '您博到现金红包' . $data['hong_bao'] . '元'; - $title = '恭喜您'; $this->ci->bobing_user_model->hongBaoDay($data['act_key'], $hong_bao); } } @@ -148,8 +150,7 @@ class Bo extends Base $data['level_name'] = $this->ci->dice->getResultName(); $data['status'] = 0; $data['lid'] = $log['lid']; - $data['title'] = $title; - $data['content'] = $content; + $data['popup'] = $popup; return $data; } diff --git a/common/models/bobing/Bobing_user_model.php b/common/models/bobing/Bobing_user_model.php index 474b6e6b..1f762de9 100644 --- a/common/models/bobing/Bobing_user_model.php +++ b/common/models/bobing/Bobing_user_model.php @@ -36,7 +36,7 @@ class Bobing_user_model extends Base_model $config = array( 'title' => 'LiChe博饼', 'content' => '2021闽南博饼嘉年华', 'game_start_date' => '2021-07-20', 'game_end_date' => '2021-09-31', 'group' => array('title' => '添加小狸', 'btn' => '加小狸企业微信', 'tips' => '通过后送288幸运分'), - 'app_id' => 1, 'act_key' => $act_key, 'kz_nums' => 5, 'zl_nums' => 3, 'wxqy_nums' => 288, 'ratio_hong_bao' => 30, 'ratio_car_gold' => 50, + 'app_id' => 1, 'act_key' => $act_key, 'kz_nums' => 5, 'zl_nums' => 3, 'wxqy_nums' => 288, 'ratio_hong_bao' => 50, 'ratio_car_gold' => 50, 'max_car_gold' => 500, 'buy_car_gold' => 500, 'hong_bao_day' => 1000, 'lottery_nums' => 10, 'rule' => array('title' => '活动流程及规则', 'content' => '
1.通过投放、社群、经销商等渠道,获取种子用户,种子用户发起活动,通过汽车大奖、iPHONE大奖,吸引开桌用户;