diff --git a/.env b/.env new file mode 100644 index 0000000..d30629e --- /dev/null +++ b/.env @@ -0,0 +1,23 @@ +APP_DEBUG = false + +[APP] +DEFAULT_TIMEZONE = Asia/Shanghai + +[DATABASE] +TYPE = mysql +HOSTNAME = 127.0.0.1 +DATABASE = youda_test +USERNAME = youda_test +PASSWORD = youda_test +HOSTPORT = 3306 +CHARSET = utf8 +DEBUG = false + +[LANG] +default_lang = zh-cn + +[REDIS] +HOST = 127.0.0.1 +PORT = 6379 +PASSWORD = +DB = 3 \ No newline at end of file diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..f8d5590 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +.env merge=ours +config/api.php merge=ours \ No newline at end of file diff --git a/.gitignore b/.gitignore index d385ba9..de53188 100755 --- a/.gitignore +++ b/.gitignore @@ -4,5 +4,4 @@ runtime/* vendor/* 404.html public/.well-known/* -.env public/ueditor/* \ No newline at end of file diff --git a/app/admin/controller/FloatBall.php b/app/admin/controller/FloatBall.php new file mode 100644 index 0000000..6a89a18 --- /dev/null +++ b/app/admin/controller/FloatBall.php @@ -0,0 +1,138 @@ +isAjax()) { + $limit = input('param.limit', 15); + $offset = input('param.offset', 0); + $where = []; + + $res = FloatBallConfig::where($where) + ->order('id', 'desc') + ->limit($offset, $limit) + ->select(); + + $total = FloatBallConfig::where($where)->count(); + + return $this->renderTable('获取成功', $total, $res, 0); + } + + return View::fetch(); + } + + /** + * 添加悬浮球配置 + */ + public function add() + { + if (request()->isPost()) { + $param = input('post.'); + $validate = $this->validate($param, [ + 'type' => 'require|number', + 'image' => 'require', + 'position_x' => 'require', + 'position_y' => 'require', + 'width' => 'require', + 'height' => 'require', + 'effect' => 'require|number', + ]); + + if (true !== $validate) { + return $this->renderError($validate); + } + + $param['status'] = isset($param['status']) ? 1 : 0; + + $res = FloatBallConfig::create($param); + if ($res) { + return $this->renderSuccess('添加成功', ['url' => (string)url('float_ball')]); + } else { + return $this->renderError('添加失败'); + } + } + + return View::fetch(); + } + + /** + * 编辑悬浮球配置 + */ + public function edit() + { + $id = input('param.id', 0); + $info = FloatBallConfig::where('id', $id)->find(); + if (empty($info)) { + return $this->renderError('数据不存在'); + } + + if (request()->isPost()) { + $param = input('post.'); + // $validate = $this->validate($param, [ + // 'type' => 'require|number', + // 'image' => 'require', + // 'position_x' => 'require', + // 'position_y' => 'require', + // 'width' => 'require', + // 'height' => 'require', + // 'effect' => 'require|number', + // ]); + + // if (true !== $validate) { + // return $this->renderError($validate); + // } + + $param['status'] = isset($param['status']) ? 1 : 0; + + $res = FloatBallConfig::update($param, ['id' => $id]); + if ($res) { + return $this->renderSuccess('编辑成功', ['url' => (string)url('float_ball')]); + } else { + return $this->renderError('编辑失败'); + } + } + + View::assign('info', $info); + return View::fetch(); + } + + /** + * 修改状态 + */ + public function status() + { + $id = input('param.id', 0); + $status = input('param.status', 0); + + $res = FloatBallConfig::update(['status' => $status], ['id' => $id]); + if ($res) { + return $this->renderSuccess('操作成功'); + } else { + return $this->renderError('操作失败'); + } + } + + /** + * 删除悬浮球配置 + */ + public function del() + { + $id = input('param.id', 0); + $res = FloatBallConfig::destroy($id); + if ($res) { + return $this->renderSuccess('删除成功'); + } else { + return $this->renderError('删除失败'); + } + } +} \ No newline at end of file diff --git a/app/admin/route/app.php b/app/admin/route/app.php index a250304..bdc14d9 100755 --- a/app/admin/route/app.php +++ b/app/admin/route/app.php @@ -377,6 +377,15 @@ Route::rule('sign_config_sort', 'SignConfig/sort', 'POST'); Route::rule('sign_config_status', 'SignConfig/status', 'POST'); Route::rule('get_coupons', 'SignConfig/getCoupons', 'GET'); +#============================ +#FloatBall.php悬浮球配置管理 +#============================ +Route::rule('float_ball', 'FloatBall/index', 'GET|POST'); +Route::rule('float_ball_add', 'FloatBall/add', 'GET|POST'); +Route::rule('float_ball_edit', 'FloatBall/edit', 'GET|POST'); +Route::rule('float_ball_del', 'FloatBall/del', 'POST'); +Route::rule('float_ball_status', 'FloatBall/status', 'POST'); + #============================ #Reward.php奖励管理 #============================ diff --git a/app/admin/view/float_ball/add.html b/app/admin/view/float_ball/add.html new file mode 100644 index 0000000..d17d27e --- /dev/null +++ b/app/admin/view/float_ball/add.html @@ -0,0 +1,249 @@ +{include file="Public/header3" /} +