ConfigsController.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <?php
  2. namespace App\Http\Controllers\Config;
  3. use App\Http\Controllers\AdminBaseController;
  4. use App\Models\ExpenseMoney;
  5. use App\Models\OrderAccountsSet;
  6. use App\Repositories\Eloquent\ConfigRepositoryEloquent;
  7. use App\Servers\CommonServer;
  8. use App\Validators\ConfigValidator;
  9. use App\Http\Requests\ConfigUpdateRequest;
  10. use App\Models\Config;
  11. use App\Models\ShopSet;
  12. use Prettus\Validator\Exceptions\ValidatorException;
  13. /**
  14. * Class CommentTagsController.
  15. *
  16. * @package namespace App\Http\Controllers;
  17. */
  18. class ConfigsController extends AdminBaseController
  19. {
  20. protected $repository;
  21. protected $validator;
  22. /**
  23. * CommentTagsController constructor.
  24. *
  25. */
  26. public function __construct(ConfigRepositoryEloquent $repository, ConfigValidator $validator)
  27. {
  28. parent::__construct($repository, $validator);
  29. }
  30. /**
  31. * Display a listing of the resource.
  32. *
  33. * @return \Illuminate\Http\Response
  34. */
  35. public function index_new()
  36. {
  37. $configs=Config::whereIn('key',['usdt','lucky'])->pluck('value','key');
  38. return view('admins.configs.index',['configs'=>$configs]);
  39. }
  40. function use_expense(){
  41. if(request()->isMethod('post')){
  42. $data=request()->all();
  43. if(isset($data['_token']))unset($data['_token']);
  44. ExpenseMoney::where('id',1)->update($data);
  45. return $this->response(self::SUCCESS_MSG,'success','',route('admin.config.on_order_set'));
  46. }else{
  47. $configs=ExpenseMoney::where('id',1)->first();
  48. return view('admins.configs.use_expense',['configs'=>$configs]);
  49. }
  50. }
  51. /**
  52. * Display a listing of the resource.
  53. *
  54. * @return \Illuminate\Http\Response
  55. */
  56. public function about_us()
  57. {
  58. $configs=Config::whereIn('key',['about_us','privacy_protocol'])->pluck('value','key');
  59. return view('admins.configs.about_us',['configs'=>$configs]);
  60. }
  61. /**
  62. * Display a listing of the resource.
  63. *
  64. * @return \Illuminate\Http\Response
  65. */
  66. public function agreement()
  67. {
  68. $configs=Config::where('key','agreement')->pluck('value','key');
  69. return view('admins.configs.agreement',['configs'=>$configs]);
  70. }
  71. /**
  72. * Display a listing of the resource.
  73. *
  74. * @return \Illuminate\Http\Response
  75. */
  76. public function beans()
  77. {
  78. $configs=Config::where('key','beans')->pluck('value','key');
  79. return view('admins.configs.beans',['configs'=>$configs]);
  80. }
  81. /**
  82. * Display a listing of the resource.
  83. *
  84. * @return \Illuminate\Http\Response
  85. */
  86. public function order_set()
  87. {
  88. $configs=Config::whereIn('key',['order_affirm','order_finish'])->pluck('value','key');
  89. return view('admins.configs.order_set',['configs'=>$configs]);
  90. }
  91. function consume(){
  92. $configs=Config::whereIn('key',['consume_money','consume_for','consume_give'])->pluck('value','key');
  93. return view('admins.configs.consume',['configs'=>$configs]);
  94. }
  95. /**
  96. * Display a listing of the resource.
  97. *
  98. * @return \Illuminate\Http\Response
  99. */
  100. public function indexDown()
  101. {
  102. $configs=Config::pluck('value','key');
  103. return view('admins.configs.indexDown',['configs'=>$configs]);
  104. }
  105. function update_new1(){
  106. foreach ( request()->all() as $key => $value ){
  107. // 查找当前数据是否存在
  108. if( Config::where('key', $key)->where('value', $value)->count() ){ continue; }
  109. Config::where('key', $key)->update([ 'value' => $value ]);
  110. }
  111. return $this->response(self::SUCCESS_MSG,'success','');
  112. }
  113. }