123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- <?php
-
-
-
- switch_exception();
-
- if (!function_exists('is_adminlogin'))
- {
-
-
- function is_adminlogin(){
- $admin_id = session('admin_id');
- if(isset($admin_id) && $admin_id > 0){
- return $admin_id;
- }else{
- return false;
- }
- }
- }
-
- if (!function_exists('apiAdminLog'))
- {
-
-
- function apiAdminLog($log_info = ''){
- $admin_id = session('admin_id');
- $admin_id = !empty($admin_id) ? $admin_id : -2;
- $add['log_time'] = getTime();
- $add['admin_id'] = $admin_id;
- $add['log_info'] = $log_info;
- $add['log_ip'] = clientIP();
- $add['log_url'] = request()->baseUrl() ;
- M('admin_log')->add($add);
- }
- }
-
- if (!function_exists('push_bdminiproapi'))
- {
-
-
- function push_bdminiproapi($access_token = '',$type = '1', $aid = '', $typeid = '')
- {
- $aid = intval($aid);
- $typeid = intval($typeid);
-
- $urls = '';
- if (!empty($aid)){
- $nid = \think\Db::name('archives')->alias('a')->join('channeltype b','a.channel = b.id')->where('a.aid',$aid)->value('b.nid');
- if ('single' == $nid){
- $urls = 'pages/article/single?typeid='.$typeid;
- }else{
- $urls = 'pages/article/view?aid='.$aid;
- }
- }elseif (!empty($typeid)){
- $urls = 'pages/article/list?typeid='.$typeid;
- }
-
- $data['type'] = $type;
- $data['url_list'] = $urls;
- $url = 'https://openapi.baidu.com/rest/2.0/smartapp/access/submitsitemap/api?access_token='.$access_token;
- $response = httpRequest($url, 'POST', $data);
- $result = json_decode($response, true);
-
- return $result;
- }
- }
|