Account.php 5.8 KB

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