Account.php 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <?php
  2. namespace app\admin\controller;
  3. use think\facade\View;
  4. use think\facade\Lang;
  5. /**
  6. * 控制器
  7. */
  8. class Account extends AdminControl {
  9. public function initialize() {
  10. parent::initialize();
  11. Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/account.lang.php');
  12. Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/config.lang.php');
  13. }
  14. /**
  15. * 设置
  16. */
  17. public function setting() {
  18. $config_model = model('config');
  19. if (!request()->isPost()) {
  20. $list_config = rkcache('config', true);
  21. View::assign('list_config', $list_config);
  22. /* 设置卖家当前栏目 */
  23. $this->setAdminCurItem('setting');
  24. return View::fetch();
  25. } else {
  26. $update_array=array();
  27. $update_array['auto_register'] = input('post.auto_register');
  28. $result = $config_model->editConfig($update_array);
  29. if ($result) {
  30. $this->log(lang('ds_edit').lang('ds_account'),1);
  31. $this->success(lang('ds_common_save_succ'));
  32. }else{
  33. $this->log(lang('ds_edit').lang('ds_account'),0);
  34. }
  35. }
  36. }
  37. /**
  38. * QQ互联
  39. */
  40. function qq() {
  41. $config_model = model('config');
  42. if (!request()->isPost()) {
  43. $list_config = rkcache('config', true);
  44. View::assign('list_config', $list_config);
  45. //输出子菜单
  46. $this->setAdminCurItem('qq');
  47. return View::fetch('qq');
  48. } else {
  49. $update_array = array();
  50. $update_array['qq_isuse'] = input('post.qq_isuse');
  51. $update_array['qq_appid'] = input('post.qq_appid');
  52. $update_array['qq_appkey'] = input('post.qq_appkey');
  53. $result = $config_model->editConfig($update_array);
  54. if ($result === true) {
  55. $this->log(lang('ds_edit').lang('qq_settings'), 1);
  56. $this->success(lang('ds_common_save_succ'));
  57. } else {
  58. $this->log(lang('ds_edit').lang('qq_settings'), 0);
  59. $this->error(lang('ds_common_save_fail'));
  60. }
  61. }
  62. }
  63. /**
  64. * sina微博设置
  65. */
  66. public function sina() {
  67. $config_model = model('config');
  68. if (!request()->isPost()) {
  69. $list_config = rkcache('config', true);
  70. View::assign('list_config', $list_config);
  71. //输出子菜单
  72. $this->setAdminCurItem('sina');
  73. return View::fetch('sina');
  74. } else {
  75. $update_array = array();
  76. $update_array['sina_isuse'] = input('post.sina_isuse');
  77. $update_array['sina_wb_akey'] = input('post.sina_wb_akey');
  78. $update_array['sina_wb_skey'] = input('post.sina_wb_skey');
  79. $result = $config_model->editConfig($update_array);
  80. if ($result === true) {
  81. $this->log(lang('ds_edit').lang('sina_settings'), 1);
  82. $this->success(lang('ds_common_save_succ'));
  83. } else {
  84. $this->log(lang('ds_edit').lang('sina_settings'), 0);
  85. $this->error(lang('ds_common_save_fail'));
  86. }
  87. }
  88. }
  89. /**
  90. * 微信登录设置
  91. */
  92. public function wx() {
  93. $config_model = model('config');
  94. if (!request()->isPost()) {
  95. $list_config = rkcache('config', true);
  96. View::assign('list_config', $list_config);
  97. //输出子菜单
  98. $this->setAdminCurItem('wx');
  99. return View::fetch('wx');
  100. } else {
  101. $update_array = array();
  102. $update_array['weixin_isuse'] = input('post.weixin_isuse');
  103. $update_array['weixin_appid'] = input('post.weixin_appid');
  104. $update_array['weixin_secret'] = input('post.weixin_secret');
  105. $result = $config_model->editConfig($update_array);
  106. if ($result) {
  107. $this->log(lang('account_synchronous_login'));
  108. $this->success(lang('ds_common_save_succ'));
  109. } else {
  110. $this->error(lang('ds_common_save_fail'));
  111. }
  112. }
  113. }
  114. /**
  115. * 获取卖家栏目列表,针对控制器下的栏目
  116. */
  117. protected function getAdminItemList() {
  118. $menu_array = array(
  119. array(
  120. 'name' => 'setting',
  121. 'text' => lang('account_setting'),
  122. 'url' => (string)url('Account/setting')
  123. ),
  124. array(
  125. 'name' => 'qq',
  126. 'text' => lang('qq_interconnection'),
  127. 'url' => (string)url('Account/qq')
  128. ),
  129. array(
  130. 'name' => 'sina',
  131. 'text' => lang('sina_interconnection'),
  132. 'url' => (string)url('Account/sina')
  133. ),
  134. array(
  135. 'name' => 'wx',
  136. 'text' => lang('wx_login'),
  137. 'url' => (string)url('Account/wx')
  138. ),
  139. );
  140. return $menu_array;
  141. }
  142. }
  143. ?>