bobing_909_4

This commit is contained in:
dengbw
2021-09-09 17:02:43 +08:00
parent 242c85b77f
commit b1f26f9f99
5 changed files with 161 additions and 17 deletions
+65 -10
View File
@@ -32,10 +32,23 @@ class Member extends HD_Controller
$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);
$lists = $users = $where = array();
if ($params['name'] || $params['mobile']) {
$where_u = array();
if ($params['name']) {
$where_u = array("nickname LIKE '%{$params['name']}%'" => null);
}
if ($params['mobile']) {
$where_u = array("mobile LIKE '%{$params['mobile']}%'" => null);
}
$res_u = $this->user_service->select($where_u, 'id DESC', 0, 0, 'id');
$uids = array_column($res_u, 'id');
!$uids && $uids[] = 0;
$where['uid in (' . implode(',', $uids) . ')'] = null;
}
$count = $this->mdBobingUser->count(array_merge($this->where, $where));
if ($count) {
$res = $this->mdBobingUser->select($this->where, 'id desc', $params['page'], $params['size']);
$res = $this->mdBobingUser->select(array_merge($this->where, $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) {
@@ -43,24 +56,22 @@ class Member extends HD_Controller
}
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 ? '<strong class="text-danger mr10">已中奖' . implode('', $lotteryry) . '</strong>' : '';
$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'];
$car_gold = $value['car_gold'] + $value['buy_car_gold'] + $value['lotter_gold'];
$car_gold = $value['car_gold'] . '+' . $value['buy_car_gold'] . '+' . $value['lotter_gold']
. '=<strong class="text-danger mr10">' . $car_gold . '</strong>';
$setValue['car_gold'] = $car_gold;
$setValue['if_kz'] = $value['if_kz'] == 1 ? '已开' : '未开';
$setValue['wxqy'] = $this->wxqyAry[$value['wxqy']];
$lists[] = $setValue;
}
}
$this->data['lists'] = $lists;
$this->data['params'] = $params;
$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);
@@ -117,6 +128,50 @@ class Member extends HD_Controller
return $this->show_view('/app/bobing/member/lists_logs', true);
}
public function lists_day()
{
$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);
$count = $this->mdBobingUserCredit->count(array_merge($this->where, $where));
if ($count) {
$res = $this->mdBobingUserCredit->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()
+5 -5
View File
@@ -5,13 +5,13 @@
<div class="am-form-group fl">
<label class="am-para-label w100">会员名称:</label>
<div class="am-para-inline w150">
<input type="text" name="name" value="<?= $name ?>"/>
<input type="text" name="name" value="<?= $params['name'] ?>"/>
</div>
</div>
<div class="am-form-group fl">
<label class="am-para-label w100">手机号码:</label>
<div class="am-para-inline w150">
<input type="text" name="mobile" value="<?= $mobile ?>"/>
<input type="text" name="mobile" value="<?= $params['mobile'] ?>"/>
</div>
</div>
<div class="am-form-group fl ml10">
@@ -27,7 +27,7 @@
<th width="10%"><span>用户名称</span></th>
<th width="10%"><span>手机号码</span></th>
<th width="10%"><span>积分</span></th>
<th width="10%"><span>购车金</span></th>
<th width="15%"><span>博饼+企微+排名=总购车金</span></th>
<th width="10%"><span>开桌</span></th>
<th width="10%"><span>企业微信</span></th>
</tr>
@@ -46,12 +46,12 @@
<td colspan="6" class="align-r">
<div class="row">
<div class="col-md-6 align-l">
<?= $v['lottery'] ?>
</div>
<div class="col-md-6 align-r">
<a href="javascript:void(0);" data-open="/app/bobing/member/get?id=<?= $v['id'] ?>"
class="am-btn am-btn-primary am-btn-xs">每日博饼</a>
<a href="javascript:void(0);" data-open="/app/bobing/member/lists_logs?uid=<?= $v['uid'] ?>"
<a href="javascript:void(0);"
data-open="/app/bobing/member/lists_logs?uid=<?= $v['uid'] ?>"
class="am-btn am-btn-primary am-btn-xs">博饼记录</a>
</div>
</div>
@@ -0,0 +1,88 @@
<div class="coms-table-wrap mt10">
<form id="vue-app" class=" form-search coms-table-hd clearfix no-border" onsubmit="return false"
action="/app/bobing/member/lists_logs">
<input name="uid" type="hidden" value="<?= $params['uid'] ?>"/>
<div class="am-form am-form-horizontal">
<div class="am-form-group fl">
<div class="am-form-group" style="margin-bottom: 0px;"></div>
<label class="am-para-label w100">博饼日期:</label>
<div class="am-form-group fl">
<div class="am-para-inline w300">
<input id="id-bo_date" name="bo_date" type="text" value="<?= $params['bo_date'] ?>"
placeholder="博饼日期范围" autocomplete="off"/>
</div>
<div class="am-para-inline" style="padding-top: 5px;">
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="today">今天</a>
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="yesterday">昨日</a>
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="7day">最近7天</a>
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="30day">最近30天</a>
</div>
</div>
</div>
<div class="am-form-group fl ml10">
<button type="submit" class="am-btn am-btn-success am-btn-sm w100">搜索</button>
</div>
</div>
</form>
<div class="coms-table-bd">
<div class="fr">共有<?= $pager['totle'] ?>条数据</div>
<table class="am-table am-table-bordered">
<thead>
<tr>
<th width="10%"><span>骰子点数</span></th>
<th width="10%"><span>级别</span></th>
<th width="10%"><span>积分</span></th>
<th width="10%"><span>购车金</span></th>
<th width="10%"><span>红包</span></th>
<th width="15%"><span>类型</span></th>
<th width="10%"><span>博饼日期</span></th>
</tr>
</thead>
<tbody>
<?php foreach ($lists as $v) { ?>
<tr>
<td><?= $v['dices'] ?></td>
<td><?= $v['level_name'] ?></td>
<td><?= $v['credit'] ?></td>
<td><?= $v['car_gold'] ?></td>
<td><?= $v['hong_bao'] ?></td>
<td><?= $v['type_name'] ?></td>
<td><?= $v['bo_date'] ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<div class="coms-table-ft clearfix">
<div class="coms-pagination fr mr20">
<?php page_view($pager) ?>
</div>
</div>
</div>
<script>
require(['laydate', 'autocomplete'], function (laydate) {
laydate.render({
elem: '#id-bo_date', range: '~'
});
$('.id-day-btn').click(function () {
var type = $(this).data('date'), date = '', d_obj = new Date();
switch (type) {
case 'today':
date = d_obj.Format('yyyy-MM-dd');
date = date + ' ~ ' + date;
break;
case 'yesterday':
date = (new Date(d_obj.getTime() - 86400000)).Format('yyyy-MM-dd');
date = date + ' ~ ' + date;
break;
case '7day':
date = (new Date(d_obj.getTime() - 86400000 * 7)).Format('yyyy-MM-dd') + ' ~ ' + d_obj.Format('yyyy-MM-dd');
break;
case '30day':
date = (new Date(d_obj.getTime() - 86400000 * 30)).Format('yyyy-MM-dd') + ' ~ ' + d_obj.Format('yyyy-MM-dd');
break;
}
$('#id-bo_date').val(date);
});
});
</script>
+2 -1
View File
@@ -99,7 +99,8 @@ class Bobing extends HD_Controller
return;
}
$uid = 5;
$credit = rand(50, 120);
$credits = array(1 => 30, 2 => 50, 3 => 60, 4 => 70, 5 => 80, 6 => 90, 7 => 100, 8 => 120);
$credit = $credits[rand(1, 8)];
$where = array('uid' => $uid, 'app_id' => $this->appConfig['app_id'], 'act_key' => $this->appConfig['act_key']);
$ret = $this->mdBobingUser->update(array("credit = credit+{$credit}" => null), $where);
if ($ret) {
+1 -1
View File
@@ -131,7 +131,7 @@ class Bobing extends Wxapp
$data['status'] = $status;
$valid_nums['value'] = $this->bo->valid_nums <= 0 ? 0 : $this->bo->valid_nums - 1;
$data['dices'] = $result['dices'];
$data['level'] = $result['level'];
$data['level'] = $result['level'] > 6 ? 6 : $result['level'];
$data['bo_title'] = $result['level_name'] . ' + ' . $result['credit'];
$data['valid_nums'] = $valid_nums;
$data['top_title'] = $this->get_top_title($cf_uid);