bobing_903

This commit is contained in:
dengbw
2021-09-03 14:40:38 +08:00
committed by lccsw
parent 99474d8243
commit 237c0d16a7
6 changed files with 323 additions and 131 deletions
+39 -33
View File
@@ -10,6 +10,8 @@ class Bo extends Base
{
private $appConfig = array();
private $carGoldAry = array(1 => '100', 2 => '100', 3 => '150', 4 => '100', 5 => '150', 6 => '100', 7 => '150');
private $dicesAry = array(1 => array(1, 3, 6, 1, 1, 5), 2 => array(6, 5, 3, 1, 2, 5), 3 => array(3, 3, 3, 6, 5, 5)
, 4 => array(6, 3, 1, 2, 2, 3), 5 => array(5, 5, 6, 3, 6, 6), 6 => array(5, 2, 3, 5, 6, 3));//罚黑随机数组
public function __construct()
{
@@ -32,30 +34,30 @@ class Bo extends Base
$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;
// $timeout = $mc->get($key);
// if ($timeout && (time() - $timeout) < 2) {
// return array('status' => API_CODE_FAIL, 'content' => '您操作太快了,速度越慢越能博到状元,刷新页面再试试');
// }
// $mc->save($key, time());
$this->ci->load->library('bobing/dice');
$this->ci->dice->init();
$size_result = $this->ci->dice->getResultArr();
$level = $this->ci->dice->getResultLevel();
$data['app_id'] = $this->appConfig['app_id'];
$data['act_key'] = $this->appConfig['act_key'];
$data['uid'] = $this->uid;
$data['dices'] = implode(',', $size_result);
$this->ci->load->library('bobing/dice');
$this->ci->dice->init();
$dices = $this->ci->dice->getResultArr();
$level = $this->ci->dice->getResultLevel();
$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用户博到状元时设为罚黑
$dices = $this->dicesAry[rand(1, 6)];
$level = $credit = 0;
$level_name = '罚黑';
}
$data['dices'] = implode(',', $dices);
$data['level'] = $level;
$data['credit'] = $this->ci->dice->getcredit($level);
$data['credit'] = $credit;
$data['bo_date'] = date('Y-m-d');
$data['ip'] = get_client_ip();
$data['ua'] = $_SERVER['HTTP_USER_AGENT'];
$data['type'] = 0;
$data['c_time'] = time();
$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)) {//购车金概率
$car_gold = $this->carGoldAry[rand(1, 7)];
@@ -63,7 +65,7 @@ class Bo extends Base
$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) . '元购车金';
$content = '<div>博到' . $car_gold . '元购车金</div><div>您已累计博得' . ($re_u['car_gold'] + $car_gold) . '元购车金</div>';
$popup = array('title' => '恭喜您', 'content' => $content, 'btn' => array('title' => '立即使用购车金', 'url' => '/pages/buyCar/detail/index?id=13'));
}
}
@@ -71,7 +73,7 @@ class Bo extends Base
if ($re_l['status'] == 1) {
return array('status' => API_CODE_FAIL, 'content' => '博饼日志添加失败');
}
$data['level_name'] = $this->ci->dice->getResultName();
$data['level_name'] = $level_name;
$data['status'] = 0;
$data['lid'] = $re_l['lid'];
$data['popup'] = $popup;
@@ -88,6 +90,8 @@ class Bo extends Base
{
$data['app_id'] = $this->appConfig['app_id'];
$data['act_key'] = $this->appConfig['act_key'];
$data['uid'] = $this->cf_uid;
$data['cf_uid'] = $this->uid;
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']);
@@ -95,29 +99,26 @@ class Bo extends Base
$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;
// $timeout = $mc->get($key);
// if ($timeout && (time() - $timeout) < 2) {
// return array('status' => API_CODE_FAIL, 'msg' => '您操作太快了,速度越慢越能博到状元,刷新页面再试试');
// }
// $mc->save($key, time());
$this->ci->load->library('bobing/dice');
$this->ci->dice->init();
$size_result = $this->ci->dice->getResultArr();
$dices = $this->ci->dice->getResultArr();
$level = $this->ci->dice->getResultLevel();
$data['uid'] = $this->cf_uid;
$data['cf_uid'] = $this->uid;
$data['dices'] = implode(',', $size_result);
$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用户博到状元时设为罚黑
$dices = $this->dicesAry[rand(1, 6)];
$level = $credit = 0;
$level_name = '罚黑';
}
$data['dices'] = implode(',', $dices);
$data['level'] = $level;
$data['credit'] = $this->ci->dice->getcredit($level);
$data['credit'] = $credit;
$data['bo_date'] = date('Y-m-d');
$data['ip'] = get_client_ip();
$data['ua'] = $_SERVER['HTTP_USER_AGENT'];
$data['type'] = 1;
$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)) {//购车金概率
$car_gold = $this->carGoldAry[rand(1, 7)];
@@ -125,7 +126,7 @@ class Bo extends Base
$car_gold = $this->appConfig['max_car_gold'] - $re_u['car_gold'];
}
$data['car_gold'] = $car_gold;
$content = '<div>恭喜您</div><div>帮助好友博到博到' . $car_gold . '元购车金和' . $data['credit'] . '幸运分,</div><div>您的好友离汽车大奖更进一步了!</div>';
$content = '<div>帮助好友博到' . $car_gold . '元购车金和' . $data['credit'] . '幸运分,</div><div>您的好友离汽车大奖更进一步了!</div>';
$popup = array('title' => '恭喜您', 'content' => $content, 'btn' => array('title' => '我也要开桌博取汽车大奖'
, 'url' => '/bobing/pages/game/index'));
}
@@ -147,7 +148,7 @@ class Bo extends Base
if ($log['status'] == 1) {
return array('status' => API_CODE_FAIL, 'content' => '博饼日志添加失败');
}
$data['level_name'] = $this->ci->dice->getResultName();
$data['level_name'] = $level_name;
$data['status'] = 0;
$data['lid'] = $log['lid'];
$data['popup'] = $popup;
@@ -161,7 +162,12 @@ class Bo extends Base
*/
public function wxqy_credit()
{
$re_l = $this->ci->bobing_logs_model->get(array('uid' => $this->uid, 'app_id' => $this->appConfig['app_id'], 'type' => 3));
$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);
if (!$re_u) {
return array('status' => -1, 'content' => '未参加博饼');
}
$re_l = $this->ci->bobing_logs_model->get(array_merge($where, array('type' => 2)));
if ($re_l) {
return array('status' => -1, 'content' => '已添过企业微信加分了');
}
+1 -1
View File
@@ -261,7 +261,7 @@ class Dice
{
$level = $level == false ? $this->_resultLevel : $level;
$arr = array(
self::RESULT_ZYCJH => 110, //状元插金花
self::RESULT_ZYCJH => 120, //状元插金花
self::RESULT_LBHONG => 100, //六勃红
//self::RESULT_BD => 13, //遍地锦
self::RESULT_LBHEI => 90, //六勃黑