From d2a1b0d3ca361a9381ee51c67541f97572f1905e Mon Sep 17 00:00:00 2001 From: wanghongjun <1445693971@qq,com> Date: Mon, 4 Sep 2023 16:47:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=A5=96=E9=87=91=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/AdminAgentTeam.php | 4 ++++ app/controller/AdminUserTeam.php | 2 ++ app/controller/AdminZoneManage.php | 24 ++++++++++++++++++++++++ app/model/ZoneGoodsParam.php | 5 ++++- app/validate/Zone.php | 3 ++- route/app.php | 1 + 6 files changed, 37 insertions(+), 2 deletions(-) diff --git a/app/controller/AdminAgentTeam.php b/app/controller/AdminAgentTeam.php index 6a2c1c3..5537b6d 100644 --- a/app/controller/AdminAgentTeam.php +++ b/app/controller/AdminAgentTeam.php @@ -187,6 +187,8 @@ class AdminAgentTeam extends BaseController return $this->renderSuccess('已删除'); } catch (ValidateException $validateException) { return $this->renderError($validateException->getMessage()); + } catch (\Exception $e) { + return $this->renderError('操作失败'); } } @@ -213,6 +215,8 @@ class AdminAgentTeam extends BaseController return $this->renderSuccess('添加成功'); } catch (ValidateException $validateException) { return $this->renderError($validateException->getMessage()); + } catch (\Exception $e) { + return $this->renderError('操作失败'); } } } diff --git a/app/controller/AdminUserTeam.php b/app/controller/AdminUserTeam.php index e650fda..8b5bdb3 100644 --- a/app/controller/AdminUserTeam.php +++ b/app/controller/AdminUserTeam.php @@ -110,6 +110,8 @@ class AdminUserTeam extends BaseController return $this->renderSuccess('已删除'); } catch (ValidateException $validateException) { return $this->renderError($validateException->getMessage()); + } catch (\Exception $e) { + return $this->renderError('操作失败'); } } diff --git a/app/controller/AdminZoneManage.php b/app/controller/AdminZoneManage.php index 67970b0..b892fe3 100644 --- a/app/controller/AdminZoneManage.php +++ b/app/controller/AdminZoneManage.php @@ -126,4 +126,28 @@ class AdminZoneManage extends BaseController return $this->renderError('操作失败'); } } + + /** + * 删除奖金设置 + * @return array + */ + public function goodsParamDel() + { + $param = Request::param(); + + try { + + validate(ZoneValidate::class)->scene('goodsParamDel')->check($param); + + $result = ZoneGoodsParam::destroy($param['z_g_p_id']); + + if (!$result) throw new ValidateException('删除失败'); + + return $this->renderSuccess('已删除'); + } catch (ValidateException $validateException) { + return $this->renderError($validateException->getMessage()); + } catch (\Exception $e) { + return $this->renderError('操作失败'); + } + } } diff --git a/app/model/ZoneGoodsParam.php b/app/model/ZoneGoodsParam.php index d45edef..518e115 100644 --- a/app/model/ZoneGoodsParam.php +++ b/app/model/ZoneGoodsParam.php @@ -2,10 +2,13 @@ namespace app\model; -use \think\Model; +use think\Model; +use think\model\concern\SoftDelete; class ZoneGoodsParam extends Model { + use SoftDelete; + protected $deleteTime = 'delete_time'; /** * 获取刮奖参数 diff --git a/app/validate/Zone.php b/app/validate/Zone.php index 779fce9..2faab84 100644 --- a/app/validate/Zone.php +++ b/app/validate/Zone.php @@ -36,6 +36,7 @@ class Zone extends Validate 'changeStatus' => ['zone_goods_id','status'], 'goodsParamList' => ['zone_goods_id'], 'goodsParamAdd' => ['amount','probability','zone_goods_id'], - 'goodsParamEdit' => ['z_g_p_id','amount','probability','zone_goods_id'] + 'goodsParamEdit' => ['z_g_p_id','amount','probability','zone_goods_id'], + 'goodsParamDel' => ['z_g_p_id'], ]; } diff --git a/route/app.php b/route/app.php index bbdc096..3801230 100644 --- a/route/app.php +++ b/route/app.php @@ -84,6 +84,7 @@ Route::group('adminZoneManage',function() { Route::post('zoneGoodsChangeStatus','adminZoneManage/zoneGoodsChangeStatus')->middleware(CheckAdmin::class)->allowCrossDomain(); Route::post('goodsParamList','adminZoneManage/goodsParamList')->middleware(CheckAdmin::class)->allowCrossDomain(); Route::post('goodsParamSave','adminZoneManage/goodsParamSave')->middleware(CheckAdmin::class)->allowCrossDomain(); + Route::post('goodsParamDel','adminZoneManage/goodsParamDel')->middleware(CheckAdmin::class)->allowCrossDomain(); }); # 支付(待开发)