diff --git a/Application/Admin/Controller/MarketPercentageController.class.php b/Application/Admin/Controller/MarketPercentageController.class.php index ab5443d27..122320e12 100644 --- a/Application/Admin/Controller/MarketPercentageController.class.php +++ b/Application/Admin/Controller/MarketPercentageController.class.php @@ -632,19 +632,25 @@ class MarketPercentageController extends ThinkController $data['time'] = strtotime($data['timestart']); $data['create_time'] = time(); - $is_save = M("tax_radio","tab_")->add($data); + $is_hav = M("tax_radio","tab_") + ->where(['time'=>strtotime($data['timestart'])]) + ->find(); - if ($is_save) { - $this->success("保存成功",U("index")); + if ($is_hav) { + $is_save = M("tax_radio","tab_") + ->where(['time'=>strtotime($data['timestart'])]) + ->save($data); } else { - $this->error("保存失败"); + $is_save = M("tax_radio","tab_")->add($data); } + $this->success("保存成功",U("index")); + } else { $data = M("tax_radio","tab_") ->field("tax_radio,time timestart") - ->order("time DESC") + ->order("create_time DESC") ->find(); $data['timestart'] = Date("Y-m",$data['timestart']);