人人商城

platform.ctrl.php 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /**
  3. * [WeEngine System] Copyright (c) 2014 WE7.CC
  4. * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
  5. */
  6. defined('IN_IA') or exit('Access Denied');
  7. load()->classs('weixin.platform');
  8. setting_load('platform');
  9. $founders = explode(',', $_W['config']['setting']['founder']);
  10. $_W['page']['title'] = '开放平台设置';
  11. if($_W['isajax'] && $_W['ispost']) {
  12. $data = array();
  13. $token = trim($_GPC['token']);
  14. $encodingaeskey =trim($_GPC['encodingaeskey']);
  15. $appid = trim($_GPC['appid']);
  16. $appsecret = trim($_GPC['appsecret']);
  17. $authstate = isset($_GPC['authstate']) ? intval($_GPC['authstate']) : $_W['setting']['platform']['authstate'];
  18. $data['token'] = !empty($token) ? $token : $_W['setting']['platform']['token'];
  19. $data['encodingaeskey'] = !empty($encodingaeskey) ? $encodingaeskey : $_W['setting']['platform']['encodingaeskey'];
  20. $data['appid'] = !empty($appid) ? $appid : $_W['setting']['platform']['appid'];
  21. $data['appsecret'] = !empty($appsecret) ? $appsecret : $_W['setting']['platform']['appsecret'];
  22. $data['authstate'] = !empty($authstate) ? 1 : 0;
  23. $result = setting_save($data,'platform');
  24. if($result) {
  25. iajax(0, '修改成功!', '');
  26. }else {
  27. iajax(1, '修改失败!', '');
  28. }
  29. }
  30. if(empty($_W['setting']['platform'])) {
  31. $_W['setting']['platform'] = array(
  32. 'token' => random(32),
  33. 'encodingaeskey' => random(43),
  34. 'appsecret' => '',
  35. 'appid' => '',
  36. 'authstate' => 1
  37. );
  38. setting_save($_W['setting']['platform'],'platform');
  39. }
  40. $siteroot_parse_array = parse_url($_W['siteroot']);
  41. if (!function_exists('mcrypt_module_open')) {
  42. itoast('抱歉,您的系统不支持加解密 mcrypt 模块,无法进行平台接入', '', '');
  43. }
  44. $account_platform = new WeixinPlatform();
  45. $authurl = $account_platform->getAuthLoginUrl();
  46. template('system/platform');