Нет описания
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. /**
  3. * 易优CMS
  4. * ============================================================================
  5. * 版权所有 2016-2028 海南赞赞网络科技有限公司,并保留所有权利。
  6. * 网站地址: http://www.eyoucms.com
  7. * ----------------------------------------------------------------------------
  8. * 如果商业用途务必到官方购买正版授权, 以免引起不必要的法律纠纷.
  9. * ============================================================================
  10. * Author: 小虎哥 <1105415366@qq.com>
  11. * Date: 2018-4-3
  12. */
  13. // 模板错误提示
  14. switch_exception();
  15. if (!function_exists('is_adminlogin'))
  16. {
  17. /**
  18. * 检验登陆
  19. * @param
  20. * @return bool
  21. */
  22. function is_adminlogin(){
  23. $admin_id = session('admin_id');
  24. if(isset($admin_id) && $admin_id > 0){
  25. return $admin_id;
  26. }else{
  27. return false;
  28. }
  29. }
  30. }
  31. if (!function_exists('apiAdminLog'))
  32. {
  33. /**
  34. * 管理员操作记录
  35. * @param $log_url 操作URL
  36. * @param $log_info 记录信息
  37. */
  38. function apiAdminLog($log_info = ''){
  39. $admin_id = session('admin_id');
  40. $admin_id = !empty($admin_id) ? $admin_id : -2;
  41. $add['log_time'] = getTime();
  42. $add['admin_id'] = $admin_id;
  43. $add['log_info'] = $log_info;
  44. $add['log_ip'] = clientIP();
  45. $add['log_url'] = request()->baseUrl() ;
  46. M('admin_log')->add($add);
  47. }
  48. }
  49. if (!function_exists('push_bdminiproapi'))
  50. {
  51. /**
  52. * 将新链接推送给百度
  53. * 将小程序资源 path 路径,提交到 API 接口中
  54. */
  55. function push_bdminiproapi($access_token = '',$type = '1', $aid = '', $typeid = '')
  56. {
  57. $aid = intval($aid);
  58. $typeid = intval($typeid);
  59. $urls = '';
  60. if (!empty($aid)){
  61. $nid = \think\Db::name('archives')->alias('a')->join('channeltype b','a.channel = b.id')->where('a.aid',$aid)->value('b.nid');
  62. if ('single' == $nid){
  63. $urls = 'pages/article/single?typeid='.$typeid;
  64. }else{
  65. $urls = 'pages/article/view?aid='.$aid;
  66. }
  67. }elseif (!empty($typeid)){
  68. $urls = 'pages/article/list?typeid='.$typeid;
  69. }
  70. $data['type'] = $type;
  71. $data['url_list'] = $urls;
  72. $url = 'https://openapi.baidu.com/rest/2.0/smartapp/access/submitsitemap/api?access_token='.$access_token;
  73. $response = httpRequest($url, 'POST', $data);
  74. $result = json_decode($response, true);
  75. return $result;
  76. }
  77. }