model = new SystemConfig(); } /** * @NodeAnotation(title="列表") */ public function index() { $this->assign('total_renwu', 11); $this->assign('total_shouxu', 22); return $this->fetch(); } /** * @NodeAnotation(title="保存") */ public function save() { $this->checkPostRequest(); $post = $this->request->post(); sr_log(json_encode($post)); // if (isset($post['xz_min_money'])){ // if ($post['xz_min_money'] > $post['xz_max_money']){ // return $this->error('最高级不能小于最低价'); // } // if (!($post['xz_cur_money'] < $post['xz_max_money'] && $post['xz_cur_money'] > $post['xz_min_money'])){ // return $this->error('当前价必须在区间之间'); // } // } try { // if (isset($post['xz_cur_money'])){ // // 清空所有商品详情缓存 // $list = Db::name('shop_goods')->where('goods_type', 5)->field('goods_id,goods_sn')->select()->toArray(); // foreach ($list as $key=>$val){ // CacheServices::clearToken(md5('goodsDetail_' . $val['goods_sn'])); // } // // } foreach ($post as $key => $val) { $this->model ->where('name', $key) ->update([ 'value' => $val, ]); } TriggerService::updateMenu(); TriggerService::updateSysconfig(); } catch (\Exception $e) { $this->error('保存失败'); } $this->success('保存成功'); } }