209 lines
9.2 KiB
PHP
209 lines
9.2 KiB
PHP
<?php
|
|
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
class Member extends HD_Controller
|
|
{
|
|
private $where, $appConfig;
|
|
private $wxqyAry = array(0 => '未加', 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 = $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(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) {
|
|
$users[$value['id']] = array('nickname' => $value['nickname'], 'mobile' => $value['mobile']);
|
|
}
|
|
foreach ($res as $key => $value) {
|
|
$setValue = array();
|
|
$user = $users[$value['uid']];
|
|
$setValue['uid'] = $value['uid'];
|
|
$setValue['nickname'] = $user['nickname'];
|
|
$setValue['mobile'] = $user['mobile'];
|
|
$setValue['credit'] = $value['credit'];
|
|
$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);
|
|
}
|
|
|
|
//博饼记录
|
|
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 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()
|
|
{
|
|
}
|
|
|
|
//添加单条数据
|
|
public function add()
|
|
{
|
|
}
|
|
|
|
//编辑单条数据
|
|
public function edit()
|
|
{
|
|
}
|
|
|
|
//删除单条数据
|
|
public function del()
|
|
{
|
|
|
|
}
|
|
|
|
//批量操作(默认修改状态)
|
|
public function batch()
|
|
{
|
|
|
|
}
|
|
|
|
//导出数据列表
|
|
public function export()
|
|
{
|
|
|
|
}
|
|
}
|