diff --git a/Application/Admin/Controller/PromoteCompanyController.class.php b/Application/Admin/Controller/PromoteCompanyController.class.php
index 9f434f15b..91efcf099 100644
--- a/Application/Admin/Controller/PromoteCompanyController.class.php
+++ b/Application/Admin/Controller/PromoteCompanyController.class.php
@@ -273,6 +273,7 @@ class PromoteCompanyController extends ThinkController
));
}
} else {
+ $this->assign('serviceAgreements', M('service_agreement', 'tab_')->select());
$this->assign('commonset', M('Kuaijieicon')->where(['url' => 'PromoteCompany/add'])->find());
$this->meta_title = '新增推广公司';
$this->display();
@@ -378,7 +379,7 @@ class PromoteCompanyController extends ThinkController
if($data['resources'] == ''){
$data['resources'] ="[]";
}
-
+ $this->assign('serviceAgreements', M('service_agreement', 'tab_')->select());
$this->assign('data', $data);
$this->display();
}
@@ -558,4 +559,60 @@ WHERE old_change_promote_id in ({$promoteData})";
}
+ public function serviceAgreementList($row = 10, $p = 1)
+ {
+ $map = [];
+ $map['_string'] = " 1=1 ";
+ if (isset($_GET['time-start'])) {
+ $map['_string'] .= " and created_time >= " . strtotime($_GET['time-start']);
+ }
+ if (isset($_GET['time-end'])) {
+ $map['_string'] .= " and created_time < " . (strtotime($_GET['time-end']) + 86400);
+ }
+ if (isset($_GET['type'])) {
+ $map['type'] = $_GET['type'];
+ }
+ if (!empty($_GET['title'])) {
+ $map['title'] = ['like', "%{$_GET['title']}%"];
+ }
+ $list = M('service_agreement', 'tab_')->where($map)->page($p, $row)->select();
+ $count = M('service_agreement', 'tab_')->where($map)->count();
+ $page = set_pagination($count, $row);
+ if ($page) {
+ $this->assign('_page', $page);
+ }
+ $this->assign('list_data', $list);
+ $this->display('service_agreement_list');
+ }
+
+ public function serviceAgreementSave($id=0, $delete=0)
+ {
+ if (IS_POST) {
+ if (empty($_POST['name']) || empty($_POST['content'])) {
+ return $this->error('请填写完整内容');
+ }
+ if ($id) {
+ $result = M('service_agreement', 'tab_')->where(['id'=>$id])->save($_POST);
+ return $result ? $this->success('更新完成') : $this->error('更新失败');
+ } else {
+ $data = $_POST;
+ $data['creator'] = is_login();
+ $data['created_time'] = time();
+ $result = M('service_agreement', 'tab_')->add($data);
+ return $result ? $this->success('生成协议完成') : $this->error('生成协议失败');
+ }
+ } else {
+ if ($id) {
+ if ($delete) {
+ $result = M('service_agreement', 'tab_')->where(['id'=>$id])->delete();
+ return $result ? $this->success('删除完成') : $this->error('删除失败');
+ }
+ $info = M('service_agreement', 'tab_')->where(['id'=>$id])->find();
+ if (empty($info)) return $this->error('未找到协议');
+ $this->assign('info', $info);
+ }
+ $this->display('service_agreement_save');
+ }
+ }
+
}
diff --git a/Application/Admin/View/PromoteCompany/add.html b/Application/Admin/View/PromoteCompany/add.html
index f30dd184b..2b822624f 100644
--- a/Application/Admin/View/PromoteCompany/add.html
+++ b/Application/Admin/View/PromoteCompany/add.html
@@ -105,6 +105,20 @@
+
+ 是否展示合同服务协议: |
+
+
+
+
+ |
+
团体归属: |
diff --git a/Application/Admin/View/PromoteCompany/edit.html b/Application/Admin/View/PromoteCompany/edit.html
index 967008ee5..14305589e 100644
--- a/Application/Admin/View/PromoteCompany/edit.html
+++ b/Application/Admin/View/PromoteCompany/edit.html
@@ -109,6 +109,20 @@
|
+
+ 是否展示合同服务协议: |
+
+
+
+
+ |
+
团体归属: |
@@ -198,7 +212,22 @@
|
-
+
+ 市场总监信息展示: |
+
+
+
+
+
+
+ |
+
@@ -368,7 +397,9 @@
"bank_name":[["nocheck",true],"银行名称不能为空"],
"bank_address":[["nocheck",true],"银行开户网点不能为空"],
"content":[["nocheck",true]],
- "status":["nocheck","","radio"]
+ "status":["nocheck","","radio"],
+ "service_agreement_show":["nocheck","","select"],
+ "marketing_director_show":["nocheck","","radio"],
}
var cres = CIC.checkAddInput(obj);
if(!cres){
diff --git a/Application/Admin/View/PromoteCompany/service_agreement_list.html b/Application/Admin/View/PromoteCompany/service_agreement_list.html
new file mode 100644
index 000000000..3f5c27d89
--- /dev/null
+++ b/Application/Admin/View/PromoteCompany/service_agreement_list.html
@@ -0,0 +1,200 @@
+
+
+
+
+
+
+
+
+
+
服务协议
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ID |
+ 标题 |
+ 操作人 |
+ 操作时间 |
+ 操作 |
+
+
+
+
+
+ aOh! 暂时还没有内容! |
+
+
+
+
+ {$data.id} |
+ {$data.name} |
+ {:get_admin_nickname($data['creator'])} |
+ {$data.created_time|date='Y-m-d H:i:s',###} |
+
+ 编辑
+ 删除
+ |
+
+
+
+
+
+
+
+
+ {$_page|default=''}
+
+
+
+
+
+
+
+
+ if(C('COLOR_STYLE')=='blue_color') echo '
+
+ ';
+
+
+
+
+
+
+
+
diff --git a/Application/Admin/View/PromoteCompany/service_agreement_save.html b/Application/Admin/View/PromoteCompany/service_agreement_save.html
new file mode 100644
index 000000000..c8356295e
--- /dev/null
+++ b/Application/Admin/View/PromoteCompany/service_agreement_save.html
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Application/Home/Controller/BaseController.class.php b/Application/Home/Controller/BaseController.class.php
index 70d61410b..d9cec83e2 100644
--- a/Application/Home/Controller/BaseController.class.php
+++ b/Application/Home/Controller/BaseController.class.php
@@ -46,6 +46,11 @@ class BaseController extends HomeController
define('G_SETTLEMENT_GRADE', 'sub_status,third_status');
}
+ if ($loginer['company_id']) {
+ $company = M('promote_company', 'tab_')->where(['id'=>$loginer['company_id']])->find();
+ $this->assign('company', $company);
+ }
+
$this->canViewUserRecharge = $this->promoteCan('view-user-recharge');
$this->checkUrlPermission();
diff --git a/Application/Home/Controller/SafeController.class.php b/Application/Home/Controller/SafeController.class.php
index 5e9d5bede..d67b04885 100644
--- a/Application/Home/Controller/SafeController.class.php
+++ b/Application/Home/Controller/SafeController.class.php
@@ -338,7 +338,14 @@ class SafeController extends BaseController{
$this->assign('addr',json_decode($address)[1]);
}
$promoteInfo['address'] = json_decode($address);
-
+ // 获取推广员的公司
+ $promoteCompany = M('promote_company', 'tab_')->where(['id'=>$promoteInfo['company_id']])->find();
+ if ($promoteCompany['service_agreement_show'] > 0) {
+ $serviceAgreement = M('service_agreement', 'tab_')->where(['id'=>$promoteCompany['service_agreement_show']])->find();
+ $serviceAgreement['content'] = $this->renderServiceAgreement($serviceAgreement['content'], $promoteInfo);
+ $this->assign("serviceAgreement",$serviceAgreement);
+ }
+ $this->assign("promoteCompany",$promoteCompany);
$this->assign("ver_status",$promoteInfo['ver_status']);
$this->assign('promoteinfo', $promoteInfo);
@@ -461,37 +468,63 @@ class SafeController extends BaseController{
$this->ajaxReturn($res);
}
- public function safeDocument() {
- $realname = $_REQUEST['realname'];
- $phone = $_REQUEST['phone'];
- $email = $_REQUEST['email'];
- $address = $_REQUEST['address'];
- if (empty($realname)) {
- $realname = '您未填写真实姓名';
- }
- if (empty($email)) {
- $email = '您未填写联系邮箱';
- }
- if (empty($address)) {
- $address = '您未填写注册地址';
- }
- if (empty($phone)) {
- $phone = '您未填写联系号码';
- }
- $time = time();
- $loginPromote = $this->getLoginPromote();
- $sn = date('Ymd') . '-' . strtoupper(substr(md5($loginPromote['id']), 8, 16));
- $endTime = date('Y-m-d',strtotime('+1 year'));
- $this->assign('time',date('Y-m-d',$time));
- $this->assign('endTime',$endTime);
- $this->assign('sn',$sn);
- $this->assign('realname',$realname);
- $this->assign('email',$email);
- $this->assign('address',$address);
- $this->assign('phone',$phone);
+ public function safeDocument($templateId=0) {
+ $template = M('service_agreement', 'tab_')->where(['id'=>$templateId])->find();
+ $promoteInfo = $this->getLoginPromote();
+
+ $sn = date('Ymd') . '-' . strtoupper(substr(md5($promoteInfo['id']), 8, 16));
+
+ $content = $template['content'];
+ $content = str_replace("{time}", date('Y-m-d'), $content);
+ $content = str_replace("{sn}", $sn, $content);
+ $content = str_replace("{endTime}", date('Y-m-d',strtotime('+1 year')), $content);
+ $content = str_replace("{account}", $promoteInfo['account'], $content);
+ $content = str_replace("{email}", $promoteInfo['email'], $content);
+ $content = str_replace("{realname}", $promoteInfo['real_name'], $content);
+ $content = str_replace("{phone}", $promoteInfo['mobile_phone'], $content);
+ $content = str_replace("{address}", $promoteInfo['address'], $content);
+
+ // $realname = $_REQUEST['realname'];
+ // $phone = $_REQUEST['phone'];
+ // $email = $_REQUEST['email'];
+ // $address = $_REQUEST['address'];
+ // if (empty($realname)) {
+ // $realname = '您未填写真实姓名';
+ // }
+ // if (empty($email)) {
+ // $email = '您未填写联系邮箱';
+ // }
+ // if (empty($address)) {
+ // $address = '您未填写注册地址';
+ // }
+ // if (empty($phone)) {
+ // $phone = '您未填写联系号码';
+ // }
+ // $time = time();
+ // $loginPromote = $this->getLoginPromote();
+
+ // $endTime = date('Y-m-d',strtotime('+1 year'));
+ // $this->assign('time',date('Y-m-d',$time));
+ // $this->assign('endTime',$endTime);
+ // $this->assign('sn',$sn);
+ // $this->assign('realname',$realname);
+ // $this->assign('email',$email);
+ // $this->assign('address',$address);
+ // $this->assign('phone',$phone);
+ $this->assign('content', $content);
$this->display();
}
+ private function renderServiceAgreement($content, $promoteInfo)
+ {
+ $content = str_replace("{account}", $promoteInfo['account'], $content);
+ $content = str_replace("{email}", $promoteInfo['email'], $content);
+ $content = str_replace("{real_name}", $promoteInfo['real_name'], $content);
+ $content = str_replace("{mobile_phone}", $promoteInfo['mobile_phone'], $content);
+ $content = str_replace("{addr}", $promoteInfo['addr'], $content);
+ return $content;
+ }
+
public function promoteLogs() {
$page = intval(I('p', 1));
$row = intval(I('row', 10));
diff --git a/Application/Home/View/default/Public/promote_base.html b/Application/Home/View/default/Public/promote_base.html
index fdc82b6fa..1e5f1685b 100644
--- a/Application/Home/View/default/Public/promote_base.html
+++ b/Application/Home/View/default/Public/promote_base.html
@@ -147,10 +147,10 @@