From 3ed5eedc0710ee0527d01a04a9542e94f64a61a7 Mon Sep 17 00:00:00 2001 From: sunke <18850253506@163.com> Date: Wed, 8 Apr 2020 13:49:05 +0800 Subject: [PATCH 01/11] =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/PromoteController.class.php | 60 +++++++++ .../Home/View/default/Promote/index.html | 34 +++++ .../default/Promote/pop_newrule_detail.html | 123 ++++++++++++++++++ 3 files changed, 217 insertions(+) create mode 100644 Application/Home/View/default/Promote/pop_newrule_detail.html diff --git a/Application/Home/Controller/PromoteController.class.php b/Application/Home/Controller/PromoteController.class.php index e0e924abe..f9c576a4b 100644 --- a/Application/Home/Controller/PromoteController.class.php +++ b/Application/Home/Controller/PromoteController.class.php @@ -232,6 +232,26 @@ class PromoteController extends BaseController $this->assign("rules", $rules); $this->assign("rules_count", count($rules)); + $promoteBelong = M('promote', 'tab_')->where(['id'=>get_pid()])->getField('company_belong'); + if (intval($promoteBelong) == 1) { + $redis = new \Org\RedisSDK\Redis(['host'=>'127.0.0.1','port'=>6379],[]); + $newcacheKey = "pop:newrule:set"; + if (!$redis->sIsMember($newcacheKey, get_pid())) { + $currentTime = strtotime(date('Y-m-d')); + $weekArray = [7,1,2,3,4,5,6]; + $week = $weekArray[date("w")]; + $match_newrules = M("document_pop_rules") + ->field('id') + ->where(['id' => 2]) + ->order("sort asc, id desc") + ->select(); + } else { + $match_newrules = []; + } + } else { + $match_newrules = []; + } + $redis = new \Org\RedisSDK\Redis(['host'=>'127.0.0.1','port'=>6379],[]); $cacheKey = "pop:rule:set"; if (!$redis->sIsMember($cacheKey, get_pid())) { @@ -246,9 +266,11 @@ class PromoteController extends BaseController } else { $match_rules = []; } + $this->assign("match_rules_id", $match_rules ? json_encode(array_column($match_rules, 'id')) : 'null'); + $this->assign("match_newrules_id", $match_newrules ? json_encode(array_column($match_newrules, 'id')) : 'null'); $this->assign("user_count", $user_count); $this->assign("total_money", $total_money); @@ -300,6 +322,44 @@ class PromoteController extends BaseController $this->display('pop_rule_detail'); } + public function popNewRuleDetail($id=0, $p=1, $row=1, $force=false) { + $result = M("document_pop_rules")->where("id in ({$id})")->page($p, $row)->select(); + if (empty($result)) { + return $this->error("未找到数据", [], true); + } + $count = M("document_pop_rules")->where("id in ({$id})")->count(); + if ($p + 1 <= $count) { + $this->assign("next_page",$p+1); + } + if ($p - 1 >= 0) { + $this->assign("preview_page",$p-1); + } + if ($p + 1 > $count) { + $this->assign("close_btn", true); + } + $this->assign("count", $count); + $this->assign("force", $force); + // return $this->success("获取数据成功", $result, true); + //$this->show("

{$result['title']}

".$result['content']); + $this->assign("rule",$result[0]); + var_dump(strtotime('next sunday')+ 24*3600);die(); + $this->display('pop_newrule_detail'); + } + + public function popNewRuleFinish() + { + $redis = new \Org\RedisSDK\Redis(['host'=>'127.0.0.1','port'=>6379],[]); + $cacheKey = "pop:newrule:set"; + if ($redis->exists($cacheKey)) { + $redis->sadd($cacheKey, get_pid()); + } else { + $redis->sadd($cacheKey, get_pid()); + $redis->exprieAt($cacheKey, strtotime('next sunday') + 24*3600); + } + return $this->success("成功", [], true); + } + + public function popRuleFinish() { $redis = new \Org\RedisSDK\Redis(['host'=>'127.0.0.1','port'=>6379],[]); diff --git a/Application/Home/View/default/Promote/index.html b/Application/Home/View/default/Promote/index.html index aa8c3c342..197167aed 100644 --- a/Application/Home/View/default/Promote/index.html +++ b/Application/Home/View/default/Promote/index.html @@ -215,6 +215,10 @@ + + + + + +
+ + + + +

{$rule.title}

+
{$rule.content}
+
+ + + + if(C('COLOR_STYLE')=='blue_color') echo ' + + '; + + + + + + + \ No newline at end of file From 2c63e6e395d6c91f4c0d6dc21d79f69da778fc8f Mon Sep 17 00:00:00 2001 From: sunke <18850253506@163.com> Date: Wed, 8 Apr 2020 13:55:53 +0800 Subject: [PATCH 02/11] =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Home/Controller/PromoteController.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/Application/Home/Controller/PromoteController.class.php b/Application/Home/Controller/PromoteController.class.php index f9c576a4b..a646bd37a 100644 --- a/Application/Home/Controller/PromoteController.class.php +++ b/Application/Home/Controller/PromoteController.class.php @@ -342,7 +342,6 @@ class PromoteController extends BaseController // return $this->success("获取数据成功", $result, true); //$this->show("

{$result['title']}

".$result['content']); $this->assign("rule",$result[0]); - var_dump(strtotime('next sunday')+ 24*3600);die(); $this->display('pop_newrule_detail'); } From bdb688c9855370b9b32c580c4050e85eab1a0a5d Mon Sep 17 00:00:00 2001 From: sunke <18850253506@163.com> Date: Thu, 9 Apr 2020 13:07:32 +0800 Subject: [PATCH 03/11] =?UTF-8?q?=E7=BC=96=E8=BE=91=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/ArticleController.class.php | 21 +++++++++++ .../Admin/View/Article/pop_rule_edit.html | 36 +++++++++++++++++++ .../Controller/PromoteController.class.php | 5 ++- .../Home/View/default/Promote/index.html | 9 +++-- 4 files changed, 67 insertions(+), 4 deletions(-) diff --git a/Application/Admin/Controller/ArticleController.class.php b/Application/Admin/Controller/ArticleController.class.php index e85f25567..ba62ede5f 100644 --- a/Application/Admin/Controller/ArticleController.class.php +++ b/Application/Admin/Controller/ArticleController.class.php @@ -918,6 +918,7 @@ class ArticleController extends AdminController { if ($_POST['type'] == 1 ) { $_POST['pop_time'] = strtotime($_POST['pop_time']); } + if ($id) { $pop_rules_model = M('document_pop_rules');//M('$this->$model_name','tab_'); $res = $pop_rules_model->where(['id'=>$id])->save($_POST); @@ -949,5 +950,25 @@ class ArticleController extends AdminController { } $this->display('pop_rule_edit'); } + + public function uploadDoc() { + $id = $_REQUEST['id']; + if(@is_uploaded_file($_FILES['file']['tmp_name'])){ + $upfile = $_FILES["file"]; + + $name = $upfile["name"]; + $type = $upfile["type"]; + $size = $upfile["size"]; + $tmp_name = $upfile["tmp_name"]; + $savePath = $_SERVER['DOCUMENT_ROOT'].__ROOT__.'/Uploads/Documents/'; + move_uploaded_file($tmp_name,$savePath.$name); + $file_name = $savePath.$name; + $error=$upfile["error"];//上传后系统返回的值 + $data['document_route'] = 'Uploads/Documents/'.$name; + M('document_pop_rules')->where(['id' => $id])->save($data); + $backData['tmp'] = $file_name; + $this->ajaxReturn(json_encode($backData,TRUE)); + } + } } diff --git a/Application/Admin/View/Article/pop_rule_edit.html b/Application/Admin/View/Article/pop_rule_edit.html index 3232af106..77aeab21d 100644 --- a/Application/Admin/View/Article/pop_rule_edit.html +++ b/Application/Admin/View/Article/pop_rule_edit.html @@ -14,6 +14,22 @@ + +
  • + + + + +
  • + +
  • + + + + + +
  • +
  • @@ -65,6 +81,26 @@ +