diff --git a/Application/Admin/Controller/ExportController.class.php b/Application/Admin/Controller/ExportController.class.php index 118624446..6a3849e40 100644 --- a/Application/Admin/Controller/ExportController.class.php +++ b/Application/Admin/Controller/ExportController.class.php @@ -5887,6 +5887,10 @@ class ExportController extends Controller if (strlen(I('company_belong'))) { $map['company_belong'] = I("company_belong"); } + + if (!is_null(I('admin_uid', null))) { + $map['admin_id'] = I('admin_uid'); + } //为数据权限添加 setPowerPromoteIds($map, 'tab_promote.id'); @@ -7114,6 +7118,7 @@ class ExportController extends Controller $xlsCell = array( array('game_name','游戏'), + array('game_type_name','游戏类型'), array('partner_name','合作公司'), array('cash_count','游戏现金金额'), array('balance_coin_count','平台币直充支出'), @@ -7145,6 +7150,10 @@ class ExportController extends Controller $map['_string'] .= " s.pay_time < {$timeend}"; } + if (!empty(I('game_type_id'))) { + $map['g.game_type_id'] = I('game_type_id'); + } + $xlsData = D("spend")->gameStatistics($map); foreach ($xlsData as $key => $value) { $xlsData[$key]['all_cash_count'] = $value['cash_count'] + $value['balance_coin_count'] + $value['inside_cash_count']; diff --git a/Application/Admin/Controller/FinanceController.class.php b/Application/Admin/Controller/FinanceController.class.php index f3a6da5fb..e72fdb907 100644 --- a/Application/Admin/Controller/FinanceController.class.php +++ b/Application/Admin/Controller/FinanceController.class.php @@ -725,6 +725,10 @@ class FinanceController extends ThinkController } $map['_string'] .= " s.pay_time < {$timeend}"; } + + if (!empty(I('game_type_id'))) { + $map['g.game_type_id'] = I('game_type_id'); + } $startTime = time(); //游戏统计列表 $data = D("spend")->gameStatistics($map, $row, $p); @@ -749,6 +753,8 @@ class FinanceController extends ThinkController $sumInside = $totalData['inside_cash_count']; $sumAll = $sumCash + $sumBalance + $sumInside; + $game_types = M("game_type", 'tab_')->field('id, type_name')->select(); + $this->assign('game_types', $game_types); $this->assign('sumCash', $sumCash); $this->assign('sumBalance', $sumBalance); $this->assign('sumInside', $sumInside); diff --git a/Application/Admin/Controller/PromoteController.class.php b/Application/Admin/Controller/PromoteController.class.php index 223d6d0fc..08cc2bd37 100644 --- a/Application/Admin/Controller/PromoteController.class.php +++ b/Application/Admin/Controller/PromoteController.class.php @@ -99,6 +99,11 @@ class PromoteController extends ThinkController if (strlen(I('company_belong'))) { $map['company_belong'] = I("company_belong"); } + + if (!is_null(I('admin_uid', null))) { + $map['admin_id'] = I('admin_uid'); + } + $this->m_title = '推广员列表'; $this->assign('commonset', M('Kuaijieicon')->where(['url'=>'Promote/lists/type/1','status'=>1])->find()); if (isset($_REQUEST['row'])) { @@ -176,6 +181,8 @@ class PromoteController extends ThinkController if ($page) { $this->assign('_page', $page); } + $admins = M('member')->field('uid,nickname')->select(); + $this->assign('admins', $admins); $this->assign('list_data', $list_data); $this->display(); } @@ -1216,6 +1223,13 @@ class PromoteController extends ThinkController $map['pb.can_view_recharge'] = I('can_view_recharge'); } + if (!is_null(I('company_id', null))) { + $map['p.company_id'] = I('company_id'); + } + + if (!is_null(I('admin_id', null))) { + $map['p.admin_id'] = I('admin_id'); + } $this->m_title = '推广公会归属管理'; $this->assign('commonset', M('Kuaijieicon')->where(['url'=>'Promote/belong','status'=>1])->find()); if (isset($_REQUEST['row'])) { @@ -1229,8 +1243,9 @@ class PromoteController extends ThinkController $model = M('promote_belong', 'tab_'); $list_data = $model->alias('pb') ->join('left join tab_promote as p on p.id=pb.promote_id') + ->join('left join tab_promote_company as pc on pc.id = p.company_id') ->where($map) - ->field('p.*,pb.*') + ->field('p.*,pb.*, pc.company_name') ->page($p, $row) ->order('verify_status asc,applicant_time asc') ->select(); @@ -1241,8 +1256,12 @@ class PromoteController extends ThinkController if ($page) { $this->assign('_page', $page); } + $companys = M('promote_company', 'tab_')->field('id, company_name')->select(); + $admins = M('member')->field('uid,nickname')->select(); $this->assign('is_admin', is_administrator()); $this->assign('list_data', $list_data); + $this->assign('companys', $companys); + $this->assign('admins', $admins); $this->display(); } diff --git a/Application/Admin/Controller/StatementMangementController.class.php b/Application/Admin/Controller/StatementMangementController.class.php index 3f5a9b98a..d36317d20 100644 --- a/Application/Admin/Controller/StatementMangementController.class.php +++ b/Application/Admin/Controller/StatementMangementController.class.php @@ -230,4 +230,103 @@ class StatementMangementController extends ThinkController } + public function rewardManageList($row = 10, $p = 1) + { + $map = []; + $list = M('reward_record', 'tab_')->where($map)->page($p, $row)->select(); + if ($list) { + $companys[1] = array_column(M('partner', 'tab_')->field('id, partner as name')->select(), 'name', 'id'); + $companys[2] = array_column(M('promote_company', 'tab_')->field('id, company_name as name')->select(), 'name', 'id'); + $games = array_column(M('game', 'tab_')->field('relation_game_id, relation_game_name')->group('relation_game_id')->select(), 'relation_game_name', 'relation_game_id'); + foreach ($list as &$item) { + $item['company_name'] = $companys[$item['company_type']][$item['company_id']]; + $item['accounts'] = json_decode($item['accounts'], true) ?: []; + $item['reward_type_desc'] = $item['reward_type'] == 1 ? "奖励" : "惩罚"; + $item['company_type_desc'] = $item['company_type'] == 1 ? "上游公司" : "下游公司"; + $item['relation_game_name'] = $games[$item['relation_game_id']]; + // if ($item['company_type'] == 1) { + + // } else { + + // } + } + } + $count = M('reward_record', 'tab_')->where($map)->count(); + $page = set_pagination($count, $row); + if ($page) { + $this->assign('_page', $page); + } + $this->assign('list', $list); + $this->display(); + } + + public function rewardManageSave($id=0) + { + if (IS_POST) { + $data = [ + 'reward_type' => I('reward_type'), + 'company_type' => I('company_type'), + 'company_id' => I('company_id'), + 'relation_game_id' => I('relation_game_id'), + 'money' => I('money'), + 'content' => I('content'), + 'remark' => I('remark'), + ]; + $accounts = I('account'); + $user_types = I('user_type'); + if ($accounts) { + + foreach ($accounts as $index => $account) { + $data['accounts'][] = array_merge(['account'=>$account], ['user_type'=>$user_types[$index]]); + } + } else { + $data['accounts'] = []; + } + $data['accounts'] = json_encode($data['accounts']); + if (!is_numeric(I('money'))) { + return $this->error('请输入正确的金额'); + } + if (empty(I('content'))) { + return $this->error('请填写事件内容'); + } + if ($id) { + $upt = M('reward_record', 'tab_')->where(['id'=>$id])->save($data); + return $upt ? $this->success('更新成功', U('StatementMangement/rewardManageList')) : $this->error('更新失败'); + } else { + $data['create_time'] = time(); + $data['creater_id'] = is_login(); + $ins = M('reward_record', 'tab_')->add($data); + return $ins ? $this->success('新增成功', U('StatementMangement/rewardManageList')) : $this->error('新增失败'); + } + } else { + $games = M('game', 'tab_')->field('relation_game_id, relation_game_name')->group('relation_game_id')->select(); + $this->assign('games', $games); + if ($id) { + if (I('delete')) { + $upt = M('reward_record', 'tab_')->where(['id'=>$id])->delete(); + return $upt ? $this->success('删除成功') : $this->error('删除失败'); + } else { + $data = M('reward_record', 'tab_')->where(['id'=>$id])->find(); + if (!$data) return $this->error("未找到该记录"); + $data['accounts'] = json_decode($data['accounts'], true) ?: []; + $this->assign('data', $data); + } + } + $this->display(); + } + + } + + public function getCompanys($type=1) + { + if ($type == 1) { + $data = M('partner', 'tab_')->field('id, partner as name')->select(); + } elseif ($type == 0) { + $data = []; + } else { + $data = M('promote_company', 'tab_')->field('id, company_name as name')->select(); + } + return $this->success($data, '', true); + } + } diff --git a/Application/Admin/Model/SpendModel.class.php b/Application/Admin/Model/SpendModel.class.php index f7177406b..9242d01ec 100644 --- a/Application/Admin/Model/SpendModel.class.php +++ b/Application/Admin/Model/SpendModel.class.php @@ -841,7 +841,7 @@ class SpendModel extends Model public function gameStatistics($map, $row = 0, $page = 1) { $query = $this->alias("s") - ->field("s.game_id,s.game_name,p.partner as partner_name, + ->field("s.game_id,s.game_name,p.partner as partner_name, g.game_type_name, SUM(CASE WHEN pay_way > 0 THEN pay_amount ELSE 0 END) as cash_count, SUM(CASE WHEN pay_way = 0 THEN pay_amount ELSE 0 END) as balance_coin_count, SUM(CASE WHEN pay_way = -1 THEN pay_amount ELSE 0 END) as inside_cash_count") diff --git a/Application/Admin/View/Finance/gameStatistics.html b/Application/Admin/View/Finance/gameStatistics.html index 4e241b0b6..b486d0ee5 100644 --- a/Application/Admin/View/Finance/gameStatistics.html +++ b/Application/Admin/View/Finance/gameStatistics.html @@ -107,6 +107,15 @@ +
+ +
+
@@ -152,6 +161,8 @@ 游戏 + 游戏类型 +
游戏现金金额第三方支付(微信,支付宝,快捷)。
平台币直充支出平台币购买游戏道具所产生的金额
@@ -180,6 +191,7 @@ {$data.partner_name} {$data.game_name} + {$data.game_type_name} {$data.cash_count}0 总计 + 总计 {$sumCash}0 {$sumBalance}0 {$sumInside}0 diff --git a/Application/Admin/View/Promote/belong.html b/Application/Admin/View/Promote/belong.html index f76ae95e2..20a550f41 100644 --- a/Application/Admin/View/Promote/belong.html +++ b/Application/Admin/View/Promote/belong.html @@ -57,6 +57,22 @@
+
+
+ +
+
+
+
+ +
+ + + 已添加添加至常用设置 +
+ + + + + + if(C('COLOR_STYLE')=='blue_color') echo ' + + '; + + + + + + + + diff --git a/Application/Admin/View/StatementMangement/rewardManageSave.html b/Application/Admin/View/StatementMangement/rewardManageSave.html new file mode 100644 index 000000000..1cbf4feba --- /dev/null +++ b/Application/Admin/View/StatementMangement/rewardManageSave.html @@ -0,0 +1,186 @@ + + + + + + + + + + + + + +
+
奖惩编辑
+
    + +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • + + $account):?> + + + + + + + + + +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
+
+ + + +
+ + + \ No newline at end of file diff --git a/Data/update.sql b/Data/update.sql index f27c9bf92..39aa50a01 100644 --- a/Data/update.sql +++ b/Data/update.sql @@ -1113,3 +1113,19 @@ ALTER TABLE `tab_promote` ADD COLUMN `auto_review_withdraw_updated_time` int(10) NOT NULL DEFAULT 0 COMMENT '提现自动审核状态更新时间'; ALTER TABLE `tab_promote` ADD INDEX `auto_review_withdraw_status`(`auto_review_withdraw_status`) USING BTREE; + +-- 奖罚记录 +CREATE TABLE `tab_reward_record` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `reward_type` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '奖罚类型 1奖励 2惩罚', + `company_type` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '公司类型 1上游公司 2下游公司', + `company_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '公司ID 当公司类型为上游CP公司时,展示合作方管理下的公司,反之展示推广公司管理下的公司', + `accounts` json NOT NULL, + `relation_game_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '游戏id', + `content` varchar(1000) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '事件内容', + `money` double(11,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '金额', + `remark` varchar(255) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '备注', + `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', + `creater_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建者ID', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;