123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- <?php
- namespace App\Http\Controllers\Config;
- use App\Http\Controllers\AdminBaseController;
- use App\Models\ExpenseMoney;
- use App\Models\Level;
- use App\Models\OrderAccountsSet;
- use App\Repositories\Eloquent\ConfigRepositoryEloquent;
- use App\Servers\CommonServer;
- use App\Validators\ConfigValidator;
- use App\Http\Requests\ConfigUpdateRequest;
- use App\Models\Config;
- use App\Models\ShopSet;
- use Prettus\Validator\Exceptions\ValidatorException;
- /**
- * Class CommentTagsController.
- *
- * @package namespace App\Http\Controllers;
- */
- class ConfigsController extends AdminBaseController
- {
- protected $repository;
- protected $validator;
- /**
- * CommentTagsController constructor.
- *
- */
- public function __construct(ConfigRepositoryEloquent $repository, ConfigValidator $validator)
- {
- parent::__construct($repository, $validator);
- }
- /**
- * Display a listing of the resource.
- *
- * @return \Illuminate\Http\Response
- */
- public function index_new()
- {
- $configs=Config::whereIn('key',['exchange_money','receive_mix','receive_max','receive_level_id','receive_user_max','receive_address','open_sys','common_address','sediment_address','common_num','common_bnb','common_db'])->pluck('value','key');
- $level_list = $this->getLevelList($configs->get('receive_level_id'));
- return view('admins.configs.index',['configs'=>$configs,'levelList' => json_encode($level_list, JSON_UNESCAPED_SLASHES)]);
- }
- /**
- * 获取层级菜单组件
- * @return array
- */
- private function getLevelList($level = '0')
- {
- $option = [
- 'checked' => $level . '',
- 'attr' => [
- [
- 'value' => '0',
- 'label' => "L0",
- 'disabled' => false,
- 'notice' => '*'
- ],
- ]
- ];
- $levels=Level::select(['id','name'])->get();
- foreach ($levels as $level){
- $option['attr'][]=[
- 'value' => $level->{'id'}.'',
- 'label' => $level->{'name'},
- 'disabled' => false,
- 'notice' => '*'
- ];
- }
- return $option;
- }
- function use_expense(){
- if(request()->isMethod('post')){
- $data=request()->all();
- if(isset($data['_token']))unset($data['_token']);
- ExpenseMoney::where('id',1)->update($data);
- return $this->response(self::SUCCESS_MSG,'success','',route('admin.config.on_order_set'));
- }else{
- $configs=ExpenseMoney::where('id',1)->first();
- return view('admins.configs.use_expense',['configs'=>$configs]);
- }
- }
- /**
- * Display a listing of the resource.
- *
- * @return \Illuminate\Http\Response
- */
- public function about_us()
- {
- $configs=Config::whereIn('key',['about_us','privacy_protocol'])->pluck('value','key');
- return view('admins.configs.about_us',['configs'=>$configs]);
- }
- /**
- * Display a listing of the resource.
- *
- * @return \Illuminate\Http\Response
- */
- public function agreement()
- {
- $configs=Config::where('key','agreement')->pluck('value','key');
- return view('admins.configs.agreement',['configs'=>$configs]);
- }
- /**
- * Display a listing of the resource.
- *
- * @return \Illuminate\Http\Response
- */
- public function beans()
- {
- $configs=Config::where('key','beans')->pluck('value','key');
- return view('admins.configs.beans',['configs'=>$configs]);
- }
- /**
- * Display a listing of the resource.
- *
- * @return \Illuminate\Http\Response
- */
- public function order_set()
- {
- $configs=Config::whereIn('key',['order_affirm','order_finish'])->pluck('value','key');
- return view('admins.configs.order_set',['configs'=>$configs]);
- }
- function consume(){
- $configs=Config::whereIn('key',['consume_money','consume_for','consume_give'])->pluck('value','key');
- return view('admins.configs.consume',['configs'=>$configs]);
- }
- /**
- * Display a listing of the resource.
- *
- * @return \Illuminate\Http\Response
- */
- public function indexDown()
- {
- $configs=Config::pluck('value','key');
- return view('admins.configs.indexDown',['configs'=>$configs]);
- }
- function update_new1(){
- foreach ( request()->all() as $key => $value ){
- // 查找当前数据是否存在
- if( Config::where('key', $key)->where('value', $value)->count() ){ continue; }
- Config::where('key', $key)->update([ 'value' => $value ]);
- }
- return $this->response(self::SUCCESS_MSG,'success','');
- }
- }
|