From 6fa32ec4d0cb9f38d49cbfb1a453513c64cb960d Mon Sep 17 00:00:00 2001 From: JerryYan <792602257@qq.com> Date: Wed, 12 Aug 2020 22:03:54 +0800 Subject: [PATCH 01/16] =?UTF-8?q?=E7=83=82=E7=AC=94=E5=A4=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hyhproject/app/controller/Note.php | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/hyhproject/app/controller/Note.php b/hyhproject/app/controller/Note.php index f7aa534..5a9d318 100644 --- a/hyhproject/app/controller/Note.php +++ b/hyhproject/app/controller/Note.php @@ -10,7 +10,7 @@ class Note extends Base { public function index(){ $userId = (int)session('WST_USER.userId'); - $model = model("note")->field(true) + $model = Db::name('note')->field(true) ->where(["user_id"=>$userId])->order("update_time", "desc") ->select(); return WSTReturn("OK", 1, $model); @@ -19,9 +19,10 @@ class Note extends Base public function detail(){ $userId = (int)session('WST_USER.userId'); if(($id = (int)input( 'id', 0)) > 0){ - $detail = model("note")->field(true) + $detail = Db::name('note') ->where(["user_id"=>$userId, "id"=>$id])->find(); if(!$detail) return WSTReturn("该条内容已被删除",0); + $detail['content'] = htmlspecialchars_decode($detail['content']); return WSTReturn("OK", 1, $detail); } return WSTReturn("异常请求",0); @@ -31,25 +32,27 @@ class Note extends Base $userId = (int)session('WST_USER.userId'); $id = (int)input( 'post.id', 0); $title = input("post.title"); - $content = input("post.content"); + $content = request()->post("content"); + $content = htmlspecialchars_decode($content); if(empty($title)) return WSTReturn("请填写标题",0); if(empty($content)) return WSTReturn("请填写内容",0); if($id > 0){ - $detail = model("note")->field(true) + $detail = Db::name('note')->field(true) ->where(["user_id"=>$userId, "id"=>$id])->select(); if(!$detail) return WSTReturn("该条内容已被删除",0); - model("note")->where(["user_id"=>$userId, "id"=>$id]) - ->save([ + Db::name('note')->where(["user_id"=>$userId, "id"=>$id]) + ->update([ "title"=>$title, "content"=>$content, "update_time"=>date("Y-m-d H:i:s"), ]); return WSTReturn("成功", 1); }elseif($id == 0){ - model("note")->save([ + Db::name('note')->insert([ "title"=>$title, "content"=>$content, "user_id"=>$userId, + "create_time"=>date("Y-m-d H:i:s"), "update_time"=>date("Y-m-d H:i:s"), ]); return WSTReturn("成功", 1); @@ -59,7 +62,7 @@ class Note extends Base public function creditIndex(){ $userId = (int)session('WST_USER.userId'); - $model = model("note_credit")->field(true) + $model = Db::name('note_credit')->field(true) ->where(["user_id"=>$userId])->order("update_time", "desc") ->select(); return WSTReturn("OK", 1, $model); @@ -76,7 +79,7 @@ class Note extends Base $cash = (float)input("post.cash"); Db::startTrans(); try{ - $id = model("note_credit")->save([ + $id = Db::name('note_credit')->save([ "title"=>$title, "content"=>$content, "user_id"=>$userId, @@ -103,7 +106,7 @@ class Note extends Base $type = (int)input("post.type", 1); $content = input("post.content"); $cash = (float)input("post.cash"); - $credit = model("note_credit")->where([ + $credit = Db::name('note_credit')->where([ "user_id"=>$userId, "id"=>$id, ])->field(true)->find(); @@ -126,7 +129,7 @@ class Note extends Base } Db::startTrans(); try{ - model("note_credit")->where([ + Db::name('note_credit')->where([ "user_id"=>$userId, "id"=>$id, ])->save($credit); From de9d4a1fc411fe40aab32ff3c84dfb97ec48fac3 Mon Sep 17 00:00:00 2001 From: JerryYan <792602257@qq.com> Date: Sat, 15 Aug 2020 17:48:44 +0800 Subject: [PATCH 02/16] =?UTF-8?q?=E8=AE=B0=E8=B4=A6,=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hyhproject/app/controller/Note.php | 213 +++++++++++++++++++---------- 1 file changed, 139 insertions(+), 74 deletions(-) diff --git a/hyhproject/app/controller/Note.php b/hyhproject/app/controller/Note.php index 5a9d318..60ddb2e 100644 --- a/hyhproject/app/controller/Note.php +++ b/hyhproject/app/controller/Note.php @@ -5,146 +5,211 @@ namespace wstmart\app\controller; use think\Db; +use think\Exception; +use think\exception\PDOException; class Note extends Base { - public function index(){ + public function index() + { $userId = (int)session('WST_USER.userId'); $model = Db::name('note')->field(true) - ->where(["user_id"=>$userId])->order("update_time", "desc") + ->where(["user_id" => $userId])->order("update_time", "desc") ->select(); return WSTReturn("OK", 1, $model); } - public function detail(){ + public function detail() + { $userId = (int)session('WST_USER.userId'); - if(($id = (int)input( 'id', 0)) > 0){ + if (($id = (int)input('id', 0)) > 0) { $detail = Db::name('note') - ->where(["user_id"=>$userId, "id"=>$id])->find(); - if(!$detail) return WSTReturn("该条内容已被删除",0); + ->where(["user_id" => $userId, "id" => $id])->find(); + if (!$detail) return WSTReturn("该条内容已被删除", 0); $detail['content'] = htmlspecialchars_decode($detail['content']); return WSTReturn("OK", 1, $detail); } - return WSTReturn("异常请求",0); + return WSTReturn("异常请求", 0); } - public function save(){ + public function save() + { $userId = (int)session('WST_USER.userId'); - $id = (int)input( 'post.id', 0); + $id = (int)input('post.id', 0); $title = input("post.title"); $content = request()->post("content"); $content = htmlspecialchars_decode($content); - if(empty($title)) return WSTReturn("请填写标题",0); - if(empty($content)) return WSTReturn("请填写内容",0); - if($id > 0){ + if (empty($title)) return WSTReturn("请填写标题", 0); + if (empty($content)) return WSTReturn("请填写内容", 0); + if ($id > 0) { $detail = Db::name('note')->field(true) - ->where(["user_id"=>$userId, "id"=>$id])->select(); - if(!$detail) return WSTReturn("该条内容已被删除",0); - Db::name('note')->where(["user_id"=>$userId, "id"=>$id]) + ->where(["user_id" => $userId, "id" => $id])->select(); + if (!$detail) return WSTReturn("该条内容已被删除", 0); + Db::name('note')->where(["user_id" => $userId, "id" => $id]) ->update([ - "title"=>$title, - "content"=>$content, - "update_time"=>date("Y-m-d H:i:s"), + "title" => $title, + "content" => $content, + "update_time" => date("Y-m-d H:i:s"), ]); return WSTReturn("成功", 1); - }elseif($id == 0){ + } elseif ($id == 0) { Db::name('note')->insert([ - "title"=>$title, - "content"=>$content, - "user_id"=>$userId, - "create_time"=>date("Y-m-d H:i:s"), - "update_time"=>date("Y-m-d H:i:s"), + "title" => $title, + "content" => $content, + "user_id" => $userId, + "create_time" => date("Y-m-d H:i:s"), + "update_time" => date("Y-m-d H:i:s"), ]); return WSTReturn("成功", 1); } - return WSTReturn("异常请求",0); + return WSTReturn("异常请求", 0); } - public function creditIndex(){ + public function creditIndex() + { $userId = (int)session('WST_USER.userId'); $model = Db::name('note_credit')->field(true) - ->where(["user_id"=>$userId])->order("update_time", "desc") + ->where(["user_id" => $userId])->order("update_time", "desc") ->select(); return WSTReturn("OK", 1, $model); } - public function creditDetail(){ - + public function creditDetail() + { + $userId = (int)session('WST_USER.userId'); + if (($id = (int)input('id', 0)) > 0) { + $detail = Db::name('note_credit') + ->where(["user_id" => $userId, "id" => $id])->find(); + if (!$detail) return WSTReturn("该条内容已被删除", 0); + $detail['content'] = htmlspecialchars_decode($detail['content']); + return WSTReturn("OK", 1, $detail); + } + return WSTReturn("异常请求", 0); } - public function creditCreate(){ + public function creditDetailInfo() + { + $userId = (int)session('WST_USER.userId'); + if (($id = (int)input('id', 0)) > 0) { + $detail = Db::name('note_credit_detail') + ->order('create_time', 'desc') + ->where(["user_id" => $userId, "credit_id" => $id])->select(); + foreach ($detail as &$item) { + $item['create_date'] = date('Y-m-d', strtotime($item['create_time'])); + } + return WSTReturn("OK", 1, $detail); + } + return WSTReturn("异常请求", 0); + } + + public function creditCreate() + { $userId = (int)session('WST_USER.userId'); $title = input("post.title"); $content = input("post.content"); $cash = (float)input("post.cash"); Db::startTrans(); - try{ + try { $id = Db::name('note_credit')->save([ - "title"=>$title, - "content"=>$content, - "user_id"=>$userId, - "cur_cash"=>$cash, + "title" => $title, + "content" => $content, + "user_id" => $userId, + "cur_cash" => $cash, ]); - model("note_credit_detail")->save([ - "credit_id"=>$id, - "type"=>0, - "cash"=>$cash, - "content"=>"新建时填写的值", - "create_time"=>date("Y-m-d H:i:s"), + Db::name("note_credit_detail")->save([ + "credit_id" => $id, + "type" => 0, + "cash" => $cash, + "content" => "新建时填写的值", + "create_time" => date("Y-m-d H:i:s"), ]); Db::commit(); return WSTReturn("OK", 1); - }catch (\Exception $e) { - Db::rollback();errLog($e); - return WSTReturn('操作失败',-1); + } catch (\Exception $e) { + Db::rollback(); + errLog($e); + return WSTReturn('操作失败', -1); } } - public function creditAdd(){ + public function creditSave() + { $userId = (int)session('WST_USER.userId'); - $id = (int)input( 'post.id', 0); - $type = (int)input("post.type", 1); - $content = input("post.content"); - $cash = (float)input("post.cash"); - $credit = Db::name('note_credit')->where([ - "user_id"=>$userId, - "id"=>$id, - ])->field(true)->find(); - if(empty($credit)){ - return WSTReturn("数据不存在",0); + $id = (int)input('post.id', 0); + $name = input("post.name"); + $cur_cash = input('post.cur_cash'); + $credit_cash = input('post.credit_cash'); + $detail = Db::name('note_credit') + ->where(["user_id" => $userId, "id" => $id])->find(); + if (!$detail) return WSTReturn("该条内容已被删除", 0); + Db::startTrans(); + try { + if ($detail['cur_cash'] != $cur_cash) { + Db::name('note_credit') + ->where(["user_id" => $userId, "id" => $id]) + ->update(compact('cur_cash')); + Db::name("note_credit_detail")->insert([ + "credit_id" => $id, + "user_id"=>$userId, + "type" => 9, + "amount" => $cur_cash, + "create_time" => date("Y-m-d H:i:s"), + ]); + } + Db::name('note_credit') + ->where(["user_id" => $userId, "id" => $id]) + ->update(compact('name', 'credit_cash')); + Db::commit(); + return WSTReturn("OK", 1); + } catch (Exception $e) { + Db::rollback(); + errLog($e); + return WSTReturn('操作失败', -1); } - switch ($type){ + } + + public function creditAdd() + { + $userId = (int)session('WST_USER.userId'); + $id = (int)input('post.id', 0); + $type = (int)input("post.type", 1); + $amount = (float)input("post.amount"); + $credit = Db::name('note_credit')->where([ + "user_id" => $userId, + "id" => $id, + ])->field(true)->find(); + if (empty($credit)) { + return WSTReturn("数据不存在", 0); + } + switch ($type) { case 1: //+ - $credit["cash"] += $cash; + $credit["amount"] += $amount; break; case 2: //- - $credit["cash"] -= $cash; - break; - case 9: - //- - $credit["cash"] = $cash; + $credit["amount"] -= $amount; break; } Db::startTrans(); - try{ + try { Db::name('note_credit')->where([ - "user_id"=>$userId, - "id"=>$id, + "user_id" => $userId, + "id" => $id, ])->save($credit); - model("note_credit_detail")->save([ - "credit_id"=>$id, - "type"=>$type, - "cash"=>$cash, - "content"=>$content, - "create_time"=>date("Y-m-d H:i:s"), + Db::name("note_credit_detail")->insert([ + "credit_id" => $id, + "user_id"=>$userId, + "type" => $type, + "amount" => $amount, + "create_time" => date("Y-m-d H:i:s"), ]); Db::commit(); return WSTReturn("OK", 1); - }catch (\Exception $e) { - Db::rollback();errLog($e); - return WSTReturn('操作失败',-1); + } catch (\Exception $e) { + Db::rollback(); + errLog($e); + return WSTReturn('操作失败', -1); } } } \ No newline at end of file From c74f56a43b30f99f384c1eb5312012fe38ddebb5 Mon Sep 17 00:00:00 2001 From: JerryYan <792602257@qq.com> Date: Sun, 16 Aug 2020 14:05:34 +0800 Subject: [PATCH 03/16] =?UTF-8?q?=E7=83=82=E7=AC=94=E5=A4=B4=E6=96=B0?= =?UTF-8?q?=E5=A2=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hyhproject/app/controller/Note.php | 57 +++++++++++++----------------- 1 file changed, 25 insertions(+), 32 deletions(-) diff --git a/hyhproject/app/controller/Note.php b/hyhproject/app/controller/Note.php index 60ddb2e..531fd62 100644 --- a/hyhproject/app/controller/Note.php +++ b/hyhproject/app/controller/Note.php @@ -6,7 +6,6 @@ namespace wstmart\app\controller; use think\Db; use think\Exception; -use think\exception\PDOException; class Note extends Base { @@ -102,43 +101,37 @@ class Note extends Base return WSTReturn("异常请求", 0); } - public function creditCreate() - { - $userId = (int)session('WST_USER.userId'); - $title = input("post.title"); - $content = input("post.content"); - $cash = (float)input("post.cash"); - Db::startTrans(); - try { - $id = Db::name('note_credit')->save([ - "title" => $title, - "content" => $content, - "user_id" => $userId, - "cur_cash" => $cash, - ]); - Db::name("note_credit_detail")->save([ - "credit_id" => $id, - "type" => 0, - "cash" => $cash, - "content" => "新建时填写的值", - "create_time" => date("Y-m-d H:i:s"), - ]); - Db::commit(); - return WSTReturn("OK", 1); - } catch (\Exception $e) { - Db::rollback(); - errLog($e); - return WSTReturn('操作失败', -1); - } - } - public function creditSave() { $userId = (int)session('WST_USER.userId'); - $id = (int)input('post.id', 0); + $id = (int)input('post.id', -1); $name = input("post.name"); $cur_cash = input('post.cur_cash'); $credit_cash = input('post.credit_cash'); + if ($id == 0){ + Db::startTrans(); + try { + $id = Db::name('note_credit')->insertGetId([ + "user_id" => $userId, "id" => $id, + "cur_cash" => $cur_cash, + 'name' => $name, + 'credit_cash' => $credit_cash, + ]); + Db::name("note_credit_detail")->insert([ + "credit_id" => $id, + "user_id"=>$userId, + "type" => 0, + "amount" => $cur_cash, + "create_time" => date("Y-m-d H:i:s"), + ]); + Db::commit(); + return WSTReturn("OK", 1); + } catch (\Exception $e) { + Db::rollback(); + errLog($e); + return WSTReturn('操作失败', -1); + } + } $detail = Db::name('note_credit') ->where(["user_id" => $userId, "id" => $id])->find(); if (!$detail) return WSTReturn("该条内容已被删除", 0); From 68663ed74dc2a94dd1f53cc003db728bbe4ff9b8 Mon Sep 17 00:00:00 2001 From: JerryYan <792602257@qq.com> Date: Sun, 16 Aug 2020 15:03:26 +0800 Subject: [PATCH 04/16] =?UTF-8?q?=E7=83=82=E7=AC=94=E5=A4=B4=E8=AE=B0?= =?UTF-8?q?=E8=B4=A6=E6=96=B0=E5=A2=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hyhproject/app/controller/Note.php | 68 ++++++++++++++++++++++++++++-- 1 file changed, 65 insertions(+), 3 deletions(-) diff --git a/hyhproject/app/controller/Note.php b/hyhproject/app/controller/Note.php index 531fd62..690b18d 100644 --- a/hyhproject/app/controller/Note.php +++ b/hyhproject/app/controller/Note.php @@ -64,6 +64,14 @@ class Note extends Base return WSTReturn("异常请求", 0); } + public function delete() { + $userId = (int)session('WST_USER.userId'); + $id = (int)input('post.id', -1); + Db::name('note') + ->where(["user_id" => $userId, "id" => $id])->delete(); + return WSTReturn("OK", 1); + } + public function creditIndex() { $userId = (int)session('WST_USER.userId'); @@ -177,11 +185,11 @@ class Note extends Base switch ($type) { case 1: //+ - $credit["amount"] += $amount; + $credit["cur_cash"] -= $amount; break; case 2: //- - $credit["amount"] -= $amount; + $credit["cur_cash"] += $amount; break; } Db::startTrans(); @@ -189,7 +197,7 @@ class Note extends Base Db::name('note_credit')->where([ "user_id" => $userId, "id" => $id, - ])->save($credit); + ])->update($credit); Db::name("note_credit_detail")->insert([ "credit_id" => $id, "user_id"=>$userId, @@ -205,4 +213,58 @@ class Note extends Base return WSTReturn('操作失败', -1); } } + + public function creditDelete() { + $userId = (int)session('WST_USER.userId'); + $id = (int)input('post.id', -1); + Db::name('note_credit') + ->where(["user_id" => $userId, "id" => $id])->delete(); + return WSTReturn("OK", 1); + } + + public function creditDeleteInfo () { + $userId = (int)session('WST_USER.userId'); + $id = (int)input('post.id', 0); + $cid = (int)input('post.credit_id', 0); + $credit = Db::name('note_credit')->where([ + "user_id" => $userId, + "id" => $cid, + ])->field(true)->find(); + $detail = Db::name("note_credit_detail")->where([ + "credit_id" => $cid, + "user_id"=>$userId, + "id" => $id, + ])->field(true)->find(); + if (empty($credit) || empty($detail)) { + return WSTReturn("数据不存在", 0); + } + switch ((int)$detail['type']) { + case 1: + //+ + $credit["cur_cash"] += $detail['amount']; + break; + case 2: + //- + $credit["cur_cash"] -= $detail['amount']; + break; + } + Db::startTrans(); + try { + Db::name('note_credit')->where([ + "user_id" => $userId, + "id" => $cid, + ])->update($credit); + Db::name("note_credit_detail")->where([ + "credit_id" => $cid, + "user_id"=>$userId, + "id" => $id, + ])->delete(); + Db::commit(); + return WSTReturn("OK", 1); + } catch (\Exception $e) { + Db::rollback(); + errLog($e); + return WSTReturn('操作失败', -1); + } + } } \ No newline at end of file From cfacbe39540dc3dcdc8a715fdeffc1006fb6812b Mon Sep 17 00:00:00 2001 From: JerryYan <792602257@qq.com> Date: Sun, 16 Aug 2020 15:16:43 +0800 Subject: [PATCH 05/16] =?UTF-8?q?=E4=BA=A4=E6=98=93=E8=A7=84=E5=88=99list?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hyhproject/app/controller/TradeRule.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hyhproject/app/controller/TradeRule.php b/hyhproject/app/controller/TradeRule.php index 90d8b82..2807365 100644 --- a/hyhproject/app/controller/TradeRule.php +++ b/hyhproject/app/controller/TradeRule.php @@ -4,11 +4,13 @@ namespace wstmart\app\controller; +use think\Db; + class TradeRule extends Base { public function index() { - $model = model("trade_rule")->field(true) + $model = Db::name("trade_rule")->field(true) ->order("create_time", "desc") ->select(); return WSTReturn("OK", 1, $model); @@ -17,8 +19,9 @@ class TradeRule extends Base public function detail() { if(($id = (int)input( 'id', 0)) > 0){ - $detail = model("trade_rule")->field(true) + $detail = Db::name("trade_rule")->field(true) ->where(["id"=>$id])->find(); + $detail['content'] = htmlspecialchars_decode($detail['content']); if(!$detail) return WSTReturn("该条内容已被删除",0); return WSTReturn("OK", 1, $detail); } From da8b0d7268fa4c5365117ddd41abcc7f1eb8bb9b Mon Sep 17 00:00:00 2001 From: JerryYan <792602257@qq.com> Date: Sun, 16 Aug 2020 15:33:22 +0800 Subject: [PATCH 06/16] =?UTF-8?q?=E5=90=8E=E5=8F=B0=E4=BA=A4=E6=98=93?= =?UTF-8?q?=E8=A7=84=E5=88=99=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hyhproject/admin/model/TradeRule.php | 1 + 1 file changed, 1 insertion(+) diff --git a/hyhproject/admin/model/TradeRule.php b/hyhproject/admin/model/TradeRule.php index 1bca90c..69745a2 100644 --- a/hyhproject/admin/model/TradeRule.php +++ b/hyhproject/admin/model/TradeRule.php @@ -48,6 +48,7 @@ class TradeRule extends Base public function add(){ $data = input('post.'); WSTUnset($data,'id,dataFlag,isShow'); + $data['content'] = htmlspecialchars_decode($data['content']); $data['create_time'] = date('Y-m-d H:i:s'); Db::startTrans(); try{ From 01c0302b8a28becd19df3f2e43a4e89144d81e85 Mon Sep 17 00:00:00 2001 From: JerryYan <792602257@qq.com> Date: Wed, 19 Aug 2020 12:57:20 +0800 Subject: [PATCH 07/16] =?UTF-8?q?=E4=BA=A4=E6=98=93=E8=A7=84=E5=88=99?= =?UTF-8?q?=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hyhproject/admin/model/TradeRule.php | 1 + hyhproject/app/controller/TradeRule.php | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/hyhproject/admin/model/TradeRule.php b/hyhproject/admin/model/TradeRule.php index 69745a2..59b7ec9 100644 --- a/hyhproject/admin/model/TradeRule.php +++ b/hyhproject/admin/model/TradeRule.php @@ -78,6 +78,7 @@ class TradeRule extends Base public function edit(){ $id = input('post.id/d'); $data = input('post.'); + $data['content'] = htmlspecialchars_decode($data['content']); WSTUnset($data,'id,dataFlag,isShow,create_time'); Db::startTrans(); try{ diff --git a/hyhproject/app/controller/TradeRule.php b/hyhproject/app/controller/TradeRule.php index 2807365..380b694 100644 --- a/hyhproject/app/controller/TradeRule.php +++ b/hyhproject/app/controller/TradeRule.php @@ -13,6 +13,10 @@ class TradeRule extends Base $model = Db::name("trade_rule")->field(true) ->order("create_time", "desc") ->select(); + foreach ($model as $detail) { + $detail['content'] = htmlspecialchars_decode($detail['content']); + return $detail; + } return WSTReturn("OK", 1, $model); } @@ -21,8 +25,8 @@ class TradeRule extends Base if(($id = (int)input( 'id', 0)) > 0){ $detail = Db::name("trade_rule")->field(true) ->where(["id"=>$id])->find(); - $detail['content'] = htmlspecialchars_decode($detail['content']); if(!$detail) return WSTReturn("该条内容已被删除",0); + $detail['content'] = htmlspecialchars_decode($detail['content']); return WSTReturn("OK", 1, $detail); } return WSTReturn("异常请求",0); From 7179dbdd114b410cfeb8af5bd661a14ea310c0f2 Mon Sep 17 00:00:00 2001 From: JerryYan <792602257@qq.com> Date: Wed, 19 Aug 2020 13:01:12 +0800 Subject: [PATCH 08/16] =?UTF-8?q?=E4=BA=A4=E6=98=93=E8=A7=84=E5=88=99?= =?UTF-8?q?=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hyhproject/app/controller/TradeRule.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hyhproject/app/controller/TradeRule.php b/hyhproject/app/controller/TradeRule.php index 380b694..3b9bf85 100644 --- a/hyhproject/app/controller/TradeRule.php +++ b/hyhproject/app/controller/TradeRule.php @@ -13,9 +13,8 @@ class TradeRule extends Base $model = Db::name("trade_rule")->field(true) ->order("create_time", "desc") ->select(); - foreach ($model as $detail) { + foreach ($model as &$detail) { $detail['content'] = htmlspecialchars_decode($detail['content']); - return $detail; } return WSTReturn("OK", 1, $model); } From 2383d24c12d9fc0bacb9b7e35720f3bb5c6689b0 Mon Sep 17 00:00:00 2001 From: JerryYan <792602257@qq.com> Date: Wed, 19 Aug 2020 13:07:59 +0800 Subject: [PATCH 09/16] =?UTF-8?q?=E5=88=87=E6=8D=A2=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hyhproject/admin/view/trade_rule/trade_rule.js | 2 +- hyhproject/app/controller/TradeRule.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/hyhproject/admin/view/trade_rule/trade_rule.js b/hyhproject/admin/view/trade_rule/trade_rule.js index 494d0d6..8f15da2 100644 --- a/hyhproject/admin/view/trade_rule/trade_rule.js +++ b/hyhproject/admin/view/trade_rule/trade_rule.js @@ -5,7 +5,7 @@ function initGrid(){ {title:'文章ID', name:'id' ,width:30,sortable:true}, {title:'标题', name:'title' ,width:200,sortable:true}, {title:'是否显示', name:'isShow' ,width:50,sortable:true, renderer: function(val,item,rowIndex){ - return '
'; + return ''; }}, {title:'创建时间', name:'create_time' ,width:120,sortable:true}, {title:'操作', name:'' ,width:100, align:'center', renderer: function(val,item,rowIndex){ diff --git a/hyhproject/app/controller/TradeRule.php b/hyhproject/app/controller/TradeRule.php index 3b9bf85..0b5a78a 100644 --- a/hyhproject/app/controller/TradeRule.php +++ b/hyhproject/app/controller/TradeRule.php @@ -12,6 +12,7 @@ class TradeRule extends Base { $model = Db::name("trade_rule")->field(true) ->order("create_time", "desc") + ->where('isShow', '1') ->select(); foreach ($model as &$detail) { $detail['content'] = htmlspecialchars_decode($detail['content']); From 6fb1da3141a98fadd57b4ed5be17db15b17aa2fc Mon Sep 17 00:00:00 2001 From: JerryYan <792602257@qq.com> Date: Sat, 22 Aug 2020 21:00:23 +0800 Subject: [PATCH 10/16] =?UTF-8?q?=E8=BF=98=E6=AC=BE=E6=97=A5=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hyhproject/app/controller/Note.php | 4 +++- hyhproject/app/controller/Users.php | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/hyhproject/app/controller/Note.php b/hyhproject/app/controller/Note.php index 690b18d..4117c53 100644 --- a/hyhproject/app/controller/Note.php +++ b/hyhproject/app/controller/Note.php @@ -116,6 +116,7 @@ class Note extends Base $name = input("post.name"); $cur_cash = input('post.cur_cash'); $credit_cash = input('post.credit_cash'); + $return_date = input('post.return_date', 1); if ($id == 0){ Db::startTrans(); try { @@ -124,6 +125,7 @@ class Note extends Base "cur_cash" => $cur_cash, 'name' => $name, 'credit_cash' => $credit_cash, + "return_date" => $return_date, ]); Db::name("note_credit_detail")->insert([ "credit_id" => $id, @@ -159,7 +161,7 @@ class Note extends Base } Db::name('note_credit') ->where(["user_id" => $userId, "id" => $id]) - ->update(compact('name', 'credit_cash')); + ->update(compact('name', 'credit_cash', 'return_date')); Db::commit(); return WSTReturn("OK", 1); } catch (Exception $e) { diff --git a/hyhproject/app/controller/Users.php b/hyhproject/app/controller/Users.php index 532a89e..cdd074c 100755 --- a/hyhproject/app/controller/Users.php +++ b/hyhproject/app/controller/Users.php @@ -1,5 +1,6 @@ getShareInfo(); } + + /** + * 注销 + */ + public function unregister(){ + $m = new M(); + $userId = $this->getUserId(); + $user = $m->getById($userId); + if (empty($user)) exit(jsonReturn('系统异常',0,[])); + $opUser = input('post.op_user'); + // TODO: 记录操作人员名称 + // TODO: 验证规则 + Db::startTrans(); + $m->where('userId', '=', $userId)->update([ + 'dataFlag'=>9, + ]); + Db::rollback(); + exit(jsonReturn('成功',1,[])); + } } From fd55825f523abbfb2aa3df79ca8955227397180f Mon Sep 17 00:00:00 2001 From: JerryYan <792602257@qq.com> Date: Sat, 22 Aug 2020 21:20:51 +0800 Subject: [PATCH 11/16] =?UTF-8?q?=E6=94=B6=E6=AC=BE=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hyhproject/app/controller/Users.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/hyhproject/app/controller/Users.php b/hyhproject/app/controller/Users.php index cdd074c..e061074 100755 --- a/hyhproject/app/controller/Users.php +++ b/hyhproject/app/controller/Users.php @@ -840,6 +840,29 @@ public function forgetPasss(){ return $m->getShareInfo(); } + + public function setting_recive() { + $userId = $this->getUserId(); + if ($this->request->isPost()) { + $data = [ + 'realname'=>input('post.realname'), + 'bankName'=>input('post.bankName'), + 'bankNo'=>input('post.bankNo'), + 'alipayRecive'=>input('post.alipayRecive'), + 'wechatRecive'=>input('post.wechatRecive'), + ]; + if(Db::name('user_recive')->where('userId', '=', $userId)->count() > 0) { + Db::name('user_recive')->where('userId', '=', $userId)->update($data); + } else { + $data['userId'] = $userId; + Db::name('user_recive')->insert($data); + } + return WSTReturn("成功", 1, $data); + } else { + $data = Db::name('user_recive')->where('userId', '=', $userId)->find(); + return WSTReturn("成功", 1, $data); + } + } /** * 注销 */ From 252a83f5781d1318a800b2f920ab5b286400a8c3 Mon Sep 17 00:00:00 2001 From: JerryYan <792602257@qq.com> Date: Sat, 22 Aug 2020 21:52:24 +0800 Subject: [PATCH 12/16] =?UTF-8?q?=E8=B4=A6=E5=8F=B7=E6=B3=A8=E9=94=80:?= =?UTF-8?q?=E9=99=A4=E6=89=8B=E6=9C=BA=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hyhproject/app/controller/Users.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/hyhproject/app/controller/Users.php b/hyhproject/app/controller/Users.php index e061074..a247db8 100755 --- a/hyhproject/app/controller/Users.php +++ b/hyhproject/app/controller/Users.php @@ -676,7 +676,7 @@ public function forgetPasss(){ //禁止缓存 header('Cache-Control:no-cache,must-revalidate'); header('Pragma:no-cache'); - //$code = input("post.verifyCode"); + $code = input("post.verifyCode"); $step = input("post.step/d"); switch ($step) { case 1:#第一步,验证身份 @@ -872,13 +872,21 @@ public function forgetPasss(){ $user = $m->getById($userId); if (empty($user)) exit(jsonReturn('系统异常',0,[])); $opUser = input('post.op_user'); + $opContent = input('post.op_content'); // TODO: 记录操作人员名称 // TODO: 验证规则 Db::startTrans(); - $m->where('userId', '=', $userId)->update([ - 'dataFlag'=>9, + Db::name('user_lock')->insert([ + 'lockTime'=>0, + 'lockReason'=>'账号已注销,操作人:'.$opUser.',注销申请内容:'.$opContent, + 'createTime'=>time(), + 'adminId'=>0, + 'userId'=>$userId, ]); - Db::rollback(); - exit(jsonReturn('成功',1,[])); + $m->where('userId', '=', $userId)->update([ + 'userStatus'=>0, + ]); + Db::commit(); + exit(jsonReturn('账号注销成功',1,[])); } } From ccf07ecb2f6f79a3ba23032be2c931b323f3feef Mon Sep 17 00:00:00 2001 From: JerryYan <792602257@qq.com> Date: Sat, 22 Aug 2020 21:54:57 +0800 Subject: [PATCH 13/16] =?UTF-8?q?=E8=B4=A6=E5=8F=B7=E6=B3=A8=E9=94=80?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hyhproject/common/model/Users.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hyhproject/common/model/Users.php b/hyhproject/common/model/Users.php index dc01756..f1701d3 100755 --- a/hyhproject/common/model/Users.php +++ b/hyhproject/common/model/Users.php @@ -168,8 +168,11 @@ class Users extends Base{ ->where(["dataFlag"=>1]) ->find(); if(isset($rs['userStatus']) && 0 == $rs['userStatus']){//禁用状态 - $lockInfo = Db::name('user_lock')->where(['userId'=>$rs['userId']])->field('lockReason,lockTime,createTime')->order('id DESC')->find(); + $lockInfo = Db::name('user_lock')->where(['userId'=>$rs['userId']])->field('adminId,lockReason,lockTime,createTime')->order('id DESC')->find(); if($lockInfo){ + if(0 == $lockInfo['adminId']){ + return WSTReturn($lockInfo['lockReason']); + } if(0 == $lockInfo['lockTime']){ return WSTReturn("账号已禁用,禁用原因:".$lockInfo['lockReason'].',禁用时间:永久'); } From 351f664b8e001f49ec710f7e2a0366ceb1e792e5 Mon Sep 17 00:00:00 2001 From: JerryYan <792602257@qq.com> Date: Sat, 22 Aug 2020 21:55:30 +0800 Subject: [PATCH 14/16] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hyhproject/common/model/Users.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hyhproject/common/model/Users.php b/hyhproject/common/model/Users.php index f1701d3..0717c83 100755 --- a/hyhproject/common/model/Users.php +++ b/hyhproject/common/model/Users.php @@ -663,7 +663,7 @@ class Users extends Base{ Db::commit(); return WSTReturn("绑定成功",1); }else{ - Db::rollback();errLog($e); + Db::rollback();errLog('失败'); return WSTReturn("",-1); } }catch (\Exception $e) { @@ -729,7 +729,7 @@ class Users extends Base{ session('findPass',null); return WSTReturn("修改成功", 1); } - return $rs; + return []; } /** From 8f058ff445e8e8b4df81b6334a319991a6b24173 Mon Sep 17 00:00:00 2001 From: JerryYan <792602257@qq.com> Date: Mon, 24 Aug 2020 22:49:23 +0800 Subject: [PATCH 15/16] 2222222222222222222 --- hyhproject/common/model/Orders.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hyhproject/common/model/Orders.php b/hyhproject/common/model/Orders.php index b1a34b9..8937f5e 100755 --- a/hyhproject/common/model/Orders.php +++ b/hyhproject/common/model/Orders.php @@ -1528,7 +1528,7 @@ class Orders extends Base{ if((int)$order["helpUserLevel"]!==0){ $vm->insertHelpSaleNotice($order["helpUserId"], $orderId, $calBaseNum*((float)dataConf('helpSaleCouponsCalBase')/100), '预获助购转换所扣', 0); - $sm->addSysSummary($calBaseNum*((float)dataConf('helpSaleCouponsCalBase')/100),0,2,'订单【'.$order['orderNo']?:'--'.'】被助购转换所扣'); + $sm->addSysSummary($calBaseNum*((float)dataConf('helpSaleCouponsCalBase')/100),0,2,'订单【'.($order['orderNo']?:'--').'】被助购转换所扣'); $vm->insertVouchersNotice($order['helpUserId'], $orderId, $calBaseNum*((float)dataConf('helpSaleCouponsCalBase')/100), 0, '预获产品券转换所扣',0); $vm->insertAlreadyVouchersNotice($order['helpUserId'], $orderId, $calBaseNum*((float)dataConf('helpSaleCouponsCalBase')/100), 0, From 3dcd915a9047902c80aa04a166805d5b3f2d65b5 Mon Sep 17 00:00:00 2001 From: JerryYan <792602257@qq.com> Date: Mon, 24 Aug 2020 22:56:48 +0800 Subject: [PATCH 16/16] =?UTF-8?q?=E5=82=BB=E4=BA=86TAT?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hyhproject/common/model/Settlements.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hyhproject/common/model/Settlements.php b/hyhproject/common/model/Settlements.php index d3f0cf4..7c0743d 100755 --- a/hyhproject/common/model/Settlements.php +++ b/hyhproject/common/model/Settlements.php @@ -28,7 +28,7 @@ class Settlements extends Base //加入快代付值 $fastScale = dataConf('fastPayInSaleScale'); $fastNum = round($discountMoney * ($fastScale*0.01),5); - Model('SysSummary')->addToPayFast($orderId,$fastNum,$fastScale,'订单【'.$order['orderNo']?:'--'.'】优惠款加入'); + Model('SysSummary')->addToPayFast($orderId,$fastNum,$fastScale,'订单【'.($order['orderNo']?:'--').'】优惠款加入'); //获取产品额 $totalMoney = $order->realTotalMoney;//产品额 if(2 != $order->goodsType){//助微吧商品不给购户券值