wupengfei 2 years ago
parent
commit
7158bb35f7
2 changed files with 0 additions and 217 deletions
  1. 0 53
      application/api/common.php
  2. 0 164
      application/common.php

+ 0 - 53
application/api/common.php

@@ -59,60 +59,7 @@ function check_password($password,$hash)
 {
     return password_verify($password,$hash);
 }
-// 获取日历 默认最近7天
-function get_calendar($day = 7,$type='asc'){
-    $data = [];
-    $week_arr = ['日','一','二','三','四','五','六'];
-    for($i=0;$i<$day;$i++) {
-        $day_time = date('Y-m-d',strtotime("-$i days"));
-        $day_title= trim(date('m月d日',strtotime("-$i days")),'0');
-        $time_int = strtotime($day_time);
-        $week_day =$week_arr[date('w',strtotime($day_time))];
-        $data[] = ['day_time' => $day_time,'week_day'=>$week_day,'time_int'=>$time_int,'day_title'=>$day_title];
-    }
-   if($type == 'asc') array_multisort(array_column($data,'time_int'),SORT_ASC,$data);
-   return $data;
-}
-function jg_push()
-{
-    $user_id = 65 ;
-    $alert ='aaa';
-    if(empty($user_id)) return false;
-    $appKey = '02a7faefd91c8a6a446a6a14';
-    $masterSecret = 'ba2e100db997024d9b6e5d35';
-    $client = new Client($appKey, $masterSecret,null);
-    $push_payload = $client->push()
-        ->setPlatform(array('ios', 'android'))
-        ->addAlias(strval($user_id))
-        ->iosNotification($alert, array(
-            'badge' => '+1',
-            'content-available' => true,
-            'mutable-content' => true,
-            'category' => 'jiguang',
-            'extras' => array(
-                'key' => 'value',
-                'jiguang'
-            ),
-        ))->androidNotification($alert, array(
-            'title' => '消息通知',
-            // 'builder_id' => 2,
-            'extras' => array(
-                'key' => 'value',
-                'jiguang'
-            ),
-        ))->options(array(
-            'apns_production' => True,
-        ));
-    try {
-        $response = $push_payload->send();
-        return $response;
-    } catch  (\JPush\Exceptions\APIConnectionException $e) {
-        return $e;
-    } catch (\JPush\Exceptions\APIRequestException $e) {
-        return $e;
-    }
 
-}
 
 
 

+ 0 - 164
application/common.php

@@ -1,78 +1,5 @@
 <?php
 use think\Db;
-/**
- * 秒转换为天
- */
-function get_stay_time($remain_time, $is_hour = 1, $is_minutes = 1)
-{
-    $day = floor($remain_time / (3600*24));
-    $day = $day > 0 ? $day.'天' : '';
-    $hour = floor(($remain_time % (3600*24)) / 3600);
-    $hour = $hour > 0 ? $hour.'小时' : '';
-    if($is_hour && $is_minutes) {
-        $minutes = floor((($remain_time % (3600*24)) % 3600) / 60);
-        $minutes = $minutes > 0 ? $minutes.'分钟' : '';
-        return $day.$hour.$minutes;
-    }
-
-    if($hour) {
-        return $day.$hour;
-    }
-    return $day;
-}
-//获取全图片地址 $image_data
-function image_path($image_data){
-    if(empty($image_data)){
-        return $image_data;
-    }
-    if (strpos($image_data,'|')!==false){
-        $image_res = explode('|',$image_data);
-    }elseif(strpos($image_data,',')!==false){
-        $image_res = explode(',',$image_data);
-    }else{
-        $image_res = array($image_data);
-    }
-    return $image_res;
-}
-
-/**
- * @param $id_card
- * @return false|string
- */
-function get_age($id_card){
-    # 1.从身份证中获取出生日期
-    $birth_Date = strtotime(substr($id_card, 6, 8));//截取日期并转为时间戳
-
-    # 2.格式化[出生日期]
-    $Year = date('Y', $birth_Date);//yyyy
-    $Month = date('m', $birth_Date);//mm
-    $Day = date('d', $birth_Date);//dd
-
-    # 3.格式化[当前日期]
-    $current_Y = date('Y');//yyyy
-    $current_M = date('m');//mm
-    $current_D = date('d');//dd
-
-    # 4.计算年龄()
-    $age = $current_Y - $Year;//今年减去生日年
-    if($Month > $current_M || $Month == $current_M && $Day > $current_D){//深层判断(日)
-        $age--;//如果出生月大于当前月或出生月等于当前月但出生日大于当前日则减一岁
-    }
-    # 返回
-    return $age;
-
-}
-
-function create_invite_code($user_id){
-    // 生成12位邀请码
-    $code_str = '';
-    $base_code = explode(',',"A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,T,U,V,W,X,Y,Z");
-    $code_key = array_rand($base_code, 10 - strlen($user_id));
-    array_map(function ($val)use (&$code_str,$base_code){
-        $code_str .=$base_code[$val] ;
-    },$code_key);
-    return $code_str.$user_id;
-}
 
 // 获取模板区域
 function get_city_area()
