人人商城

service.ctrl.php 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. $_W['page']['title'] = '常用接入服务 - 常用接入服务 - 高级功能';
  8. permission_check_account_user('platform_reply');
  9. load()->model('module');
  10. load()->model('reply');
  11. $m = module_fetch('userapi');
  12. $cfg = $m['config'];
  13. $ds = reply_search("`uniacid` = 0 AND module = 'userapi' AND `status`=1");
  14. $apis = array();
  15. foreach ($ds as $row) {
  16. $apis[$row['id']] = $row;
  17. }
  18. if ($_W['ispost'] && $_W['isajax']) {
  19. $rids = explode(',', $_GPC['rids']);
  20. if (is_array($rids)) {
  21. $cfg = array();
  22. foreach ($rids as $rid) {
  23. if (!empty($apis[$rid])) {
  24. $cfg[intval($rid)] = true;
  25. }
  26. }
  27. $module = WeUtility::createModule('userapi');
  28. $module->saveSettings($cfg);
  29. }
  30. exit();
  31. }
  32. $ds = array();
  33. foreach ($apis as $row) {
  34. $reply = pdo_fetch('SELECT * FROM ' . tablename('userapi_reply') . ' WHERE `rid`=:rid', array(':rid' => $row['id']));
  35. $r = array();
  36. $r['title'] = $row['name'];
  37. $r['rid'] = $row['id'];
  38. $r['description'] = $reply['description'];
  39. $r['switch'] = $cfg[$r['rid']] ? ' checked="checked"' : '';
  40. $ds[] = $r;
  41. }
  42. template('platform/service');