From 1693f7fa98b39c6464c8fdf5a2275b44251493a5 Mon Sep 17 00:00:00 2001 From: liuweiwen <“529520975@qq.com> Date: Thu, 5 Dec 2019 17:10:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A8=E5=B9=BF=E5=85=AC=E5=8F=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PromoteCompanyController.class.php | 197 ++++++++++++++++++ .../Controller/PromoteController.class.php | 10 +- Application/Admin/View/Promote/add.html | 6 +- .../Admin/View/PromoteCompany/add.html | 85 ++++++++ .../Admin/View/PromoteCompany/edit.html | 88 ++++++++ .../Admin/View/PromoteCompany/lists.html | 169 +++++++++++++++ .../Base/Service/PromoteService.class.php | 2 +- Application/Mobile/View/Index/business.html | 2 +- Application/Mobile/View/Index/index.html | 2 +- Application/Mobile/View/Index/introduce.html | 2 +- Application/Mobile/View/User/index.html | 2 +- Application/Mobile/View/User/login.html | 2 +- 12 files changed, 553 insertions(+), 14 deletions(-) create mode 100644 Application/Admin/Controller/PromoteCompanyController.class.php create mode 100644 Application/Admin/View/PromoteCompany/add.html create mode 100644 Application/Admin/View/PromoteCompany/edit.html create mode 100644 Application/Admin/View/PromoteCompany/lists.html diff --git a/Application/Admin/Controller/PromoteCompanyController.class.php b/Application/Admin/Controller/PromoteCompanyController.class.php new file mode 100644 index 000000000..820a071af --- /dev/null +++ b/Application/Admin/Controller/PromoteCompanyController.class.php @@ -0,0 +1,197 @@ + + */ +class PromoteCompanyController extends ThinkController +{ + private $modelName = 'PromoteCompany'; + + //列表 + public function lists() + { + $model = M($this->modelName, 'tab_'); + $map = []; + $id = intval(I('id', 0)); + if (!empty($id)) { + $map['tab_promote_company.id'] = $id; + $parameter['id'] = $id; + } + + if (isset($_REQUEST['status']) && $_REQUEST['status'] !== '') { + $status = intval($_REQUEST['status']); + $map['tab_promote_company.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_promote_company.id,tab_promote_company.company_name,tab_promote_company.status, + tab_promote_company.create_time,sys_member.nickname') + ->join('left join sys_member on sys_member.uid = tab_promote_company.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) { + $company_name = I('post.company_name', ''); + $status = intval(I('post.status', 1)); + + if (empty($company_name)) { + $this->error('请输入推广公司名称'); + } + if (!in_array($status, [0, 1])) { + $this->error('参数异常'); + } + + $model = M($this->modelName, 'tab_'); + $map['company_name'] = $company_name; + $res = $model->where($map)->getField('id'); + if ($res) { + $this->error('合作方已存在'); + } + + $time = time(); + $save['company_name'] = $company_name; + $save['status'] = $status; + $save['uid'] = UID; + $save['create_time'] = $time; + $save['last_up_time'] = $time; + + $res = $model->add($save); + if ($res) { + \Think\Log::actionLog('PromoteCompany/add', 'partner', $res); + $this->success('保存成功', U('lists')); + } else { + $this->error('保存失败'); + } + } else { + $this->assign('commonset', M('Kuaijieicon')->where(['url' => 'PromoteCompany/add'])->find()); + $this->meta_title = '新增推广公司'; + $this->display(); + } + } + + //编辑 + public function edit() + { + $model = M($this->modelName, 'tab_'); + + if ($_POST) { + $company_name = I('post.company_name', ''); + $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,company_name')->find($id); + if (empty($data)) { + $this->error('数据异常'); + } + + $map['company_name'] = $company_name; + $res = $model->where($map)->getField('id'); + if ($res && $res != $id) { + $this->error('合作方已存在'); + } + + $time = time(); + $save['id'] = $id; + $save['company_name'] = $company_name; + $save['status'] = $status; + $save['last_up_time'] = $time; + + $res = $model->save($save); + if ($res === false) { + $this->error('保存失败'); + } else { + \Think\Log::actionLog('PromoteCompany/edit', 'PromoteCompany', $id); + $this->success('保存成功', U('lists')); + } + } else { + $id = intval(I('get.id', 0)); + $map['id'] = $id; + $data = $model->field('id,company_name,status')->find($id); + if (empty($data)) { + $this->error('数据异常', U('lists')); + } + + $this->assign('data', $data); + $this->assign('commonset', M('Kuaijieicon')->where(['url' => 'PromoteCompany/edit'])->find()); + $this->meta_title = '编辑合作方'; + $this->display(); + } + } + + //删除 + public function del() + { + if (!empty($_POST['ids'])) { + if (!is_array($_POST['ids'])) { + $this->error('参数异常'); + } + + $id = implode(',', $_POST['ids']); + } else { + $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/Controller/PromoteController.class.php b/Application/Admin/Controller/PromoteController.class.php index 3370975ff..9e1c385be 100644 --- a/Application/Admin/Controller/PromoteController.class.php +++ b/Application/Admin/Controller/PromoteController.class.php @@ -195,7 +195,7 @@ class PromoteController extends ThinkController } public function add($account=null, $password=null, $second_pwd=null, $real_name=null, $email=null, $mobile_phone=null, - $bank_name=null, $bank_card=null, $admin=null, $status=null, $ba_id = null, $partner_id = null) + $bank_name=null, $bank_card=null, $admin=null, $status=null, $ba_id = null, $company_id = null) { if (IS_POST) { if (C('PROMOTE_AUTO_AUDIT') == 1) { @@ -213,7 +213,7 @@ class PromoteController extends ThinkController 'admin_id'=>$admin, 'status'=>$status, 'ba_id'=>$ba_id, - 'partner_id'=>$partner_id, + 'company_id'=>$company_id, ); if (preg_match('/^[a-zA-Z0-9]{6,15}$/', $account)==false) { $this->error('账号只能是6-15位字母或数字'); @@ -231,10 +231,10 @@ class PromoteController extends ThinkController $this->error('添加失败'); } } else { - $this->meta_title ='新增渠道信息'; + $this->meta_title = '新增渠道信息'; $this->m_title = '推广员列表'; - $partners = M('partner', 'tab_')->where(['status' => 1])->select(); - $this->assign('partners', $partners); + $companys = M('promote_company', 'tab_')->where(['status' => 1])->select(); + $this->assign('companys', $companys); $this->assign('commonset', M('Kuaijieicon')->where(['url'=>'Promote/lists/type/1','status'=>1])->find()); $this->display(); } diff --git a/Application/Admin/View/Promote/add.html b/Application/Admin/View/Promote/add.html index adc043921..4a22e69e7 100644 --- a/Application/Admin/View/Promote/add.html +++ b/Application/Admin/View/Promote/add.html @@ -86,10 +86,10 @@ 所属推广公司 - - - + + diff --git a/Application/Admin/View/PromoteCompany/add.html b/Application/Admin/View/PromoteCompany/add.html new file mode 100644 index 000000000..6f730da18 --- /dev/null +++ b/Application/Admin/View/PromoteCompany/add.html @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + +
+ + +
+ +
+ +
+ + + + + + + + + + + +
*推广公司名称: + +
*显示状态: + + + + + +
+
+
+ + + 返回 + +
+
+
+
+ + +
+ + + + diff --git a/Application/Admin/View/PromoteCompany/edit.html b/Application/Admin/View/PromoteCompany/edit.html new file mode 100644 index 000000000..8bfa4e180 --- /dev/null +++ b/Application/Admin/View/PromoteCompany/edit.html @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + +
+ + +
+ +
+ +
+ + + + + + + + + + + +
*合作方名称: + +
*显示状态: + + + + + +
+
+
+ + + + 返回 + +
+
+
+
+ + +
+ + + + diff --git a/Application/Admin/View/PromoteCompany/lists.html b/Application/Admin/View/PromoteCompany/lists.html new file mode 100644 index 000000000..2e4c7781a --- /dev/null +++ b/Application/Admin/View/PromoteCompany/lists.html @@ -0,0 +1,169 @@ + + + + + + + + + + + +
+
+
+ 新增 + 删除 +
+
+ + + + + + + + + + + + + + + + + +
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + 推广公司显示状态添加人添加时间操作
aOh! 暂时还没有内容!
{$data.company_name}{$data.status}{$data.nickname}{$data.create_time} + 编辑 + 删除 +
+
+
+
+ {$_page|default=''} +
+ + + +
+ + + + + + + + + diff --git a/Application/Base/Service/PromoteService.class.php b/Application/Base/Service/PromoteService.class.php index 606cf5290..871f07efb 100644 --- a/Application/Base/Service/PromoteService.class.php +++ b/Application/Base/Service/PromoteService.class.php @@ -944,7 +944,7 @@ class PromoteService { 'parent_id' => $parent ? $parent['id'] : 0, 'parent_name' => $parent ? $parent['account'] : '官方渠道', 'admin_id' => $params['admin_id'] ?? 0, - 'partner_id' => $params['partner_id'] ?? 0, + 'company_id' => $params['company_id'] ?? 0, 'invite_code' => $params['invite_code'] ?? '', 'create_time' => time(), ]; diff --git a/Application/Mobile/View/Index/business.html b/Application/Mobile/View/Index/business.html index d00a386ef..38b27a6a9 100644 --- a/Application/Mobile/View/Index/business.html +++ b/Application/Mobile/View/Index/business.html @@ -61,7 +61,7 @@
diff --git a/Application/Mobile/View/Index/index.html b/Application/Mobile/View/Index/index.html index c676b03d9..919e99bee 100644 --- a/Application/Mobile/View/Index/index.html +++ b/Application/Mobile/View/Index/index.html @@ -71,7 +71,7 @@
diff --git a/Application/Mobile/View/Index/introduce.html b/Application/Mobile/View/Index/introduce.html index b30913d8a..dbe3a5b6a 100644 --- a/Application/Mobile/View/Index/introduce.html +++ b/Application/Mobile/View/Index/introduce.html @@ -46,7 +46,7 @@
diff --git a/Application/Mobile/View/User/index.html b/Application/Mobile/View/User/index.html index 846c51f04..7eb0bd4eb 100644 --- a/Application/Mobile/View/User/index.html +++ b/Application/Mobile/View/User/index.html @@ -76,7 +76,7 @@
diff --git a/Application/Mobile/View/User/login.html b/Application/Mobile/View/User/login.html index 55080ffd7..52e38600a 100644 --- a/Application/Mobile/View/User/login.html +++ b/Application/Mobile/View/User/login.html @@ -59,7 +59,7 @@