admin_wxpay.inc.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
  3. exit('Access Denied');
  4. }
  5. if($_GET['act'] == 'save'){
  6. if($_GET['formhash'] != $_G['formhash']) {
  7. cpmsg('parameters_error','action=plugins&operation=config&do='.$pluginid.'&identifier=xj_event&pmod=admin_wxpay','succeed');
  8. }
  9. $wxset = array();
  10. $wxset['appid'] = addslashes($_GET['appid']);
  11. $wxset['appsecret'] = addslashes($_GET['appsecret']);
  12. $wxset['apikey'] = addslashes($_GET['apikey']);
  13. $wxset['mch_id'] = addslashes($_GET['mch_id']);
  14. $wxset['wsqonly'] = intval($_GET['wsqonly']);
  15. $wxset['open_appid'] = addslashes($_GET['open_appid']);
  16. $wxset['open_mch_id'] = addslashes($_GET['open_mch_id']);
  17. $wxset['open_apikey'] = addslashes($_GET['open_apikey']);
  18. $wxset['xcx_appid'] = addslashes($_GET['xcx_appid']);
  19. $wxset['xcx_appsecret'] = addslashes($_GET['xcx_appsecret']);
  20. $wxset['xcx_mch_id'] = addslashes($_GET['xcx_mch_id']);
  21. $wxset['xcx_apikey'] = addslashes($_GET['xcx_apikey']);
  22. $wxset['magapp_secret'] = addslashes($_GET['magapp_secret']);
  23. $wxset['magapp_siteurl'] = addslashes($_GET['magapp_siteurl']);
  24. $wxset['qianfan_type'] = addslashes($_GET['qianfan_type']);
  25. writetocache('xj_event_wxset',getcachevars(array('wxset'=>$wxset)));
  26. $message = lang('plugin/xj_event', 'bccg');
  27. cpmsg($message,'action=plugins&operation=config&do='.$pluginid.'&identifier=xj_event&pmod=admin_wxpay','succeed');
  28. }
  29. if($_GET['act'] == 'clear'){
  30. //调用微信支付设置
  31. if(file_exists($xj_event_wxset = DISCUZ_ROOT.'./data/sysdata/cache_xj_event_wxset.php')) {
  32. @include $xj_event_wxset;
  33. }
  34. @include DISCUZ_ROOT.'source/plugin/xj_event/module/wxopen/include/wxpayfunc.php';
  35. require_once libfile('function/cache');
  36. //小程序
  37. loadcache('wxxcx_token');
  38. $cx = get('https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid='.$wxset['xcx_appid'].'&secret='.$wxset['xcx_appsecret']);
  39. $token = json_decode($cx,true) ;
  40. $token['timestamp'] = $_G['timestamp'];
  41. savecache('wxxcx_token',$token);
  42. DB::delete('xj_wxopen_login',"uid=0");
  43. cpmsg(lang('plugin/xj_event','caozuochenggong'),'action=plugins&operation=config&do='.$pluginid.'&identifier=xj_event&pmod=admin_wxpay','succeed');
  44. }
  45. if(file_exists($xj_event_wxset = DISCUZ_ROOT.'./data/sysdata/cache_xj_event_wxset.php')) {
  46. @include $xj_event_wxset;
  47. }
  48. showformheader('plugins&operation=config&do='.$pluginid.'&identifier=xj_event&pmod=admin_wxpay&act=save');
  49. showtableheader(lang('plugin/xj_event','wxzfszqgj').' <a href="'.ADMINSCRIPT.'?action=plugins&operation=config&do='.$pluginid.'&identifier=xj_event&pmod=admin_wxpay&act=clear" style=" border-radius:3px; padding:3px 10px; background-color:#44a1e2;color:#fff;">'.lang('plugin/xj_event','genxinhuanchun').'</a>');
  50. showsetting(lang('plugin/xj_event', 'wxgahappid'), 'appid', $wxset['appid'], 'text');
  51. showsetting('AppSecret', 'appsecret', $wxset['appsecret'], 'text');
  52. showsetting('APIKEY', 'apikey', $wxset['apikey'], 'text');
  53. showsetting(lang('plugin/xj_event','wxzfshh'), 'mch_id', $wxset['mch_id'], 'text');
  54. showsetting(lang('plugin/xj_event','wsqzxswxzf'), 'wsqonly', $wxset['wsqonly'], 'radio');
  55. showsetting(lang('plugin/xj_event', 'appwxkfpdappid'), 'open_appid', $wxset['open_appid'], 'text');
  56. showsetting(lang('plugin/xj_event', 'appwxzfshh'), 'open_mch_id', $wxset['open_mch_id'], 'text');
  57. showsetting(lang('plugin/xj_event', 'appwxzfapikey'), 'open_apikey', $wxset['open_apikey'], 'text');
  58. showsetting(lang('plugin/xj_event','xcxappid'), 'xcx_appid', $wxset['xcx_appid'], 'text');
  59. showsetting(lang('plugin/xj_event','xcxappsecret'), 'xcx_appsecret', $wxset['xcx_appsecret'], 'text');
  60. showsetting(lang('plugin/xj_event','xcxwxzfshh'), 'xcx_mch_id', $wxset['xcx_mch_id'], 'text');
  61. showsetting(lang('plugin/xj_event','xcxapikey'), 'xcx_apikey', $wxset['xcx_apikey'], 'text');
  62. showtableheader(lang('plugin/xj_event','majiaapzfsz'));
  63. showsetting(lang('plugin/xj_event','majiayinyongsecret'), 'magapp_secret', $wxset['magapp_secret'], 'text');
  64. showsetting(lang('plugin/xj_event','majiaappyunming'),'magapp_siteurl', $wxset['magapp_siteurl'], 'text');
  65. showtableheader(lang('plugin/xj_card','qianfanappzfsz'));
  66. showsetting(lang('plugin/xj_card','qianfanappddlx'),'qianfan_type', $wxset['qianfan_type'], 'text');
  67. showsubmit('submit',lang('plugin/xj_event', 'save'));
  68. showtablefooter();
  69. showformfooter();
  70. ?>