Setting.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | A3Mall
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2020 http://www.a3-mall.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Author: xzncit <158373108@qq.com>
  8. // +----------------------------------------------------------------------
  9. namespace app\admin\controller\users;
  10. use app\admin\controller\Auth;
  11. use mall\response\Response;
  12. use mall\utils\Tool;
  13. use think\facade\Request;
  14. use think\facade\View;
  15. use app\common\models\Setting as SettingModel;
  16. class Setting extends Auth {
  17. /**
  18. * 基本设置
  19. * @return string|\think\response\Json
  20. * @throws \think\db\exception\DataNotFoundException
  21. * @throws \think\db\exception\DbException
  22. * @throws \think\db\exception\ModelNotFoundException
  23. */
  24. public function base(){
  25. if(Request::isAjax()){
  26. $data = Request::post();
  27. $data["username"] = strip_tags(trim($data["username"]));
  28. $data["amount"] = (float)$data["amount"];
  29. $data["bank"] = strip_tags(trim($data["bank"]));
  30. SettingModel::saveData("users",$data);
  31. return Response::returnArray("操作成功",1);
  32. }
  33. return View::fetch("",[
  34. "data"=>SettingModel::getArrayData("users")
  35. ]);
  36. }
  37. /**
  38. * 注册协议
  39. * @return string|\think\response\Json
  40. */
  41. public function register(){
  42. if(Request::isAjax()){
  43. $data = Request::post();
  44. SettingModel::saveData("register",Tool::editor($data["content"]));
  45. return Response::returnArray("操作成功",1);
  46. }
  47. return View::fetch("",[
  48. "data"=>SettingModel::getStringData("register")
  49. ]);
  50. }
  51. }