@@ -124,80 +51,6 @@ function curl_get($url)
     }
 }
 
-// 获取物流信息
-function get_delivery($send_no = 'JD0053309649641',$express_code=''){
-        error_reporting(E_ALL || ~E_NOTICE);
-        $AppKey     = 204111217;
-        $AppSecret  ='LGUYqAh335HMec0eyJZdiHwMhrapU1fH';
-        $AppCode    ='5f96216347b547579e2417685ee8e647';//开通服务后 买家中心-查看AppCode
-        $host = "https://wuliu.market.alicloudapi.com";//api访问链接
-        $path = "/kdi";//API访问后缀
-        $method = "GET";
-        $body  ='';
-        $headers = array();
-        array_push($headers, "Authorization:APPCODE " . $AppCode);
-        $querys = "no={$send_no}&type={$express_code}";  //参数写在这里
-        $url = $host . $path . "?" . $querys;
-        $curl = curl_init();
-        curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
-        curl_setopt($curl, CURLOPT_URL, $url);
-        curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
-        curl_setopt($curl, CURLOPT_FAILONERROR, false);
-        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
-        curl_setopt($curl, CURLOPT_HEADER, true);
-        if (1 == strpos("$" . $host, "https://")) {
-            curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
-            curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
-        }
-        $out_put = curl_exec($curl);
-        $httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
-        list($header, $body) = explode("\r\n\r\n", $out_put, 2);
-        if ($httpCode == 200) {
-            return json_decode($body,true)['result'];
-        } else {
-            return [];
-        }
-    }
-
-// 实名认证
-function user_certification($id_card,$name){
-    $host = "http://checkone.market.alicloudapi.com";
-    $path = "/chinadatapay/1882";
-    $method = "POST";
-    $appcode = "30be8bdcc65842919980a8276ffc4995";
-    $headers = array();
-    array_push($headers, "Authorization:APPCODE " . $appcode);
-    //根据API的要求,定义相对应的Content-Type
-    array_push($headers, "Content-Type".":"."application/x-www-form-urlencoded; charset=UTF-8");
-
-    $bodys = "idcard=".$id_card."&name=".$name;
-    $url = $host . $path;
-
-    $curl = curl_init();
-    curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
-    curl_setopt($curl, CURLOPT_URL, $url);
-    curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
-    curl_setopt($curl, CURLOPT_FAILONERROR, false);
-    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
-    curl_setopt($curl, CURLOPT_HEADER, false);
-    if (1 == strpos("$".$host, "https://"))
-    {
-        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
-        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
-    }
-    curl_setopt($curl, CURLOPT_POSTFIELDS, $bodys);
-    $res = curl_exec($curl);
-    if($res){
-        $res = json_decode($res,true);
-        if($res['data']['result'] == 1){
-           return 1;
-        }else{
-            return 0;
-        }
-    }else{
-       return 0;
-    }
-}
 
 /**
  * 把返回的数据集转换成Tree
@@ -223,7 +76,6 @@ function make_tree($list,$pk='id',$pid='pid',$child='children',$root=0){
     return $tree;
 }
 
-
 //判断字段存在并不为空
 function isset_full($arr, $key)
 {
@@ -233,7 +85,6 @@ function isset_full($arr, $key)
         return false;
     }
 }
-
 //判断字段存在并不为空 并且等于验证值
 function isset_full_check($arr, $key,$check_val)
 {
@@ -251,21 +102,6 @@ function all_pay_type()
 }
 
 /**
- * @param $start 验证开始时间
- * @param $end   验证结束时间
- * @param $check_st  已有活动开始时间
- * @param $check_end 已有活动结束时间
- * @return bool  true 可以创建活动
- */
-function check_act_time($start,$end,$check_st,$check_end)
-{
-    $check_val = false;
-    if($start > $check_end || $end < $check_st) $check_val = true;
-    return  $check_val;
-}
-
-
-/**
  * 生成32位随机数
  */
 function get32Str($length='32'){