request->get(); if($this->request->isAjax()){ if($get['type'] == 1){ $list = RechargeLogic::templatelists($get['type']); }else{ $list = RechargeLogic::getRechargeConfig(); } $this->_success('',$list); } return $this->fetch(); } /** * note 设置充值 * create_time 2020/10/24 11:34 */ public function setRecharge(){ $post = $this->request->post(); if($this->request->isAjax()){ RechargeLogic::setRecharge($post); $this->_success('设置成功'); } } /** * note 添加充值模板 * create_time 2020/10/23 17:52 */ public function add(){ if ($this->request->isAjax()){ $post = $this->request->post(); $result = $this->validate($post,'app\admin\validate\RechargeTemplate'); if ($result === true){ RechargeLogic::add($post); $this->_success('添加成功!'); } $this->_error($result); } return $this->fetch(); } /** * note 编辑充值模板 * create_time 2020/10/23 17:51 */ public function edit($id){ if ($this->request->isAjax()){ $post = $this->request->post(); $post['del'] = 0; $result = $this->validate($post,'app\admin\validate\RechargeTemplate'); if ($result === true){ RechargeLogic::edit($post); $this->_success('修改成功'); } $this->_error($result); } $info = RechargeLogic::getRechargeTemplate($id); $this->assign('info',$info); return $this->fetch(); } /** * note 删除充值模板 */ public function del($id) { if ($this->request->isAjax()) { $result = RechargeLogic::del($id); if ($result) { $this->_success('删除成功'); } $this->_error('删除失败'); } } public function changeFields(){ $table = 'recharge_template'; $pk_name = 'id'; $pk_value = $this->request->get('id'); $field = $this->request->get('field'); $field_value = $this->request->get('value'); $result = CommonLogic::changeTableValue($table,$pk_name,$pk_value,$field,$field_value); if($result){ $this->_success('修改成功'); } $this->_error('修改失败'); } }