SystemController.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456
  1. <?php
  2. /**
  3. * 系统设置
  4. */
  5. namespace App\Http\Controllers\Admin;
  6. use App\Http\Controllers\Controller;
  7. use App\Models\ArticleType;
  8. use App\Models\LotteryMoney;
  9. use Illuminate\Http\Request as Req;
  10. use Request;
  11. /**
  12. *
  13. */
  14. class SystemController extends Controller {
  15. /**
  16. *
  17. */
  18. function index() {
  19. return view('admin.systemSet/index');
  20. }
  21. /**
  22. * 活动公告
  23. */
  24. function Article() {
  25. $dt = \App\Lib\DataTable\DataTable::init();
  26. $dt->setDataSource('/admin/System/getArticle');
  27. $dt->setLang('notice');
  28. $dt->addColsFields('id');
  29. $dt->addColsFields('title');
  30. // $dt->addColsFields('content');
  31. $dt->addColsFields('time');
  32. $dt->addColsFields('type');
  33. $dt->setToolBar(array('edit'));
  34. return view('admin.systemSet/arictle', $dt->render());
  35. }
  36. /**
  37. * 公告添加
  38. * [addNotice description]
  39. */
  40. function addNotice() {
  41. return view('admin.menu/addNotice');
  42. }
  43. // //基础设置
  44. // function BaseSet() {
  45. // $dt = \App\Lib\DataTable\DataTable::init();
  46. // $dt->setDataSource('/admin/System/getBaseSet');
  47. // $dt->setLang('notice');
  48. // $dt->addColsFields('id', array('fixed' => 'left'));
  49. // $dt->addColsFields('infoname');
  50. // $dt->addColsFields('infocontent', array('edit' => 'password'));
  51. // $dt->addColsFields('status');
  52. // $dt->setToolBar(array('save'));
  53. // return view('admin.systemSet/arictle', $dt->render());
  54. //
  55. // }
  56. //获取基础设置
  57. function getBaseSet() {
  58. $infoname = Request::has('infoname') ? Request::get('infoname') : '';
  59. $infocontent = Request::has('infocontent') ? Request::get('infocontent') : '';
  60. $status = Request::has('status') ? Request::get('status') : '';
  61. $where = array();
  62. if (!empty($infoname)) {
  63. $where[] = array('infoname', 'like', '%' . $infoname . '%');
  64. }
  65. if (!empty($infocontent)) {
  66. $where[] = array('infocontent', 'like', '%' . $infocontent . '%');
  67. }
  68. if (!empty($status)) {
  69. if ($status == 2) {
  70. $where[] = array('status', '=', '0');
  71. } else {
  72. $where[] = array('status', '=', $status);
  73. }
  74. }
  75. $db = new \App\Models\Setinfo();
  76. $data = $db->getAllSet($where);
  77. return \App\Lib\DataTable\DataTable::init()->toJson($data, count($data));
  78. }
  79. /**
  80. * 菜单管理
  81. */
  82. function Menu() {
  83. $dt = \App\Lib\DataTable\DataTable::init();
  84. $dt->setDataSource('/admin/System/getMenu');
  85. $dt->setLang('menu');
  86. $dt->addColsFields('id', array('fixed' => 'left'));
  87. $dt->addColsFields('name');
  88. $dt->addColsFields('icon');
  89. $dt->addColsFields('href');
  90. $dt->addColsFields('type');
  91. $dt->addColsFields('sort');
  92. $dt->addColsFields('parent_id');
  93. $dt->addColsFields('target');
  94. $dt->setToolBar(array('edit'));
  95. // return view('vip.menu',$dt->render());
  96. return view('admin.systemSet/menu', $dt->render());
  97. }
  98. //获取菜单列表
  99. function getMenu() {
  100. $limit = Request::has('limit') ? Request::get('limit') : '';
  101. $page = Request::has('page') ? Request::get('page') : '';
  102. $field = Request::has('field') ? Request::get('field') : '';
  103. $order = Request::has('order') ? Request::get('order') : '';
  104. $model = \App\Models\NavsModel::offset(($page - 1) * $limit)
  105. ->limit($limit);
  106. $name = Request::has('name') ? Request::get('name') : '';
  107. $href = Request::has('href') ? Request::get('href') : '';
  108. $parent_id = Request::has('parent_id') ? Request::get('parent_id') : '';
  109. $type = Request::has('type') ? Request::get('type') : '';
  110. $where = array();
  111. if (!empty($name)) {
  112. $where[] = array('name', 'like', '%' . $name . '%');
  113. }
  114. if (!empty($href)) {
  115. $where[] = array('href', 'like', '%' . $href . '%');
  116. }
  117. if (!empty($parent_id)) {
  118. $where[] = array('parent_id', '=', $parent_id);
  119. }
  120. if (!empty($type)) {
  121. if ($type == -1) {
  122. $where[] = array('type', '=', '0');
  123. } else {
  124. $where[] = array('type', '=', $type);
  125. }
  126. }
  127. if (!empty($where) && is_array($where)) {
  128. $model = $model->where($where);
  129. }
  130. if (!empty($field) && !empty($order)) {
  131. $model = $model->orderBy($field, $order);
  132. }
  133. $data = $model->get();
  134. $data = $data->toArray();
  135. if (!empty($data) && is_array($data)) {
  136. $langinfo = trans('status.dc_navs.type');
  137. foreach ($data as $k => $v) {
  138. $data[$k]['type'] = ($v['type'] == 0) ? $langinfo['-1'] : $langinfo[$v['type']];
  139. }
  140. }
  141. $count = \App\Models\NavsModel::count();
  142. return \App\Lib\DataTable\DataTable::init()->toJson($data, $count);
  143. }
  144. //获取活动信息
  145. function getArticle() {
  146. $limit = Request::has('limit') ? Request::get('limit') : 10;
  147. $title = Request::has('title') ? Request::get('title') : '';
  148. $type = Request::has('type') ? Request::get('type') : '';
  149. $add_startime = Request::has('add_startime') ? Request::get('add_startime') : '';
  150. $add_endtime = Request::has('add_endtime') ? Request::get('add_endtime') : '';
  151. $where = array();
  152. if (!empty($title)) {
  153. $where[] = array('title', 'like', '%' . $title . '%');
  154. }
  155. if (!empty($type)) {
  156. $where[] = array('type', '=', $type);
  157. }
  158. if (!empty($add_startime)) {
  159. $add_startime = date('Y-m-d H:i:s', strtotime($add_startime));
  160. $where[] = array('time', '>=', $add_startime);
  161. }
  162. if (!empty($add_endtime)) {
  163. $add_endtime = date('Y-m-d H:i:s', strtotime($add_endtime));
  164. $where[] = array('time', '<=', $add_endtime);
  165. }
  166. $db = new \App\Models\Article();
  167. $data = $db->getlist($limit, $where);
  168. $Lottery= new LotteryMoney();
  169. $activity_list = $Lottery->getLotteryList();
  170. $activity_list = is_array($activity_list)&&count($activity_list) >0?array_column($Lottery->getLotteryList(),"name","id"):[];
  171. if (count($data)>0) {
  172. //$langinfo = trans('status.article.type');
  173. //2018-09-26 修改无限级分类
  174. $_type = (new ArticleType())->type();
  175. $type = array_column($_type,"parent_path","id");
  176. $type_name = array_column($_type,"cate_name","id");
  177. foreach ($data['data'] as $k => $v) {
  178. // $data['data'][$k]['type'] = isset($langinfo[$v['type']])?$langinfo[$v['type']]:null;
  179. $act = isset($activity_list[$v["child_id"]])&&!empty($activity_list[$v["child_id"]])?"<b>【活动:".$activity_list[$v["child_id"]]."】</b>":"";
  180. $_name= isset($type_name[$v['type']])?">".$type_name[$v['type']]:"";
  181. $data['data'][$k]['type'] = isset($type[$v['type']])?$type[$v['type']].$_name.$act:$_name;
  182. }
  183. }
  184. return \App\Lib\DataTable\DataTable::init()->toJson($data['data'], $data['total']);
  185. }
  186. //获取活动信息
  187. function getArticleType() {
  188. $cen = [
  189. "1"=>"一级分类",
  190. "2"=>"二级分类",
  191. "3"=>"三级分类",
  192. "4"=>"四级分类",
  193. "5"=>"五级分类",
  194. "6"=>"六级分类",
  195. "7"=>"七级分类",
  196. "8"=>"八级分类",
  197. "9"=>"九级分类",
  198. ];
  199. $limit = Request::has('limit') ? Request::get('limit') : 10;
  200. $title = Request::has('title') ? Request::get('title') : '';
  201. $type = Request::has('type') ? Request::get('type') : '';
  202. $add_startime = Request::has('add_startime') ? Request::get('add_startime') : '';
  203. $add_endtime = Request::has('add_endtime') ? Request::get('add_endtime') : '';
  204. $where = array();
  205. if (!empty($title)) {
  206. $where[] = array('cate_name', 'like', '%' . $title . '%');
  207. }
  208. if (!empty($add_startime)) {
  209. $add_startime = date('Y-m-d H:i:s', strtotime($add_startime));
  210. $where[] = array('create_time', '>=', $add_startime);
  211. }
  212. if (!empty($add_endtime)) {
  213. $add_endtime = date('Y-m-d H:i:s', strtotime($add_endtime));
  214. $where[] = array('create_time', '<=', $add_endtime);
  215. }
  216. $db = new ArticleType();
  217. $data = $db->getlist($where,$limit );
  218. $c = count($data);
  219. if ($c>0) {
  220. foreach ($data as $k=>$v){
  221. $data[$k]["parent_path"]=empty($v["parent_path"])?$cen[1]:$v["parent_path"];
  222. }
  223. return \App\Lib\DataTable\DataTable::init()->toJson($data, $c);
  224. }
  225. return \App\Lib\DataTable\DataTable::init()->toJson($data['data']=[], $data['total']=null);
  226. }
  227. //添加菜单
  228. function AddMenu() {
  229. $id = Request::has('id') ? Request::get('id') : '';
  230. $data = array();
  231. $db = new \App\Models\NewMenu();
  232. if (!empty($id)) {
  233. $data = $db->getMenuById($id);
  234. }
  235. $parent = $db->getMenuParent();
  236. return view('admin.menu/add', ['data' => $data, 'parents' => $parent]);
  237. }
  238. function Edit(Req $req) {
  239. $id = $req->id;
  240. if (empty($id)) {
  241. abort(404);
  242. }
  243. $db = new \App\Models\NewMenu();
  244. if (!$req->isMethod('post')) {
  245. $data = $db::where('id', $id)->first();
  246. if (!$data) {
  247. abort(404);
  248. }
  249. $data = $data->toArray();
  250. $parent = $db->getMenuParent();
  251. return view('admin.menu/add', ['data' => $data, 'parents' => $parent]);
  252. } else {
  253. $model = $db::where('id', $id)->first();
  254. $model->name = $req->input('menu_name');
  255. $model->href = $req->input('menu_url');
  256. $model->icon = $req->input('menu_icon');
  257. $model->sort = $req->input('menu_sort');
  258. $model->type = $req->input('type');
  259. $model->save();
  260. return responseToJson(1);
  261. }
  262. }
  263. //添加
  264. function add() {
  265. $name = Request::get('name');
  266. echo '<pre>';
  267. print_r($_GET);
  268. print_r($_POST);
  269. }
  270. //玩法简介
  271. function Playdesc() {
  272. $dt = \App\Lib\DataTable\DataTable::init();
  273. $dt->setDataSource('/admin/System/active');
  274. $dt->setLang('notice');
  275. $dt->addColsFields('id', array('fixed' => 'left'));
  276. $dt->addColsFields('name');
  277. // $dt->addColsFields('play_desc');
  278. $dt->addColsFields('table_name');
  279. $dt->setToolBar(array('view', 'edit'));
  280. return view('admin.systemSet/arictle', $dt->render());
  281. }
  282. /**
  283. * 公告显示
  284. */
  285. function Notice() {
  286. $db = new \App\Models\Setinfo();
  287. $data = $db->getNotice();
  288. return responseToJson($data);
  289. }
  290. /**
  291. * 公告设置
  292. */
  293. function NoticeSet() {
  294. }
  295. /**
  296. * 弹框
  297. */
  298. function OutBox() {
  299. $db = new \App\Models\Setinfo();
  300. $data = $db->getBoxOut();
  301. return responseToJson($data);
  302. }
  303. /**
  304. * 手机弹框内容设置
  305. */
  306. function OutBoxSet() {
  307. }
  308. /**
  309. * 客服QQ设置
  310. */
  311. function ServerQQ() {
  312. // $data=DB::table('setinfo')->where('infotype',14)->get();
  313. // dump($data->toArray());
  314. $db = new \App\Models\Setinfo();
  315. $data = $db->getQQnumber();
  316. return responseToJson($data);
  317. }
  318. /**
  319. * 客服QQ设置修改
  320. */
  321. function ServerQQSet() {
  322. }
  323. /**
  324. * 代理设置
  325. */
  326. function Agent() {
  327. $db = new \App\Models\Setinfo();
  328. $data = $db->getAgentSet();
  329. return responseToJson($data);
  330. }
  331. /**
  332. * 代理模式设置
  333. */
  334. function AgentSet() {
  335. }
  336. /**
  337. * 平台维护
  338. */
  339. function PlatFrom() {
  340. $db = new \App\Models\Setinfo();
  341. $data = $db->getPlatSet();
  342. return responseToJson($data);
  343. }
  344. /**
  345. * 平台维护设置
  346. */
  347. function PlatFromSet() {
  348. }
  349. //虚拟游戏设置显示
  350. function Flaseprize() {
  351. $db = new \App\Models\Setinfo();
  352. $data = $db->getPrizeSet();
  353. return responseToJson($data);
  354. }
  355. //转账银行卡信息
  356. function BankInfo() {
  357. $db = new \App\Models\Setinfo();
  358. $data = $db->getBankInfo();
  359. return responseToJson($data);
  360. }
  361. //跑马灯公告
  362. function RunNotice() {
  363. $db = new \App\Models\Setinfo();
  364. $data = $db->getRunNotice();
  365. return responseToJson($data);
  366. }
  367. //注册设置信息
  368. function RegisterSet() {
  369. $db = new \App\Models\Settings();
  370. $data = $db->getSet();
  371. return responseToJson($data);
  372. }
  373. /**
  374. * 游戏玩法说明消息
  375. */
  376. function Active() {
  377. $list = Request::has('limit') ? Request::get('limit') : 10;
  378. $db = new \App\Models\GameType();
  379. $data = $db->getDescList($list);
  380. return \App\Lib\DataTable\DataTable::init()->toJson($data['data'], $data['total']);
  381. // return responseToJson($data);
  382. }
  383. /**
  384. * 修改游戏玩法内容
  385. */
  386. function ActiveSet() {
  387. // $data=DB::table('article')->limit(3)->get();
  388. // dump($data->toArray());
  389. }
  390. /**
  391. * 系统菜单列表
  392. */
  393. function SystemMenu() {
  394. $db = new \App\Models\Menu();
  395. $data = $db->getMenuAll();
  396. return responseToJson($data);
  397. }
  398. /**
  399. * 菜单
  400. */
  401. function MenuList() {
  402. $data = config('menu');
  403. return responseToJson($data);
  404. }
  405. function cceshi(){
  406. dump('start');
  407. $db=\App\Models\Role::hasRoot('11');
  408. dump($db);
  409. }
  410. }
  411. ?>