123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- <?php
- namespace app\admin\controller;
- use think\facade\View;
- use think\facade\Lang;
- /**
- * 控制器
- */
- class Account extends AdminControl {
- public function initialize() {
- parent::initialize();
- Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/account.lang.php');
- Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/config.lang.php');
- }
- /**
- * 设置
- */
- public function setting() {
- $config_model = model('config');
- if (!request()->isPost()) {
- $list_config = rkcache('config', true);
- View::assign('list_config', $list_config);
- /* 设置卖家当前栏目 */
- $this->setAdminCurItem('setting');
- return View::fetch();
- } else {
- $update_array=array();
- $update_array['auto_register'] = input('post.auto_register');
- $result = $config_model->editConfig($update_array);
- if ($result) {
- $this->log(lang('ds_edit').lang('ds_account'),1);
- $this->success(lang('ds_common_save_succ'));
- }else{
- $this->log(lang('ds_edit').lang('ds_account'),0);
- }
- }
- }
-
- /**
- * QQ互联
- */
- function qq() {
- $config_model = model('config');
- if (!request()->isPost()) {
- $list_config = rkcache('config', true);
- View::assign('list_config', $list_config);
- //输出子菜单
- $this->setAdminCurItem('qq');
- return View::fetch('qq');
- } else {
- $update_array = array();
- $update_array['qq_isuse'] = input('post.qq_isuse');
- $update_array['qq_appid'] = input('post.qq_appid');
- $update_array['qq_appkey'] = input('post.qq_appkey');
- $result = $config_model->editConfig($update_array);
- if ($result === true) {
- $this->log(lang('ds_edit').lang('qq_settings'), 1);
- $this->success(lang('ds_common_save_succ'));
- } else {
- $this->log(lang('ds_edit').lang('qq_settings'), 0);
- $this->error(lang('ds_common_save_fail'));
- }
- }
- }
- /**
- * sina微博设置
- */
- public function sina() {
- $config_model = model('config');
- if (!request()->isPost()) {
- $list_config = rkcache('config', true);
- View::assign('list_config', $list_config);
- //输出子菜单
- $this->setAdminCurItem('sina');
- return View::fetch('sina');
- } else {
- $update_array = array();
- $update_array['sina_isuse'] = input('post.sina_isuse');
- $update_array['sina_wb_akey'] = input('post.sina_wb_akey');
- $update_array['sina_wb_skey'] = input('post.sina_wb_skey');
- $result = $config_model->editConfig($update_array);
- if ($result === true) {
- $this->log(lang('ds_edit').lang('sina_settings'), 1);
- $this->success(lang('ds_common_save_succ'));
- } else {
- $this->log(lang('ds_edit').lang('sina_settings'), 0);
- $this->error(lang('ds_common_save_fail'));
- }
- }
- }
- /**
- * 微信登录设置
- */
- public function wx() {
- $config_model = model('config');
- if (!request()->isPost()) {
- $list_config = rkcache('config', true);
- View::assign('list_config', $list_config);
- //输出子菜单
- $this->setAdminCurItem('wx');
- return View::fetch('wx');
- } else {
- $update_array = array();
- $update_array['weixin_isuse'] = input('post.weixin_isuse');
- $update_array['weixin_appid'] = input('post.weixin_appid');
- $update_array['weixin_secret'] = input('post.weixin_secret');
-
- $result = $config_model->editConfig($update_array);
- if ($result) {
- $this->log(lang('account_synchronous_login'));
- $this->success(lang('ds_common_save_succ'));
- } else {
- $this->error(lang('ds_common_save_fail'));
- }
- }
- }
- /**
- * 获取卖家栏目列表,针对控制器下的栏目
- */
- protected function getAdminItemList() {
- $menu_array = array(
- array(
- 'name' => 'setting',
- 'text' => lang('account_setting'),
- 'url' => (string)url('Account/setting')
- ),
- array(
- 'name' => 'qq',
- 'text' => lang('qq_interconnection'),
- 'url' => (string)url('Account/qq')
- ),
- array(
- 'name' => 'sina',
- 'text' => lang('sina_interconnection'),
- 'url' => (string)url('Account/sina')
- ),
- array(
- 'name' => 'wx',
- 'text' => lang('wx_login'),
- 'url' => (string)url('Account/wx')
- ),
- );
- return $menu_array;
- }
- }
- ?>
|