Bladeren bron

厨师户

mark 3 jaren geleden
commit
2fcc02e27a
52 gewijzigde bestanden met toevoegingen van 5112 en 0 verwijderingen
  1. 8 0
      .gitignore
  2. 30 0
      README.md
  3. 28 0
      composer.json
  4. 195 0
      demo.php
  5. 106 0
      src/shanTaoTool/BaseAuth/AdminAuth.php
  6. 101 0
      src/shanTaoTool/Bean/BaseAuth/AddUserParamBean.php
  7. 93 0
      src/shanTaoTool/Bean/BaseBean.php
  8. 93 0
      src/shanTaoTool/Bean/BaseBeanV1.php
  9. 99 0
      src/shanTaoTool/Bean/Crm/TaobaoBatchSendParamBean.php
  10. 230 0
      src/shanTaoTool/Bean/ElasticSearch/CreateLogDocParamBean.php
  11. 205 0
      src/shanTaoTool/Bean/ElasticSearch/GetLogDocParamBean.php
  12. 120 0
      src/shanTaoTool/Bean/Pay/GetCodePayUrlParamBean.php
  13. 115 0
      src/shanTaoTool/Bean/Pdd/Ddk/GoodsDetailParamBean.php
  14. 305 0
      src/shanTaoTool/Bean/Pdd/Ddk/GoodsPromotionUrlGenerateParamBean.php
  15. 199 0
      src/shanTaoTool/Bean/Pdd/Ddk/GoodsRecommendGetParamBean.php
  16. 346 0
      src/shanTaoTool/Bean/Pdd/Ddk/GoodsSearchParamBean.php
  17. 136 0
      src/shanTaoTool/Bean/Pdd/Ddk/OrderListRangeGetParamBean.php
  18. 23 0
      src/shanTaoTool/Bean/Pdd/Ddk/PidStatusEnum.php
  19. 115 0
      src/shanTaoTool/Bean/Pdd/Ddk/ResourceUrlGenParamBean.php
  20. 98 0
      src/shanTaoTool/Bean/Qr/CreateQrLogoImgServiceParamBean.php
  21. 142 0
      src/shanTaoTool/Bean/SendEmail/SendEmailByCustomeParamBean.php
  22. 32 0
      src/shanTaoTool/Crm/Crm.php
  23. 20 0
      src/shanTaoTool/CrmTool.php
  24. 324 0
      src/shanTaoTool/ElasticSearch/ElasticSerach.php
  25. 48 0
      src/shanTaoTool/Enum/Pdd/Ddk/DdkResourceTypeEnum.php
  26. 118 0
      src/shanTaoTool/EsTool.php
  27. 92 0
      src/shanTaoTool/Excel/Export.php
  28. 69 0
      src/shanTaoTool/ExcelTool.php
  29. 10 0
      src/shanTaoTool/Exception/AuthException.php
  30. 13 0
      src/shanTaoTool/Exception/CrmException.php
  31. 13 0
      src/shanTaoTool/Exception/ElasticSearchException.php
  32. 13 0
      src/shanTaoTool/Exception/FileException.php
  33. 13 0
      src/shanTaoTool/Exception/HttpCustomeException.php
  34. 13 0
      src/shanTaoTool/Exception/PayException.php
  35. 13 0
      src/shanTaoTool/Exception/QiWeiException.php
  36. 13 0
      src/shanTaoTool/Exception/SendEmailException.php
  37. 13 0
      src/shanTaoTool/Exception/SmsException.php
  38. 155 0
      src/shanTaoTool/HttpCurl.php
  39. 113 0
      src/shanTaoTool/Mq/MqService.php
  40. 31 0
      src/shanTaoTool/MqTool.php
  41. 128 0
      src/shanTaoTool/Pay/PayService.php
  42. 49 0
      src/shanTaoTool/PayTool.php
  43. 447 0
      src/shanTaoTool/Pdd/Ddk/DdkDaogouService.php
  44. 163 0
      src/shanTaoTool/QiWeiTool.php
  45. 56 0
      src/shanTaoTool/Qr/QrService.php
  46. 45 0
      src/shanTaoTool/QrTool.php
  47. 124 0
      src/shanTaoTool/SendEmail.php
  48. 74 0
      src/shanTaoTool/Sms/QidianyunSms.php
  49. 32 0
      src/shanTaoTool/Sms/SanTiSms.php
  50. 33 0
      src/shanTaoTool/SmsTool.php
  51. 45 0
      src/shanTaoTool/UploadTool.php
  52. 13 0
      src/shanTaoTool/template/Ceshi.php

+ 8 - 0
.gitignore

@@ -0,0 +1,8 @@
+/.idea
+/.vscode
+/vendor
+*.log
+.env
+.DS_Store
+composer.lock
+token.txt

+ 30 - 0
README.md

@@ -0,0 +1,30 @@
+#基础工具包:
+   ##权限:
+   
+   #####用户登录
+   AdminAuth::login($userName,$userPassword,$userProjectId);返回token
+   
+   #####判断用户权限
+   AdminAuth::checkUserAuth($path,$token);返回true、false
+   
+   #####获取当前用户所有权限
+   AdminAuth::getAuth($token);返回树形结构权限
+
+---
+   ##基础功能
+   
+   #####上传文件
+   UploadTool::uploadFile($file,$filename='');返回文件路径
+   
+   #####httpGet请求
+   HttpCurl::getCurl(string $url,array $params=[],array $headers=[]);返回结果
+   
+   #####httpPost请求
+   HttpCurl::postCurl($url,$params=[],$headers=[],$asJson=true);返回结果
+   
+   #####推送mq信息
+   MqService::pushMessage($message,$queueName);
+   
+   #####企微报警
+   QiWeiTool::sendMessageToBaoJing("报警信息");
+   

+ 28 - 0
composer.json

@@ -0,0 +1,28 @@
+{
+    "name": "shantao/tool",
+    "description": "工具包",
+    "authors": [
+        {
+            "name": "mark",
+            "email": "1377981054@qq.com"
+        }
+    ],
+    "minimum-stability": "dev",
+    "require": {
+        "php": ">=7.0",
+        "curl/curl": "2.3.0",
+        "php-amqplib/php-amqplib": "2.12.1",
+        "qiniu/php-sdk": "7.3.0",
+        "phpoffice/phpspreadsheet": "1.15.0",
+        "elasticsearch/elasticsearch": "7.4.0",
+        "khanamiryan/qrcode-detector-decoder": "1.0.4",
+        "lrq/qrcode": "~2.0.0",
+        "phpmailer/phpmailer": "6.4.0",
+        "tekintian/phpqrcode": "1.0"
+    },
+    "autoload": {
+        "psr-4": {
+            "Tool\\ShanTaoTool\\": "src/shanTaoTool"
+        }
+    }
+}

+ 195 - 0
demo.php

@@ -0,0 +1,195 @@
+<?php
+
+use Tool\ShanTaoTool\Bean\ElasticSearch\CreateLogDocParamBean;
+use Tool\ShanTaoTool\EsTool;
+
+require_once "./vendor/autoload.php";
+
+//$url = "www.baidu.com";
+//$url = "https://runion.meituan.com/url?key=765f44a936837a4c8a347d7e6576cf69&url=https%3A%2F%2Fcube.meituan.com%2Fawp%2Fhfe%2Fblock%2Fa945391288b790d558b7%2F78716%2Findex.html%3Fappkey%3D765f44a936837a4c8a347d7e6576cf69%3A1234561&sid=1234561";
+//var_dump(\Tool\ShanTaoTool\QiWeiTool::sendImgTxtToBaoJing(
+//    "http://image.vv-tool.com/meituan.jpg",
+//    $url,
+//    "美团外卖",
+//    "外卖领券",
+//    "daogouqun")
+//);
+//var_dump(\Tool\ShanTaoTool\QiWeiTool::sendImgToBaoJing("2.png","daogouqun"));
+
+//var_dump(\Tool\ShanTaoTool\BaseAuth\AdminAuth::login("hujie1","123456","88888888"));
+//var_dump(\Tool\ShanTaoTool\BaseAuth\AdminAuth::getAuth());
+
+//var_dump(\Tool\ShanTaoTool\QiWeiTool::sendMessageToBaoJing("ceshi"));
+
+//$head = ["测试","名字"];
+//$data = [
+//    [
+//        "测试","anii"
+//    ],
+//    [
+//        "skdh","ksi8"
+//    ]
+//];
+
+//\Tool\ShanTaoTool\ExcelTool::exportToCsv($head,$data,"ceshi");
+
+
+
+//
+//
+//$channel = $connection->channel();
+//
+//echo ' [*] Waiting for messages. To exit press CTRL+C', "\n";
+//
+//$callback = function($msg) {
+//    echo " [x] Received ", $msg->body, "\n";
+//    $data = json_decode($msg->body,true);
+//    $bean = new CreateLogDocParamBean($data);
+//    $res = EsTool::createLogDoc($bean);
+//    var_dump($res);
+//};
+//
+//$channel->basic_consume('vtoolLogQueue', '', false, true, false, false, $callback);
+//
+//while(count($channel->callbacks)) {
+//    $channel->wait();
+//}
+//
+//$channel->close();
+//$connection->close();
+
+
+
+//测试es
+//$data = [
+//    "requestParams"=>json_encode(["name"=>"mark"]),
+//    "requestResponse"=>json_encode(["age"=>29]),
+//    "requestPath"=>"/ceshi/path",
+//    "requestLog"=>json_encode(["ceshi","自定义日志"]),
+//    "requestSqlLog"=>json_encode(["insel sql","update sql"]),
+//    "requestProjectName"=>"vtool",
+//    "createdAt"=>"1611916077.8329",
+//    "updatedAt"=>"1611916231.7019",
+//    "requestId"=>1611916231,
+//    "uniqueTraceId"=>md5(1234)
+//];
+//$bean = new \Tool\ShanTaoTool\Bean\ElasticSearch\CreateLogDocParamBean($data);
+//$res = \Tool\ShanTaoTool\EsTool::createLogDoc($bean);
+//var_dump($res);
+//var_dump($data);
+//
+//\Tool\ShanTaoTool\ElasticSearch\ElasticSerach::getElasticSearchClient();
+//$client = \Tool\ShanTaoTool\ElasticSearch\ElasticSerach::$client;
+//$param = [
+//    "index"=>"2021-03-08",
+//    "projectName"=>"vtool",
+////    "requestPath"=>"doc/apps/docs",
+//    "page"=>1,
+//    "pageSize"=>2,
+//    "unique_trace_id"=>"81dc9bdb52d04dc20036dbd8313ed055"
+//];
+//$bean = new \Tool\ShanTaoTool\Bean\ElasticSearch\GetLogDocParamBean($param);
+//$data = \Tool\ShanTaoTool\EsTool::getLogDoc($bean);
+//var_dump($data);
+
+//ini_set("memory_limit",-1);
+//
+//$datas = \Tool\ShanTaoTool\ExcelTool::importExcel("1.xlsx");
+//$heades = [];
+//$headData = json_decode($datas[1][1],true);
+//foreach ($headData as $key=>$val){
+//    if(!is_array($val)){
+//        $heades[] = $key;
+//    }
+//}
+//
+//$res = [];
+//foreach ($datas as $k=>$data){
+//    if($k>0){
+//        $tmps = json_decode($data[1],true);
+//        foreach ($tmps as $tmpKey=>$kv){
+//            if(!is_array($kv)){
+//                if(in_array($tmpKey,["inputDate","actionDate","amoytocustomerDate"])){
+//                    if($kv){
+//                        $kv = " ".date("Y-m-d H:i:s",$kv/1000);
+//                    }
+//                }
+//                $res[$k-1][]=$kv;
+//            }
+//        }
+//    }
+//
+//}
+//var_dump("数据总数:".count($res));
+////\Tool\ShanTaoTool\ExcelTool::exportToCsv($heades,$res,"修正");
+////打开PHP文件句柄,php://output,表示直接输出到浏览器
+//$fp = fopen("修正.csv","a+");
+//fwrite($fp, chr(0xEF).chr(0xBB).chr(0xBF)); // 添加 BOM
+////输出Excel列表名称信息
+//$headerList = $heades;
+//foreach ($headerList as $key => $value) {
+////            $headerList[$key] = iconv('UTF-8', 'GBK', $value);//CSV的EXCEL支持BGK编码,一定要转换,否则乱码
+//    $headerList[$key] = $value;//CSV的EXCEL支持BGK编码,一定要转换,否则乱码
+//}
+////使用fputcsv将数据写入文件句柄
+//fputcsv($fp, $headerList);
+////计数器
+//$num = 0;
+////每隔$limit行,刷新一下输出buffer,不要太大亦不要太小
+//$limit = 100000;
+//$data = $res;
+////逐行去除数据,不浪费内存
+//$count = count($data);
+//for($i = 0 ; $i < $count ; $i++){
+//    $num++;
+//    //刷新一下输出buffer,防止由于数据过多造成问题
+////    if($limit == $num){
+////        ob_flush();
+////        flush();
+////        $num = 0;
+////    }
+//    $row = $data[$i];
+//    foreach ($row as $key => $value) {
+//        $value = is_numeric($value) ? $value."\t" : $value;//解决输出长度较长的数字型变成科学计数法
+//        $row[$key] = $value;
+////                $row[$key] = iconv('UTF-8', 'GBK', $value);
+//    }
+//    fputcsv($fp, $row);
+//}
+//fclose($fp);
+
+//$txt = \Tool\ShanTaoTool\QrTool::getQrContent("http://oss.taobao2622.top/WechatIMG3.jpeg");
+//var_dump($txt);
+
+//$re = \Tool\ShanTaoTool\SendEmail::sendEmail("底单处理通知","v兔工具",'1152888295@qq.com',"<p data-we-empty-p=''>尊敬的用户:</p><p>您提交的关于包裹id:包裹idxxx,快递公司:快递公司xxx,快递单号:快递单号xxx,申请的底单已经完成申请,</p><p>以下电子面单:</p><p><img src='底单图片xxx' style='max-width:50%;'><br></p><p><br></p><p>如果需要查看详情,点击http://www.vv-tool.com/store/list,如果有什么问题请及时联系网站客服<br></p><p></p><p></p><p>备注:备注xxx</p><hr><p data-we-empty-p=''>v兔电商工具</p>");
+//var_dump($re);
+
+//$res = \Tool\ShanTaoTool\Pdd\Ddk\DdkDaogouService::goodsPidGenerate(1);
+//$res = \Tool\ShanTaoTool\Pdd\Ddk\DdkDaogouService::goodsPidQuery(1,10,0);
+//$bean = [
+//      "pid"=>"14844776_209372830",
+//      "generateWeApp"=>"true",
+//      "resourceType"=>\Tool\ShanTaoTool\Enum\Pdd\Ddk\DdkResourceTypeEnum::RESOURCE_HUOCHEPIAO
+//];
+//$bean = new \Tool\ShanTaoTool\Bean\Pdd\Ddk\ResourceUrlGenParamBean($bean);
+//$res = \Tool\ShanTaoTool\Pdd\Ddk\DdkDaogouService::resourceUrlGen($bean);
+//$bean = new \Tool\ShanTaoTool\Bean\Pdd\Ddk\OrderListRangeGetParamBean(
+//    [
+//        "startTime"=>"2021-05-18 13:50:00",
+//        "endTime"=>"2021-05-18 15:19:00",
+//    ]
+//);
+//$res = \Tool\ShanTaoTool\Pdd\Ddk\DdkDaogouService::orderListRangeGet($bean);
+//$res = \Tool\ShanTaoTool\Sms\QidianyunSms::send("18768452697","1334");
+//var_dump($res);
+
+$str = "ceshi";
+$params = [
+    "fileName"=>"1.jpg",
+    "qrContent"=>"nicai",
+    "qrSize"=>20,
+    "logoName"=>"1.jpeg"
+];
+$bean = new \Tool\ShanTaoTool\Bean\Qr\CreateQrLogoImgServiceParamBean($params);
+$res = \Tool\ShanTaoTool\QrTool::createQrLogoImg($bean);
+var_dump($res);

+ 106 - 0
src/shanTaoTool/BaseAuth/AdminAuth.php

@@ -0,0 +1,106 @@
+<?php
+
+
+namespace Tool\ShanTaoTool\BaseAuth;
+
+
+use Tool\ShanTaoTool\Bean\BaseAuth\AddUserParamBean;
+use Tool\ShanTaoTool\Exception\AuthException;
+use Tool\ShanTaoTool\HttpCurl;
+
+class AdminAuth
+{
+    /**
+     * 登录
+     * @param string $userName 用户名
+     * @param string $userPassword 密码
+     */
+    public static function login($userName, $userPassword,$userProjectId)
+    {
+        $url = BASE_AUTH_URL."user/login";
+        $params = [
+            "user_name"=>$userName,
+            "user_password"=>$userPassword,
+            "user_project_id"=>$userProjectId
+        ];
+        $queryParam = array_merge($_POST,$_GET);
+        if(isset($queryParam["traceId"]) && $queryParam["traceId"]){
+            $params["traceId"] = $queryParam["traceId"];
+        }
+        $res = HttpCurl::postCurl($url,$params,[],false);
+        if($res["status"]){
+            return $res["data"];
+        }
+        throw new AuthException($res["msg"],$res["code"]);
+    }
+
+    /**
+     * 检测用户是否拥有此权限
+     * @param string $path
+     */
+    public static function checkUserAuth($path,$token)
+    {
+        $url = BASE_AUTH_URL."checkNodeAuth";
+        $headers = [
+            "token"=>$token,
+            "path"=>$path
+        ];
+        $queryParam = array_merge($_POST,$_GET);
+        if(isset($queryParam["traceId"]) && $queryParam["traceId"]){
+            $params["traceId"] = $queryParam["traceId"];
+        }
+        $res = HttpCurl::postCurl($url,[],$headers,false);
+        if($res["status"]){
+            return $res["data"];
+        }
+        throw new AuthException($res["msg"],$res["code"]);
+    }
+
+    /**
+     * 获取该用户的所有权限(返回树状权限结构)
+     */
+    public static function getAuth($token)
+    {
+        $url = BASE_AUTH_URL."userGetInfo";
+        $headers = [
+            "token"=>$token
+        ];
+        $queryParam = array_merge($_POST,$_GET);
+        $params = [];
+        if(isset($queryParam["traceId"]) && $queryParam["traceId"]){
+            $params["traceId"] = $queryParam["traceId"];
+        }
+        $res = HttpCurl::getCurl($url,$params,$headers);
+        if($res["status"]){
+            return $res["data"];
+        }
+        throw new AuthException($res["msg"],$res["code"]);
+    }
+
+    /**
+     * 修改用户密码
+     * @param $oldPassword  原始密码
+     * @param $newPassword  新密码
+     * @param $token    秘要
+     */
+    public static function modifyPassword($oldPassword, $newPassword, $token)
+    {
+        $url = BASE_AUTH_URL."user/set_me_password";
+        $headers = [
+            "token"=>$token
+        ];
+        $params = [
+            "old_password"=>$oldPassword,
+            "new_password"=>$newPassword
+        ];
+        $queryParam = array_merge($_POST,$_GET);
+        if(isset($queryParam["traceId"]) && $queryParam["traceId"]){
+            $params["traceId"] = $queryParam["traceId"];
+        }
+        $res = HttpCurl::postCurl($url,$params,$headers,false);
+        if($res["status"]){
+            return $res["data"];
+        }
+        throw new AuthException($res["msg"],$res["code"]);
+    }
+}

