userapireply.table.php 1.3 KB

123456789101112131415161718192021222324252627282930
  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. class UserapireplyTable extends We7Table {
  8. protected $tableName = 'userapi_reply';
  9. protected $field = array('rid', 'description', 'apiurl', 'token', 'default_text', 'cachetime');
  10. public function userapiSave($all_service, $file) {
  11. $rule_info = array('uniacid' => 0, 'name' => $all_service[$file]['title'], 'module' => 'userapi', 'displayorder' => 255, 'status' => 1);
  12. table('rule')->fill($rule_info)->save();
  13. $rule_id = pdo_insertid();
  14. $rule_keyword_info = array('rid' => $rule_id, 'uniacid' => 0, 'module' => 'userapi', 'displayorder' => $rule_info['displayorder'], 'status' => $rule_info['status']);
  15. if (!empty($all_service[$file]['keywords'])) {
  16. foreach ($all_service[$file]['keywords'] as $keyword_info) {
  17. $rule_keyword_info['content'] = $keyword_info[1];
  18. $rule_keyword_info['type'] = $keyword_info[0];
  19. table('rulekeyword')->fill($rule_keyword_info)->save();
  20. }
  21. }
  22. $userapi_reply = array('rid' => $rule_id, 'description' => htmlspecialchars($all_service[$file]['description']), 'apiurl' => $file);
  23. table('userapireply')->fill($userapi_reply)->save();
  24. return $rule_id;
  25. }
  26. }