diff --git a/admin/controllers/app/bobing/Member.php b/admin/controllers/app/bobing/Member.php
new file mode 100644
index 00000000..222bb3e7
--- /dev/null
+++ b/admin/controllers/app/bobing/Member.php
@@ -0,0 +1,153 @@
+ '未加', 1 => '加入', -1 => '删除');
+ private $levelNameAry = array(13 => "状元插金花", 12 => "六勃红", 11 => "遍地锦", 10 => "六抔黑", 9 => "五红", 8 => "五子带一秀",
+ 7 => "五子", 6 => "状元", 5 => "对堂", 4 => "三红", 3 => "四进", 2 => "二举", 1 => "一秀", 0 => "罚黑");
+
+ public function __construct()
+ {
+ parent::__construct();
+ $this->load->model('bobing/bobing_user_model', 'mdBobingUser');
+ $this->load->model('bobing/bobing_user_credit_model', 'mdBobingUserCredit');
+ $this->load->model('bobing/bobing_logs_model', 'mdBobingLogs');
+ $this->appConfig = $this->mdBobingUser->appConfig();
+ $this->where = array('act_key' => $this->appConfig['act_key'], 'app_id' => $this->appConfig['app_id']);
+ $this->load->service("app/user_service", array("app_id" => $this->appConfig['app_id']));
+ }
+
+ //首页信息
+ public function index()
+ {
+ $this->lists();
+ }
+
+ //数据列表
+ public function lists()
+ {
+ $params = $this->input->get();
+ $params['page'] = $params['page'] ? intval($params['page']) : 1;
+ $params['size'] = $params['size'] ? intval($params['size']) : 20;
+ $lists = $users = array();
+ $count = $this->mdBobingUser->count($this->where);
+ if ($count) {
+ $res = $this->mdBobingUser->select($this->where, 'id desc', $params['page'], $params['size']);
+ $uids = array_column($res, 'uid');
+ $res_u = $this->user_service->select(array('id in (' . implode(',', $uids) . ')' => null), 'id DESC', 0, 0, 'id,nickname,mobile');
+ foreach ($res_u as $key => $value) {
+ $users[$value['id']] = array('nickname' => $value['nickname'], 'mobile' => $value['mobile']);
+ }
+ foreach ($res as $key => $value) {
+ $setValue = array();
+ $re_uc = $this->mdBobingUserCredit->select(array_merge($this->where, array('uid' => $value['uid'], 'lottery>' => 0)), 'lottery DESC', 0, 0, 'lottery');
+ $lotteryry = array();
+ foreach ($re_uc as $key1 => $value2) {
+ $lotteryry[] = $this->mdBobingUser->lottery($value2['lottery']);
+ }
+ $setValue['lottery'] = $lotteryry ? '已中奖' . implode(',', $lotteryry) . '' : '';
+ $user = $users[$value['uid']];
+ $setValue['uid'] = $value['uid'];
+ $setValue['nickname'] = $user['nickname'];
+ $setValue['mobile'] = $user['mobile'];
+ $setValue['credit'] = $value['credit'];
+ $setValue['car_gold'] = $value['car_gold'] + $value['buy_car_gold'];
+ $setValue['if_kz'] = $value['if_kz'] == 1 ? '已开' : '未开';
+ $setValue['wxqy'] = $this->wxqyAry[$value['wxqy']];
+ $lists[] = $setValue;
+ }
+ }
+ $this->data['lists'] = $lists;
+ $this->data['_title'] = '博饼用户';
+ $this->data['pager'] = array('count' => ceil($count / $params['size']), 'curr' => $params['page'], 'totle' => $count);
+ return $this->show_view('/app/bobing/member/lists', true);
+ }
+
+ //博饼记录
+ public function lists_logs()
+ {
+ $params = $this->input->get();
+ $params['page'] = $params['page'] ? intval($params['page']) : 1;
+ $params['size'] = $params['size'] ? intval($params['size']) : 20;
+ $uid = intval($params['uid']);
+ $res_u = $this->user_service->get(array('id' => $uid));
+ $nickname = $res_u['nickname'] ? $res_u['nickname'] : '未授权';
+ $lists = $users = array();
+ $where = array('uid' => $uid);
+ if ($params['bo_date']) {
+ $bo_date = explode(' ~ ', $params['bo_date']);
+ $bo_date[0] && $where["bo_date >="] = $bo_date[0];
+ $bo_date[1] && $where["bo_date <="] = $bo_date[1];
+ }
+ $count = $this->mdBobingLogs->count(array_merge($this->where, $where));
+ if ($count) {
+ $res = $this->mdBobingLogs->select(array_merge($this->where, $where), 'id desc', $params['page'], $params['size']);
+ $cfusers = array();//微信昵称
+ $cf_uids = array_unique(array_column($res, 'cf_uid'));
+ $re_u = $this->user_service->select(array('id in (' . implode(',', $cf_uids) . ')' => null), 'id DESC', 0, 0, 'id,nickname');
+ foreach ($re_u as $key => $value) {
+ $cfusers[$value['id']] = $value['nickname'] ? $value['nickname'] : '未授权';
+ }
+ foreach ($res as $key => $value) {
+ $setValue = array();
+ $setValue['dices'] = $value['dices'];
+ $setValue['level_name'] = $value['type'] != 2 ? $this->levelNameAry[$value['level']] : '';
+ $setValue['credit'] = $value['credit'];
+ $setValue['car_gold'] = $value['car_gold'] > 0 ? $value['car_gold'] : '';
+ $setValue['hong_bao'] = $value['hong_bao'] > 0 ? $value['hong_bao'] . ($value['status'] == 2 ? '已领' : '未领') : '';
+ $setValue['bo_date'] = $value['bo_date'];
+ if ($value['type'] == 1) {
+ $type_name = $cfusers[$value['cf_uid']] . '帮博';
+ } else if ($value['type'] == 2) {
+ $type_name = '加企微';
+ } else {
+ $type_name = '个人博';
+ }
+ $setValue['type_name'] = $type_name;
+ $lists[] = $setValue;
+ }
+ }
+ $this->data['lists'] = $lists;
+ $this->data['params'] = $params;
+ $this->data['_title'] = $nickname . '_博饼记录';
+ $this->data['pager'] = array('count' => ceil($count / $params['size']), 'curr' => $params['page'], 'totle' => $count);
+ return $this->show_view('/app/bobing/member/lists_logs', true);
+ }
+
+
+ //展示单条数据
+ public function get()
+ {
+ }
+
+ //添加单条数据
+ public function add()
+ {
+ }
+
+ //编辑单条数据
+ public function edit()
+ {
+ }
+
+ //删除单条数据
+ public function del()
+ {
+
+ }
+
+ //批量操作(默认修改状态)
+ public function batch()
+ {
+
+ }
+
+ //导出数据列表
+ public function export()
+ {
+
+ }
+}
diff --git a/admin/controllers/app/liche/Main.php b/admin/controllers/app/liche/Main.php
index a225346e..ec40436b 100644
--- a/admin/controllers/app/liche/Main.php
+++ b/admin/controllers/app/liche/Main.php
@@ -63,6 +63,13 @@ class Main extends HD_Controller
),
);
+ $list[] = array(
+ 'title' => '博饼',
+ 'btns' => array(
+ array('name' => '查看详情', 'url' => '/app/bobing/member?app_id=' . $this->app_id),
+ ),
+ );
+
$conditions[] = array('icon' => 'am-icon-home', 'list' => $list);
/*小程序设置 end*/
diff --git a/admin/views/app/bobing/member/lists.php b/admin/views/app/bobing/member/lists.php
new file mode 100644
index 00000000..6938cfed
--- /dev/null
+++ b/admin/views/app/bobing/member/lists.php
@@ -0,0 +1,69 @@
+
+
+
+
共有= $pager['totle'] ?>条数据
+
+
+
+ | 用户名称 |
+ 手机号码 |
+ 积分 |
+ 购车金 |
+ 开桌 |
+ 企业微信 |
+
+
+
+
+
+ | = $v['nickname'] ?> |
+ = $v['mobile'] ?> |
+ = $v['credit'] ?> |
+ = $v['car_gold'] ?> |
+ = $v['if_kz'] ?> |
+ = $v['wxqy'] ?> |
+
+
+
+
+
+ = $v['lottery'] ?>
+
+
+
+ |
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/admin/views/app/bobing/member/lists_logs.php b/admin/views/app/bobing/member/lists_logs.php
new file mode 100644
index 00000000..7910b049
--- /dev/null
+++ b/admin/views/app/bobing/member/lists_logs.php
@@ -0,0 +1,88 @@
+
+
+
+
共有= $pager['totle'] ?>条数据
+
+
+
+ | 骰子点数 |
+ 级别 |
+ 积分 |
+ 购车金 |
+ 红包 |
+ 类型 |
+ 博饼日期 |
+
+
+
+
+
+ | = $v['dices'] ?> |
+ = $v['level_name'] ?> |
+ = $v['credit'] ?> |
+ = $v['car_gold'] ?> |
+ = $v['hong_bao'] ?> |
+ = $v['type_name'] ?> |
+ = $v['bo_date'] ?> |
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/api/controllers/plan/Bobing.php b/api/controllers/plan/Bobing.php
index 8f3fef13..d681dd82 100644
--- a/api/controllers/plan/Bobing.php
+++ b/api/controllers/plan/Bobing.php
@@ -62,8 +62,13 @@ class Bobing extends HD_Controller
. ' and act_key = ' . $this->appConfig['act_key'] . ' and lottery= 1)'] = null;
$res_c = $this->mdBobingUserCredit->select($where, 'credit desc,u_time asc', 1, $this->appConfig['lottery_nums'], 'id,uid,credit');
if ($res_c) {//设置中奖用户
- $ids = implode(',', array_column($res_c, 'id'));//中奖用户
- $this->mdBobingUserCredit->update(array('lottery' => 1), array('id in (' . $ids . ')' => null));
+ foreach ($res_c as $key => $value) {
+ //设中奖
+ $this->mdBobingUserCredit->update(array('lottery' => 1), array('id' => $value['id']));
+ //加中奖购车金
+ $this->mdBobingUser->update(array('lotter_gold' => $this->appConfig['lotter_gold'])
+ , array('uid' => $value['uid'], 'app_id' => $this->appConfig['app_id'], 'act_key' => $this->appConfig['act_key']));
+ }
$lottery = json_encode($res_c, JSON_UNESCAPED_UNICODE);
debug_log('lottery:' . $lottery, $this->log_file);
echo json_encode($lottery, JSON_UNESCAPED_UNICODE);
diff --git a/api/controllers/wechat/Liche.php b/api/controllers/wechat/Liche.php
index df4f1763..af2e32e1 100644
--- a/api/controllers/wechat/Liche.php
+++ b/api/controllers/wechat/Liche.php
@@ -112,7 +112,7 @@ Class Liche extends HD_Controller
//添加企业微信加分
$this->load->library('bobing/bo');
$this->bo->uid = $re_u['id'];
- $result = $this->bo->wxqy_credit();
+ $result = $this->bo->wxqy_car_gold();
debug_log('wxqy:' . json_encode($result, JSON_UNESCAPED_UNICODE), $this->log_file);
}
//debug_log('qymsg_addData:' . json_encode($addData, JSON_UNESCAPED_UNICODE), $this->log_file);
@@ -144,6 +144,101 @@ Class Liche extends HD_Controller
}
}
+ /**
+ * Notes:临时更新用户客户id
+ * Created on: 2021/03/01 17:02
+ * Created by: dengbw
+ * https://liche-api-dev.xiaoyu.com/wechat/liche/tem_external_contact
+ * https://api.liche.cn/wechat/liche/tem_external_contact
+ */
+ public function tem_external_contact()
+ {
+ $this->load->model('app/app_wechatqy_model', 'mdWechatqy');
+ $this->load->library('wx_qyapi', array());
+ $param = $this->input->get();
+ $param['page'] = intval($param['page']);
+ //获取配置了客户联系功能的成员列表
+// $re = $this->wx_qyapi->get_external_contact(array('url' => 'get_follow_user_list'));
+// echo json_encode($re, JSON_UNESCAPED_UNICODE);
+// exit;
+ //用户分页分别获取避免超时
+// $userid = "DianCheDaRenXiaoLi";
+// if ($param['next_cursor'] || !$param['page']) {
+// $next_cursor = $this->get_by_user($userid, $param['next_cursor']);
+// header('refresh:3;url=/wechat/liche/tem_external_contact?next_cursor=' . $next_cursor . '&page=' . ($param['page'] + 1));
+// } else {
+// echo '跑数据结束=' . $userid;
+// }
+// exit;
+// ob_start(); //打开缓冲区
+ $follow_user = ["LinZhenZhen", "18950116819", "ShengHuaXiangXueTieLongLuPeng", "ChenHuiCan", "13600972070", "0fun",
+ "WuHuanZheng", "ChenWeiHua", "13313999284", "FuZhouShengHuaTaiQiCheXiaoShouYo", "DianCheDaRenXiaoLi", "YeJiaChen",
+ "LuoJinYan", "QianJianLin", "18005933510", "wudz", "huangy", "LiZhengHui", "YeRongZhang", "LiZhiWei", "CaiYaFen",
+ "TaoQianQian", "FanHaiYu", "XuDanPing", "ChenWenZhang", "HongXinYi", "CaiZhiMin", "JiangYeLei", "ZengLingYan", "18906027570",
+ "jean", "fuyy", "taric", "jimmy", "HongSiZe", "huangjq", "xugy", "wuhl", "HuangZhiJie", "ZhangShanBang", "zhangtf", "fudw",
+ "HuJianPing", "13666060496", "LinXiaoLong", "LinCongCong", "liuch", "RenLin", "18876491999", "KangPengHui", "liusb", "luohj",
+ "YangYaQi", "WangJiangFu", "SuiYuErAn", "Xia", "MuZi2020", "a.bing", "ChenZhiShen", "ChenCuiYun", "YuTing", "WenYan", "YueYouYin",
+ "QuanZhouLiCheChuNa"];
+ $count = count($follow_user);
+ if ($param['page'] >= $count) {
+ echo '
本次更新企业成员:';
+ echo '
成功更新 ' . $count . ' 人';
+ echo '
点击将再次更新企业成员>>>';
+ exit;
+ }
+ $userid = $follow_user[$param['page']];
+ $next_cursor = $this->get_by_user($userid, '');
+ if ($next_cursor) {
+ $ii = 0;
+ while ($next_cursor) {
+ $next_cursor = $this->get_by_user($userid, $next_cursor);
+ $ii++;
+ }
+ }
+ echo '
成功更新企业成员:' . $userid;
+ header('refresh:3;url=/wechat/liche/tem_external_contact?page=' . ($param['page'] + 1));
+ ob_end_flush();//输出全部内容到浏览器
+ }
+
+ private function get_by_user($userid = '', $next_cursor = '')
+ {
+ $re = $this->wx_qyapi->get_external_contact(array('url' => 'get_by_user', 'userid' => $userid, 'next_cursor' => $next_cursor, 'limit' => '100'));
+ $next_cursor = '';
+ if ($re['errcode'] == 0) {
+ $next_cursor = $re['next_cursor'];
+ foreach ($re['external_contact_list'] as $key => $value) {
+ $external_userid = $value['external_contact']['external_userid'];
+ if ($external_userid) {
+ $re_qy = $this->mdWechatqy->get(array('external_userid' => $external_userid, 'app_id' => self::$app_id));
+ $jsondata = array();
+ $jsondata['external_contact'] = $value['external_contact'] ? $value['external_contact'] : '';
+ $jsondata['follow_info'] = $value['follow_info'] ? $value['follow_info'] : '';
+ $tags = $value['follow_info']['tag_id'];
+ $addData = array(
+ 'app_id' => self::$app_id,
+ 'external_userid' => $value['external_contact']['external_userid'],
+ 'name' => $value['external_contact']['name'],
+ 'avatar' => $value['external_contact']['avatar'],
+ 'unionid' => $value['external_contact']['unionid'] ? $value['external_contact']['unionid'] : '',
+ 'userid' => $value['follow_info']['userid'] ? $value['follow_info']['userid'] : '',
+ 'remark' => $value['follow_info']['remark'] ? $value['follow_info']['remark'] : '',
+ 'tags' => $tags && $tags != '[]' ? implode(',', $tags) : '',
+ 'c_time' => $value['follow_info']['createtime'] ? $value['follow_info']['createtime'] : time(),
+ 'jsondata' => json_encode($jsondata, JSON_UNESCAPED_UNICODE),
+ 'status' => 1,
+ );
+ if (!$re_qy) {
+ $this->mdWechatqy->add($addData);
+ } else {
+ $this->mdWechatqy->update($addData, array('external_userid' => $external_userid));
+ }
+ }
+ }
+ echo '
next_cursor=' . $next_cursor . '&external_contact_list=' . count($re['external_contact_list']);
+ }
+ return $next_cursor;
+ }
+
/**
* Notes:添加企业客户事件
* https://hd-api-dev.xiaoyu.com/wechat/xmcard/add_wechatqy
diff --git a/api/controllers/wxapp/bobing/Bobing.php b/api/controllers/wxapp/bobing/Bobing.php
index f02a4ecb..fb14c905 100644
--- a/api/controllers/wxapp/bobing/Bobing.php
+++ b/api/controllers/wxapp/bobing/Bobing.php
@@ -29,6 +29,7 @@ class Bobing extends Wxapp
$this->load->model('bobing/bobing_logs_model', 'mdBobingLogs');
$this->appConfig = $this->mdBobingUser->appConfig();
$this->appConfig['act_key'] = $this->appConfig['act_key'];
+ $this->car_id = $inputs['car_id'] ? intval($inputs['car_id']) : 13;
}
/**
@@ -45,19 +46,22 @@ class Bobing extends Wxapp
$cf_uid = intval($params['cf_uid']);//要助力id
$this->myuid == $cf_uid && $cf_uid = 0;
//$cf_uid = 2;
- $where = array('act_key' => $this->appConfig['act_key'], 'app_id' => $this->appConfig['app_id'], 'uid' => $this->myuid);
- $credit = $percentage = 0;
+ $credit = $percentage = $if_kz = $car_gold = 0;
if ($re_u) {
+ $car_gold = $re_u['car_gold'] + $re_u['buy_car_gold']+ $re_u['lotter_gold'];
$credit = $re_u['credit'];
- if (!$cf_uid && $re_u['if_kz'] == 0) {//更新开桌
- $this->mdBobingUser->update(array("if_kz" => 1), $where);
+ if ($cf_uid == 0 && $re_u['if_kz'] == 0) {
+ $this->mdBobingUser->update(array('if_kz' => 1), array('id' => $re_u['id']));
}
$sum = $this->mdBobingUser->count(array('app_id' => $this->appConfig['app_id'], 'act_key' => $this->appConfig['act_key']));
$row = $this->mdBobingUser->count(array('app_id' => $this->appConfig['app_id'], 'act_key' => $this->appConfig['act_key'], 'credit<=' => $credit));
$percentage = round($row / $sum * 100, 2);
}
- $share = array('title' => '送你100元现金,帮我博取iPhone13、汽车大奖', 'content' => '目前累计' . $credit . '幸运分,打败全闽南' . $percentage . '%的用户,
-继续邀请好友助力博饼,
冲刺购物卡、苹果手机、汽车大奖~
添加小狸微信,还可立即获得288幸运分!
'
+ $share_content = array('我已经博取' . $car_gold . '元购车金和' . $credit . '幸运分',
+ '运气超越了全闽南' . $percentage . '%的用户。', '快来帮我助力博饼冲击汽车大奖,', '助力博饼可以获得现金奖励,最高100元哦!');
+ $content = '目前累计' . $car_gold . '元购车金和' . $credit . '幸运分,您的运气爆表,
超越了全闽南' . $percentage . '%的用户,
+邀请好友助力博饼,获得更多购车金,冲击汽车大奖~
助力好友可获得现金红包,最高100元!
';
+ $share = array('title' => '送你100元现金,帮我博取购车金和汽车大奖', 'share_content' => $share_content, 'content' => $content
, 'img' => $this->mdBobingUser->appImg('share_tip', $this->car_id), 'posters' => $this->mdBobingUser->appImg('posterbg', $this->car_id));
$result['valid_nums'] = $this->get_valid_nums($cf_uid);
$result['top_title'] = $this->get_top_title($cf_uid);
@@ -92,6 +96,7 @@ class Bobing extends Wxapp
$this->bo->uid = $this->myuid;
$valid_nums = $this->get_valid_nums($cf_uid);//获取博饼剩余数
$this->bo->valid_nums = $valid_nums['value'];
+ $this->bo->car_id = $this->car_id;
$nickname = '';
if ($cf_uid) {//助力博
$this->bo->cf_uid = $cf_uid;
@@ -132,6 +137,22 @@ class Bobing extends Wxapp
return $data;
}
+ protected function put_kz()
+ {
+ //throw new Hd_exception('开桌要先进群', API_CODE_FAIL);
+ $where = array('act_key' => $this->appConfig['act_key'], 'app_id' => $this->appConfig['app_id'], 'uid' => $this->myuid);
+ $re_u = $this->mdBobingUser->get($where);
+ if ($re_u['if_kz'] == 1) {
+ throw new Hd_exception('您已经开过桌了', API_CODE_FAIL);
+ }
+ $ret = $this->mdBobingUser->update(array("if_kz" => 1), array('id' => $re_u['id']));
+ if (!$ret) {
+ throw new Hd_exception('开桌失败', API_CODE_FAIL);
+ }
+ throw new Hd_exception('开桌成功', API_CODE_SUCCESS);
+ }
+
+
protected function get_users()
{
$params = $this->input->get();
@@ -173,19 +194,24 @@ class Bobing extends Wxapp
*/
private function get_top_title($cf_uid)
{
+ $top_titles = array();
if ($cf_uid) {
$reU = $this->app_user_model->get(array('id' => $cf_uid));
$top_title = $reU['nickname'] ? $reU['nickname'] . '的桌子' : '未知用户的桌子';
+ $top_titles[] = array('title' => $top_title, 'url' => '');
} else {
- $credit = $ranking = 0;
$where = array('app_id' => $this->appConfig['app_id'], 'act_key' => $this->appConfig['act_key'], 'bo_date' => date('Y-m-d'));
$re_c = $this->mdBobingUserCredit->get(array_merge($where, array('uid' => $this->myuid)));
- $re_c && $credit = $re_c['credit'];
+ $credit = $re_c['credit'] ? $re_c['credit'] : 0;
$ranking = $this->mdBobingUserCredit->count(array_merge($where, array('credit>=' => $credit, 'uid<>' => $this->myuid))) + 1;//排名
$ranking > 100 && $ranking = '100名外';
- $top_title = "今日博饼分:{$credit} | 今日排名:{$ranking}";
+ $top_titles[] = array('title' => "今日博饼分:{$credit} | 今日排名:{$ranking}", 'url' => '');
+ $where = array('app_id' => $this->appConfig['app_id'], 'act_key' => $this->appConfig['act_key'], 'uid' => $this->myuid);
+ $re_u = $this->mdBobingUser->get($where);
+ $car_gold = $re_u['car_gold'] + $re_u['buy_car_gold']+ $re_u['lotter_gold'];
+ $top_titles[] = array('title' => "累计购车金:{$car_gold}元 查看购车金适用车型>>", 'url' => '/bobing/pages/game/signUp/index');
}
- return $top_title;
+ return $top_titles;
}
private function pr_users($return_array = false, $params = array())
@@ -249,7 +275,7 @@ class Bobing extends Wxapp
$value['car_gold'] > 0 && $content .= "和{$value['car_gold']}元购车金";
$value['hong_bao'] > 0 && $content .= ",额外博到现金红包";
} else if ($value['type'] == 2) {
- $content = "桌长加企业微信得到{$value['credit']}幸运分";
+ $content = "桌长加企业微信得到{$this->appConfig['wxqy_nums']}购车金";
}
$logs[] = $content;
}
@@ -275,7 +301,7 @@ class Bobing extends Wxapp
}
/**
- * Notes:设置car_id
+ * Notes:设置用户
* Created on: 2021/9/2 15:32
* Created by: dengbw
* @param array $params
@@ -283,27 +309,23 @@ class Bobing extends Wxapp
*/
private function set_user($params = array())
{
- $this->myuid == $params['cf_uid'] && $params['cf_uid'] = 0;
$where = array('app_id' => $this->appConfig['app_id'], 'act_key' => $this->appConfig['act_key'], 'uid' => $this->myuid);
$re_u = $this->mdBobingUser->get($where);
- if ($re_u['car_id']) {
- $this->car_id = $re_u['car_id'];
- } else if ($params['car_id']) {
- $this->car_id = $params['car_id'];
- } else if ($params['cf_uid']) {
- $where['uid'] = $params['cf_uid'];
- $re_u_c = $this->mdBobingUser->get($where);
- $this->car_id = $re_u_c['car_id'];
- }
- !$this->car_id && $this->car_id = 13;
- if (!$re_u['car_id']) {
- $where['uid'] = $this->myuid;
- $this->mdBobingUser->update(array("car_id" => $this->car_id), $where);
- }
if (!$re_u) {
- $where['uid'] = $this->myuid;
- $addUser = array_merge($where, array('car_id' => $this->car_id, 'c_time' => time()));
+ $addUser = array_merge($where, array('c_time' => time()));
$this->mdBobingUser->add($addUser);
+ //添加购物金
+ $re_au = $this->app_user_model->get(array('id' => $this->myuid));
+ if ($re_au['unionid']) {
+ $this->load->model('app/app_wechatqy_model', 'mdWechatqy');
+ $re_wx = $this->mdWechatqy->get(array('unionid' => $re_au['unionid'], 'app_id' => $this->appConfig['app_id']));
+ if ($re_wx) {//有加企业微信
+ $this->app_user_model->update(array('wxqy' => 1), array('id' => $re_au['id']));
+ $this->load->library('bobing/bo');
+ $this->bo->uid = $this->myuid;
+ $this->bo->wxqy_car_gold(); //加购物金
+ }
+ }
}
return $re_u;
}
diff --git a/api/controllers/wxapp/bobing/Home.php b/api/controllers/wxapp/bobing/Home.php
index 1dc917b2..1e9e41c1 100644
--- a/api/controllers/wxapp/bobing/Home.php
+++ b/api/controllers/wxapp/bobing/Home.php
@@ -26,6 +26,7 @@ class Home extends Wxapp
$this->load->model('bobing/bobing_user_credit_model', 'mdBobingUserCredit');
$this->load->model('apporder/order_purchase_model', 'mdOrderPurchase');
$this->appConfig = $this->mdBobingUser->appConfig();
+ $this->car_id = $inputs['car_id'] ? intval($inputs['car_id']) : 13;
}
/**
@@ -42,7 +43,7 @@ class Home extends Wxapp
$this->data['banner'] = $this->mdBobingUser->appImg('banner', $this->car_id);
$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);
+ $lucky_car[] = array('title' => '', 'img' => $this->mdBobingUser->appImg('index-tip'), 'url' => '/bobing/pages/game/signUp/index');
$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'];
@@ -223,7 +224,7 @@ class Home extends Wxapp
$where = array('app_id' => $this->appConfig['app_id'], 'act_key' => $this->appConfig['act_key'], 'bo_date' => $bo_date, 'lottery' => 1);
$total = $this->mdBobingUserCredit->count($where);
if ($total) {
- $res_c = $this->mdBobingUserCredit->select($where, 'credit desc,u_time asc', 1, 10, 'uid,credit');
+ $res_c = $this->mdBobingUserCredit->select($where, 'credit desc,u_time asc', 0, 0, 'uid,credit');
if ($res_c) {
$users = array();//微信昵称
$uids = array_column($res_c, 'uid');
@@ -308,20 +309,14 @@ class Home extends Wxapp
$tips = '';
if ($re_u) {
$credit = $re_u['credit'];
- $car_gold = $re_u['car_gold'] + $re_u['buy_car_gold'];
+ $car_gold = $re_u['car_gold'] + $re_u['buy_car_gold'] + $re_u['lotter_gold'];
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[] = '新能源汽车一台';
- }
+ $tipsAry[] = $this->mdBobingUser->lottery($value['lottery']);
}
$tips = '您已中奖' . implode(',', $tipsAry) . '
';
} else {
@@ -333,8 +328,8 @@ class Home extends Wxapp
$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'));
+ //$menulist[] = array('title' => '9.9抢500购车金', 'url' => 'buy_car_gold', 'img' => $this->mdBobingUser->appImg('icon-mine-1'));
+ $menulist[] = array('title' => '预约试驾', 'url' => '/bobing/pages/game/signUp/index', 'img' => $this->mdBobingUser->appImg('icon-mine-4'));
$menulist[] = array('title' => '我的海报', 'url' => '/bobing/pages/game/invite/index', 'img' => $this->mdBobingUser->appImg('icon-mine-2'));
$menulist[] = array('title' => '联系客服', 'url' => '/pages/', 'img' => $this->mdBobingUser->appImg('icon-mine-3'));
$menulist[] = array('title' => '关于狸车', 'url' => 'lc://switchTab/pages/index/index', 'img' => $this->mdBobingUser->appImg('icon-mine-5'));
@@ -349,7 +344,24 @@ class Home extends Wxapp
}
/**
- * Notes:购买购车金
+ * Notes:获取图片
+ * Created on: 2021/9/7 15:40
+ * Created by: dengbw
+ * @return array
+ * @throws Hd_Exception
+ */
+ protected function get_img()
+ {
+ $params = $this->input->get();
+ if (!$params['name']) {
+ throw new Hd_Exception('图片名称必填', API_CODE_INVILD_PARAM);
+ }
+ $this->data['img'] = $this->mdBobingUser->appImg($params['name'], $this->car_id);
+ return $this->data;
+ }
+
+ /**
+ * Notes:购买购车金 暂不需要
* Created on: 2021/8/31 9:57
* Created by: dengbw
* @return array
@@ -464,7 +476,7 @@ class Home extends Wxapp
}
/**
- * Notes:设置car_id
+ * Notes:设置用户
* Created on: 2021/9/2 15:32
* Created by: dengbw
* @param array $params
@@ -472,27 +484,23 @@ class Home extends Wxapp
*/
private function set_user($params = array())
{
- $this->myuid == $params['cf_uid'] && $params['cf_uid'] = 0;
$where = array('app_id' => $this->appConfig['app_id'], 'act_key' => $this->appConfig['act_key'], 'uid' => $this->myuid);
$re_u = $this->mdBobingUser->get($where);
- if ($re_u['car_id']) {
- $this->car_id = $re_u['car_id'];
- } else if ($params['car_id']) {
- $this->car_id = $params['car_id'];
- } else if ($params['cf_uid']) {
- $where['uid'] = $params['cf_uid'];
- $re_u_c = $this->mdBobingUser->get($where);
- $this->car_id = $re_u_c['car_id'];
- }
- !$this->car_id && $this->car_id = 13;
- if (!$re_u['car_id']) {
- $where['uid'] = $this->myuid;
- $this->mdBobingUser->update(array("car_id" => $this->car_id), $where);
- }
if (!$re_u) {
- $where['uid'] = $this->myuid;
- $addUser = array_merge($where, array('car_id' => $this->car_id, 'c_time' => time()));
+ $addUser = array_merge($where, array('c_time' => time()));
$this->mdBobingUser->add($addUser);
+ //添加购物金
+ $re_au = $this->app_user_model->get(array('id' => $this->myuid));
+ if ($re_au['unionid']) {
+ $this->load->model('app/app_wechatqy_model', 'mdWechatqy');
+ $re_wx = $this->mdWechatqy->get(array('unionid' => $re_au['unionid'], 'app_id' => $this->appConfig['app_id']));
+ if ($re_wx) {//有加企业微信
+ $this->app_user_model->update(array('wxqy' => 1), array('id' => $re_au['id']));
+ $this->load->library('bobing/bo');
+ $this->bo->uid = $this->myuid;
+ $this->bo->wxqy_car_gold(); //加购物金
+ }
+ }
}
return $re_u;
}
diff --git a/api/libraries/bobing/Bo.php b/api/libraries/bobing/Bo.php
index ec9396f3..cdf4437c 100644
--- a/api/libraries/bobing/Bo.php
+++ b/api/libraries/bobing/Bo.php
@@ -44,7 +44,7 @@ class Bo extends Base
$credit = $this->ci->dice->getcredit($level);
$level_name = $this->ci->dice->getResultName();
$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_id'] == 15 && $level >= 6) {//ex1用户博到状元时设为罚黑
+ if ($this->car_id == 15 && $level >= 6) {//ex1用户博到状元时设为罚黑
$dices = $this->dicesAry[rand(1, 6)];
$level = $credit = 0;
$level_name = '罚黑';
@@ -59,14 +59,16 @@ class Bo extends Base
$data['c_time'] = time();
$popup = '';
if ($re_u['car_gold'] < $this->appConfig['max_car_gold']) {//购车金小于购车金设定值
- if ($this->appConfig['ratio_car_gold'] && $this->appConfig['ratio_car_gold'] >= rand(1, 100)) {//购车金概率
- $car_gold = $this->carGoldAry[rand(1, 7)];
+ if ($this->appConfig['ratio_car_gold'] && $this->appConfig['ratio_car_gold_kz'] >= rand(1, 100)) {//购车金概率
+ //$car_gold = $this->carGoldAry[rand(1, 7)];
+ $car_gold = rand(90, 110);
if (($car_gold + $re_u['car_gold']) > $this->appConfig['max_car_gold']) {//如果购车金大于设定值,那么本次增加到最大值
$car_gold = $this->appConfig['max_car_gold'] - $re_u['car_gold'];
}
$data['car_gold'] = $car_gold;
- $content = '博到' . $car_gold . '元购车金
您已累计博得' . ($re_u['car_gold'] + $car_gold) . '元购车金
';
- $popup = array('title' => '恭喜您', 'content' => $content, 'btn' => array('title' => '立即使用购车金', 'url' => '/pages/buyCar/detail/index?id=13'));
+ $all_car_gold = $car_gold + $re_u['car_gold'] + $re_u['buy_car_gold'] + $re_u['lotter_gold'];
+ $content = '博到' . $car_gold . '元购车金
您已累计博得' . $all_car_gold . '元购车金
';
+ $popup = array('title' => '恭喜您', 'content' => $content, 'btn' => array('title' => '立即使用购车金', 'url' => '/bobing/pages/game/signUp/index'));
}
}
$re_l = $this->add_log($data);
@@ -96,7 +98,7 @@ class Bo extends Base
$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']);
$content = '您已获得' . $credit . '积分,
立即开桌获得更多幸运分,
冲刺购物卡、苹果手机、汽车大奖
';
- $popup = array('title' => '开桌', 'content' => $content, 'btn' => array('title' => '立即开桌', 'url' => '/bobing/pages/game/index'));
+ $popup = array('title' => '开桌', 'content' => $content, 'btn' => array('title' => '立即开桌', 'url' => '/bobing/pages/index/index'));
return array('status' => 2, 'popup' => $popup);
}
$this->ci->load->library('bobing/dice');
@@ -106,7 +108,7 @@ class Bo extends Base
$credit = $this->ci->dice->getcredit($level);
$level_name = $this->ci->dice->getResultName();
$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_id'] == 15 && $level >= 6) {//ex1用户博到状元时设为罚黑
+ if ($this->car_id == 15 && $level >= 6) {//ex1用户博到状元时设为罚黑
$dices = $this->dicesAry[rand(1, 6)];
$level = $credit = 0;
$level_name = '罚黑';
@@ -120,15 +122,16 @@ class Bo extends Base
$data['type'] = 1;
$popup = '';
if ($re_u['car_gold'] < $this->appConfig['max_car_gold']) {//购车金小于购车金设定值
- if ($this->appConfig['ratio_car_gold'] && $this->appConfig['ratio_car_gold'] >= rand(1, 100)) {//购车金概率
- $car_gold = $this->carGoldAry[rand(1, 7)];
+ if ($this->appConfig['ratio_car_gold'] && $this->appConfig['ratio_car_gold_zl'] >= rand(1, 100)) {//购车金概率
+ //$car_gold = $this->carGoldAry[rand(1, 7)];
+ $car_gold = rand(40, 60);
if (($car_gold + $re_u['car_gold']) > $this->appConfig['max_car_gold']) {//如果购车金大于设定值,那么本次增加到最大值
$car_gold = $this->appConfig['max_car_gold'] - $re_u['car_gold'];
}
$data['car_gold'] = $car_gold;
$content = '帮助好友博到' . $car_gold . '元购车金和' . $data['credit'] . '幸运分,
您的好友离汽车大奖更进一步了!
';
$popup = array('title' => '恭喜您', 'content' => $content, 'btn' => array('title' => '我也要开桌博取汽车大奖'
- , 'url' => '/bobing/pages/game/index'));
+ , 'url' => '/bobing/pages/index/index'));
}
}
$hong_bao_day = $this->ci->bobing_user_model->hongBaoDay($data['act_key']);
@@ -156,11 +159,11 @@ class Bo extends Base
}
/**
- * Notes:添加企业微信加分
+ * Notes:添加企业微信加购车金
* Created on: 2021/8/25 10:04
* Created by: dengbw
*/
- public function wxqy_credit()
+ public function wxqy_car_gold()
{
$where = array('app_id' => $this->appConfig['app_id'], 'act_key' => $this->appConfig['act_key'], 'uid' => $this->uid);
$re_u = $this->ci->bobing_user_model->get($where);
@@ -169,12 +172,13 @@ class Bo extends Base
}
$re_l = $this->ci->bobing_logs_model->get(array_merge($where, array('type' => 2)));
if ($re_l) {
- return array('status' => -1, 'content' => '已添过企业微信加分了');
+ return array('status' => -1, 'content' => '已添过企业微信加购车金了');
}
$data['app_id'] = $this->appConfig['app_id'];
$data['act_key'] = $this->appConfig['act_key'];
$data['uid'] = $this->uid;
- $data['credit'] = $this->appConfig['wxqy_nums'];
+ $data['credit'] = 0;
+ $data['car_gold'] = $this->appConfig['wxqy_nums'];
$data['bo_date'] = date('Y-m-d');
$data['ip'] = get_client_ip();
$data['ua'] = $_SERVER['HTTP_USER_AGENT'];
@@ -184,7 +188,7 @@ class Bo extends Base
if ($log['status'] == 1) {
return array('status' => -1, 'content' => '博饼日志添加失败');
}
- return array('status' => $log['lid'], 'content' => '企业微信加分成功');
+ return array('status' => $log['lid'], 'content' => '企业微信加购车金成功');
}
//博饼结果保存到数据库
@@ -197,8 +201,12 @@ class Bo extends Base
if ($lid) {
$map = array('act_key' => $data['act_key'], 'app_id' => $data['app_id'], 'uid' => $data['uid']);
$up_data["credit = credit+{$data['credit']}"] = null;//加积分
- $data['car_gold'] && $up_data["car_gold = car_gold+{$data['car_gold']}"] = null;//加购车金
- $data['type'] == 2 && $up_data["wxqy"] = 1;//加企业微信
+ if ($data['type'] == 2) {//加企业微信
+ $up_data["wxqy"] = 1;
+ $up_data["buy_car_gold"] = $data['car_gold'];
+ } else {
+ $data['car_gold'] && $up_data["car_gold = car_gold+{$data['car_gold']}"] = null;//加购车金
+ }
$this->ci->bobing_user_model->update($up_data, $map);
$map['bo_date'] = $data['bo_date'];
$re_c = $this->ci->bobing_user_credit_model->get($map);
diff --git a/common/models/bobing/Bobing_user_model.php b/common/models/bobing/Bobing_user_model.php
index b64eb9e0..ff3082fd 100644
--- a/common/models/bobing/Bobing_user_model.php
+++ b/common/models/bobing/Bobing_user_model.php
@@ -36,34 +36,37 @@ class Bobing_user_model extends Base_model
$config = array(
'title' => 'LiChe博饼', 'content' => '2021闽南博饼嘉年华', 'game_start_date' => '2021-09-01 10:00', 'game_end_date' => '2021-10-08 15:00',
'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' => 50, 'ratio_car_gold' => 50,
- 'max_car_gold' => 500, 'buy_car_gold' => 500, 'hong_bao_day' => 1000, 'lottery_nums' => 10,
+ 'app_id' => 1, 'act_key' => $act_key, 'kz_nums' => 5, 'zl_nums' => 3, 'wxqy_nums' => 500, 'ratio_hong_bao' => 50, 'ratio_car_gold_kz' => 60,'ratio_car_gold_zl' => 33,
+ 'max_car_gold' => 500, 'buy_car_gold' => 500, 'hong_bao_day' => 500, 'lottery_nums' => 10,'lotter_gold' => 1000,
'rule' => array('title' => '活动流程及规则', 'content' => '
一、活动时间:2021年9月9日10:00-2021年10月8日15:00
二、活动流程及规则
1. 开桌用户可以直接获得5次博饼次数,博饼次数用完后,通过邀请助力用户获得3次博饼次数为其博饼,双方可获得如下奖励
(1)开桌用户:
① 获得购车金:助力用户每次助力博饼,随机为开桌用户获得一定金额的购车金,购车金可以累计使用;
- ② 获得幸运分: 助力用户每次助力博饼,根据博出的结果,为开桌用户获得不同的幸运分:一秀1分、二举2分、四进5分、三红10分、对堂20分、状元50分
+ ② 获得幸运分: 助力用户每次助力博饼,根据博出的结果,为开桌用户获得不同的幸运分:一秀5分、二举10分、四进15分、三红20分、对堂30分、状元50分
+五子60分、五子带一秀70分、五红80分、六博黑90分、六博红100分、状元插金华120分
(2)助力用户:
- ① 获得购车金:助力用户每次助力博饼,随机获得现金红包,现金红包直接进入获奖用户的微信钱包;
- ② 获得幸运分: 助力用户每次助力博饼,根据博出的结果,同时为自己获得幸运分:一秀1分、二举2分、四进5分、三红10分、对堂20分、状元50分…
-2. 所有用户均可通过添加狸车企业微信,获得288幸运分
-3. 每日博饼幸运分进入日排行榜,前10名可获得购物卡1张;
-4. 开桌用户活动期间累计博饼幸运分,进入排行榜:
- (1)单周博饼幸运分排行榜
- ① 活动期间设置3个单周饼幸运分排行榜,单周博饼幸运分排名第一的用户,将获得iPhone13 手机一只(每位用户活动期间只能获得一次)
- ② 单周饼幸运分排行榜周期:9月13日-9月19日、9月20日-9月26日、9月27日-10月3日
-(2)饼幸运分总排行榜
- ① 活动期间博饼幸运分排名第一的用户,将获得新能源汽车一台(个人偶然所得税自理)
- ② 活动期间博饼幸运分排名第二至第八的用户,将获得iPhone13 手机一只(已获得单周排行榜手机大奖用户不重复获取,顺延至下一位)
-5. 关于购车金
-(1)活动期间用户博取的购车金及9.9元换购的500元购车金均可累计使用;
-(2)使用范围为:厦门、泉州、漳州
-(3)使用的品牌或车型为:雷丁芒果、东风新能源EX1、哪吒汽车、零跑汽车、奇瑞小蚂蚁、欧拉黑猫、欧拉白猫、欧拉好猫
-(4)购车金在指定经销商处使用,用户可在经销商处协商好购车价后,再提出购车金抵扣,不影响正常车辆优惠政策;
-6. 任何问题均可联系新能源汽车顾问解答 (联系新能源汽车顾问按钮)
-7. 在法律允许范围内,主办方拥有对本次活动的最终解释权。
'),
+ ① 获得购车金:助力用户每次助力博饼,随机获得现金红包,最高可获得100元,现金红包直接进入获奖用户的微信钱包;
+ ② 获得幸运分: 助力用户每次助力博饼,根据博出的结果,同时为自己获得幸运分:一秀5分、二举10分、四进15分、三红20分、对堂30分、状元50分
+五子60分、五子带一秀70分、五红80分、六博黑90分、六博红100分、状元插金华120分
+2. 所有用户均可通过添加狸车顾问微信,直接领取500元购车金(购车金可以与博饼获得的购车金共同累计,一位用户活动期间只能领取一次)
+3. 每日博饼幸运分进入日排行榜,前10名可额外获得购车金1000元(购车金可以与博饼获得的购车金共同累计,一位用户活动期间只能获得一次日排行奖励)
+4. 活动期间博饼幸运分进入总排行榜,第一名获得新能源汽车大奖(车辆所有权,购置税自理)
+5. 每日排行、总排行榜若出现幸运分相同的情况,则以用户首次进行博饼的时间进行排序依据,越早参加博饼的用户,排名越靠前;
+6. 关于购车金
+(1)活动期间用户博取的购车金、领取的购车金以及排名奖励的购车金均可累计使用;
+(2)使用范围为:泉州、漳州、厦门指定的经销商(点击查看经销商列表)
+(3)使用的品牌车型为:
+川汽野马-雷丁芒果
+东风新能源-EX1
+哪吒-哪吒V
+零跑-零跑T03、S01、C11
+欧拉-黑猫、白猫、好猫
+奇瑞新能源-小蚂蚁
+(4)使用购车金时,用户可在经销商处协商好购车价后,再提出购车金抵扣,不影响正常车辆优惠政策;
+7. 任何问题均可联系新能源汽车顾问解答 (联系新能源汽车顾问按钮)
+8. 在法律允许范围内,主办方拥有对本次活动的最终解释权。
'),
);
}
return $config;
@@ -97,6 +100,7 @@ class Bobing_user_model extends Base_model
$imgs['posterbg'] = $url_id . 'posterbg.jpg';
//分享图
$imgs['share_tip'] = $url_id . 'share-tip.jpg';
+ $imgs['signUp-theme'] = $url_id . 'signUp-theme.jpg';
//礼品
$imgs['gift'] = array(
array('id' => 1, 'title' => '第一名', 'img' => $url_id . 'gift_box_tip_1.jpg'),
@@ -105,6 +109,7 @@ class Bobing_user_model extends Base_model
array('id' => 4, 'title' => '现金红包', 'img' => $url . 'gift_box_tip_4.jpg'));
//固定图片
$imgs['index-tip'] = $url . 'index-tip.jpg';
+ $imgs['dealer'] = $url . 'dealer.jpg';
$imgs['icon-mine-1'] = $url . 'icon-mine-1.png';
$imgs['icon-mine-2'] = $url . 'icon-mine-2.png';
$imgs['icon-mine-3'] = $url . 'icon-mine-3.png';
@@ -140,4 +145,14 @@ class Bobing_user_model extends Base_model
}
return $amount;
}
+
+ //中奖奖品
+ public function lottery($lottery = 0)
+ {
+ $lotterys = array(1 => '购车金1000元', 2 => '新能源汽车一台');
+ if ($lottery) {
+ $lotterys = $lotterys[$lottery];
+ }
+ return $lotterys;
+ }
}