Account.php 5.7 KB

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