+ 101 - 0
src/shanTaoTool/Bean/BaseAuth/AddUserParamBean.php

@@ -0,0 +1,101 @@
+<?php
+
+
+namespace Tool\ShanTaoTool\Bean\BaseAuth;
+
+
+use Tool\ShanTaoTool\Bean\BaseBean;
+
+class AddUserParamBean extends BaseBean
+{
+    private $userPhone;//手机号码
+
+    private $userName;//用户名称
+
+    private $userEmail;//用户邮箱
+
+    private $userPassword;//用户密码
+
+    private $userProjectId;//项目ID
+
+    /**
+     * @return mixed
+     */
+    public function getUserProjectId()
+    {
+        return $this->userProjectId;
+    }
+
+    /**
+     * @param mixed $userProjectId
+     */
+    public function setUserProjectId($userProjectId)
+    {
+        $this->userProjectId = $userProjectId;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getUserPhone()
+    {
+        return $this->userPhone;
+    }
+
+    /**
+     * @param mixed $userPhone
+     */
+    public function setUserPhone($userPhone)
+    {
+        $this->userPhone = $userPhone;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getUserName()
+    {
+        return $this->userName;
+    }
+
+    /**
+     * @param mixed $userName
+     */
+    public function setUserName($userName)
+    {
+        $this->userName = $userName;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getUserEmail()
+    {
+        return $this->userEmail;
+    }
+
+    /**
+     * @param mixed $userEmail
+     */
+    public function setUserEmail($userEmail)
+    {
+        $this->userEmail = $userEmail;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getUserPassword()
+    {
+        return $this->userPassword;
+    }
+
+    /**
+     * @param mixed $userPassword
+     */
+    public function setUserPassword($userPassword)
+    {
+        $this->userPassword = $userPassword;
+    }
+
+}

+ 93 - 0
src/shanTaoTool/Bean/BaseBean.php

@@ -0,0 +1,93 @@
+<?php
+
+
+namespace Tool\ShanTaoTool\Bean;
+
+
+
+
+class BaseBean
+{
+    /**
+     * 构造函数
+     * @param $data 数据集
+     */
+    public function __construct($data = [])
+    {
+        if (!empty($data)) {
+            foreach ($data as $key => $val) {
+                if (property_exists($this, $key) && !is_null($val)) {
+                    $setMethodName = $this->getSetMethodName($key);
+                    if (method_exists($this, $setMethodName)) {
+                        $this->$setMethodName($val);
+                    } else {
+                        $this->$key = $val;
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * 获取set方法名称
+     * @param $key
+     * @return string
+     */
+    protected function getSetMethodName($key)
+    {
+        return "set" . ucfirst($key);
+    }
+
+    /**
+     * 获取get方法名称
+     * @param $key
+     * @return string
+     */
+    protected function getGetMethodName($key)
+    {
+        return "get" . ucfirst($key);
+    }
+
+    public function toArray()
+    {
+        $data = [];
+        //获取所有属性
+        $reflectInstance = new \ReflectionClass(get_class($this));
+        $properties = $reflectInstance->getProperties();
+        foreach ($properties as $property){
+            $key = $property->getName();
+            $getMethodName = $this->getGetMethodName($key);
+            $data[$key] = method_exists($this, $getMethodName) ? $this->$getMethodName() : $this->$key;
+            if(is_null($data[$key])){
+                unset($data[$key]);
+            }
+        }
+        return $data;
+    }
+
+    /**
+     * 下划线转驼峰
+     * @param $key
+     */
+    public function conversionToTuoFeng($key)
+    {
+        $str = preg_replace_callback('/([-_]+([a-z]{1}))/i', function ($matches) {
+            return strtoupper($matches[2]);
+        }, $key);
+        return $str;
+    }
+
+    /**
+     * 驼峰转下划线
+     * @param $key
+     * @return string
+     */
+    public function conversionToXiaHuaXian($key)
+    {
+        $str = str_replace("_", "", $key);
+        $str = preg_replace_callback('/([A-Z]{1})/', function ($matches) {
+            return '_' . strtolower($matches[0]);
+        }, $str);
+        return ltrim($str, "_");
+    }
+}

+ 93 - 0
src/shanTaoTool/Bean/BaseBeanV1.php

@@ -0,0 +1,93 @@
+<?php
+
+
+namespace Tool\ShanTaoTool\Bean;
+
+
+
+
+class BaseBeanV1
+{
+    /**
+     * 构造函数
+     * @param $data 数据集
+     */
+    public function __construct($data = [])
+    {
+        if (!empty($data)) {
+            foreach ($data as $key => $val) {
+                if (property_exists($this, $key) && !is_null($val)) {
+                    $setMethodName = $this->getSetMethodName($key);
+                    if (method_exists($this, $setMethodName)) {
+                        $this->$setMethodName($val);
+                    } else {
+                        $this->$key = $val;
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * 获取set方法名称
+     * @param $key
+     * @return string
+     */
+    protected function getSetMethodName($key)
+    {
+        return "set" . ucfirst($this->conversionToTuoFeng($key));
+    }
+
+    /**
+     * 获取get方法名称
+     * @param $key
+     * @return string
+     */
+    protected function getGetMethodName($key)
+    {
+        return "get" . ucfirst($this->conversionToTuoFeng($key));
+    }
+
+    public function toArray()
+    {
+        $data = [];
+        //获取所有属性
+        $reflectInstance = new \ReflectionClass(get_class($this));
+        $properties = $reflectInstance->getProperties();
+        foreach ($properties as $property){
+            $key = $property->getName();
+            $getMethodName = $this->getGetMethodName($key);
+            $data[$key] = method_exists($this, $getMethodName) ? $this->$getMethodName() : $this->$key;
+            if(is_null($data[$key])){
+                unset($data[$key]);
+            }
+        }
+        return $data;
+    }
+
+    /**
+     * 下划线转驼峰
+     * @param $key
+     */
+    public function conversionToTuoFeng($key)
+    {
+        $str = preg_replace_callback('/([-_]+([a-z]{1}))/i', function ($matches) {
+            return strtoupper($matches[2]);
+        }, $key);
+        return $str;
+    }
+
+    /**
+     * 驼峰转下划线
+     * @param $key
+     * @return string
+     */
+    public function conversionToXiaHuaXian($key)
+    {
+        $str = str_replace("_", "", $key);
+        $str = preg_replace_callback('/([A-Z]{1})/', function ($matches) {
+            return '_' . strtolower($matches[0]);
+        }, $str);
+        return ltrim($str, "_");
+    }
+}

+ 99 - 0
src/shanTaoTool/Bean/Crm/TaobaoBatchSendParamBean.php

@@ -0,0 +1,99 @@
+<?php
+
+
+namespace Tool\ShanTaoTool\Bean\Crm;
+
+
+use Tool\ShanTaoTool\Bean\BaseBean;
+
+class TaobaoBatchSendParamBean extends BaseBean
+{
+    /**
+     * 订单编号
+     * @var $orderNumber string
+     */
+    private $orderNumber;
+
+    /**
+     * 卖家昵称
+     * @var $sellerNick string
+     */
+    private $sellerNick;
+
+    /**
+     * 快递单号
+     * @var $expressNumber string
+     */
+    private $expressNumber;
+
+    /**
+     * 快递编码
+     * @var $expressCode string
+     */
+    private $expressCode;
+
+    /**
+     * @return string
+     */
+    public function getOrderNumber(): string
+    {
+        return $this->orderNumber;
+    }
+
+    /**
+     * @param string $orderNumber
+     */
+    public function setOrderNumber(string $orderNumber)
+    {
+        $this->orderNumber = $orderNumber;
+    }
+
+    /**
+     * @return string
+     */
+    public function getSellerNick(): string
+    {
+        return $this->sellerNick;
+    }
+
+    /**
+     * @param string $sellerNick
+     */
+    public function setSellerNick(string $sellerNick)
+    {
+        $this->sellerNick = $sellerNick;
+    }
+
+    /**
+     * @return string
+     */
+    public function getExpressNumber(): string
+    {
+        return $this->expressNumber;
+    }
+
+    /**
+     * @param string $expressNumber
+     */
+    public function setExpressNumber(string $expressNumber)
+    {
+        $this->expressNumber = $expressNumber;
+    }
+
+    /**
+     * @return string
+     */
+    public function getExpressCode(): string
+    {
+        return $this->expressCode;
+    }
+
+    /**
+     * @param string $expressCode
+     */
+    public function setExpressCode(string $expressCode)
+    {
+        $this->expressCode = $expressCode;
+    }
+
+}

+ 230 - 0
src/shanTaoTool/Bean/ElasticSearch/CreateLogDocParamBean.php

@@ -0,0 +1,230 @@
+<?php
+
+
+namespace Tool\ShanTaoTool\Bean\ElasticSearch;
+
+
+use Tool\ShanTaoTool\Bean\BaseBean;
+
+class CreateLogDocParamBean extends BaseBean
+{
+    /**
+     * 请求id
+     * @var $requestId string
+     */
+    private $requestId;
+
+    /**
+     * @return string
+     */
+    public function getRequestId()
+    {
+        return $this->requestId;
+    }
+
+    /**
+     * @param string $requestId
+     */
+    public function setRequestId($requestId)
+    {
+        $this->requestId = $requestId;
+    }
+
+    /**
+     * 请求参数
+     * @var $requestParams string
+     */
+    private $requestParam;
+
+    /**
+     * 请求路径
+     * @var $requestPath string
+     */
+    private $requestPath;
+
+    /**
+     * 请求响应
+     * @var $requestResponse string
+     */
+    private $requestResponse;
+
+    /**
+     * 自定义日志
+     * @var $requestLog string
+     */
+    private $requestLog;
+
+    /**
+     * sql日志
+     * @var $requestSqlLog string
+     */
+    private $requestSqlLog;
+
+    /**
+     * 请求的项目名称
+     * @var $requestProjectName string
+     */
+    private $requestProjectName;
+
+    /**
+     * 请求开始时间
+     * @var $createdAt string
+     */
+    private $createdAt;
+
+    /**
+     * 请求结束时间
+     * @var $updatedAt string
+     */
+    private $updatedAt;
+
+    /**
+     * 链路追踪ID
+     * @var string $uniqueTraceId
+     */
+    private $uniqueTraceId;
+
+    /**
+     * @return string
+     */
+    public function getUniqueTraceId()
+    {
+        return $this->uniqueTraceId;
+    }
+
+    /**
+     * @param string $uniqueTraceId
+     */
+    public function setUniqueTraceId($uniqueTraceId)
+    {
+        $this->uniqueTraceId = $uniqueTraceId;
+    }
+
+    /**
+     * @return string
+     */
+    public function getRequestParam()
+    {
+        return $this->requestParam;
+    }
+
+    /**
+     * @param string $requestParams
+     */
+    public function setRequestParam($requestParam)
+    {
+        $this->requestParam = $requestParam;
+    }
+
+    /**
+     * @return string
+     */
+    public function getRequestPath()
+    {
+        return $this->requestPath;
+    }
+
+    /**
+     * @param string $requestPath
+     */
+    public function setRequestPath($requestPath)
+    {
+        $this->requestPath = $requestPath;
+    }
+
+    /**
+     * @return string
+     */
+    public function getRequestResponse()
+    {
+        return $this->requestResponse;
+    }
+
+    /**
+     * @param string $requestResponse
+     */
+    public function setRequestResponse($requestResponse)
+    {
+        $this->requestResponse = $requestResponse;
+    }
+
+    /**
+     * @return string
+     */
+    public function getRequestLog()
+    {
+        return $this->requestLog;
+    }
+
+    /**
+     * @param string $requestLog
+     */
+    public function setRequestLog($requestLog)
+    {
+        $this->requestLog = $requestLog;
+    }
+
+    /**
+     * @return string
+     */
+    public function getRequestSqlLog()
+    {
+        return $this->requestSqlLog;
+    }
+
+    /**
+     * @param string $requestSqlLog
+     */
+    public function setRequestSqlLog($requestSqlLog)
+    {
+        $this->requestSqlLog = $requestSqlLog;
+    }
+
+    /**
+     * @return string
+     */
+    public function getRequestProjectName()
+    {
+        return $this->requestProjectName;
+    }
+
+    /**
+     * @param string $requestProjectName
+     */
+    public function setRequestProjectName($requestProjectName)
+    {
+        $this->requestProjectName = $requestProjectName;
+    }
+
+    /**
+     * @return string
+     */
+    public function getCreatedAt()
+    {
+        return $this->createdAt;
+    }
+
+    /**
+     * @param string $createdAt
+     */
+    public function setCreatedAt($createdAt)
+    {
+        $this->createdAt = $createdAt;
+    }
+
+    /**
+     * @return string
+     */
+    public function getUpdatedAt()
+    {
+        return $this->updatedAt;
+    }
+
+    /**
+     * @param string $updatedAt
+     */
+    public function setUpdatedAt($updatedAt)
+    {
+        $this->updatedAt = $updatedAt;
+    }
+}

+ 205 - 0
src/shanTaoTool/Bean/ElasticSearch/GetLogDocParamBean.php

@@ -0,0 +1,205 @@
+<?php
+
+
+namespace Tool\ShanTaoTool\Bean\ElasticSearch;
+
+
+use Tool\ShanTaoTool\Bean\BaseBean;
+
+class GetLogDocParamBean extends BaseBean
+{
+    /**
+     * 索引名称
+     * @var $index string
+     */
+    private $index;
+
+    /**
+     * 项目名称
+     * @var $projectName string
+     */
+    private $projectName;
+
+    /**
+     * 请求路径
+     * @var $requestPath string
+     */
+    private $requestPath;
+
+    /**
+     * 第几页
+     * @var $page
+     */
+    private $page;
+
+    /**
+     * 每页数量
+     * @var $pageSize
+     */
+    private $pageSize;
+
+    /**
+     * @var 参数
+     */
+    private $param;
+
+    /**
+     * @var string $uniqueTraceId 链路追踪ID
+     */
+    private $uniqueTraceId;
+
+    /**
+     * @var string 请求开始时间
+     */
+    private $requestStartTime;
+
+    /**
+     * @var string 请求结束时间
+     */
+    private $requestEndTime;
+
+    /**
+     * @return string
+     */
+    public function getRequestStartTime()
+    {
+        return $this->requestStartTime;
+    }
+
+    /**
+     * @param string $requestStartTime
+     */
+    public function setRequestStartTime($requestStartTime)
+    {
+        $this->requestStartTime = $requestStartTime;
+    }
+
+    /**
+     * @return string
+     */
+    public function getRequestEndTime()
+    {
+        return $this->requestEndTime;
+    }
+
+    /**
+     * @param string $requestEndTime
+     */
+    public function setRequestEndTime($requestEndTime)
+    {
+        $this->requestEndTime = $requestEndTime;
+    }
+
+    /**
+     * @return string 链路追踪ID
+     */
+    public function getUniqueTraceId()
+    {
+        return $this->uniqueTraceId;
+    }
+
+    /**
+     * 链路追踪ID
+     * @param  $uniqueTraceId
+     */
+    public function setUniqueTraceId($uniqueTraceId)
+    {
+        $this->uniqueTraceId = $uniqueTraceId;
+    }
+
+    /**
+     * @return
+     */
+    public function getParam()
+    {
+        return $this->param;
+    }
+
+    /**
+     * @param  $param
+     */
+    public function setParam($param)
+    {
+        $this->param = $param;
+    }
+
+    /**
+     * @return string
+     */
+    public function getIndex()
+    {
+        return $this->index;
+    }
+
+    /**
+     * @param string $index
+     */
+    public function setIndex($index)
+    {
+        $this->index = $index;
+    }
+
+    /**
+     * @return string
+     */
+    public function getProjectName()
+    {
+        return $this->projectName;
+    }
+
+    /**
+     * @param string $projectName
+     */
+    public function setProjectName($projectName)
+    {
+        $this->projectName = $projectName;
+    }
+
+    /**
+     * @return string
+     */
+    public function getRequestPath()
+    {
+        return $this->requestPath;
+    }
+
+    /**
+     * @param string $requestPath
+     */
+    public function setRequestPath($requestPath)
+    {
+        $this->requestPath = $requestPath;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getPage()
+    {
+        return $this->page;
+    }
+
+    /**
+     * @param mixed $page
+     */
+    public function setPage($page)
+    {
+        $this->page = $page;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getPageSize()
+    {
+        return $this->pageSize;
+    }
+
+    /**
+     * @param mixed $pageSize
+     */
+    public function setPageSize($pageSize)
+    {
+        $this->pageSize = $pageSize;
+    }
+}

+ 120 - 0
src/shanTaoTool/Bean/Pay/GetCodePayUrlParamBean.php

@@ -0,0 +1,120 @@
+<?php
+
+
+namespace Tool\ShanTaoTool\Bean\Pay;
+
+
+use Tool\ShanTaoTool\Bean\BaseBean;
+
+class GetCodePayUrlParamBean extends BaseBean
+{
+    /**
+     * appkey
+     * @var string $appKey
+     */
+    private $appKey;
+
+    /**
+     * secret
+     * @var string $appSecret
+     */
+    private $appSecret;
+
+    /**
+     * 订单支付金额
+     * @var int $orderPrice
+     */
+    private $orderPrice;
+
+    /**
+     * 第三方关联订单号
+     * @var string $relationOrderNumber
+     */
+    private $relationOrderNumber;
+
+    /**
+     * 支付类型(1微信2支付宝)
+     * @var int $payType
+     */
+    private $payType;
+
+    /**
+     * @return string
+     */
+    public function getAppKey(): string
+    {
+        return $this->appKey;
+    }
+
+    /**
+     * @param string $appKey
+     */
+    public function setAppKey(string $appKey)
+    {
+        $this->appKey = $appKey;
+    }
+
+    /**
+     * @return string
+     */
+    public function getAppSecret(): string
+    {
+        return $this->appSecret;
+    }
+
+    /**
+     * @param string $appSecret
+     */
+    public function setAppSecret(string $appSecret)
+    {
+        $this->appSecret = $appSecret;
+    }
+
+    /**
+     * @return int
+     */
+    public function getOrderPrice(): int
+    {
+        return $this->orderPrice;
+    }
+
+    /**
+     * @param int $orderPrice
+     */
+    public function setOrderPrice(int $orderPrice)
+    {
+        $this->orderPrice = $orderPrice;
+    }
+
+    /**
+     * @return string
+     */
+    public function getRelationOrderNumber(): string
+    {
+        return $this->relationOrderNumber;
+    }
+
+    /**
+     * @param string $relationOrderNumber
+     */
+    public function setRelationOrderNumber(string $relationOrderNumber)
+    {
+        $this->relationOrderNumber = $relationOrderNumber;
+    }
+
+    /**
+     * @return int
+     */
+    public function getPayType(): int
+    {
+        return $this->payType;
+    }
+
+    /**
+     * @param int $payType
+     */
+    public function setPayType(int $payType)
+    {
+        $this->payType = $payType;
+    }
+}

+ 115 - 0
src/shanTaoTool/Bean/Pdd/Ddk/GoodsDetailParamBean.php

@@ -0,0 +1,115 @@
+<?php
+
+
+namespace Tool\ShanTaoTool\Bean\Pdd\Ddk;
+
+
+use Tool\ShanTaoTool\Bean\BaseBean;
+
+class GoodsDetailParamBean extends BaseBean
+{
+    /**
+     * 自定义参数json
+     */
+    private $customParameters;
+
+    /**
+     * 商品goodsSign
+     */
+    private $goodsSign;
+
+    /**
+     * 推广位pid
+     */
+    private $pid;
+
+    /**
+     * 搜索ID
+     */
+    private $searchId;
+
+    /**
+     * 招商多多客ID
+     */
+    private $zsDuoId;
+
+    /**
+     * @return mixed
+     */
+    public function getCustomParameters()
+    {
+        return $this->customParameters;
+    }
+
+    /**
+     * @param mixed $customParameters
+     */
+    public function setCustomParameters($customParameters)
+    {
+        $this->customParameters = $customParameters;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getGoodsSign()
+    {
+        return $this->goodsSign;
+    }
+
+    /**
+     * @param mixed $goodsSign
+     */
+    public function setGoodsSign($goodsSign)
+    {
+        $this->goodsSign = $goodsSign;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getPid()
+    {
+        return $this->pid;
+    }
+
+    /**
+     * @param mixed $pid
+     */
+    public function setPid($pid)
+    {
+        $this->pid = $pid;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getSearchId()
+    {
+        return $this->searchId;
+    }
+
+    /**
+     * @param mixed $searchId
+     */
+    public function setSearchId($searchId)
+    {
+        $this->searchId = $searchId;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getZsDuoId()
+    {
+        return $this->zsDuoId;
+    }
+
+    /**
+     * @param mixed $zsDuoId
+     */
+    public function setZsDuoId($zsDuoId)
+    {
+        $this->zsDuoId = $zsDuoId;
+    }
+}

+ 305 - 0
src/shanTaoTool/Bean/Pdd/Ddk/GoodsPromotionUrlGenerateParamBean.php

@@ -0,0 +1,305 @@
+<?php
+
+
+namespace Tool\ShanTaoTool\Bean\Pdd\Ddk;
+
+
+
+use Tool\ShanTaoTool\Bean\BaseBeanV1;
+
+class GoodsPromotionUrlGenerateParamBean extends BaseBeanV1
+{
+    /**
+     * 多多礼金ID
+     */
+    private $cash_gift_id;
+
+    /**
+     * 自定义礼金标题,用于向用户展示渠道专属福利,不超过12个字
+     */
+    private $cash_gift_name;
+
+    /**
+     * 自定义参数json
+     */
+    private $custom_parameters;
+
+    /**
+     * 是否生成带授权的单品链接。如果未授权,则会走授权流程
+     */
+    private $generate_authority_url;
+
+    /**
+     * 是否生成店铺收藏券推广链接
+     */
+    private $generate_mall_collect_coupon;
+
+    /**
+     * 是否生成qq小程序
+     */
+    private $generate_qq_app;
+
+    /**
+     * 是否返回 schema URL
+     */
+    private $generate_schema_url;
+
+    /**
+     * 是否生成短链接,true-是,false-否
+     */
+    private $generate_short_url;
+
+    /**
+     * 是否生成拼多多福利券微信小程序推广信息
+     */
+    private $generate_we_app;
+
+    /**
+     * 商品goodsSign列表,例如:["c9r2omogKFFAc7WBwvbZU1ikIb16_J3CTa8HNN"],
+     */
+    private $goods_sign_list;
+
+    /**
+     * true--生成多人团推广链接 false--生成单人团推广链接(默认false)1、单人团推广链接:用户访问单人团推广链接,可直接购买商品无需拼团。2、多人团推广链接:用户访问双人团推广链接开团,若用户分享给他人参团,则开团者和参团者的佣金均结算给推手
+     */
+    private $multi_group;
+
+    /**
+     * 推广位ID
+     */
+    private $p_id;
+
+    /**
+     * 搜索id,建议填写,提高收益。来自pdd.ddk.goods.recommend.get、pdd.ddk.goods.search、pdd.ddk.top.goods.list.query等接口
+     */
+    private $search_id;
+
+    /**
+     * 招商多多客ID
+     */
+    private $zs_duo_id;
+
+    /**
+     * @return mixed
+     */
+    public function getCashGiftId()
+    {
+        return $this->cash_gift_id;
+    }
+
+    /**
+     * @param mixed $cash_gift_id
+     */
+    public function setCashGiftId($cash_gift_id)
+    {
+        $this->cash_gift_id = $cash_gift_id;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getCashGiftName()
+    {
+        return $this->cash_gift_name;
+    }
+
+    /**
+     * @param mixed $cash_gift_name
+     */
+    public function setCashGiftName($cash_gift_name)
+    {
+        $this->cash_gift_name = $cash_gift_name;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getCustomParameters()
+    {
+        return $this->custom_parameters;
+    }
+
+    /**
+     * @param mixed $custom_parameters
+     */
+    public function setCustomParameters($custom_parameters)
+    {
+        $this->custom_parameters = $custom_parameters;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getGenerateAuthorityUrl()
+    {
+        return $this->generate_authority_url;
+    }
+
+    /**
+     * @param mixed $generate_authority_url
+     */
+    public function setGenerateAuthorityUrl($generate_authority_url)
+    {
+        $this->generate_authority_url = $generate_authority_url;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getGenerateMallCollectCoupon()
+    {
+        return $this->generate_mall_collect_coupon;
+    }
+
+    /**
+     * @param mixed $generate_mall_collect_coupon
+     */
+    public function setGenerateMallCollectCoupon($generate_mall_collect_coupon)
+    {
+        $this->generate_mall_collect_coupon = $generate_mall_collect_coupon;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getGenerateQqApp()
+    {
+        return $this->generate_qq_app;
+    }
+
+    /**
+     * @param mixed $generate_qq_app
+     */
+    public function setGenerateQqApp($generate_qq_app)
+    {
+        $this->generate_qq_app = $generate_qq_app;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getGenerateSchemaUrl()
+    {
+        return $this->generate_schema_url;
+    }
+
+    /**
+     * @param mixed $generate_schema_url
+     */
+    public function setGenerateSchemaUrl($generate_schema_url)
+    {
+        $this->generate_schema_url = $generate_schema_url;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getGenerateShortUrl()
+    {
+        return $this->generate_short_url;
+    }
+
+    /**
+     * @param mixed $generate_short_url
+     */
+    public function setGenerateShortUrl($generate_short_url)
+    {
+        $this->generate_short_url = $generate_short_url;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getGenerateWeApp()
+    {
+        return $this->generate_we_app;
+    }
+
+    /**
+     * @param mixed $generate_we_app
+     */
+    public function setGenerateWeApp($generate_we_app)
+    {
+        $this->generate_we_app = $generate_we_app;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getGoodsSignList()
+    {
+        return $this->goods_sign_list;
+    }
+
+    /**
+     * @param mixed $goods_sign_list
+     */
+    public function setGoodsSignList($goods_sign_list)
+    {
+        $this->goods_sign_list = $goods_sign_list;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getMultiGroup()
+    {
+        return $this->multi_group;
+    }
+
+    /**
+     * @param mixed $multi_group
+     */
+    public function setMultiGroup($multi_group)
+    {
+        $this->multi_group = $multi_group;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getPId()
+    {
+        return $this->p_id;
+    }
+
+    /**
+     * @param mixed $p_id
+     */
+    public function setPId($p_id)
+    {
+        $this->p_id = $p_id;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getSearchId()
+    {
+        return $this->search_id;
+    }
+
+    /**
+     * @param mixed $search_id
+     */
+    public function setSearchId($search_id)
+    {
+        $this->search_id = $search_id;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getZsDuoId()
+    {
+        return $this->zs_duo_id;
+    }
+
+    /**
+     * @param mixed $zs_duo_id
+     */
+    public function setZsDuoId($zs_duo_id)
+    {
+        $this->zs_duo_id = $zs_duo_id;
+    }
+}

+ 199 - 0
src/shanTaoTool/Bean/Pdd/Ddk/GoodsRecommendGetParamBean.php

@@ -0,0 +1,199 @@
+<?php
+
+
+namespace Tool\ShanTaoTool\Bean\Pdd\Ddk;
+
+
+use Tool\ShanTaoTool\Bean\BaseBeanV1;
+
+class GoodsRecommendGetParamBean extends BaseBeanV1
+{
+    /**
+     * 活动商品标记数组,例:[4,7],4-秒杀,7-百亿补贴,10851-千万补贴,31-品牌黑标,10564-精选爆品-官方直推爆款,10584-精选爆品-团长推荐,24-品牌高佣,其他的值请忽略
+     */
+    private $activity_tags;
+
+    /**
+     * 猜你喜欢场景的商品类目,20100-百货,20200-母婴,20300-食品,20400-女装,20500-电器,20600-鞋包,20700-内衣,20800-美妆,20900-男装,21000-水果,21100-家纺,21200-文具,21300-运动,21400-虚拟,21500-汽车,21600-家装,21700-家具,21800-医药
+     */
+    private $cat_id;
+
+    /**
+     * 进宝频道推广商品: 1-今日销量榜,3-相似商品推荐,4-猜你喜欢(和进宝网站精选一致),5-实时热销榜,6-实时收益榜。默认值5
+     */
+    private $channel_type;
+
+    /**
+     * 自定义参数json
+     */
+    private $custom_parameters;
+
+    /**
+     * 商品goodsSign列表,相似商品推荐场景时必传,仅取数组的第一位,例如:["c9r2omogKFFAc7WBwvbZU1ikIb16_J3CTa8HNN"]
+     */
+    private $goods_sign_list;
+
+    /**
+     * 每页数量
+     */
+    private $limit;
+
+    /**
+     * 翻页时建议填写前页返回的list_id值
+     */
+    private $list_id;
+
+    /**
+     * 从多少位置开始请求;默认值 : 0,offset需是limit的整数倍,仅支持整页翻页
+     */
+    private $offset;
+
+    /**
+     * 推广位ID
+     */
+    private $pid;
+
+    /**
+     * @return mixed
+     */
+    public function getActivityTags()
+    {
+        return $this->activity_tags;
+    }
+
+    /**
+     * @param mixed $activity_tags
+     */
+    public function setActivityTags($activity_tags)
+    {
+        $this->activity_tags = $activity_tags;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getCatId()
+    {
+        return $this->cat_id;
+    }
+
+    /**
+     * @param mixed $cat_id
+     */
+    public function setCatId($cat_id)
+    {
+        $this->cat_id = $cat_id;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getChannelType()
+    {
+        return $this->channel_type;
+    }
+
+    /**
+     * @param mixed $channel_type
+     */
+    public function setChannelType($channel_type)
+    {
+        $this->channel_type = $channel_type;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getCustomParameters()
+    {
+        return $this->custom_parameters;
+    }
+
+    /**
+     * @param mixed $custom_parameters
+     */
+    public function setCustomParameters($custom_parameters)
+    {
+        $this->custom_parameters = $custom_parameters;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getGoodsSignList()
+    {
+        return $this->goods_sign_list;
+    }
+
+    /**
+     * @param mixed $goods_sign_list
+     */
+    public function setGoodsSignList($goods_sign_list)
+    {
+        $this->goods_sign_list = $goods_sign_list;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getLimit()
+    {
+        return $this->limit;
+    }
+
+    /**
+     * @param mixed $limit
+     */
+    public function setLimit($limit)
+    {
+        $this->limit = $limit;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getListId()
+    {
+        return $this->list_id;
+    }
+
+    /**
+     * @param mixed $list_id
+     */
+    public function setListId($list_id)
+    {
+        $this->list_id = $list_id;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getOffset()
+    {
+        return $this->offset;
+    }
+
+    /**
+     * @param mixed $offset
+     */
+    public function setOffset($offset)
+    {
+        $this->offset = $offset;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getPid()
+    {
+        return $this->pid;
+    }
+
+    /**
+     * @param mixed $pid
+     */
+    public function setPid($pid)
+    {
+        $this->pid = $pid;
+    }
+}

+ 346 - 0
src/shanTaoTool/Bean/Pdd/Ddk/GoodsSearchParamBean.php

@@ -0,0 +1,346 @@
+<?php
+
+
+namespace Tool\ShanTaoTool\Bean\Pdd\Ddk;
+
+
+use Tool\ShanTaoTool\Bean\BaseBeanV1;
+
+class GoodsSearchParamBean extends BaseBeanV1
+{
+    /**
+     * 活动商品标记数组,例:[4,7],4-秒杀,7-百亿补贴,10851-千万补贴,31-品牌黑标,10564-精选爆品-官方直推爆款,10584-精选爆品-团长推荐,24-品牌高佣,其他的值请忽略
+     */
+    private $activity_tags;
+
+    /**
+     * 自定义屏蔽一级/二级/三级类目ID,自定义数量不超过20个;使用pdd.goods.cats.get接口获取cat_id
+     */
+    private $block_cats;
+
+    /**
+     * 屏蔽商品类目包:1-拼多多小程序屏蔽的类目&关键词;2-虚拟类目;3-医疗器械;4-处方药;5-非处方药
+     */
+    private $block_cat_packages;
+
+    /**
+     * 商品类目ID,使用pdd.goods.cats.get接口获取
+     */
+    private $cat_id;
+
+    /**
+     * 自定义参数json
+     */
+    private $custom_parameters;
+
+    /**
+     * 商品goodsSign列表,例如:["c9r2omogKFFAc7WBwvbZU1ikIb16_J3CTa8HNN"]
+     */
+    private $goods_sign_list;
+
+    /**
+     * 是否为品牌商品
+     */
+    private $is_brand_goods;
+
+    /**
+     * 商品关键词,与opt_id字段选填一个或全部填写。可支持goods_id、拼多多链接(即拼多多app商详的链接)、进宝长链/短链(即为pdd.ddk.goods.promotion.url.generate接口生成的长短链)
+     */
+    private $keyword;
+
+    /**
+     * 翻页时建议填写前页返回的list_id值
+     */
+    private $list_id;
+
+    /**
+     * 店铺类型,1-个人,2-企业,3-旗舰店,4-专卖店,5-专营店,6-普通店(未传为全部)
+     */
+    private $merchant_type;
+
+    /**
+     * 店铺类型数组,例如:[1,2]
+     */
+    private $merchant_type_list;
+
+    /**
+     * 商品标签类目ID,使用pdd.goods.opt.get获取
+     */
+    private $opt_id;
+
+    /**
+     * 第几页
+     */
+    private $page;
+
+    /**
+     * 每页数量
+     */
+    private $page_size;
+
+    /**
+     * 推广位ID
+     */
+    private $pid;
+
+    /**
+     * 筛选范围列表 样例:[{"range_id":0,"range_from":1,"range_to":1500},{"range_id":1,"range_from":1,"range_to":1500}]
+     */
+    private $range_list;
+
+    /**
+     * @return mixed
+     */
+    public function getActivityTags()
+    {
+        return $this->activity_tags;
+    }
+
+    /**
+     * @param mixed $activity_tags
+     */
+    public function setActivityTags($activity_tags)
+    {
+        $this->activity_tags = $activity_tags;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getBlockCats()
+    {
+        return $this->block_cats;
+    }
+
+    /**
+     * @param mixed $block_cats
+     */
+    public function setBlockCats($block_cats)
+    {
+        $this->block_cats = $block_cats;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getBlockCatPackages()
+    {
+        return $this->block_cat_packages;
+    }
+
+    /**
+     * @param mixed $block_cat_packages
+     */
+    public function setBlockCatPackages($block_cat_packages)
+    {
+        $this->block_cat_packages = $block_cat_packages;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getCatId()
+    {
+        return $this->cat_id;
+    }
+
+    /**
+     * @param mixed $cat_id
+     */
+    public function setCatId($cat_id)
+    {
+        $this->cat_id = $cat_id;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getCustomParameters()
+    {
+        return $this->custom_parameters;
+    }
+
+    /**
+     * @param mixed $custom_parameters
+     */
+    public function setCustomParameters($custom_parameters)
+    {
+        $this->custom_parameters = $custom_parameters;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getGoodsSignList()
+    {
+        return $this->goods_sign_list;
+    }
+
+    /**
+     * @param mixed $goods_sign_list
+     */
+    public function setGoodsSignList($goods_sign_list)
+    {
+        $this->goods_sign_list = $goods_sign_list;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getIsBrandGoods()
+    {
+        return $this->is_brand_goods;
+    }
+
+    /**
+     * @param mixed $is_brand_goods
+     */
+    public function setIsBrandGoods($is_brand_goods)
+    {
+        $this->is_brand_goods = $is_brand_goods;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getKeyword()
+    {
+        return $this->keyword;
+    }
+
+    /**
+     * @param mixed $keyword
+     */
+    public function setKeyword($keyword)
+    {
+        $this->keyword = $keyword;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getListId()
+    {
+        return $this->list_id;
+    }
+
+    /**
+     * @param mixed $list_id
+     */
+    public function setListId($list_id)
+    {
+        $this->list_id = $list_id;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getMerchantType()
+    {
+        return $this->merchant_type;
+    }
+
+    /**
+     * @param mixed $merchant_type
+     */
+    public function setMerchantType($merchant_type)
+    {
+        $this->merchant_type = $merchant_type;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getMerchantTypeList()
+    {
+        return $this->merchant_type_list;
+    }
+
+    /**
+     * @param mixed $merchant_type_list
+     */
+    public function setMerchantTypeList($merchant_type_list)
+    {
+        $this->merchant_type_list = $merchant_type_list;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getOptId()
+    {
+        return $this->opt_id;
+    }
+
+    /**
+     * @param mixed $opt_id
+     */
+    public function setOptId($opt_id)
+    {
+        $this->opt_id = $opt_id;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getPage()
+    {
+        return $this->page;
+    }
+
+    /**
+     * @param mixed $page
+     */
+    public function setPage($page)
+    {
+        $this->page = $page;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getPageSize()
+    {
+        return $this->page_size;
+    }
+
+    /**
+     * @param mixed $page_size
+     */
+    public function setPageSize($page_size)
+    {
+        $this->page_size = $page_size;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getPid()
+    {
+        return $this->pid;
+    }
+
+    /**
+     * @param mixed $pid
+     */
+    public function setPid($pid)
+    {
+        $this->pid = $pid;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getRangeList()
+    {
+        return $this->range_list;
+    }
+
+    /**
+     * @param mixed $range_list
+     */
+    public function setRangeList($range_list)
+    {
+        $this->range_list = $range_list;
+    }
+}

+ 136 - 0
src/shanTaoTool/Bean/Pdd/Ddk/OrderListRangeGetParamBean.php

@@ -0,0 +1,136 @@
+<?php
+
+
+namespace Tool\ShanTaoTool\Bean\Pdd\Ddk;
+
+
+use Tool\ShanTaoTool\Bean\BaseBean;
+
+class OrderListRangeGetParamBean extends BaseBean
+{
+    /**
+     * 是否为礼金订单
+     */
+    private $cashGiftOrder;
+
+    /**
+     * 支付结束时间
+     */
+    private $endTime;
+
+    /**
+     * 上一次迭代器id
+     */
+    private $lastOrderId;
+
+    /**
+     * 每页数量
+     */
+    private $pageSize;
+
+    /**
+     * 订单类型(1推广订单2直播间订单)
+     */
+    private $queryOrderType;
+
+    /**
+     * 支付开始时间
+     */
+    private $startTime;
+
+    /**
+     * @return mixed
+     */
+    public function getCashGiftOrder()
+    {
+        return $this->cashGiftOrder;
+    }
+
+    /**
+     * @param mixed $cashGiftOrder
+     */
+    public function setCashGiftOrder($cashGiftOrder)
+    {
+        $this->cashGiftOrder = $cashGiftOrder;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getEndTime()
+    {
+        return $this->endTime;
+    }
+
+    /**
+     * @param mixed $endTime
+     */
+    public function setEndTime($endTime)
+    {
+        $this->endTime = $endTime;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getLastOrderId()
+    {
+        return $this->lastOrderId;
+    }
+
+    /**
+     * @param mixed $lastOrderId
+     */
+    public function setLastOrderId($lastOrderId)
+    {
+        $this->lastOrderId = $lastOrderId;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getPageSize()
+    {
+        return $this->pageSize;
+    }
+
+    /**
+     * @param mixed $pageSize
+     */
+    public function setPageSize($pageSize)
+    {
+        $this->pageSize = $pageSize;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getQueryOrderType()
+    {
+        return $this->queryOrderType;
+    }
+
+    /**
+     * @param mixed $queryOrderType
+     */
+    public function setQueryOrderType($queryOrderType)
+    {
+        $this->queryOrderType = $queryOrderType;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getStartTime()
+    {
+        return $this->startTime;
+    }
+
+    /**
+     * @param mixed $startTime
+     */
+    public function setStartTime($startTime)
+    {
+        $this->startTime = $startTime;
+    }
+}

+ 23 - 0
src/shanTaoTool/Bean/Pdd/Ddk/PidStatusEnum.php

@@ -0,0 +1,23 @@
+<?php
+
+
+namespace Tool\ShanTaoTool\Bean\Pdd\Ddk;
+
+
+/**
+ * 推广位状态枚举类
+ * Class PidStatusEnum
+ * @package Tool\ShanTaoTool\Bean\Pdd\Ddk
+ */
+class PidStatusEnum
+{
+    /**
+     * 封禁
+     */
+    const PID_STATUS_OFF=1;
+
+    /**
+     * 正常
+     */
+    const PID_STATUS_ON=0;
+}

+ 115 - 0
src/shanTaoTool/Bean/Pdd/Ddk/ResourceUrlGenParamBean.php

@@ -0,0 +1,115 @@
+<?php
+
+
+namespace Tool\ShanTaoTool\Bean\Pdd\Ddk;
+
+
+use Tool\ShanTaoTool\Bean\BaseBean;
+
+class ResourceUrlGenParamBean extends BaseBean
+{
+    /**
+     * 推广位ID
+     */
+    private $pid;
+
+    /**
+     * 自定义参数(json)
+     */
+    private $customParameters;
+
+    /**
+     * 是否生成拼多多福利券微信小程序推广信息
+     */
+    private $generateWeApp;
+
+    /**
+     * 频道来源
+     */
+    private $resourceType;
+
+    /**
+     * 原链接
+     */
+    private $url;
+
+    /**
+     * @return mixed
+     */
+    public function getPid()
+    {
+        return $this->pid;
+    }
+
+    /**
+     * @param mixed $pid
+     */
+    public function setPid($pid)
+    {
+        $this->pid = $pid;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getCustomParameters()
+    {
+        return $this->customParameters;
+    }
+
+    /**
+     * @param mixed $customParameters
+     */
+    public function setCustomParameters($customParameters)
+    {
+        $this->customParameters = $customParameters;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getGenerateWeApp()
+    {
+        return $this->generateWeApp;
+    }
+
+    /**
+     * @param mixed $generateWeApp
+     */
+    public function setGenerateWeApp($generateWeApp)
+    {
+        $this->generateWeApp = $generateWeApp;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getResourceType()
+    {
+        return $this->resourceType;
+    }
+
+    /**
+     * @param mixed $resourceType
+     */
+    public function setResourceType($resourceType)
+    {
+        $this->resourceType = $resourceType;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getUrl()
+    {
+        return $this->url;
+    }
+
+    /**
+     * @param mixed $url
+     */
+    public function setUrl($url)
+    {
+        $this->url = $url;
+    }
+}

+ 98 - 0
src/shanTaoTool/Bean/Qr/CreateQrLogoImgServiceParamBean.php

@@ -0,0 +1,98 @@
+<?php
+
+
+namespace Tool\ShanTaoTool\Bean\Qr;
+
+
+use Tool\ShanTaoTool\Bean\BaseBean;
+
+class CreateQrLogoImgServiceParamBean extends BaseBean
+{
+    /**
+     * 文件名称
+     * @var string $fileName
+     */
+    private $fileName;
+
+    /**
+     * 二维码内容
+     * @var string $qrContent
+     */
+    private $qrContent;
+
+    /**
+     * 二维码大小
+     * @var int $qrSize
+     */
+    private $qrSize;
+
+    /**
+     * logo地址
+     * @var string $logoName
+     */
+    private $logoName;
+
+    /**
+     * @return string
+     */
+    public function getFileName(): string
+    {
+        return $this->fileName;
+    }
+
+    /**
+     * @param string $fileName
+     */
+    public function setFileName(string $fileName)
+    {
+        $this->fileName = $fileName;
+    }
+
+    /**
+     * @return string
+     */
+    public function getQrContent(): string
+    {
+        return $this->qrContent;
+    }
+
+    /**
+     * @param string $qrContent
+     */
+    public function setQrContent(string $qrContent)
+    {
+        $this->qrContent = $qrContent;
+    }
+
+    /**
+     * @return int
+     */
+    public function getQrSize(): int
+    {
+        return $this->qrSize;
+    }
+
+    /**
+     * @param int $qrSize
+     */
+    public function setQrSize(int $qrSize)
+    {
+        $this->qrSize = $qrSize;
+    }
+
+    /**
+     * @return string
+     */
+    public function getLogoName(): string
+    {
+        return $this->logoName;
+    }
+
+    /**
+     * @param string $logoName
+     */
+    public function setLogoName(string $logoName)
+    {
+        $this->logoName = $logoName;
+    }
+}

+ 142 - 0
src/shanTaoTool/Bean/SendEmail/SendEmailByCustomeParamBean.php

@@ -0,0 +1,142 @@
+<?php
+
+
+namespace Tool\ShanTaoTool\Bean\SendEmail;
+
+
+use Tool\ShanTaoTool\Bean\BaseBean;
+
+class SendEmailByCustomeParamBean extends BaseBean
+{
+    /**
+     * 邮件标题
+     * @var string $title
+     */
+    private $title;
+
+    /**
+     * 邮件名称
+     * @var $name string
+     */
+    private $name;
+
+    /**
+     * 接收的邮件地址
+     * @var string $email
+     */
+    private $email;
+
+    /**
+     * 邮件内容
+     * @var string $content
+     */
+    private $content;
+
+    /**
+     * 邮件服务器账号
+     * @var string $serviceName
+     */
+    private $serviceName;
+
+    /**
+     * 邮件服务器密码
+     * @var string $servicePassword
+     */
+    private $servicePassword;
+
+    /**
+     * @return string
+     */
+    public function getTitle(): string
+    {
+        return $this->title;
+    }
+
+    /**
+     * @param string $title
+     */
+    public function setTitle(string $title)
+    {
+        $this->title = $title;
+    }
+
+    /**
+     * @return string
+     */
+    public function getName(): string
+    {
+        return $this->name;
+    }
+
+    /**
+     * @param string $name
+     */
+    public function setName(string $name)
+    {
+        $this->name = $name;
+    }
+
+    /**
+     * @return string
+     */
+    public function getEmail(): string
+    {
+        return $this->email;
+    }
+
+    /**
+     * @param string $email
+     */
+    public function setEmail(string $email)
+    {
+        $this->email = $email;
+    }
+
+    /**
+     * @return string
+     */
+    public function getContent(): string
+    {
+        return $this->content;
+    }
+
+    /**
+     * @param string $content
+     */
+    public function setContent(string $content)
+    {
+        $this->content = $content;
+    }
+
+    /**
+     * @return string
+     */
+    public function getServiceName(): string
+    {
+        return $this->serviceName;
+    }
+
+    /**
+     * @param string $serviceName
+     */
+    public function setServiceName(string $serviceName)
+    {
+        $this->serviceName = $serviceName;
+    }
+
+    /**
+     * @return string
+     */
+    public function getServicePassword(): string
+    {
+        return $this->servicePassword;
+    }
+
+    /**
+     * @param string $servicePassword
+     */
+    public function setServicePassword(string $servicePassword)
+    {
+        $this->servicePassword = $servicePassword;
+    }
+}

+ 32 - 0
src/shanTaoTool/Crm/Crm.php

@@ -0,0 +1,32 @@
+<?php
+
+
+namespace Tool\ShanTaoTool\Crm;
+
+
+use Tool\ShanTaoTool\Bean\Crm\TaobaoBatchSendParamBean;
+use Tool\ShanTaoTool\Exception\CrmException;
+use Tool\ShanTaoTool\HttpCurl;
+
+class Crm
+{
+    /**
+     * 淘宝批量发货接口
+     * @param $data
+     */
+    public static function taobaoBatchSend(TaobaoBatchSendParamBean $taobaoBatchSendParamBean)
+    {
+        $url = "v1/taobao/batchSendProduct";
+        $params = [
+            "orderNumber"=>$taobaoBatchSendParamBean->getOrderNumber(),
+            "sellerNick"=>$taobaoBatchSendParamBean->getSellerNick(),
+            "expressNumber"=>$taobaoBatchSendParamBean->getExpressNumber(),
+            "expressCode"=>$taobaoBatchSendParamBean->getExpressCode()
+        ];
+        $res = HttpCurl::postCurl(env("CRM_URL").$url,$params,[],false);
+        if(isset($res["status"])&&$res["status"]){
+            return $res["data"];
+        }
+        throw new CrmException("请求失败");
+    }
+}

+ 20 - 0
src/shanTaoTool/CrmTool.php

@@ -0,0 +1,20 @@
+<?php
+
+
+namespace Tool\ShanTaoTool;
+
+
+use Tool\ShanTaoTool\Bean\Crm\TaobaoBatchSendParamBean;
+use Tool\ShanTaoTool\Crm\Crm;
+
+class CrmTool
+{
+    /**
+     * 淘宝批量发货接口
+     * @param TaobaoBatchSendParamBean $taobaoBatchSendParamBean
+     */
+    public static function batchSend(TaobaoBatchSendParamBean $taobaoBatchSendParamBean)
+    {
+        return Crm::taobaoBatchSend($taobaoBatchSendParamBean);
+    }
+}

+ 324 - 0
src/shanTaoTool/ElasticSearch/ElasticSerach.php

@@ -0,0 +1,324 @@
+<?php
+
+
+namespace Tool\ShanTaoTool\ElasticSearch;
+
+use function Complex\sec;
+use Elasticsearch\ClientBuilder;
+use Tool\ShanTaoTool\Bean\ElasticSearch\GetLogDocParamBean;
+use Tool\ShanTaoTool\Exception\ElasticSearchException;
+
+/**
+ * es操作类
+ * Class ElasticSerach
+ * @package Tool\ShanTaoTool\ElasticSearch
+ */
+class ElasticSerach
+{
+    /**
+     * @var $client \Elasticsearch\Client
+     */
+    static $client;
+
+    /**
+     * 获取es客户端
+     */
+    public static function getElasticSearchClient()
+    {
+        $host = env("ES_HOST");
+        $port = env("ES_PORT");
+        $user = env("ES_USER");
+        $password = env("ES_PASSWORD");
+        $hosts = ["{$host}:{$port}"];
+        $clientBuilder = ClientBuilder::create();
+        //设置es地址
+        $clientBuilder->setHosts($hosts);
+        //设置账号密码
+        $clientBuilder->setBasicAuthentication($user,$password);
+        //设置尝试次数
+        $clientBuilder->setRetries(2);
+        $client = $clientBuilder->build();
+        self::$client = $client;
+    }
+
+    /**
+     * 创建索引
+     * @param $index 索引名称
+     * @param $mapping 索引结构
+     */
+    public static function createIndex($index,$mapping=[])
+    {
+        if(!$index){
+            throw new ElasticSearchException("索引不能为空");
+        }
+        $param = [
+            "index"=>$index
+        ];
+        if($mapping){
+            $param["body"]["mappings"] = $mapping;
+        }
+        return self::$client->indices()->create($param);
+    }
+
+    /**
+     * 索引中写入文档
+     * @param $index   索引名称
+     * @param $data    文档数据
+     * @param $id    文档ID
+     */
+    public static function createDoc($index, array $data,$id=0)
+    {
+        if(!$index){
+            throw new ElasticSearchException("索引不能为空");
+        }
+        if(!$data){
+            throw new ElasticSearchException("文档不能为空");
+        }
+        $params = [
+            "index"=>$index,
+            "body"=>$data
+        ];
+        if($id){
+            $params["id"] = $id;
+        }
+        return self::$client->index($params);
+    }
+
+    /**
+     * 批量写入文档
+     * @param $index 索引名称
+     * @param array $datas 文档数据
+     */
+    public static function batchCreateDoc($index, array $datas)
+    {
+        if(!$index){
+            throw new ElasticSearchException("索引不能为空");
+        }
+        if(!$datas){
+            throw new ElasticSearchException("文档不能为空");
+        }
+        if(count($datas)>100){
+            throw new ElasticSearchException("文档数量不能大于100");
+        }
+        $params = [
+            "index"=>$index,
+            "body"=>[]
+        ];
+        foreach ($datas as $data){
+            $params['body'][] = [
+                'index' => [
+                    '_index' => $index,
+                ]
+            ];
+            $params['body'][] = $data;
+        }
+
+        return self::$client->bulk($params);
+    }
+
+    /**
+     * 根据索引和文档ID获取文档
+     * @param $index 索引名称
+     * @param $id 文档ID
+     */
+    public static function getDoc($index, $id)
+    {
+        if(!$index){
+            throw new ElasticSearchException("索引不能为空");
+        }
+        if(!$id){
+            throw new ElasticSearchException("文档id不能为空");
+        }
+        $params = [
+            "index"=>$index,
+            "id"=>$id
+        ];
+        return self::$client->get($params);
+    }
+
+    /**
+     * 更新文档信息
+     * @param $index 索引名称
+     * @param $id 文档ID
+     * @param array $data 更新内容
+     */
+    public static function updateDoc($index, $id, array $data)
+    {
+        if(!$index){
+            throw new ElasticSearchException("索引不能为空");
+        }
+        if(!$id){
+            throw new ElasticSearchException("文档id不能为空");
+        }
+        if(!$data){
+            throw new ElasticSearchException("更新内容不能为空");
+        }
+        $params = [
+            "index"=>$index,
+            "id"=>$id,
+            "body"=>[
+                "doc"=>$data
+            ]
+        ];
+        return self::$client->update($params);
+    }
+
+    /**
+     * 删除文档
+     * @param $index 索引名称
+     * @param $id 文档ID
+     */
+    public static function deleteDoc($index, $id)
+    {
+        if(!$index){
+            throw new ElasticSearchException("索引不能为空");
+        }
+        if(!$id){
+            throw new ElasticSearchException("文档id不能为空");
+        }
+        $params = [
+            "index"=>$index,
+            "id"=>$id
+        ];
+        return self::$client->delete($params);
+    }
+
+    /**
+     * 根据索引和项目名称获取数据
+     * @param GetLogDocParamBean $getLogDocParamBean
+     * @return array
+     * @throws ElasticSearchException
+     */
+    public static function getLogDoc(GetLogDocParamBean $getLogDocParamBean)
+    {
+        if(!$getLogDocParamBean->getIndex()){
+            throw new ElasticSearchException("索引不能为空");
+        }
+        if(!$getLogDocParamBean->getProjectName()){
+            throw new ElasticSearchException("项目名称不能为空");
+        }
+        $param = [
+            "index"=>$getLogDocParamBean->getIndex(),
+            "body"=>[
+                "query"=>[
+                    "bool"=>[
+                        "must"=>[
+                            [
+                                "match"=>[
+                                    "request_project_name"=>$getLogDocParamBean->getProjectName()
+                                ]
+                            ]
+                        ]
+
+                    ]
+
+                ],
+                "sort"=>[
+                    [
+                        "request_id"=>[
+                            "order"=>"desc"
+                        ]
+                    ]
+                ]
+            ]
+        ];
+        //判断是否存在路径
+        if($getLogDocParamBean->getRequestPath()){
+            $param["body"]["query"]["bool"]["must"][] = [
+                "match"=>[
+                    "request_path_md5"=>md5($getLogDocParamBean->getRequestPath())
+                ]
+            ];
+        }
+        //判断是否存在参数
+        if($getLogDocParamBean->getParam()){
+            $param["body"]["query"]["bool"]["must"][] = [
+                "match"=>[
+                    "request_param"=>$getLogDocParamBean->getParam()
+                ]
+            ];
+        }
+
+        //判断是否存在链路追踪ID
+        if($getLogDocParamBean->getUniqueTraceId()){
+            $param["body"]["query"]["bool"]["must"][] = [
+                "match"=>[
+                    "unique_trace_id"=>$getLogDocParamBean->getUniqueTraceId()
+                ]
+            ];
+        }
+
+        //判断是否存在请求时间
+        if ($getLogDocParamBean->getRequestStartTime()){
+            $param["body"]["query"]["bool"]["must"][] = [
+                "range"=>[
+                    "request_id"=>[
+                        "gte"=>strtotime($getLogDocParamBean->getRequestStartTime())*1000,
+                        "lte"=>strtotime($getLogDocParamBean->getRequestEndTime())*1000
+                    ]
+                ]
+            ];
+        }
+
+        //判断是否存在页数
+        $page = $getLogDocParamBean->getPage();
+        $pageSize = $getLogDocParamBean->getPageSize();
+        if($page){
+            $param["size"] = $pageSize;
+            $param["from"] = ($page-1)*$pageSize;
+        }
+        return self::$client->search($param);
+    }
+
+    /**
+     * 根据traceId获取链路数据
+     * @param string $uniqueTraceId
+     * @param string $index
+     * @return array
+     * @throws ElasticSearchException
+     */
+    public static function getTraceLogDoc(string $uniqueTraceId,$index)
+    {
+        $param = [
+            "index"=>$index,
+            "body"=>[
+                "query"=>[
+                    "bool"=>[
+                        "must"=>[
+                            [
+                                "match"=>[
+                                    "unique_trace_id"=>$uniqueTraceId
+                                ]
+                            ]
+                        ]
+
+                    ]
+
+                ],
+                "sort"=>[
+                    [
+                        "request_id"=>[
+                            "order"=>"asc"
+                        ]
+                    ]
+                ]
+            ]
+        ];
+        return self::$client->search($param);
+    }
+
+    /**
+     * 删除索引
+     * @param string $index
+     */
+    public static function deleteIndex($index)
+    {
+        if(!$index){
+            throw new ElasticSearchException("索引不能为空");
+        }
+        $params = [
+            "index"=>$index
+        ];
+        return self::$client->indices()->delete($params);
+    }
+}

+ 48 - 0
src/shanTaoTool/Enum/Pdd/Ddk/DdkResourceTypeEnum.php

@@ -0,0 +1,48 @@
+<?php
+
+
+namespace Tool\ShanTaoTool\Enum\Pdd\Ddk;
+
+
+/**
+ * 多多客频道来源枚举类
+ * Class DdkResourceTypeEnum
+ * @package Tool\ShanTaoTool\Enum\Pdd\Ddk
+ */
+class DdkResourceTypeEnum
+{
+    /**
+     * 限时秒杀
+     */
+    const RESOURCE_MIAOSHA=4;
+
+    /**
+     * 充值中心
+     */
+    const RESOURCE_CHONGZHI=39997;
+
+    /**
+     * 活动转链
+     */
+    const RESOURCE_HUODONGZHUANLIAN=39998;
+
+    /**
+     * 百亿补贴
+     */
+    const RESOURCE_BAIYIBUTIE=39996;
+
+    /**
+     * 电器城
+     */
+    const RESOURCE_DIANQICHENG=39999;
+
+    /**
+     * 领券中心
+     */
+    const RESOURCE_LINGQUANZHONGXIN=40000;
+
+    /**
+     * 火车票
+     */
+    const RESOURCE_HUOCHEPIAO=50005;
+}

+ 118 - 0
src/shanTaoTool/EsTool.php

@@ -0,0 +1,118 @@
+<?php
+
+
+namespace Tool\ShanTaoTool;
+
+
+use Tool\ShanTaoTool\Bean\ElasticSearch\CreateLogDocParamBean;
+use Tool\ShanTaoTool\Bean\ElasticSearch\GetLogDocParamBean;
+use Tool\ShanTaoTool\ElasticSearch\ElasticSerach;
+use Tool\ShanTaoTool\Exception\ElasticSearchException;
+
+class EsTool
+{
+    /**
+     * 写入请求日志
+     * @param CreateLogDocParamBean $createLogDocParamBean
+     */
+    public static function createLogDoc(CreateLogDocParamBean $createLogDocParamBean)
+    {
+        //获取当前索引,以天为单位
+        $index = date("Y-m-d");
+        //1.创建索引,存在在报错
+        ElasticSerach::getElasticSearchClient();
+        try{
+            $mapping = [
+                "properties"=>[
+                    "request_id"=>[
+                        "type"=>"int",
+                        "fielddata"=>true
+                    ],
+                    "request_path"=>[
+                        "type"=>"string"
+                    ],
+                    "request_path_md5"=>[
+                        "type"=>"string"
+                    ],
+                    "request_param"=>[
+                        "type"=>"string"
+                    ],
+                    "request_response"=>[
+                        "type"=>"string"
+                    ],
+                    "request_sql_log"=>[
+                        "type"=>"string"
+                    ],
+                    "request_log"=>[
+                        "type"=>"string"
+                    ],
+                    "request_project_name"=>[
+                        "type"=>"string"
+                    ],
+                    "createdAt"=>[
+                        "type"=>"date",
+                        "format"=>"yyyy-MM-dd HH:mm:ss"
+                    ],
+                    "updatedAt"=>[
+                        "type"=>"date",
+                        "format"=>"yyyy-MM-dd HH:mm:ss"
+                    ]
+                ]
+            ];
+            ElasticSerach::createIndex($index,$mapping);
+        }catch (\Exception $exception){}
+        //2.写入文档
+        $responseDatas = is_bool($createLogDocParamBean->getRequestResponse())?"":$createLogDocParamBean->getRequestResponse();
+        $doc = [
+            "request_path"=>$createLogDocParamBean->getRequestPath(),
+            "request_path_md5"=>md5($createLogDocParamBean->getRequestPath()),
+            "request_param"=>$createLogDocParamBean->getRequestParam(),
+            "request_response"=>$responseDatas,
+            "request_sql_log"=>$createLogDocParamBean->getRequestSqlLog(),
+            "request_log"=>$createLogDocParamBean->getRequestLog(),
+            "request_project_name"=>$createLogDocParamBean->getRequestProjectName(),
+            "created_at"=>is_numeric($createLogDocParamBean->getCreatedAt())?date("Y-m-d H:i:s",$createLogDocParamBean->getCreatedAt()):$createLogDocParamBean->getCreatedAt(),
+            "updated_at"=>is_numeric($createLogDocParamBean->getUpdatedAt())?date("Y-m-d H:i:s",$createLogDocParamBean->getUpdatedAt()):$createLogDocParamBean->getUpdatedAt(),
+            "request_id"=>$createLogDocParamBean->getRequestId(),
+            "request_time"=>is_numeric($createLogDocParamBean->getUpdatedAt())?($createLogDocParamBean->getUpdatedAt()-$createLogDocParamBean->getCreatedAt())*1000:0,
+            "unique_trace_id"=>$createLogDocParamBean->getUniqueTraceId()?$createLogDocParamBean->getUniqueTraceId():""
+        ];
+        return ElasticSerach::createDoc($index,$doc);
+    }
+
+    /**
+     * 根据索引和项目名称获取日志数据
+     * @param GetLogDocParamBean $getLogDocParamBean
+     * @return array
+     * @throws Exception\ElasticSearchException
+     */
+    public static function getLogDoc(GetLogDocParamBean $getLogDocParamBean)
+    {
+        ElasticSerach::getElasticSearchClient();
+        return ElasticSerach::getLogDoc($getLogDocParamBean);
+    }
+
+
+    /**
+     * 根据索引和链路ID获取链路数据
+     * @param string $traceId 链路ID
+     * @param string $index 索引
+     * @return array
+     * @throws Exception\ElasticSearchException
+     */
+    public static function getTraceLogDoc(string $traceId,$index)
+    {
+        ElasticSerach::getElasticSearchClient();
+        return ElasticSerach::getTraceLogDoc($traceId,$index);
+    }
+
+    /**
+     * 删除索引
+     * @param string $index
+     */
+    public static function deleteIndex(string $index)
+    {
+        ElasticSerach::getElasticSearchClient();
+        return ElasticSerach::deleteIndex($index);
+    }
+}

+ 92 - 0
src/shanTaoTool/Excel/Export.php

@@ -0,0 +1,92 @@
+<?php
+
+
+namespace Tool\ShanTaoTool\Excel;
+
+
+use PhpOffice\PhpSpreadsheet\IOFactory;
+use PhpOffice\PhpSpreadsheet\Spreadsheet;
+
+class Export
+{
+    /**
+     * params $headerList 头部列表信息(一维数组) 必传
+     * params $data 导出的数据(二维数组)  必传
+     * params $filename 文件名称转码 必传
+     * PS:出现数字格式化情况,可添加看不见的符号,使其正常,如:"\t"
+     **/
+    public function exportToCsv($headerList = [] , $data = [] , $fileName = ''){
+        //文件名称转码
+//        $fileName = iconv('UTF-8', 'GBK', $fileName);
+        //设置header头
+        header('Content-Type: application/vnd.ms-excel');
+        header('Content-Disposition: attachment;filename=' . $fileName . '.csv');
+        header('Cache-Control: max-age=0');
+        //打开PHP文件句柄,php://output,表示直接输出到浏览器
+        $fp = fopen("php://output","a");
+        fwrite($fp, chr(0xEF).chr(0xBB).chr(0xBF)); // 添加 BOM
+        //输出Excel列表名称信息
+        foreach ($headerList as $key => $value) {
+//            $headerList[$key] = iconv('UTF-8', 'GBK', $value);//CSV的EXCEL支持BGK编码,一定要转换,否则乱码
+            $headerList[$key] = $value;//CSV的EXCEL支持BGK编码,一定要转换,否则乱码
+        }
+        //使用fputcsv将数据写入文件句柄
+        fputcsv($fp, $headerList);
+        //计数器
+        $num = 0;
+        //每隔$limit行,刷新一下输出buffer,不要太大亦不要太小
+        $limit = 100000;
+        //逐行去除数据,不浪费内存
+        $count = count($data);
+        for($i = 0 ; $i < $count ; $i++){
+            $num++;
+            //刷新一下输出buffer,防止由于数据过多造成问题
+            if($limit == $num){
+                ob_flush();
+                flush();
+                $num = 0;
+            }
+            $row = $data[$i];
+            foreach ($row as $key => $value) {
+                $value = is_numeric($value) ? $value."\t" : $value;//解决输出长度较长的数字型变成科学计数法
+                $row[$key] = $value;
+//                $row[$key] = iconv('UTF-8', 'GBK', $value);
+            }
+            fputcsv($fp, $row);
+        }
+    }
+
+    public function exportToExcel($headerList = [] , $datas = [] , $fileName = '')
+    {
+        $filename = $fileName.'.xlsx';
+        header('Content-Type: application/vnd.ms-excel');
+        header('Content-Disposition: attachment;filename="'.$filename.'"');
+        header('Cache-Control: max-age=0');
+        $spreadsheet = new Spreadsheet();
+        $worksheet = $spreadsheet->getActiveSheet();
+        $worksheet->setTitle($fileName);
+        foreach ($headerList as $key=>$header){
+            //设置标题
+            $worksheet->setCellValueByColumnAndRow((int)$key+1, 1, $header);
+        }
+        foreach ($datas as $kk=>$data){
+            $tmp = 0;
+            foreach ($data as $k=>$val){
+                //设置数据
+                $worksheet->setCellValueByColumnAndRow((int)$tmp+1,(int)$kk+2,$val);
+                $tmp++;
+            }
+        }
+        $writer =IOFactory::createWriter($spreadsheet, 'Xlsx');
+        $writer->save('php://output');
+    }
+
+    public function importExcel($file)
+    {
+        $reader = IOFactory::createReader('Xlsx');
+        //打开文件、载入excel表格
+        $spreadsheet = $reader->load($file);
+        # 获取活动工作薄
+        return $spreadsheet->getActiveSheet()->toArray();
+    }
+}

+ 69 - 0
src/shanTaoTool/ExcelTool.php

@@ -0,0 +1,69 @@
+<?php
+
+
+namespace Tool\ShanTaoTool;
+
+
+use Tool\ShanTaoTool\Excel\Export;
+use Tool\ShanTaoTool\Exception\FileException;
+
+class ExcelTool
+{
+
+    /**
+     * 导出csv文件
+     * @param array $headers 列名
+     * @param array $datas 数据
+     * @param string $fileName  文件名
+     */
+    public static function exportToCsv($headers,$datas,$fileName)
+    {
+        $export = new Export();
+        $export->exportToCsv($headers,$datas,$fileName);
+    }
+
+    /**
+     * 导出excel文件
+     * @param array $headers 列名
+     * @param array $datas 数据
+     * @param string $fileName  文件名
+     */
+    public static function exportToExcel($headers,$datas,$fileName)
+    {
+        $export = new Export();
+        $export->exportToExcel($headers,$datas,$fileName);
+    }
+
+    /**
+     * 获取csv内容
+     * @param string $filePath 文件内容
+     */
+    public static function importCsv($filePath)
+    {
+        $handle = fopen($filePath,"r");
+        if(!$handle){
+            throw new FileException("文件打开失败");
+        }
+        $list=[];
+        while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
+            $num = count($data);
+            for ($c=0; $c < $num; $c++) {
+                $arr[]=$data[$c];
+            }
+            $list[]=$arr;
+            unset($arr);
+        }
+        fclose($handle);
+        return $list;
+    }
+
+    /**
+     * 获取excel的内容
+     * @param $filePath
+     */
+    public static function importExcel($filePath)
+    {
+        $export = new Export();
+        return $export->importExcel($filePath);
+    }
+}

+ 10 - 0
src/shanTaoTool/Exception/AuthException.php

@@ -0,0 +1,10 @@
+<?php
+
+
+namespace Tool\ShanTaoTool\Exception;
+
+
+class AuthException extends \Exception
+{
+
+}

+ 13 - 0
src/shanTaoTool/Exception/CrmException.php

@@ -0,0 +1,13 @@
+<?php
+
+
+namespace Tool\ShanTaoTool\Exception;
+
+
+class CrmException extends \Exception
+{
+    public function __construct($msg)
+    {
+        parent::__construct($msg,500);
+    }
+}

+ 13 - 0
src/shanTaoTool/Exception/ElasticSearchException.php

@@ -0,0 +1,13 @@
+<?php
+
+
+namespace Tool\ShanTaoTool\Exception;
+
+
+class ElasticSearchException extends \Exception
+{
+    public function __construct($msg)
+    {
+        parent::__construct($msg,500);
+    }
+}

+ 13 - 0
src/shanTaoTool/Exception/FileException.php

@@ -0,0 +1,13 @@
+<?php
+
+
+namespace Tool\ShanTaoTool\Exception;
+
+
+class FileException extends \Exception
+{
+    public function __construct($msg)
+    {
+        parent::__construct($msg,500);
+    }
+}

+ 13 - 0
src/shanTaoTool/Exception/HttpCustomeException.php

@@ -0,0 +1,13 @@
+<?php
+
+
+namespace Tool\ShanTaoTool\Exception;
+
+
+class HttpCustomeException extends \Exception
+{
+    public function __construct($msg)
+    {
+        parent::__construct($msg,500);
+    }
+}

+ 13 - 0
src/shanTaoTool/Exception/PayException.php

@@ -0,0 +1,13 @@
+<?php
+
+
+namespace Tool\ShanTaoTool\Exception;
+
+
+class PayException extends \Exception
+{
+    public function __construct($msg)
+    {
+        parent::__construct($msg,500);
+    }
+}

+ 13 - 0
src/shanTaoTool/Exception/QiWeiException.php

@@ -0,0 +1,13 @@
+<?php
+
+
+namespace Tool\ShanTaoTool\Exception;
+
+
+class QiWeiException extends \Exception
+{
+    public function __construct($msg)
+    {
+        parent::__construct($msg,500);
+    }
+}

+ 13 - 0
src/shanTaoTool/Exception/SendEmailException.php

@@ -0,0 +1,13 @@
+<?php
+
+
+namespace Tool\ShanTaoTool\Exception;
+
+
+class SendEmailException extends \Exception
+{
+    public function __construct($msg)
+    {
+        parent::__construct($msg,500);
+    }
+}

+ 13 - 0
src/shanTaoTool/Exception/SmsException.php

@@ -0,0 +1,13 @@
+<?php
+
+
+namespace Tool\ShanTaoTool\Exception;
+
+
+class SmsException extends \Exception
+{
+    public function __construct($msg)
+    {
+        parent::__construct($msg,500);
+    }
+}

+ 155 - 0
src/shanTaoTool/HttpCurl.php

@@ -0,0 +1,155 @@
+<?php
+
+
+namespace Tool\ShanTaoTool;
+
+
+use Curl\Curl;
+use Tool\ShanTaoTool\Exception\HttpCustomeException;
+
+class HttpCurl
+{
+    /**
+     * @param string $url 请求地址
+     * @param array $params 请求参数
+     * @param array $headers 请求头
+     */
+    public static function getCurl(string $url,array $params=[],array $headers=[],$ssl=false)
+    {
+        //判断是否存在traceId
+        if(isset($_GET["traceId"])){
+            $headers["traceId"] = $_GET["traceId"];
+        }
+        $curl = new Curl();
+        //塞入header头
+        foreach ($headers as $key=>$header){
+            $curl->setHeader($key,$header);
+        }
+        if(!$ssl){
+            $curl->setOpt(CURLOPT_SSL_VERIFYPEER,false);
+            $curl->setOpt(CURLOPT_SSL_VERIFYHOST,false);
+        }
+        //塞入参数
+        $curl->get($url,$params);
+        return json_decode($curl->response,true);
+    }
+
+
+    /**
+     * @param string $url 请求地址
+     * @param array $params 请求参数
+     * @param array $headers 请求头
+     * @param bool $asJson 是否json传输(true是 false否)
+     */
+    public static function postCurl($url,$params=[],$headers=[],$asJson=true,$ssl=false)
+    {
+        //判断是否存在traceId
+        if(isset($_GET["traceId"])){
+            $headers["traceId"] = $_GET["traceId"];
+        }
+
+        $curl = new Curl();
+        //塞入header头
+        foreach ($headers as $key=>$header){
+            $curl->setHeader($key,$header);
+        }
+        //判断是否json请求
+        if($asJson){
+            $curl->setHeader("Content-Type","application/json;charset=utf-8");
+        }
+        if(!$ssl){
+            $curl->setOpt(CURLOPT_SSL_VERIFYPEER,false);
+            $curl->setOpt(CURLOPT_SSL_VERIFYHOST,false);
+        }
+        //塞入参数
+        $curl->post($url,$params,$asJson);
+        return json_decode($curl->response,true);
+    }
+
+    /**
+     * @param string $url 请求地址
+     * @param array $params 请求参数
+     * @param array $headers 请求头
+     */
+    public static function getCurlOrigin(string $url,array $params=[],array $headers=[],$ssl=false)
+    {
+        //判断是否存在traceId
+        if(isset($_GET["traceId"])){
+            $headers["traceId"] = $_GET["traceId"];
+        }
+        $curl = new Curl();
+        //塞入header头
+        foreach ($headers as $key=>$header){
+            $curl->setHeader($key,$header);
+        }
+        if(!$ssl){
+            $curl->setOpt(CURLOPT_SSL_VERIFYPEER,false);
+            $curl->setOpt(CURLOPT_SSL_VERIFYHOST,false);
+        }
+        //塞入参数
+        $curl->get($url,$params);
+        return $curl->response;
+    }
+
+
+    /**
+     * @param string $url 请求地址
+     * @param array $params 请求参数
+     * @param array $headers 请求头
+     * @param bool $asJson 是否json传输(true是 false否)
+     */
+    public static function postCurlOrigin($url,$params=[],$headers=[],$asJson=true,$ssl=false)
+    {
+        //判断是否存在traceId
+        if(isset($_GET["traceId"])){
+            $headers["traceId"] = $_GET["traceId"];
+        }
+
+        $curl = new Curl();
+        //塞入header头
+        foreach ($headers as $key=>$header){
+            $curl->setHeader($key,$header);
+        }
+        //判断是否json请求
+        if($asJson){
+            $curl->setHeader("Content-Type","application/json;charset=utf-8");
+        }
+        if(!$ssl){
+            $curl->setOpt(CURLOPT_SSL_VERIFYPEER,false);
+            $curl->setOpt(CURLOPT_SSL_VERIFYHOST,false);
+        }
+        //塞入参数
+        $curl->post($url,$params,$asJson);
+        return $curl->response;
+    }
+
+    /**
+     * 后端转发上传文件
+     * @param string $url
+     * @param string $filepath
+     */
+    public static function uploadFile(string $url,string $filepath)
+    {
+
+        $file = new \CURLFile($filepath,"application/octet-stream");
+        $data = [
+            "media"=>$file
+        ];
+        $ch = curl_init($url);
+        curl_setopt($ch,CURLOPT_POST,1);
+        curl_setopt($ch,CURLOPT_POSTFIELDS,$data);
+        curl_setopt($ch,CURLOPT_HTTPHEADER,["multipart/form-data"]);
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+        curl_setopt($ch,CURLOPT_BINARYTRANSFER,true);
+        $result = curl_exec($ch);
+        if(curl_errno($ch)){
+            curl_close($ch);
+            throw new HttpCustomeException("文件上传失败");
+        }
+        curl_close($ch);
+        $res = json_decode($result,1);
+        if($res["errcode"]==0){
+            return $res["media_id"];
+        }
+    }
+}

+ 113 - 0
src/shanTaoTool/Mq/MqService.php

@@ -0,0 +1,113 @@
+<?php
+
+
+namespace Tool\ShanTaoTool\Mq;
+
+use PhpAmqpLib\Connection\AMQPStreamConnection;
+use PhpAmqpLib\Message\AMQPMessage;
+
+/**
+ * mq服务
+ * Class MqService
+ * @package Tool\ShanTaoTool\Mq
+ */
+class MqService
+{
+    /**
+     * @var string 地址
+     */
+    private static $host;
+
+    /**
+     * @var string 端口
+     */
+    private static $port;
+
+    /**
+     * @var string 账号
+     */
+    private static $userName;
+
+    /**
+     * @var string 密码
+     */
+    private static $userPassword;
+
+    /**
+     * 设置mq连接属性
+     * @param string $host  连接地址
+     * @param string $port  连接端口
+     * @param string $userName 账号
+     * @param string $userPassword 密码
+     */
+    public static function setMqAttributes($host, $port, $userName, $userPassword)
+    {
+        self::$host=$host;
+        self::$port=$port;
+        self::$userName=$userName;
+        self::$userPassword=$userPassword;
+    }
+    /**
+     * 获取mq连接
+     * @return AMQPStreamConnection
+     */
+    public static function getMqConnection()
+    {
+        self::$host=env("MQ_HOST");
+        self::$port=env("MQ_PORT");
+        self::$userName=env("MQ_USER_NAME");
+        self::$userPassword=env("MQ_USER_PASSWORD");
+        //连接mq
+        $connection = new AMQPStreamConnection(self::$host,self::$port,self::$userName,self::$userPassword);
+        return $connection;
+    }
+
+    /**
+     * 推送日志消息到mq(提前设置好交换机和队列)
+     * @param string $message 消息
+     * @param string $routeKey 路由键
+     */
+    public static function pushLogMessage($message,$routeKey)
+    {
+        $connection = self::getMqConnection();
+        //创建channel
+        $channel = $connection->channel();
+
+        //声明队列(前提mq上面的交换机logExchange已经创建)
+//        $channel->queue_declare($queueName);
+//        //将交换机和队列绑定
+//        $channel->queue_bind($queueName,"logExchange");
+
+        //创建mq消息
+        $msg = new AMQPMessage($message);
+        //推送消息到mq
+        $channel->basic_publish($msg,"logExchange",$routeKey);
+
+        //发送成功之后关闭channel和connection
+        $channel->close();
+        $connection->close();
+    }
+
+    /**
+     * 推送消息到mq(提前设置好交换机和队列)
+     * @param string $message 消息
+     * @param string $exchange 交换机
+     * @param string $routeKey 路由键
+     */
+    public static function pushMessage($message,$exchange,$routeKey)
+    {
+        $connection = self::getMqConnection();
+        //创建channel
+        $channel = $connection->channel();
+
+        //创建mq消息
+        $msg = new AMQPMessage($message);
+        //推送消息到mq
+        $channel->basic_publish($msg,$exchange,$routeKey);
+
+        //发送成功之后关闭channel和connection
+        $channel->close();
+        $connection->close();
+    }
+
+}

+ 31 - 0
src/shanTaoTool/MqTool.php

@@ -0,0 +1,31 @@
+<?php
+
+
+namespace Tool\ShanTaoTool;
+
+
+use Tool\ShanTaoTool\Mq\MqService;
+
+class MqTool
+{
+    /**
+     * 推送日志消息到mq
+     * @param $message 消息
+     * @param $routeKey 路由键
+     */
+    public static function pushLogMessage($message,$routeKey)
+    {
+        MqService::pushLogMessage($message,$routeKey);
+    }
+
+    /**
+     * 推送消息的mq
+     * @param $message 消息
+     * @param $exchange 交换机
+     * @param $routeKey 路由键
+     */
+    public static function pushMessage($message,$exchange,$routeKey)
+    {
+        MqService::pushMessage($message,$exchange,$routeKey);
+    }
+}

+ 128 - 0
src/shanTaoTool/Pay/PayService.php

@@ -0,0 +1,128 @@
+<?php
+
+
+namespace Tool\ShanTaoTool\Pay;
+
+use Tool\ShanTaoTool\Bean\Pay\GetCodePayUrlParamBean;
+use Tool\ShanTaoTool\Exception\PayException;
+use Tool\ShanTaoTool\HttpCurl;
+
+/**
+ * 支付服务类
+ * Class PayService
+ * @package Tool\ShanTaoTool\Pay
+ */
+class PayService
+{
+    /**
+     * 获取支付二维码接口
+     * @param GetCodePayUrlParamBean $bean
+     * @return array ["qrcode_url"=>"支付二维码","qr"=>"支付二维码","order_number"=>"订单编号"]
+     * @throws PayException
+     */
+    public static function getCodePayUrlService(GetCodePayUrlParamBean $bean)
+    {
+        $url = env("OFFICIAL_PAY_URL");
+        if(!$url){
+            throw new PayException("官方支付地址不能为空");
+        }
+        if(!$bean->getOrderPrice()){
+            throw new PayException("支付金额不能为空");
+        }
+        if(!$bean->getRelationOrderNumber()){
+            throw new PayException("支付关联订单号不能为空");
+        }
+        if(!$bean->getPayType()){
+            throw new PayException("支付类型不能为空");
+        }
+        if(!$bean->getAppKey()){
+            throw new PayException("支付appkey不能为空");
+        }
+        if(!$bean->getAppSecret()){
+            throw new PayException("支付appsecret不能为空");
+        }
+
+        $url = $url."v1/pay/codePayUrl";
+
+        $params = [
+            "orderPrice"=>$bean->getOrderPrice(),
+            "relationOrderNumber"=>$bean->getRelationOrderNumber(),
+            "payType"=>$bean->getPayType()
+        ];
+        $header = [
+            "appKey"=>$bean->getAppKey(),
+            "appSecret"=>$bean->getAppSecret()
+        ];
+        $res = HttpCurl::postCurl($url,$params,$header);
+        if(!$res["status"]){
+            throw new PayException("请换成其他方式充值");
+        }
+        return $res["data"];
+    }
+
+    /**
+     * 根据官方订单编号获取订单
+     * @param $token string token
+     * @param $trade_sn string 官方订单编号
+     * @param $amount int 金额(单位为分)
+     * @return ["order_sn"=>"淘象订单编号","price"=>"支付金额(单位为分)"]
+     */
+    public static function getOfficialOrderByOrderNumberService($token, $trade_sn, $amount)
+    {
+        $url = env("TAOXIANG_PAY_URL");
+        if(!$url){
+            throw new PayException("淘象支付地址不能为空");
+        }
+        if(!$token){
+            throw new PayException("token不能为空");
+        }
+        if(!$trade_sn){
+            throw new PayException("官方支付单号不能为空");
+        }
+        if(!$amount){
+            throw new PayException("订单金额不能为空");
+        }
+        $params = [
+            "token"=>$token,
+            "trade_sn"=>$trade_sn,
+            "amount"=>$amount
+        ];
+        $url = $url."merchant/alipay_apply_quick/forget";
+        $res = HttpCurl::postCurl($url,$params);
+        if($res["status"]!=0){
+            throw new PayException("订单获取失败");
+        }
+        return $res["data"];
+    }
+
+    /**
+     * 获取支付方式
+     * @param $appKey string appkey
+     * @param $appSecret string  secret
+     */
+    public static function getPayMethodService($appKey,$appSecret)
+    {
+        $url = env("OFFICIAL_PAY_URL");
+        if(!$url){
+            throw new PayException("官方支付地址不能为空");
+        }
+        if(!$appSecret){
+            throw new PayException("用户不能为空");
+        }
+        if(!$appKey){
+            throw new PayException("用户不能为空");
+        }
+
+        $url = $url."v1/pay/method";
+
+        $header = [
+            "appKey"=>$appKey,
+            "appSecret"=>$appSecret
+        ];
+        $res = HttpCurl::getCurl($url,[],$header);
+        if(!$res["status"]){
+            throw new PayException("支付方式失败");
+        }
+        return $res["data"];
+    }
+}

+ 49 - 0
src/shanTaoTool/PayTool.php

@@ -0,0 +1,49 @@
+<?php
+
+
+namespace Tool\ShanTaoTool;
+
+use Tool\ShanTaoTool\Bean\Pay\GetCodePayUrlParamBean;
+use Tool\ShanTaoTool\Exception\PayException;
+use Tool\ShanTaoTool\Pay\PayService;
+
+/**
+ * 支付工具类
+ * Class PayTool
+ * @package Tool\ShanTaoTool
+ */
+class PayTool
+{
+    /**
+     * 获取支付二维码接口
+     * @param GetCodePayUrlParamBean $bean
+     * @return array ["qrcode_url"=>"支付二维码","qr"=>"支付二维码","order_number"=>"订单编号"]
+     * @throws PayException
+     */
+    public static function getCodePayUrl(GetCodePayUrlParamBean $bean)
+    {
+       return PayService::getCodePayUrlService($bean);
+    }
+
+    /**
+     * 根据官方订单编号获取订单
+     * @param $token string token
+     * @param $trade_sn string 官方订单编号
+     * @param $amount int 金额(单位为分)
+     * @return ["order_sn"=>"淘象订单编号","price"=>"支付金额(单位为分)"]
+     */
+    public static function getOfficialOrderByOrderNumber($token, $trade_sn, $amount)
+    {
+        return PayService::getOfficialOrderByOrderNumberService($token,$trade_sn,$amount);
+    }
+
+    /**
+     * 获取支付方式
+     * @param $appKey
+     * @param $appSecret
+     */
+    public static function getPayMethod($appKey, $appSecret)
+    {
+        return PayService::getPayMethodService($appKey,$appSecret);
+    }
+}

+ 447 - 0
src/shanTaoTool/Pdd/Ddk/DdkDaogouService.php

@@ -0,0 +1,447 @@
+<?php
+
+
+namespace Tool\ShanTaoTool\Pdd\Ddk;
+
+
+use Tool\ShanTaoTool\Bean\Pdd\Ddk\GoodsDetailParamBean;
+use Tool\ShanTaoTool\Bean\Pdd\Ddk\GoodsPromotionUrlGenerateParamBean;
+use Tool\ShanTaoTool\Bean\Pdd\Ddk\GoodsRecommendGetParamBean;
+use Tool\ShanTaoTool\Bean\Pdd\Ddk\GoodsSearchParamBean;
+use Tool\ShanTaoTool\Bean\Pdd\Ddk\OrderListRangeGetParamBean;
+use Tool\ShanTaoTool\Bean\Pdd\Ddk\ResourceUrlGenParamBean;
+use Tool\ShanTaoTool\HttpCurl;
+
+/**
+ * 多多客导购服务类
+ * Class DdkDaogouService
+ * @package Tool\ShanTaoTool\Pdd\Ddk
+ */
+class DdkDaogouService
+{
+    /**
+     * 拼多多请求地址
+     * @var string
+     */
+    public static $url = "https://gw-api.pinduoduo.com/api/router";
+
+    /**
+     * 生成签名
+     * @param $params
+     * @return array
+     */
+    public static function getSign($params)
+    {
+        $client_secret = env("PDD_CLIENT_SECRET");
+        //公共参数
+        $commonParams = [
+            "client_id"=>env("PDD_CLIENT_ID"),
+            "timestamp"=>time()
+        ];
+
+        $params = array_merge($commonParams,$params);
+
+        //字典升序排列
+        ksort($params);
+
+        $str = "";
+        foreach ($params as $key=>$val){
+                $str .= $key.$val;
+        }
+        $str = $client_secret.$str.$client_secret;
+        $sign = strtoupper(md5($str));
+        $params["sign"] = $sign;
+        return $params;
+    }
+
+    /**
+     * 生成多多进宝频道推广
+     * @param ResourceUrlGenParamBean $resourceUrlGenParamBean
+     */
+    public static function resourceUrlGen(ResourceUrlGenParamBean $resourceUrlGenParamBean)
+    {
+        $params = [
+            "type"=>"pdd.ddk.resource.url.gen",
+            "pid"=>$resourceUrlGenParamBean->getPid(),
+            "resource_type"=>$resourceUrlGenParamBean->getResourceType()
+        ];
+        if($resourceUrlGenParamBean->getCustomParameters()){
+            $params["custom_parameters"] = $resourceUrlGenParamBean->getCustomParameters();
+        }
+
+        if($resourceUrlGenParamBean->getGenerateWeApp()){
+            $params["generate_we_app"] = $resourceUrlGenParamBean->getGenerateWeApp();
+        }
+        if($resourceUrlGenParamBean->getUrl()){
+            $params["url"] = $resourceUrlGenParamBean->getUrl();
+        }
+        $params = self::getSign($params);
+        $res = HttpCurl::postCurl(self::$url,$params);
+        return $res;
+    }
+
+    /**
+     * 批量绑定推广位的媒体id
+     * @param $mediaId int 媒体ID
+     * @param array $pidList 推广位列表
+     */
+    public static function pidMediaidBind($mediaId, array $pidList)
+    {
+        $params = [
+            "type"=>"pdd.ddk.pid.mediaid.bind",
+            "media_id"=>$mediaId,
+            "pid_list"=>$pidList
+        ];
+        $params = self::getSign($params);
+        $res = HttpCurl::postCurl(self::$url,$params);
+        return $res;
+    }
+
+    /**
+     * 创建多多进宝推广位
+     * @param $number int 要生成的推广位数量
+     * @param $pidNameList array 推广位名称['1','2']
+     * @param $mediaId int 媒体ID
+     */
+    public static function goodsPidGenerate($number, $pidNameList=[], $mediaId=0)
+    {
+        $params = [
+            "type"=>"pdd.ddk.goods.pid.generate",
+            "number"=>$number
+        ];
+        if ($pidNameList){
+            $params["p_id_name_list"] = $pidNameList;
+        }
+        if($mediaId){
+            $params["media_id"] = $mediaId;
+        }
+        $params = self::getSign($params);
+        $res = HttpCurl::postCurl(self::$url,$params);
+        return $res;
+    }
+
+    /**
+     * @param $page int 第几页
+     * @param $pageSize int 每页数量
+     * @param $status int 推广位状态
+     */
+    public static function goodsPidQuery($page, $pageSize, $status)
+    {
+        $params = [
+            "type"=>"pdd.ddk.goods.pid.query",
+            "page"=>$page,
+            "page_size"=>$pageSize,
+            "status"=>$status
+        ];
+        $params = self::getSign($params);
+        $res = HttpCurl::postCurl(self::$url,$params);
+        return $res;
+    }
+
+    /**
+     * 用时间段查询推广订单接口
+     * @param OrderListRangeGetParamBean $orderListRangeGetParamBean
+     */
+    public static function orderListRangeGet(OrderListRangeGetParamBean $orderListRangeGetParamBean)
+    {
+        $params = [
+            "type"=>"pdd.ddk.order.list.range.get",
+            "start_time"=>$orderListRangeGetParamBean->getStartTime(),
+            "end_time"=>$orderListRangeGetParamBean->getEndTime(),
+        ];
+
+        if($orderListRangeGetParamBean->getPageSize()){
+            $params["page_size"] = $orderListRangeGetParamBean->getPageSize();
+        }
+
+        if($orderListRangeGetParamBean->getCashGiftOrder()){
+            $params["cash_gift_order"] = $orderListRangeGetParamBean->getCashGiftOrder();
+        }
+
+        if($orderListRangeGetParamBean->getLastOrderId()){
+            $params["last_order_id"] = $orderListRangeGetParamBean->getLastOrderId();
+        }
+
+        if($orderListRangeGetParamBean->getQueryOrderType()){
+            $params["query_order_type"] = $orderListRangeGetParamBean->getQueryOrderType();
+        }
+
+        $params = self::getSign($params);
+        $res = HttpCurl::postCurl(self::$url,$params);
+        return $res;
+    }
+
+    /**
+     * 查询订单详情
+     * @param $orderSn string 订单编号
+     * @param $queryOrderType int 订单类型:1-推广订单;2-直播间订单
+     */
+    public static function orderDetailGet($orderSn, $queryOrderType=0)
+    {
+        $params = [
+            "type"=>"pdd.ddk.order.detail.get",
+            "order_sn"=>$orderSn
+        ];
+        if($queryOrderType){
+            $params["query_order_type"] = $queryOrderType;
+        }
+        $params = self::getSign($params);
+        $res = HttpCurl::postCurl(self::$url,$params);
+        return $res;
+    }
+
+    /**
+     * 多多进宝商品详情查询
+     * @param GoodsDetailParamBean $goodsDetailParamBean
+     */
+    public static function goodsDetail(GoodsDetailParamBean $goodsDetailParamBean)
+    {
+        $params = [
+            "type"=>"pdd.ddk.goods.detail"
+        ];
+
+        if($goodsDetailParamBean->getCustomParameters()){
+            $params["custom_parameters"] = $goodsDetailParamBean->getCustomParameters();
+        }
+
+        if($goodsDetailParamBean->getGoodsSign()){
+            $params["goods_sign"] = $goodsDetailParamBean->getGoodsSign();
+        }
+
+        if($goodsDetailParamBean->getPid()){
+            $params["pid"] = $goodsDetailParamBean->getPid();
+        }
+
+        if($goodsDetailParamBean->getSearchId()){
+            $params["search_id"] = $goodsDetailParamBean->getSearchId();
+        }
+
+        if($goodsDetailParamBean->getZsDuoId()){
+            $params["zs_duo_id"] = $goodsDetailParamBean->getZsDuoId();
+        }
+
+        $params = self::getSign($params);
+        $res = HttpCurl::postCurl(self::$url,$params);
+        return $res;
+    }
+
+    /**
+     * 多多进宝推广链接生成
+     * @param GoodsPromotionUrlGenerateParamBean $goodsPromotionUrlGenerateParamBean
+     */
+    public static function goodsPromotionUrlGenerate(GoodsPromotionUrlGenerateParamBean $goodsPromotionUrlGenerateParamBean)
+    {
+        $params = [
+            "type"=>"pdd.ddk.goods.promotion.url.generate",
+            "p_id"=>$goodsPromotionUrlGenerateParamBean->getPId()
+        ];
+
+        if($goodsPromotionUrlGenerateParamBean->getCashGiftId()){
+            $params["cash_gift_id"] = $goodsPromotionUrlGenerateParamBean->getCashGiftId();
+        }
+
+        if($goodsPromotionUrlGenerateParamBean->getCashGiftName()){
+            $params["cash_gift_name"] = $goodsPromotionUrlGenerateParamBean->getCashGiftName();
+        }
+
+        if($goodsPromotionUrlGenerateParamBean->getCustomParameters()){
+            $params["custom_parameters"] = $goodsPromotionUrlGenerateParamBean->getCustomParameters();
+        }
+
+        if($goodsPromotionUrlGenerateParamBean->getGenerateAuthorityUrl()){
+            $params["generate_authority_url"] = $goodsPromotionUrlGenerateParamBean->getGenerateAuthorityUrl();
+        }
+
+        if($goodsPromotionUrlGenerateParamBean->getGenerateMallCollectCoupon()){
+            $params["generate_mall_collect_coupon"] = $goodsPromotionUrlGenerateParamBean->getGenerateMallCollectCoupon();
+        }
+
+        if($goodsPromotionUrlGenerateParamBean->getGenerateQqApp()){
+            $params["generate_qq_app"] = $goodsPromotionUrlGenerateParamBean->getGenerateQqApp();
+        }
+
+        if($goodsPromotionUrlGenerateParamBean->getGenerateSchemaUrl()){
+            $params["generate_schema_url"] = $goodsPromotionUrlGenerateParamBean->getGenerateSchemaUrl();
+        }
+
+        if($goodsPromotionUrlGenerateParamBean->getGenerateShortUrl()){
+            $params["generate_short_url"] = $goodsPromotionUrlGenerateParamBean->getGenerateShortUrl();
+        }
+
+        if($goodsPromotionUrlGenerateParamBean->getGenerateWeApp()){
+            $params["generate_we_app"] = $goodsPromotionUrlGenerateParamBean->getGenerateWeApp();
+        }
+
+        if($goodsPromotionUrlGenerateParamBean->getGoodsSignList()){
+            $params["goods_sign_list"] = $goodsPromotionUrlGenerateParamBean->getGoodsSignList();
+        }
+
+        if($goodsPromotionUrlGenerateParamBean->getMultiGroup()){
+            $params["multi_group"] = $goodsPromotionUrlGenerateParamBean->getMultiGroup();
+        }
+
+        if($goodsPromotionUrlGenerateParamBean->getSearchId()){
+            $params["search_id"] = $goodsPromotionUrlGenerateParamBean->getSearchId();
+        }
+
+        if($goodsPromotionUrlGenerateParamBean->getZsDuoId()){
+            $params["zs_duo_id"] = $goodsPromotionUrlGenerateParamBean->getZsDuoId();
+        }
+
+        $params = self::getSign($params);
+        $res = HttpCurl::postCurl(self::$url,$params);
+        return $res;
+    }
+
+    /**
+     * 多多进宝商品推荐API
+     * @param GoodsRecommendGetParamBean $goodsRecommendGetParamBean
+     */
+    public static function goodsRecommendGet(GoodsRecommendGetParamBean $goodsRecommendGetParamBean)
+    {
+        $params = [
+            "type"=>"pdd.ddk.goods.recommend.get"
+        ];
+
+        if($goodsRecommendGetParamBean->getActivityTags()){
+            $params["activity_tags"] = $goodsRecommendGetParamBean->getActivityTags();
+        }
+
+        if($goodsRecommendGetParamBean->getCatId()){
+            $params["cat_id"] = $goodsRecommendGetParamBean->getCatId();
+        }
+
+        if($goodsRecommendGetParamBean->getChannelType()){
+            $params["channel_type"] = $goodsRecommendGetParamBean->getChannelType();
+        }
+
+        if($goodsRecommendGetParamBean->getCustomParameters()){
+            $params["custom_parameters"] = $goodsRecommendGetParamBean->getCustomParameters();
+        }
+
+        if($goodsRecommendGetParamBean->getGoodsSignList()){
+            $params["goods_sign_list"] = $goodsRecommendGetParamBean->getGoodsSignList();
+        }
+
+        if($goodsRecommendGetParamBean->getLimit()){
+            $params["limit"] = $goodsRecommendGetParamBean->getLimit();
+        }
+
+        if($goodsRecommendGetParamBean->getListId()){
+            $params["list_id"] = $goodsRecommendGetParamBean->getListId();
+        }
+
+        if($goodsRecommendGetParamBean->getOffset()){
+            $params["offset"] = $goodsRecommendGetParamBean->getOffset();
+        }
+
+        if($goodsRecommendGetParamBean->getPid()){
+            $params["pid"] = $goodsRecommendGetParamBean->getPid();
+        }
+
+        $params = self::getSign($params);
+        $res = HttpCurl::postCurl(self::$url,$params);
+        return $res;
+    }
+
+    /**
+     * 多多进宝商品查询
+     * @param GoodsSearchParamBean $goodsSearchParamBean
+     */
+    public static function goodsSearch(GoodsSearchParamBean $goodsSearchParamBean)
+    {
+        $params = [
+            "type"=>"pdd.ddk.goods.search"
+        ];
+
+        if($goodsSearchParamBean->getActivityTags()){
+            $params["activity_tags"] = $goodsSearchParamBean->getActivityTags();
+        }
+
+        if($goodsSearchParamBean->getBlockCats()){
+            $params["block_cats"] = $goodsSearchParamBean->getBlockCats();
+        }
+
+        if($goodsSearchParamBean->getBlockCatPackages()){
+            $params["block_cat_packages"] = $goodsSearchParamBean->getBlockCatPackages();
+        }
+
+        if($goodsSearchParamBean->getCatId()){
+            $params["cat_id"] = $goodsSearchParamBean->getCatId();
+        }
+
+        if($goodsSearchParamBean->getCustomParameters()){
+            $params["custom_parameters"] = $goodsSearchParamBean->getCustomParameters();
+        }
+
+        if($goodsSearchParamBean->getGoodsSignList()){
+            $params["goods_sign_list"] = $goodsSearchParamBean->getGoodsSignList();
+        }
+
+        if($goodsSearchParamBean->getIsBrandGoods()){
+            $params["is_brand_goods"] = $goodsSearchParamBean->getIsBrandGoods();
+        }
+
+        if($goodsSearchParamBean->getKeyword()){
+            $params["keyword"] = $goodsSearchParamBean->getKeyword();
+        }
+
+        if($goodsSearchParamBean->getListId()){
+            $params["list_id"] = $goodsSearchParamBean->getListId();
+        }
+
+        if($goodsSearchParamBean->getMerchantType()){
+            $params["merchant_type"] = $goodsSearchParamBean->getMerchantType();
+        }
+
+        if($goodsSearchParamBean->getMerchantTypeList()){
+            $params["merchant_type_list"] = $goodsSearchParamBean->getMerchantTypeList();
+        }
+
+        if($goodsSearchParamBean->getOptId()){
+            $params["opt_id"] = $goodsSearchParamBean->getOptId();
+        }
+
+        if($goodsSearchParamBean->getPage()){
+            $params["page"] = $goodsSearchParamBean->getPage();
+        }
+
+        if($goodsSearchParamBean->getPageSize()){
+            $params["page_size"] = $goodsSearchParamBean->getPageSize();
+        }
+
+        if($goodsSearchParamBean->getPid()){
+            $params["pid"] = $goodsSearchParamBean->getPid();
+        }
+
+        $params = self::getSign($params);
+        $res = HttpCurl::postCurl(self::$url,$params);
+        return $res;
+    }
+
+    /**
+     * 多多进宝转链接口
+     * @param $pid string 推广位ID
+     * @param $sourceUrl string 商品链接
+     * @param array $customParameters 自定义参数
+     */
+    public static function goodsZsUnitUrlGen($pid,$sourceUrl="",$customParameters=[])
+    {
+        $params = [
+            "type"=>"pdd.ddk.goods.zs.unit.url.gen",
+            "pid"=>$pid
+        ];
+        if ($sourceUrl){
+            $params["source_url"] = $sourceUrl;
+        }
+
+        if($customParameters){
+            $params["custom_parameters"] = $customParameters;
+        }
+
+        $params = self::getSign($params);
+        $res = HttpCurl::postCurl(self::$url,$params);
+        return $res;
+    }
+
+}

+ 163 - 0
src/shanTaoTool/QiWeiTool.php

@@ -0,0 +1,163 @@
+<?php
+
+
+namespace Tool\ShanTaoTool;
+
+use Tool\ShanTaoTool\Exception\HttpCustomeException;
+use Tool\ShanTaoTool\Exception\QiWeiException;
+
+/**
+ * 企业微信工具
+ * Class QiWeiTool
+ * @package Tool\ShanTaoTool
+ */
+class QiWeiTool
+{
+    /**
+     * 企业微信基础url
+     * @var string $baseUrl
+     */
+    protected static $baseUrl = "https://qyapi.weixin.qq.com/cgi-bin/";
+
+    /**
+     * 获取企业微信报警acess_token
+     */
+    public static function getBaoJingAccessToken()
+    {
+        $accessTokenUrl = env("QIWEI_BAOJING_ACCESSTOKEN_URL");
+        if(!$accessTokenUrl){
+            throw new QiWeiException("请先配置企微token获取地址");
+        }
+        //获取accesstToken
+        $res = HttpCurl::getCurl($accessTokenUrl);
+        if($res["status"]){
+            return $res["data"]["token"];
+        }
+        throw new QiWeiException("企微token获取失败");
+    }
+
+    /**
+     * 推送报警信息到自家应用
+     * @param string $message 报警信息
+     * @param string $chartId 群聊ID
+     */
+    public static function sendMessageToBaoJing(string $message,$chartId="")
+    {
+        //获取群聊ID
+        if(!$chartId){
+            $chartId = env("QIWEI_BAOJING_CHART_ID");
+        }
+        if(!$chartId){
+            throw new QiWeiException("请先配置企微群聊ID");
+        }
+        $accessToken = self::getBaoJingAccessToken();
+        $url = self::$baseUrl."appchat/send?access_token=".$accessToken;
+        //组装报警信息
+        $data = [
+            "chatid"=>$chartId,
+            "msgtype"=>"text",
+            "text"=>[
+                "content"=>$message
+            ],
+            "safe"=>0
+        ];
+        return HttpCurl::postCurl($url,$data);
+    }
+
+    /**
+     * 发送图片到企微
+     * @param string $imgPath 图片地址
+     * @param string $chartId 群聊ID
+     */
+    public static function sendImgToBaoJing(string $imgPath,$chartId="")
+    {
+        //获取群聊ID
+        if(!$chartId){
+            $chartId = env("QIWEI_BAOJING_CHART_ID");
+        }
+        if(!$chartId){
+            throw new QiWeiException("请先配置企微群聊ID");
+        }
+        $accessToken = self::getBaoJingAccessToken();
+        $res = self::uploadTmpSource($accessToken,$imgPath);
+        $url = self::$baseUrl."appchat/send?access_token=".$accessToken;
+        //组装报警信息
+        $data = [
+            "chatid"=>$chartId,
+            "msgtype"=>"image",
+            "image"=>[
+                "media_id"=>$res
+            ],
+            "safe"=>0
+        ];
+        return HttpCurl::postCurl($url,$data);
+    }
+
+    /**
+     * @param string $imgPath
+     * @param string $chartId
+     * @return mixed
+     * @throws QiWeiException
+     */
+    public static function sendImgTxtToBaoJing($coverPath,$contentUrl,$desc,$title,$chartId="")
+    {
+        //获取群聊ID
+        if(!$chartId){
+            $chartId = env("QIWEI_BAOJING_CHART_ID");
+        }
+        if(!$chartId){
+            throw new QiWeiException("请先配置企微群聊ID");
+        }
+        $accessToken = self::getBaoJingAccessToken();
+        $url = self::$baseUrl."appchat/send?access_token=".$accessToken;
+        //组装报警信息
+        $data = [
+            "chatid"=>$chartId,
+            "msgtype"=>"news",
+            "news"=>[
+                "articles"=>[
+                    [
+                        "title"=>$title,
+                        "description"=>$desc,
+                        "url"=>$contentUrl,
+                        "picurl"=>$coverPath
+                    ]
+                ]
+            ],
+            "safe"=>0
+        ];
+        return HttpCurl::postCurl($url,$data);
+    }
+
+    /**
+     * 上传图片到临时素材
+     * @param string $accessToken token
+     * @param string $filepath  图片地址
+     */
+    private static function uploadTmpSource(string $accessToken,$filepath)
+    {
+        $url = self::$baseUrl."media/upload?access_token=".$accessToken."&type=image";
+
+        $file = new \CURLFile($filepath,"application/octet-stream");
+        $data = [
+            "media"=>$file
+        ];
+        $ch = curl_init($url);
+        curl_setopt($ch,CURLOPT_POST,1);
+        curl_setopt($ch,CURLOPT_POSTFIELDS,$data);
+        curl_setopt($ch,CURLOPT_HTTPHEADER,["multipart/form-data"]);
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+        curl_setopt($ch,CURLOPT_BINARYTRANSFER,true);
+        $result = curl_exec($ch);
+        if(curl_errno($ch)){
+            curl_close($ch);
+            throw new HttpCustomeException("文件上传失败");
+        }
+        curl_close($ch);
+        $res = json_decode($result,1);
+        if($res["status"]){
+            return $res;
+        }
+        throw new HttpCustomeException("文件上传失败");
+    }
+}

+ 56 - 0
src/shanTaoTool/Qr/QrService.php

@@ -0,0 +1,56 @@
+<?php
+
+
+namespace Tool\ShanTaoTool\Qr;
+
+use lrq\qrcode\QrcodeMain;
+use tekintian\TekinQR;
+use Tool\ShanTaoTool\Bean\Qr\CreateQrLogoImgServiceParamBean;
+use Zxing\QrReader;
+
+/**
+ * 二维码服务类
+ * Class QrService
+ * @package Tool\ShanTaoTool\Qr
+ */
+class QrService
+{
+    /**
+     * 获取二维码的内容
+     * @param $imgPath string 二维码地址
+     */
+    public static function getQrContentService($imgPath)
+    {
+        $qrCode = new QrReader($imgPath);
+        return $qrCode->text();
+    }
+
+    /**
+     * 创建二维码图片
+     * @param string $content 二维码内容
+     * @param string $fileName 文件名称(带上后缀名.png)
+     */
+    public static function createQrImgService(string $content,string $fileName)
+    {
+        $qrcode = new QrcodeMain($content);
+        $qrcode->execute();
+        return $qrcode->png($fileName);
+    }
+
+
+    /**
+     * 创建带有logo的二维码
+     * @param CreateQrLogoImgServiceParamBean $createQrLogoImgServiceParamBean
+     * @return string|null
+     */
+    public static function createQrLogoImgService(CreateQrLogoImgServiceParamBean $createQrLogoImgServiceParamBean)
+    {
+        return TekinQR::getQRImg(
+            $createQrLogoImgServiceParamBean->getQrContent(),
+            $createQrLogoImgServiceParamBean->getQrSize(),
+            $createQrLogoImgServiceParamBean->getLogoName(),
+            2,
+            $createQrLogoImgServiceParamBean->getFileName()
+        );
+    }
+}

+ 45 - 0
src/shanTaoTool/QrTool.php

@@ -0,0 +1,45 @@
+<?php
+
+
+namespace Tool\ShanTaoTool;
+
+use Tool\ShanTaoTool\Bean\Qr\CreateQrLogoImgServiceParamBean;
+use Tool\ShanTaoTool\Qr\QrService;
+
+/**
+ * 二维码类
+ * Class QrTool
+ * @package Tool\ShanTaoTool
+ */
+class QrTool
+{
+    /**
+     * 获取二维码内容
+     * @param $imgPath string 二维码地址
+     */
+    public static function getQrContent($imgPath)
+    {
+        return QrService::getQrContentService($imgPath);
+    }
+
+    /**
+     * 创建二维码
+     * @param $content string 二维码内容
+     * @param $fileName string 文件名称
+     * @return string
+     */
+    public static function creatrQrimg($content, $fileName)
+    {
+        return QrService::createQrImgService($content,$fileName);
+    }
+
+    /**
+     * 创建带有logo的二维码
+     * @param CreateQrLogoImgServiceParamBean $createQrLogoImgServiceParamBean
+     * @return string|null
+     */
+    public static function createQrLogoImg(CreateQrLogoImgServiceParamBean $createQrLogoImgServiceParamBean)
+    {
+        return QrService::createQrLogoImgService($createQrLogoImgServiceParamBean);
+    }
+}

+ 124 - 0
src/shanTaoTool/SendEmail.php

@@ -0,0 +1,124 @@
+<?php
+
+
+namespace Tool\ShanTaoTool;
+
+
+use PHPMailer\PHPMailer\PHPMailer;
+use PHPMailer\PHPMailer\SMTP;
+use Tool\ShanTaoTool\Bean\SendEmail\SendEmailByCustomeParamBean;
+use Tool\ShanTaoTool\Exception\SendEmailException;
+
+class SendEmail
+{
+    /**
+     * 发送邮件
+     * @param $title 邮件标题
+     * @param $name 发送人名称
+     * @param $email 收件人邮件账号
+     * @param $content 邮件内容html格式代码
+     */
+    public static function sendEmail($title='',$name='',$email='',$content='')
+    {
+        if($title=='' || $name=='' || $email=='' || $content==''){
+            return "缺少参数";
+        }
+        $mail = new PHPMailer(true);
+
+        try {
+            //Server settings
+//            $mail->SMTPDebug = 2;                      //启用详细调试输出
+            $mail->isSMTP();                                            //使用SMTP
+            $mail->Host       = 'smtp.qq.com';                     //将SMTP服务器设置为通过
+            $mail->SMTPAuth   = true;                                   //启用SMTP验证
+            $mail->Username   = '1956694751@qq.com';                     // SMTP用户名
+            $mail->Password   = 'latgklkiojvfeicj';                               // SMTP密码
+            $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;         //启用TLS加密;`的PHPMailer :: ENCRYPTION_SMTPS`鼓励
+            $mail->Port       = 465;                                    //要连接的TCP端口,在上面的PHPMailer :: ENCRYPTION_SMTPS中使用465
+
+            //Recipients
+            $mail->setFrom('1956694751@qq.com',$name);
+            $mail->addAddress($email);               //Name is optional
+//            $mail->addReplyTo('info@example.com', 'Information');
+//            $mail->addCC('cc@example.com');
+//            $mail->addBCC('bcc@example.com');
+
+            //Attachments
+//            $mail->addAttachment('/var/tmp/file.tar.gz');         //Add attachments
+//            $mail->addAttachment('/tmp/image.jpg', 'new.jpg');    //Optional name
+
+            //Content
+            $mail->isHTML(true);                                  //Set email format to HTML
+            $mail->Subject = $title;
+            $mail->Body    = $content;
+
+            $mail->send();
+            return true;
+        } catch (\Exception $e) {
+           return false;
+        }
+    }
+
+    /**
+     * 发送邮件
+     * @param SendEmailByCustomeParamBean $sendEmailByCustomeParamBean
+     * @return bool
+     * @throws SendEmailException
+     */
+    public static function sendEmailByCustome(SendEmailByCustomeParamBean $sendEmailByCustomeParamBean)
+    {
+        if(!$sendEmailByCustomeParamBean->getTitle()){
+            throw new SendEmailException("缺少参数");
+        }
+        if(!$sendEmailByCustomeParamBean->getContent()){
+            throw new SendEmailException("缺少参数");
+        }
+        if(!$sendEmailByCustomeParamBean->getEmail()){
+            throw new SendEmailException("缺少参数");
+        }
+        if(!$sendEmailByCustomeParamBean->getName()){
+            throw new SendEmailException("缺少参数");
+        }
+        if(!$sendEmailByCustomeParamBean->getServiceName()){
+            throw new SendEmailException("缺少参数");
+        }
+        if(!$sendEmailByCustomeParamBean->getServicePassword()){
+            throw new SendEmailException("缺少参数");
+        }
+        $mail = new PHPMailer(true);
+
+        try {
+            //Server settings
+//            $mail->SMTPDebug = 2;                      //启用详细调试输出
+            $mail->isSMTP();                                            //使用SMTP
+            $mail->Host       = 'smtp.qq.com';                     //将SMTP服务器设置为通过
+            $mail->SMTPAuth   = true;                                   //启用SMTP验证
+            $mail->Username   = $sendEmailByCustomeParamBean->getServiceName();                     // SMTP用户名
+            $mail->Password   = $sendEmailByCustomeParamBean->getServicePassword();                               // SMTP密码
+            $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;         //启用TLS加密;`的PHPMailer :: ENCRYPTION_SMTPS`鼓励
+            $mail->Port       = 465;                                    //要连接的TCP端口,在上面的PHPMailer :: ENCRYPTION_SMTPS中使用465
+
+            //Recipients
+            $mail->setFrom($sendEmailByCustomeParamBean->getServiceName(),$sendEmailByCustomeParamBean->getName());
+            $mail->addAddress($sendEmailByCustomeParamBean->getEmail());               //Name is optional
+//            $mail->addReplyTo('info@example.com', 'Information');
+//            $mail->addCC('cc@example.com');
+//            $mail->addBCC('bcc@example.com');
+
+            //Attachments
+//            $mail->addAttachment('/var/tmp/file.tar.gz');         //Add attachments
+//            $mail->addAttachment('/tmp/image.jpg', 'new.jpg');    //Optional name
+
+            //Content
+            $mail->isHTML(true);                                  //Set email format to HTML
+            $mail->Subject = $sendEmailByCustomeParamBean->getTitle();
+            $mail->Body    = $sendEmailByCustomeParamBean->getContent();
+
+            $mail->send();
+            return true;
+        } catch (\Exception $e) {
+            return false;
+        }
+    }
+
+}

+ 74 - 0
src/shanTaoTool/Sms/QidianyunSms.php

@@ -0,0 +1,74 @@
+<?php
+
+
+namespace Tool\ShanTaoTool\Sms;
+
+
+use Tool\ShanTaoTool\HttpCurl;
+
+class QidianyunSms
+{
+    public static function encodePercent($str)
+    {
+        $res = urlencode($str);
+        $res = preg_replace('/\+/', '%20', $res);
+        $res = preg_replace('/\*/', '%2A', $res);
+        $res = preg_replace('/%7E/', '~', $res);
+        return $res;
+    }
+
+    /**
+     * @param $apiParams
+     * @return string
+     */
+    public static function buildSign($apiParams)
+    {
+        ksort($apiParams);
+        $canonicalizedQueryString = '';
+        foreach ($apiParams as $key => $value) {
+            $canonicalizedQueryString .= '&' . self::encodePercent($key) . '=' . self::encodePercent($value);
+        }
+        $methodType = 'POST';
+        return $methodType . '&%2F&' . self::encodePercent(substr($canonicalizedQueryString, 1));
+    }
+
+    public static function hmac($stringToSign, $accessSecret)
+    {
+        return base64_encode(hash_hmac('sha1', $stringToSign, $accessSecret . '&', true));
+    }
+
+
+
+    public static function send($mobile, $code, $sign_name = null, $template_code = null)
+    {
+        $content = array(
+            'content' => "您的验证码是: $code ,请勿向任何人提供短信验证码,五分钟内有效。",
+        );
+        $api_params = array(
+            'templateParam' => json_encode($content, JSON_UNESCAPED_UNICODE),
+            'receiver'      => $mobile,
+            'smsSignName'   => env("QIANDIANYUN_SIGN_NAME"),
+            'templateCode'  => env("QIANDIANYUN_TEMPLATE_CODE"),
+            'timestamp'     => time() * 1000,
+            'signType'      => 'HMAC',
+            'account'       => env("QIDIANYUN_ACCOUNT"),
+        );
+
+        // 组合请求参数
+        $sign = self::buildSign($api_params);
+        // 根据组合参数和密钥进行签名
+        $sign = self::hmac($sign, env("QIANDIANYUN_SECRET"));
+        // 将签名增加到参数中
+        $api_params['sign'] = $sign;
+        // 格式化准备发送参数
+//        $sendJson = json_encode($api_params, JSON_UNESCAPED_UNICODE);
+//        $ret = HTTP::request(self::API, $sendJson, null, [
+//            'Content-Type: application/json; charset=utf-8',
+//            'Content-Length: ' . strlen($sendJson)
+//        ]);
+        $ret = HttpCurl::postCurl(self::API,$api_params);
+        return $ret;
+    }
+
+    const API = 'https://smsapi.startdt.com/v2/sms/send';
+}

+ 32 - 0
src/shanTaoTool/Sms/SanTiSms.php

@@ -0,0 +1,32 @@
+<?php
+
+
+namespace Tool\ShanTaoTool\Sms;
+
+
+use Tool\ShanTaoTool\HttpCurl;
+
+class SanTiSms
+{
+    /**
+     * 短信发送
+     * @param $phone
+     * @param $code
+     */
+    public static function send($phone, $code)
+    {
+        $appId = env("SANTI_SMS_APPID");
+        $appKey = env("SANTI_SMS_APPKEY");
+        $url = env("SANTI_SMS_URL");
+
+        $params = [
+            "appId"=>$appId,
+            "appKey"=>$appKey,
+            "modeId"=>"225749",
+            "vars"=>$code,
+            "mobile"=>$phone,
+            "sign"=>strtolower(md5($appKey.$appId.$phone)),
+        ];
+        return HttpCurl::getCurl($url,$params);
+    }
+}

+ 33 - 0
src/shanTaoTool/SmsTool.php

@@ -0,0 +1,33 @@
+<?php
+
+
+namespace Tool\ShanTaoTool;
+
+
+use Tool\ShanTaoTool\Exception\SmsException;
+use Tool\ShanTaoTool\Sms\QidianyunSms;
+use Tool\ShanTaoTool\Sms\SanTiSms;
+
+class SmsTool
+{
+    /**
+     * 短信验证码发送
+     * @param $phone string 手机号
+     * @param $code string 验证码
+     * @param $type string 断行服务商(santi三体qidianyun奇点云)
+     * @return mixed
+     */
+    public static function sendCode($phone, $code,$type)
+    {
+        switch ($type){
+            case "santi":
+                return SanTiSms::send($phone,$code);
+                break;
+            case "qidianyun":
+                return QidianyunSms::send($phone,$code);
+                break;
+            default:
+                throw new SmsException("短信运营商不正确");
+        }
+    }
+}

+ 45 - 0
src/shanTaoTool/UploadTool.php

@@ -0,0 +1,45 @@
+<?php
+
+
+namespace Tool\ShanTaoTool;
+
+use Qiniu\Auth;
+use Qiniu\Config;
+use Qiniu\Storage\UploadManager;
+use Qiniu\Zone;
+use SplFileInfo;
+use Tool\ShanTaoTool\Exception\FileException;
+
+/**
+ * 上传工具类
+ * Class UploadTool
+ * @package Tool\ShanTaoTool
+ */
+class UploadTool
+{
+
+    /**
+     * 文件上传接口
+     * @param SplFileInfo $file
+     * @param string $filename
+     * @return string
+     * @throws FileException
+     */
+    public static function uploadFile(SplFileInfo $file,$filename="")
+    {
+        if (!$filename) {
+            $filename = date('Y/m/d/h/m/s/') .  rand(0, 99999);
+        }
+        $auth = new Auth(env("QINIU_ACCESS_KEY"), env("QINIU_SECRET_KEY"));
+        $token = $auth->uploadToken(env("QINIU_BUCKET"));
+
+        $zone = Zone::zonez0();//设置华东区
+        $config = new Config($zone);
+        $upload_manager = new UploadManager($config);
+        list($ret, $err) = $upload_manager->putFile($token, $filename, $file->getRealPath());
+        if ($err !== null) {
+            throw new FileException("上传失败");
+        }
+        return env("QINIU_DOMAIN") . $filename;
+    }
+}

+ 13 - 0
src/shanTaoTool/template/Ceshi.php

@@ -0,0 +1,13 @@
+<?php
+
+
+namespace Tool\ShanTaoTool\template;
+
+
+class Ceshi
+{
+    public static function ceshi()
+    {
+        var_dump(887);
+    }
+}