From dd10535a0741f29ed0082992a8acc05996209632 Mon Sep 17 00:00:00 2001 From: chenxiaojun <956334972@qq.com> Date: Mon, 28 Oct 2019 15:31:37 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=90=8E=E5=8F=B0->=E6=B8=B8?= =?UTF-8?q?=E6=88=8F=E7=AE=A1=E7=90=86->=E6=96=B0=E5=A2=9E=E5=90=88?= =?UTF-8?q?=E4=BD=9C=E6=96=B9=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Admin/Common/function.php | 14 ++ .../Controller/PartnerController.class.php | 188 ++++++++++++++++++ Application/Admin/View/Game/add.html | 11 + Application/Admin/View/Game/edit.html | 13 ++ Application/Admin/View/Game/lists.html | 4 + Application/Admin/View/Partner/add.html | 85 ++++++++ Application/Admin/View/Partner/edit.html | 88 ++++++++ Application/Admin/View/Partner/lists.html | 169 ++++++++++++++++ Data/update.sql | 16 +- 9 files changed, 586 insertions(+), 2 deletions(-) create mode 100644 Application/Admin/Controller/PartnerController.class.php create mode 100644 Application/Admin/View/Partner/add.html create mode 100644 Application/Admin/View/Partner/edit.html create mode 100644 Application/Admin/View/Partner/lists.html diff --git a/Application/Admin/Common/function.php b/Application/Admin/Common/function.php index 687ec4204..239e890ab 100644 --- a/Application/Admin/Common/function.php +++ b/Application/Admin/Common/function.php @@ -528,3 +528,17 @@ function getServerType($serverType) return (($serverType == 1) ? '专服' : '混服'); } +//获取合作方 +function getPartnerList($id = 0) +{ + if ($id > 0) { + return M('Partner', 'tab_')->field('id,partner')->find($id); + } else { + return M('Partner', 'tab_')->field('id,partner')->where(array('status' => 1))->select(); + } +} + +function getPartnerName($id = 0) +{ + return M('Partner', 'tab_')->where(array('id' => intval($id)))->getField('partner'); +} \ No newline at end of file diff --git a/Application/Admin/Controller/PartnerController.class.php b/Application/Admin/Controller/PartnerController.class.php new file mode 100644 index 000000000..3be4e66f1 --- /dev/null +++ b/Application/Admin/Controller/PartnerController.class.php @@ -0,0 +1,188 @@ + + */ +class PartnerController extends ThinkController +{ + private $modelName = 'Partner'; + + //列表 + public function lists() + { + $model = M($this->modelName, 'tab_'); + $map = []; + $id = intval(I('id', 0)); + if (!empty($id)) { + $map['tab_partner.id'] = $id; + $parameter['id'] = $id; + } + + if (isset($_REQUEST['status']) && $_REQUEST['status'] !== '') { + $status = intval($_REQUEST['status']); + $map['tab_partner.status'] = $status; + $parameter['status'] = $status; + } + + $page = intval(I('get.p', 0)); + $page = $page ? $page : 1; //默认显示第一页数据 + $row = intval(I('row', 0)); + $row = empty($row) ? 10 : $row;//每页条数 + + $data = $model + ->field('tab_partner.id,tab_partner.partner,tab_partner.status,tab_partner.create_time,sys_member.nickname') + ->join('left join sys_member on sys_member.uid = tab_partner.uid') + ->where($map) + ->order('id desc') + ->page($page, $row) + ->select(); + + /* 查询记录总数 */ + $count = $model + ->where($map) + ->count(); + + if (!empty($data)) { + foreach ($data as &$list) { + $list['status'] = ($list['status'] == 0) ? '已关闭' : '已开启'; + $list['create_time'] = date('Y-m-d H:i:s', $list['create_time']); + } + } + + //分页 + $parameter['p'] = $page; + $parameter['row'] = $row; + $page = set_pagination($count, $row, $parameter); + if ($page) { + $this->assign('_page', $page); + } + + $this->assign('listData', $data); + $this->assign('count', $count); + $this->assign('commonset', M('Kuaijieicon')->where(['url' => 'Partner/lists'])->find()); + $this->meta_title = '合作方管理'; + $this->display(); + } + + //添加 + public function add() + { + if ($_POST) { + $partner = I('post.partner', ''); + $status = intval(I('post.status', 1)); + + if (empty($partner)) { + $this->error('请输入合作方名称'); + } + if (!in_array($status, [0, 1])) { + $this->error('参数异常'); + } + + $model = M($this->modelName, 'tab_'); + $map['partner'] = $partner; + $res = $model->where($map)->getField('id'); + if ($res) { + $this->error('合作方已存在'); + } + + $time = time(); + $save['partner'] = $partner; + $save['status'] = $status; + $save['uid'] = UID; + $save['create_time'] = $time; + $save['last_up_time'] = $time; + + $res = $model->add($save); + if ($res) { + \Think\Log::actionLog('Partner/add', 'partner', $res); + $this->success('保存成功', U('lists')); + } else { + $this->error('保存失败'); + } + } else { + $this->assign('commonset', M('Kuaijieicon')->where(['url' => 'Partner/add'])->find()); + $this->meta_title = '新增合作方'; + $this->display(); + } + } + + //编辑 + public function edit() + { + $model = M($this->modelName, 'tab_'); + + if ($_POST) { + $partner = I('post.partner', ''); + $status = intval(I('post.status', 1)); + $id = intval(I('post.id', 0)); + + if (empty($partner)) { + $this->error('请输入合作方名称'); + } + if (!in_array($status, [0, 1]) || $id == 0) { + $this->error('参数异常'); + } + + $data = $model->field('id,partner')->find($id); + if (empty($data)) { + $this->error('数据异常'); + } + + $map['partner'] = $partner; + $res = $model->where($map)->getField('id'); + if ($res && $res != $id) { + $this->error('合作方已存在'); + } + + $time = time(); + $save['id'] = $id; + $save['partner'] = $partner; + $save['status'] = $status; + $save['last_up_time'] = $time; + + $res = $model->save($save); + if ($res === false) { + $this->error('保存失败'); + } else { + \Think\Log::actionLog('Partner/edit', 'partner', $id); + $this->success('保存成功', U('lists')); + } + } else { + $id = intval(I('get.id', 0)); + $map['id'] = $id; + $data = $model->field('id,partner,status')->find($id); + if (empty($data)) { + $this->error('数据异常', U('lists')); + } + + $this->assign('data', $data); + $this->assign('commonset', M('Kuaijieicon')->where(['url' => 'Partner/edit'])->find()); + $this->meta_title = '编辑合作方'; + $this->display(); + } + } + + //删除 + public function del() + { + $id = intval(I('get.id', 0)); + if ($id == 0) { + $this->error('参数异常'); + } + + $res = M($this->modelName, 'tab_')->delete($id); + if ($res === false) { + $this->error('删除失败'); + } + + $this->success('删除成功', U('lists')); + } +} diff --git a/Application/Admin/View/Game/add.html b/Application/Admin/View/Game/add.html index a967b6986..e4a8cb55b 100644 --- a/Application/Admin/View/Game/add.html +++ b/Application/Admin/View/Game/add.html @@ -188,6 +188,17 @@ + + 合作方: + + + + 游戏详细介绍: diff --git a/Application/Admin/View/Game/edit.html b/Application/Admin/View/Game/edit.html index b97ee5d7e..dace2644c 100644 --- a/Application/Admin/View/Game/edit.html +++ b/Application/Admin/View/Game/edit.html @@ -196,6 +196,19 @@ + + 合作方: + + + + 游戏详细介绍: diff --git a/Application/Admin/View/Game/lists.html b/Application/Admin/View/Game/lists.html index eae185a53..56fac7fac 100644 --- a/Application/Admin/View/Game/lists.html +++ b/Application/Admin/View/Game/lists.html @@ -138,6 +138,7 @@ text-indent:0; 游戏类型 游戏Appid 推荐状态 + 合作方 显示状态 支付状态 下载次数 @@ -163,6 +164,7 @@ text-indent:0; {:get_game_type_name($data['game_type_id'])} {$data.game_appid} {:get_info_status($data['recommend_status'],1)} + {:getPartnerName($data['partner_id'])}
@@ -254,6 +256,7 @@ text-indent:0; 运营平台 游戏类型 游戏来源 + 合作方 排序设置 审核状态 显示状态 @@ -276,6 +279,7 @@ text-indent:0; {:get_systems_name($data['sdk_version'])} {:get_game_type_name($data['game_type_id'])} {:get_developer_name($data['developers'])} + {:getPartnerName($data['partner_id'])}
{$data.sort} diff --git a/Application/Admin/View/Partner/add.html b/Application/Admin/View/Partner/add.html new file mode 100644 index 000000000..c499967a0 --- /dev/null +++ b/Application/Admin/View/Partner/add.html @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + +
+ + +
+ +
+ +
+ + + + + + + + + + + +
*合作方名称: + +
*显示状态: + + + + + +
+
+
+ + + 返回 + +
+
+
+
+ + +
+ + + + diff --git a/Application/Admin/View/Partner/edit.html b/Application/Admin/View/Partner/edit.html new file mode 100644 index 000000000..8bfa4e180 --- /dev/null +++ b/Application/Admin/View/Partner/edit.html @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + +
+ + +
+ +
+ +
+ + + + + + + + + + + +
*合作方名称: + +
*显示状态: + + + + + +
+
+
+ + + + 返回 + +
+
+
+
+ + +
+ + + + diff --git a/Application/Admin/View/Partner/lists.html b/Application/Admin/View/Partner/lists.html new file mode 100644 index 000000000..6e791528e --- /dev/null +++ b/Application/Admin/View/Partner/lists.html @@ -0,0 +1,169 @@ + + + + + + + + + + + +
+
+
+ 新增 + 删除 +
+
+
+
+ +
+ +
+ +
+ +
+ 搜索 +
+
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + 合作方显示状态添加人添加时间操作
aOh! 暂时还没有内容!
{$data.partner}{$data.status}{$data.nickname}{$data.create_time} + 编辑 + 删除 +
+
+
+
+ {$_page|default=''} +
+ + + +
+ + + + + + + + + diff --git a/Data/update.sql b/Data/update.sql index ce1797271..e764fca51 100644 --- a/Data/update.sql +++ b/Data/update.sql @@ -169,10 +169,22 @@ ADD COLUMN `user_token` char(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT alter table `tab_giftbag` modify COLUMN `giftbag_version` tinyint(2) COMMENT '运营平台 0双平台 1and 2ios 3超级签' -- 2019-10-22 cxj -UPDATE `sys_model` SET list_grid = "id:编号\r\nsort:排序\r\ngame_name:游戏名称\r\ngame_type_name:游戏类型\r\ngame_type_id:游戏类型\r\ngame_appid:游戏appid\r\ngame_status|get_info_status:显示状态\r\npay_status|get_info_status:支付状态\r\nicon:图片id\r\napply_status:审核状态\r\ncategory:开放类型\r\nrecommend_status|get_info_status*1:推荐状态\r\nrelation_game_id:关联游戏id\r\nrelation_game_name:关联游戏名称\r\nsdk_version:运营平台\r\ndevelopers:开发商\r\ndow_num:下载\r\nonline_status:上线状态\r\ncreate_time:创建时间\r\nserver_type:混服管理\r\nid:操作:[EDIT]&id=[id]|编辑,Game/del?ids=[id]|删除" where id = 15; +UPDATE `sys_model` SET list_grid = "id:编号\r\nsort:排序\r\ngame_name:游戏名称\r\ngame_type_name:游戏类型\r\ngame_type_id:游戏类型\r\ngame_appid:游戏appid\r\ngame_status|get_info_status:显示状态\r\npay_status|get_info_status:支付状态\r\nicon:图片id\r\napply_status:审核状态\r\ncategory:开放类型\r\nrecommend_status|get_info_status*1:推荐状态\r\nrelation_game_id:关联游戏id\r\nrelation_game_name:关联游戏名称\r\nsdk_version:运营平台\r\ndevelopers:开发商\r\ndow_num:下载\r\nonline_status:上线状态\r\ncreate_time:创建时间\r\nserver_type:混服管理\r\npartner_id:合作方\r\nid:操作:[EDIT]&id=[id]|编辑,Game/del?ids=[id]|删除" where id = 15; -- 2019-10-23 zcl ALTER TABLE `tab_coin_pay_order` CHANGE COLUMN `currency_num` `coin_num` int(11) NULL DEFAULT 0 COMMENT '代币数量' AFTER `auditor_time`; -- 2019-10-23 zcl -update tab_quick_menu set name='订单查询' where name='充值明细' \ No newline at end of file +update tab_quick_menu set name='订单查询' where name='充值明细' + +-- 2019-10-28 cxj +CREATE TABLE `tab_partner` ( + `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', + `partner` varchar(30) NOT NULL COMMENT '合作方名称', + `uid` int(11) NOT NULL DEFAULT '0' COMMENT '添加人ID', + `status` tinyint(3) NOT NULL DEFAULT '1' COMMENT '状态 0-禁用 1-启用', + `create_time` int(10) NOT NULL DEFAULT '0' COMMENT '添加时间', + `last_up_time` int(10) NOT NULL DEFAULT '0' COMMENT '最后更新时间', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +ALTER TABLE `tab_game` ADD COLUMN `partner_id` int(11) NOT NULL DEFAULT 0 COMMENT '合作方ID' AFTER `supersign_url`; \ No newline at end of file