|
@@ -60,108 +60,10 @@ class Admin extends Backend
|
|
|
}
|
|
|
|
|
|
$this->view->assign('groupdata', $groupdata);
|
|
|
- //公会
|
|
|
- $gh = Db::name('gonghui')->order('id asc')->column('id,name');
|
|
|
- $this->assign('gh',$gh);
|
|
|
- //公会
|
|
|
$this->assignconfig("admin", ['id' => $this->auth->id]);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 查看
|
|
|
- */
|
|
|
- public function index()
|
|
|
- {
|
|
|
- //设置过滤方法
|
|
|
- $this->request->filter(['strip_tags', 'trim']);
|
|
|
- if ($this->request->isAjax()) {
|
|
|
- //如果发送的来源是Selectpage,则转发到Selectpage
|
|
|
- if ($this->request->request('keyField')) {
|
|
|
- return $this->selectpage();
|
|
|
- }
|
|
|
-// $childrenGroupIds = $this->childrenGroupIds;
|
|
|
-// $groupName = AuthGroup::where('id', 'in', $childrenGroupIds)
|
|
|
-// ->column('id,name');
|
|
|
-// $authGroupList = AuthGroupAccess::where('group_id', 'in', $childrenGroupIds)
|
|
|
-// ->field('uid,group_id')
|
|
|
-// ->select();
|
|
|
-
|
|
|
-// $adminGroupName = [];
|
|
|
-// foreach ($authGroupList as $k => $v) {
|
|
|
-// if (isset($groupName[$v['group_id']])) {
|
|
|
-// $adminGroupName[$v['uid']][$v['group_id']] = $groupName[$v['group_id']];
|
|
|
-// }
|
|
|
-// }
|
|
|
-// $groups = $this->auth->getGroups();
|
|
|
-// foreach ($groups as $m => $n) {
|
|
|
-// $adminGroupName[$this->auth->id][$n['id']] = $n['name'];
|
|
|
-// }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
|
|
-
|
|
|
- $map['user_id'] = ['gt', 0];
|
|
|
- if ($this->auth->id != 1 && $this->auth->id != 11) {
|
|
|
- $map['id'] = $this->auth->id;
|
|
|
- }
|
|
|
-
|
|
|
- $list = $this->model
|
|
|
-// ->where($where)
|
|
|
- ->where($map)
|
|
|
-// ->where('id', 'in', $this->childrenAdminIds)
|
|
|
- ->field(['password', 'salt', 'token'], true)
|
|
|
- ->order($sort, $order)
|
|
|
- ->paginate($limit);
|
|
|
|
|
|
- //获取时间
|
|
|
- $searchwhere = $this->request->get("filter", '');
|
|
|
- $searchwhere = (array)json_decode($searchwhere, true);
|
|
|
- if (isset($searchwhere['time'])) {
|
|
|
- $starttime = strtotime(mb_substr($searchwhere['time'], 0, 19));
|
|
|
- $endtime = strtotime(mb_substr($searchwhere['time'], 23, 19));
|
|
|
- } else { //若没有 则显示本周
|
|
|
- $starttime = strtotime(date('Y-m-d')) - ((date('w')==0?7:date('w'))-1)*86400;
|
|
|
- $endtime = $starttime + 86400 * 7 - 1;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- $money_map['log_type'] = ['in', [21, 22, 23, 54, 60, 82]];
|
|
|
- $money_map['createtime'] = ['between', [$starttime, $endtime]];
|
|
|
-
|
|
|
- $mt_user_money_log = Db::name('user_money_log');
|
|
|
- $mt_user = Db::name('user');
|
|
|
- $mt_extend_reward = Db::name('extend_reward');
|
|
|
- foreach ($list as $k => &$v) {
|
|
|
-// $groups = isset($adminGroupName[$v['id']]) ? $adminGroupName[$v['id']] : [];
|
|
|
-// $v['groups'] = implode(',', array_keys($groups));
|
|
|
-// $v['groups_text'] = implode(',', array_values($groups));
|
|
|
-
|
|
|
- $user_ids = $mt_user->where(['intro_uid' => $v['user_id']])->column('id');
|
|
|
- $user_ids = $user_ids ? : [];
|
|
|
- $money_map['user_id'] = ['in', $user_ids];
|
|
|
- //总收益
|
|
|
- $week_sum_money = $mt_user_money_log->where($money_map)->sum('change_value');
|
|
|
- $week_sum_money = $week_sum_money > 0 ? $week_sum_money : 0;
|
|
|
- $v['week_sum_money'] = $week_sum_money;
|
|
|
- //查询等级
|
|
|
- $extend_reward_info = $mt_extend_reward->where(['total_flow' => ['elt', $week_sum_money]])->order('id desc')->find();
|
|
|
- if ($extend_reward_info) {
|
|
|
- $v['extend_name'] = $extend_reward_info['name'];
|
|
|
- $v['extra_reward'] = $extend_reward_info['extra_reward'];
|
|
|
- $v['extra_moeny'] = number_format($week_sum_money * $extend_reward_info['extra_reward'] / 100, 2, '.', '');
|
|
|
- } else {
|
|
|
- $v['extend_name'] = '';
|
|
|
- $v['extra_reward'] = '';
|
|
|
- $v['extra_moeny'] = '';
|
|
|
- }
|
|
|
- }
|
|
|
- $result = array("total" => $list->total(), "rows" => $list->items());
|
|
|
-
|
|
|
- return json($result);
|
|
|
- }
|
|
|
- return $this->view->fetch();
|
|
|
- }
|
|
|
|
|
|
/**
|
|
|
* 批量更新
|