Commit 84f303fe authored by luhongguang's avatar luhongguang

update:es host配置

parent d4137182
...@@ -18,6 +18,7 @@ class GoodsSku extends MysqlBase ...@@ -18,6 +18,7 @@ class GoodsSku extends MysqlBase
const STATUS_PASS = 1;//审核通过 const STATUS_PASS = 1;//审核通过
const STATUS_REJECT = 2;//审核驳回 const STATUS_REJECT = 2;//审核驳回
const ONLINE_STATUS_NO_ONLINE = 0;//未上架
const ONLINE_STATUS_ONLINE = 1;//已上架 const ONLINE_STATUS_ONLINE = 1;//已上架
const ONLINE_STATUS_OFFLINE = 2;//已下架 const ONLINE_STATUS_OFFLINE = 2;//已下架
......
<?php
namespace App\Services\goods;
use Api\PhpUtils\Elastic\ElasticUtil;
class ElasticService
{
public static function createIndex($index)
{
$elasticClient = ElasticUtil::getInstance();
$data = [
'mappings' => [
'properties' => [
'id' => [
'type' => 'keyword',
],
'name' => [
'type' => 'text',
],
]
]
];
$res = $elasticClient->createIndex($index, $data);
var_export($res);
}
/**
* 写入 es 一条数据
* @param $index
* @param $data
* @param $id
* @return array|callable
*/
public static function indexDoc($index, $id, $data)
{
$hostStr = config("elasticsearch", "goods.host");
$hosts = explode(",", $hostStr);
$elasticClient = ElasticUtil::getInstance($hosts);
return $elasticClient->indexDoc($index, $data, $id);
}
/**
* 修改 es 一条数据
* @param $index
* @param $id
* @param $data
* @return array|callable
*/
public static function updateDoc($index, $id, $data)
{
$elasticClient = ElasticUtil::getInstance();
return $elasticClient->updateDoc($index, $id, $data);
}
public static function bulk($index)
{
$elasticClient = ElasticUtil::getInstance();
$data = [
['index' => ['_index' => $index]],
['test_field' => '公安部:各地校车将享最高路权'],
['index' => ['_index' => $index]],
['test_field' => '中韩渔警冲突调查:韩警平均每天扣1艘中国渔船'],
['index' => ['_index' => $index]],
['test_field' => '中国驻洛杉矶领事馆遭亚裔男子枪击 嫌犯已自首'],
];
$res = $elasticClient->bulkIndexDoc($data);
var_export($res);
}
public static function searchDoc($index)
{
$elasticClient = ElasticUtil::getInstance();
$data = [
'query' => [
'match' => [
'test_field' => '中国'
]
],
'highlight' => [
'pre_tags' => ['<tag1>', '<tag2>'],
'post_tags' => ['</tag1>', '</tag2>'],
"fields" => [
'test_field' => new \stdClass()
]
]
];
$res = $elasticClient->searchDoc($index, $data);
var_export($res);
}
}
\ No newline at end of file
...@@ -147,6 +147,8 @@ class GoodsService ...@@ -147,6 +147,8 @@ class GoodsService
if (!empty($skuData["setmeal"])) { if (!empty($skuData["setmeal"])) {
$skuParams["setmeal"] = $skuData["setmeal"]; $skuParams["setmeal"] = $skuData["setmeal"];
} }
self::addGoodsInfoToEs($skuParams);
GoodsSku::save($skuParams); GoodsSku::save($skuParams);
return $skuId; return $skuId;
} }
...@@ -420,6 +422,9 @@ class GoodsService ...@@ -420,6 +422,9 @@ class GoodsService
if (!empty($params["setmeal"])) { if (!empty($params["setmeal"])) {
$skuParams["setmeal"] = $params["setmeal"]; $skuParams["setmeal"] = $params["setmeal"];
} }
//同步到es
self::goodsInfoToEs($skuData, $skuParams);
return GoodsSku::save($skuParams, ["goods_sku_id" => $goodsSkuId]); return GoodsSku::save($skuParams, ["goods_sku_id" => $goodsSkuId]);
} }
...@@ -528,4 +533,52 @@ class GoodsService ...@@ -528,4 +533,52 @@ class GoodsService
{ {
} }
private static function updateGoodsInfoToEs($skuData, $skuParams)
{
$index = "bp_goods";
$data = [
"doc"=>[
"id" => $skuData["goods_sku_id"],
"goods_pic" => $skuParams["url"],
"name" => $skuParams["name"],
"inventory_rest" => $skuParams["inventory_rest"],
"total_amount_sold" => $skuData["total_amount_sold"],
"original_price" => $skuParams["original_price"],
"price" => $skuParams["price"],
"status" => $skuData["status"],
"online_status" => $skuData["online_status"],
],
];
$esRes = ElasticService::updateDoc($index, $skuData["goods_sku_id"], $data);
var_dump($esRes);exit;
}
/**
* es 创建一条数据
* @param $skuParams
* @return bool
*/
private static function addGoodsInfoToEs($skuParams)
{
$index = "bp_goods";
$data = [
"doc"=>[
"id" => $skuParams["goods_sku_id"],
"goods_pic" => $skuParams["url"],
"name" => $skuParams["name"],
"inventory_rest" => $skuParams["inventory_rest"],
"total_amount_sold" => 0,
"original_price" => $skuParams["original_price"],
"price" => $skuParams["price"],
"status" => GoodsSku::STATUS_AUDIT,
"online_status" => GoodsSku::ONLINE_STATUS_NO_ONLINE,
],
];
$esRes = ElasticService::indexDoc($index, $skuParams["goods_sku_id"], $data);
if ($esRes["result"] == "created" && $esRes["_shards"]["successful"] == 1) {
return true;
}
return false;
}
} }
\ No newline at end of file
...@@ -34,11 +34,11 @@ ...@@ -34,11 +34,11 @@
"repositories": { "repositories": {
"api/php_utils":{ "api/php_utils":{
"type":"vcs", "type":"vcs",
"url":"https://git.yidian-inc.com:8021/api0/php_utils.git" "url":"https://git.yidian-inc.com:8021/bp/php_utils.git"
}, },
"api/php_services":{ "api/php_services":{
"type":"vcs", "type":"vcs",
"url":"https://git.yidian-inc.com:8021/api0/php_services.git" "url":"https://git.yidian-inc.com:8021/bp/php_services.git"
} }
} }
} }
\ No newline at end of file
php 通用业务 生活圈通用业务
\ No newline at end of file \ No newline at end of file
{ {
"name": "api/php_services", "name": "api/php_services",
"description": "api php_services", "description": "bp api php_services",
"type": "library", "type": "library",
"require": { "require": {
"php": ">=7.2", "php": ">=7.2",
"api/php_utils":"dev-master" "api/php_utils":"dev-master",
"perftools/php-profiler": "^0.18.0"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
...@@ -14,7 +15,7 @@ ...@@ -14,7 +15,7 @@
"repositories": { "repositories": {
"api/php_utils":{ "api/php_utils":{
"type":"vcs", "type":"vcs",
"url":"https://git.yidian-inc.com:8021/api0/php_utils.git" "url":"https://gitlab.yidian-inc.com/bp/php_utils.git"
} }
} }
} }
\ No newline at end of file
<?php
echo 's.local.com';
\ No newline at end of file
...@@ -27,7 +27,7 @@ class DesEncryptor ...@@ -27,7 +27,7 @@ class DesEncryptor
$this->_iv = $iv; $this->_iv = $iv;
$this->_encrypt = $encrypt; $this->_encrypt = $encrypt;
$this->_cipher = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_CBC, ''); $this->_cipher = mcrypt_module_open(MCRYPT_DES, '', MCRYPT_MODE_CBC, '');
mcrypt_generic_init($this->_cipher, $this->_key, $this->_iv); mcrypt_generic_init($this->_cipher, $this->_key, $this->_iv);
} }
......
...@@ -66,7 +66,7 @@ class IdCertification ...@@ -66,7 +66,7 @@ class IdCertification
$result_posit = $this->getIdCardOcr($posit_image_url); $result_posit = $this->getIdCardOcr($posit_image_url);
} }
if (!empty($back_image_url)) { if (!empty($back_image_url)) {
$result_back = $this->getIdCardOcr($posit_image_url); $result_back = $this->getIdCardOcr($back_image_url);
} }
$final['posit'] = self::analysisPositData($result_posit ?? []); $final['posit'] = self::analysisPositData($result_posit ?? []);
$final['back'] = self::analysisBackData($result_back ?? []); $final['back'] = self::analysisBackData($result_back ?? []);
......
...@@ -79,7 +79,7 @@ class SocialCreditCertification ...@@ -79,7 +79,7 @@ class SocialCreditCertification
'databaseImageContent' => $base64_image 'databaseImageContent' => $base64_image
]; ];
$result = (new Request())->post(self::ocr_bussiness_url, $post_data, 4000, 'json'); $result = (new Request())->post(self::ocr_bussiness_url, $post_data, 5000, 'json',[],1);
if (isset($result['code'],$result['response']) && $result['code'] === 0 ) { if (isset($result['code'],$result['response']) && $result['code'] === 0 ) {
return $result['response']; return $result['response'];
......
<?php
namespace Api\PhpServices\ChameleonPackage;
use Api\PhpUtils\Redis\Codis;
class Package
{
/**
* 将包信息存储到 redis,若 package_version 已存在,则更新
* @param $appid
* @param $package_version
* @param $data
*/
public static function save( string $appid, $package_version, array $data ){
$redis = (new Codis())->getInstance();
$key = config("redis","key.prefix.ChameleonPackage").$appid."_".$package_version;
$old = $redis->get($key);
$json = self::getJson($data);
if($json){
$data["json"] = $json;
}
if($old){
$old = json_decode($old, true);
$data = array_merge($old, $data);
}
$data = json_encode($data);
return $redis->set($key, $data);
}
/**
* 获取指定版本的所有包信息
* @param string $appid
* @param $package_version
* @return bool|mixed|string
*/
public static function getAll(string $appid, $package_version){
$key = config("redis","key.prefix.ChameleonPackage").$appid."_".$package_version;
$redis = (new Codis())->getInstance();
$res = $redis->get($key);
return json_decode($res, true);
}
/**
* 仅获取json 信息
* @param string $appid
* @param $package_version
* @return mixed
*/
public static function getInfo(string $appid, $package_version){
$key = config("redis","key.prefix.ChameleonPackage").$appid."_".$package_version;
$redis = (new Codis())->getInstance();
$res = $redis->get($key);
if(!$res){
return [];
}
$res = json_decode($res, true);
return $res["json"] ?? [];
}
/**
* 目前约定把包中的 json 文件单独用extra字段传入,不需解压包提取
* 若后期修改字段或需要解压,在此方法中操作提取json返回即可
* @param $data
* @return mixed|string
*/
private static function getJson($data){
return $data["extra"]??"";
}
}
\ No newline at end of file
<?php
namespace Api\PhpServices\Collect;
use Api\PhpServices\Collect\models\Collect as CollectModels;
use Api\PhpUtils\Common\IP;
/**
* Class Doc
* @package Api\PhpServices\Collect
*/
class Collect
{
/**
* 错误码
*/
const ERROR_CODE = [
1 => "已收藏",
2 => "收藏失败",
3 => "取消收藏失败"
];
/**
* 文章类型的收藏 type 字段定值
*/
const DOC_TYPE = 'doc';
/**
* mongo 模型
* @var object
*/
private $model;
public function __construct()
{
$this->model = CollectModels::getInstance();
}
/**
* 收藏文章
* @param $userid
* @param $docid
* @return array
*/
public function addDoc($userid, $docid, $ctype, array $data = []){
// 查重
$params = [
'userid' => $userid,
'type' => self::DOC_TYPE,
'docid' => $docid,
];
$has = $this->model->count($params);
if( $has > 0 ){
return $this->error(1);
}
// 存库
$insert = array_merge($data, [
'uid' => md5($userid.'-doc-'.$docid),
'userid' => $userid,
'docid' => $docid,
'type' => self::DOC_TYPE,
'ctype' => $ctype,
'createTime' => $_SERVER['REQUEST_TIME'],
'updateTime' => $_SERVER['REQUEST_TIME'],
'ip' => IP::ip()
]);
$res = $this->model->add($insert);
if($res){
return $this->success();
}
return $this->error(2);
}
/**
* 批量取消收藏
*/
public function del($userid, array $ids){
$res = $this->model->delete([
'userid' => $userid,
'docid' => [
'$in' => $ids
]
]);
if( is_int($res) ){
return $this->success();
}
return $this->error(3);
}
/**
* 收藏列表
* @param $userid
* @param int $start
* @param int $limit
* @param int[] $order
* @return
*/
public function list($userid, $start = 0, $limit = 20, $order = ["createTime"=>-1]){
$params = [
'userid' => $userid
];
$fields = [
'_id' => 0
];
$sort = $order;
$limit = [
'start' => $start,
'count' => $limit
];
$res = $this->model->getMany($params, $fields, $sort, $limit);
return $res;
}
/**
* 获取用户收藏数
* @param $userid
*/
public function collectNum($userid){
$params = [
'userid' => $userid
];
return $this->model->count($params);
}
/**
* 用户是否已收藏文章(批量)
* @param $userid
* @param array $docs
*/
public function isCollected($userid, array $docs){
$params = [
'userid' => $userid,
'docid' => [
'$in' => $docs
]
];
$fields = [
'_id' => 0,
'docid' => 1
];
$res = $this->model->getMany($params, $fields);
return $res;
}
/**
* 成功响应
* @param null $data
* @return array|int[]
*/
private function success($data = null){
if(is_null($data)){
return ['code' => 0];
}
return [ 'code' => 0, 'data'=>$data ];
}
/**
* 异常响应
* @param $code
* @return array
*/
private function error($code){
return ["code" => $code, "msg" => self::ERROR_CODE[$code]];
}
}
\ No newline at end of file
1. 配置 yaconf
- mongo.ini 中配置库的连接信息,如下,其中键的 metro 部分可以换成其他名字用来标识不同数据库,键的其他部分不可改变
```
metro.host='10.126.150.23'
metro.port='27017'
metro.db='metro'
metro.uriOptions.replicaSet='rs-api-test'
metro.uriOptions.readperference='secondaryperferred'
metro.uriOptions.connectTimeoutMS='500'
metro.uriOptions.socketTimeoutMS='6000'
metro.uriOptions.wTimeoutMS='3000'
metro.driverOptions.typeMap.root='array'
metro.driverOptions.typeMap.document='array'
```
- app.ini 中配置收藏服务用到的库信息与表名,如下,键名不可修改,`collect.mongo.db` 的值为 mongo.ini 中数据库的标识名,`collect.mongo.collection` 为表名(集合名)
```
# 收藏mongo库名
collect.mongo.db = "metro"
# 收藏mongo表名
collect.mongo.collection = "collect"
```
2. 使用服务
$service = new Api\PhpServices\Collect\Collect();
$service->addDoc($userid, $docid); // 添加收藏
$service->del($userid, ["id1","id2","id3"]); // 批量取消收藏
$service->list($userid, $page['start'], $page['size']); // 获取收藏列表
\ No newline at end of file
<?php
namespace Api\PhpServices\Collect\models;
use Api\PhpUtils\Mongo\Base;
class Collect extends Base
{
protected static $instance;
protected function getConfigIndex()
{
return "collect";
}
protected function getCollectionName()
{
return "data";
}
protected function getWhere($params)
{
return $params;
}
protected function getQueryOptions($fields = [], $sort = [], $limit = [])
{
$options = [
'maxTimeMS' => 800,
'limit' => 100
];
if (is_array($fields) && !empty($fields)) {
$options['projection'] = $fields;
}
if (is_array($sort) && !empty($sort)) {
$options['sort'] = $sort;
}
if (is_array($limit)) {
if(isset($limit['start'])){
$options['skip'] = intval($limit['start']);
}
if(isset($limit['count'])){
$options['limit'] = intval($limit['count']);
}
}
return $options;
}
}
\ No newline at end of file
<?php
namespace Api\PhpServices\Comment;
use Api\PhpUtils\Http\Request;
use App\Exception\custom\CodeSpecialException;
class Comment
{
const UNSUAL_CODE = 999999; // 请求上游接口返回异常,比如服务器挂了
const REQUEST_ERROR = 100001; // 上游接口返回的请求异常,会附带一些错误信息
const PARAMS_ERROR = 100010; // 上游接口返回参数错误
const NOTNORMAL_ERROR = 100037; // 上游接口返回非法用户
const SUCCESS_CODE = 100000; // 上游接口返回成功码
/**
* 添加评论/回复评论
* POST
* @doc 运营中台接口文档地址http://ydwiki.yidian-inc.com/pages/viewpage.action?pageId=59701834
* @doc method 接口名称 新增评论接口接口 接口地址 comment/addComment
* @param array $params 请求参数 详细的参数看运营中台接口文档
* @return array
*/
public static function add(array $params){
$url = config("interface","service.comment.add");
if(!$url){
throw new CodeSpecialException("comment_url_error");
}
$res = (new Request())->post($url, $params);
if(!isset($res['response']) || empty($res['response'])){
throw new CodeSpecialException("comment_unusual");
}
$res = $res['response'];
if( $res['code'] == self::UNSUAL_CODE ) {
throw new CodeSpecialException("comment_unusual");
}
if($res["code"] == self::SUCCESS_CODE){
if( isset($res['status']) ) {
unset($res['status']);
}
return $res;
}
switch ($res["code"]/1){
case self::REQUEST_ERROR:
throw new CodeSpecialException("comment_add",$res['message']??'请求失败');
case self::PARAMS_ERROR:
throw new CodeSpecialException("comment_params_error");
case self::NOTNORMAL_ERROR:
throw new CodeSpecialException("comment_notnormal_user");
default:
throw new CodeSpecialException("comment_inner_error");
}
}
/**
* 评论列表
* GET
* @doc 运营中台接口文档地址http://ydwiki.yidian-inc.com/pages/viewpage.action?pageId=59701834
* @doc method 接口名称 根据docId获取评论 接口地址 comment/getCommentByDocId
* @param array $params 请求参数 详细的参数看运营中台接口文档
*/
public static function getListByDocid(array $params){
$url = config("interface","service.comment.list_by_docid");
if(!$url){
throw new CodeSpecialException("comment_url_error");
}
$res = (new Request())->get($url, $params);
if(!isset($res['response']) || !isset($res['response']["code"])){
throw new CodeSpecialException("comment_unusual");
}
$res = $res['response'];
if( $res['code'] == self::UNSUAL_CODE ) {
throw new CodeSpecialException("comment_unusual");
}
if($res["code"] == self::SUCCESS_CODE){
if( isset($res['status']) ) {
unset($res['status']);
}
return $res;
}
switch ($res["code"]/1){
case self::REQUEST_ERROR:
throw new CodeSpecialException("comment_request_error",$res['message']??'请求失败');
case self::PARAMS_ERROR:
throw new CodeSpecialException("comment_params_error");
case self::NOTNORMAL_ERROR:
throw new CodeSpecialException("comment_notnormal_user");
default:
throw new CodeSpecialException("comment_inner_error");
}
}
/**
* 评论点赞
* POST
* @doc 运营中台接口文档地址http://ydwiki.yidian-inc.com/pages/viewpage.action?pageId=59701834
* @doc method 接口名称 赞/踩互动接口 接口地址 like/getLikeNumber
* @param array $params 请求参数 详细的参数看运营中台接口文档
* @throws CodeSpecialException
* @return true
*/
public static function like(array $params){
$url = config("interface","service.comment.like");
if(!$url){
throw new CodeSpecialException("comment_url_error");
}
$res = (new Request())->post($url, $params);
if(!isset($res['response']) || !isset($res['response']["code"])){
throw new CodeSpecialException("comment_unusual");
}
$res = $res['response'];
if( $res['code'] == self::REQUEST_ERROR ) {
throw new CodeSpecialException("comment_unusual", $res['message']);
}
if($res["code"] == self::SUCCESS_CODE){
if( isset($res['code']) ) {
unset($res['code']);
}
if( isset($res['status']) ) {
unset($res['status']);
}
return $res;
}
switch ($res["code"]/1){
case self::REQUEST_ERROR:
throw new CodeSpecialException("comment_like",$res['message']??'请求失败');
case self::PARAMS_ERROR:
throw new CodeSpecialException("comment_params_error");
case self::NOTNORMAL_ERROR:
throw new CodeSpecialException("comment_notnormal_user");
default:
throw new CodeSpecialException("comment_inner_error");
}
}
/**
* 表情
* @doc 运营中台接口文档地址http://ydwiki.yidian-inc.com/pages/viewpage.action?pageId=59701834
* @doc method 接口名称 根据业务ID获取表情 接口地址 expression/getAppExpression
* @param int $businessId 业务ID运营中台定义
* @throws CodeSpecialException
*/
public static function getExpression(int $businessId){
$params = [
'businessId'=>$businessId
];
$url = config("interface","service.comment.expression");
if(!$url){
throw new CodeSpecialException("comment_url_error");
}
$res = (new Request())->get($url, $params);
if(!isset($res['response']) || !isset($res['response']["code"])){
throw new CodeSpecialException("comment_unusual");
}
$res = $res['response'];
if( $res['code'] == self::UNSUAL_CODE ) {
throw new CodeSpecialException("comment_unusual");
}
if($res["code"] == self::SUCCESS_CODE){
if( isset($res['code']) ) {
unset($res['code']);
}
if( isset($res['status']) ) {
unset($res['status']);
}
return $res;
}
switch ($res["code"]/1){
case self::REQUEST_ERROR:
throw new CodeSpecialException("comment_request_error",$res['message']??'请求失败');
case self::PARAMS_ERROR:
throw new CodeSpecialException("comment_params_error");
case self::NOTNORMAL_ERROR:
throw new CodeSpecialException("comment_notnormal_user");
default:
throw new CodeSpecialException("comment_inner_error");
}
}
/**
* 根据userid和docid获取用户评论列表
* @doc 运营中台接口文档地址http://ydwiki.yidian-inc.com/pages/viewpage.action?pageId=59701834
* @doc method 接口名称 根据业务ID获取表情 接口地址 comment/getCommentByUserId
* @param array $params 请求参数 详细的参数看运营中台接口文档
* @throws CodeSpecialException
*/
public static function getLikeListByUseridByDocid( array $params )
{
$url = config("interface","service.comment.like_list_byuserid_bydocid");
if(!$url){
throw new CodeSpecialException("comment_url_error");
}
$res = (new Request())->get($url, $params, 500);
if(!$res || !isset($res["code"])){
throw new CodeSpecialException("comment_unusual");
}
if( $res['code'] == self::UNSUAL_CODE ) {
throw new CodeSpecialException("comment_unusual");
}
if($res["code"] == self::SUCCESS_CODE){
if( isset($res['result']) ) {
unset($res['result']);
}
if( isset($res['request_time']) ) {
unset($res['request_time']);
}
if( isset($res['code']) ) {
unset($res['code']);
}
if( isset($res['status']) ) {
unset($res['status']);
}
return $res;
}
switch ($res["code"]/1){
case self::REQUEST_ERROR:
throw new CodeSpecialException("comment_request_error",$res['message']??'请求失败');
case self::PARAMS_ERROR:
throw new CodeSpecialException("comment_params_error");
case self::NOTNORMAL_ERROR:
throw new CodeSpecialException("comment_notnormal_user");
default:
throw new CodeSpecialException("comment_inner_error");
}
}
/**
* 评论删除
* @doc 运营中台接口文档地址http://ydwiki.yidian-inc.com/pages/viewpage.action?pageId=59701834
* @doc method 接口名称 删除评论 接口地址 comment/deleteComment
* @param array $params 请求参数 详细的参数看运营中台接口文档
* @return true
* @throws CodeSpecialException
*/
public static function delete(array $params){
$url = config("interface","service.comment.delete");
if(!$url){
throw new CodeSpecialException("comment_url_error");
}
$res = (new Request())->post($url, $params,300);
if(!isset($res['response']) || !isset($res['response']["code"])){
throw new CodeSpecialException("comment_unusual");
}
$res = $res['response'];
if( $res['code'] == self::UNSUAL_CODE ) {
throw new CodeSpecialException("comment_unusual");
}
if( $res["code"] == self::SUCCESS_CODE ){
if( isset($res['code']) ) {
unset($res['code']);
}
if( isset($res['status']) ) {
unset($res['status']);
}
return $res;
// if( isset($res['data']) && $res['data']['result'] === true ) {
// return true;
// }else{
// throw new CodeSpecialException("comment_delete",$res['result']??'请求失败');
// }
}
switch ($res["code"]/1){
case self::REQUEST_ERROR:
throw new CodeSpecialException("comment_delete",$res['message']??'请求失败');
case self::PARAMS_ERROR:
throw new CodeSpecialException("comment_params_error");
case self::NOTNORMAL_ERROR:
throw new CodeSpecialException("comment_notnormal_user");
default:
throw new CodeSpecialException("comment_inner_error");
}
}
/**
* 根据commentId获取评论详情
* @doc 运营中台接口文档地址http://ydwiki.yidian-inc.com/pages/viewpage.action?pageId=59701834
* @doc method 接口名称 根据commentId获取评论 接口地址 comment/getCommentByCommentId
* @param array $params 请求参数 详细的参数看运营中台接口文档
* @return array
* @throws CodeSpecialException
*/
public static function getDetailByTopComentId(array $params){
$url = config("interface","service.comment.list_bytop_commentid");
$res = (new Request())->get($url, $params, 500);
if(!$res || !isset($res["code"])){
throw new CodeSpecialException("comment_unusual");
}
if( $res['code'] == self::UNSUAL_CODE ) {
throw new CodeSpecialException("comment_unusual");
}
if($res["code"] == self::SUCCESS_CODE){
if( isset($res['result']) ) {
unset($res['result']);
}
if( isset($res['request_time']) ) {
unset($res['request_time']);
}
if( isset($res['code']) ) {
unset($res['code']);
}
if( isset($res['status']) ) {
unset($res['status']);
}
return $res;
}
switch ($res["code"]/1){
case self::REQUEST_ERROR:
throw new CodeSpecialException("comment_request_error",$res['message']??'请求失败');
case self::PARAMS_ERROR:
throw new CodeSpecialException("comment_params_error");
case self::NOTNORMAL_ERROR:
throw new CodeSpecialException("comment_notnormal_user");
default:
throw new CodeSpecialException("comment_inner_error");
}
}
/**
* 根据userid获取用户评论列表
* @doc 运营中台接口文档地址http://ydwiki.yidian-inc.com/pages/viewpage.action?pageId=59701834
* @doc method 接口名称 根据commentId获取评论 接口地址 comment/getCommentByUserId
* @param array $params 请求参数 详细的参数看运营中台接口文档
* @return array
* @throws CodeSpecialException
*/
public static function getListByUserid(array $params){
$url = config("interface","service.comment.list_byuserid");
if(!$url){
throw new CodeSpecialException("comment_url_error");
}
$res = (new Request())->get($url, $params, 500);
if(!$res || !isset($res["code"])){
throw new CodeSpecialException("comment_unusual");
}
if( $res['code'] == self::UNSUAL_CODE ) {
throw new CodeSpecialException("comment_unusual");
}
if($res["code"] == self::SUCCESS_CODE){
if( isset($res['result']) ) {
unset($res['result']);
}
if( isset($res['request_time']) ) {
unset($res['request_time']);
}
if( isset($res['code']) ) {
unset($res['code']);
}
if( isset($res['status']) ) {
unset($res['status']);
}
return $res;
}
switch ($res["code"]/1){
case self::REQUEST_ERROR:
throw new CodeSpecialException("comment_request_error",$res['message']??'请求失败');
case self::PARAMS_ERROR:
throw new CodeSpecialException("comment_params_error");
case self::NOTNORMAL_ERROR:
throw new CodeSpecialException("comment_notnormal_user");
default:
throw new CodeSpecialException("comment_inner_error");
}
}
/**
* 根据userid和docid获取用户评论列表方法
* @doc 运营中台接口文档地址http://ydwiki.yidian-inc.com/pages/viewpage.action?pageId=59701834
* @doc method 接口名称 根据commentId获取评论 接口地址 comment/getCommentByUserId
* @param array $params 请求参数 详细的参数看运营中台接口文档
* @return array
* @throws CodeSpecialException
*/
public static function getListByUseridByDocid(array $params){
$url = config("interface","service.comment.list_byuserid_bydocid");
if(!$url){
throw new CodeSpecialException("comment_url_error");
}
$res = (new Request())->get($url, $params, 500);
if(!$res || !isset($res["code"])){
throw new CodeSpecialException("comment_unusual");
}
if( $res['code'] == self::UNSUAL_CODE ) {
throw new CodeSpecialException("comment_unusual");
}
if($res["code"] == self::SUCCESS_CODE){
if( isset($res['result']) ) {
unset($res['result']);
}
if( isset($res['request_time']) ) {
unset($res['request_time']);
}
if( isset($res['code']) ) {
unset($res['code']);
}
if( isset($res['status']) ) {
unset($res['status']);
}
return $res;
}
switch ($res["code"]/1){
case self::REQUEST_ERROR:
throw new CodeSpecialException("comment_request_error",$res['message']??'请求失败');
case self::PARAMS_ERROR:
throw new CodeSpecialException("comment_params_error");
case self::NOTNORMAL_ERROR:
throw new CodeSpecialException("comment_notnormal_user");
default:
throw new CodeSpecialException("comment_inner_error");
}
}
/**
* 根据docid获取评论的数量
* @doc 运营中台接口文档地址http://ydwiki.yidian-inc.com/pages/viewpage.action?pageId=59701834
* @doc method 接口名称 根据docId获取评论数量 接口地址 comment/getCommentNumberByDocId
* @param int $businessId 业务ID
* @param int $docId 文章ID
* @return array
* @throws CodeSpecialException
*/
public static function getCommentNumByDocid(int $businessId, string $docId){
$params = [
'businessId'=>$businessId,
'docId'=>$docId
];
$url = config("interface","service.comment.num_bydocid");
if(!$url){
return [];
//throw new CodeSpecialException("comment_url_error");
}
$res = (new Request())->get($url, $params, 500);
if(!$res || !isset($res["code"])){
return [];
// throw new CodeSpecialException("comment_unusual");
}
if( $res['code'] == self::UNSUAL_CODE ) {
return [];
//throw new CodeSpecialException("comment_unusual");
}
if($res["code"] == self::SUCCESS_CODE){
if( isset($res['result']) ) {
unset($res['result']);
}
if( isset($res['request_time']) ) {
unset($res['request_time']);
}
if( isset($res['code']) ) {
unset($res['code']);
}
if( isset($res['status']) ) {
unset($res['status']);
}
return $res['data'] ?? [];
}
return [];
}
/**
* 根据commentId获取回复数量
* @doc 运营中台接口文档地址http://ydwiki.yidian-inc.com/pages/viewpage.action?pageId=59701834
* @doc method 接口名称 根据docId获取评论数量 接口地址 comment/getCommentNumberByCommentId
* @param int $businessId 业务ID
* @param int $commentId 评论ID
* @return array
* @throws CodeSpecialException
*/
public static function getReplyNumByCommentId(int $commentId, int $businessId){
$params = [
'commentId'=>$commentId,
'businessId'=>$businessId
];
$url = config("interface","service.comment.replynum_bycommentid");
if(!$url){
throw new CodeSpecialException("comment_url_error");
}
$res = (new Request())->get($url, $params, 500);
if(!$res || !isset($res["code"])){
throw new CodeSpecialException("comment_unusual");
}
if( $res['code'] == self::UNSUAL_CODE ) {
throw new CodeSpecialException("comment_unusual");
}
if($res["code"] == self::SUCCESS_CODE){
if( isset($res['result']) ) {
unset($res['result']);
}
if( isset($res['request_time']) ) {
unset($res['request_time']);
}
if( isset($res['code']) ) {
unset($res['code']);
}
if( isset($res['status']) ) {
unset($res['status']);
}
return $res;
}
switch ($res["code"]/1){
case self::REQUEST_ERROR:
throw new CodeSpecialException("comment_request_error",$res['message']??'请求失败');
case self::PARAMS_ERROR:
throw new CodeSpecialException("comment_params_error");
case self::NOTNORMAL_ERROR:
throw new CodeSpecialException("comment_notnormal_user");
default:
throw new CodeSpecialException("comment_inner_error");
}
}
/**
* 根据userid获取回复数量
* @param array $params
* @return true
* @throws CodeSpecialException
*/
public static function getReplyNumByUserid(array $params){
$url = config("interface","service.comment.replynum_byuserid");
if(!$url){
throw new CodeSpecialException("comment_url_error");
}
$res = (new Request())->get($url, $params, 500);
if(!$res || !isset($res["code"])){
throw new CodeSpecialException("comment_unusual");
}
if( $res['code'] == self::UNSUAL_CODE ) {
throw new CodeSpecialException("comment_unusual");
}
if($res["code"] == self::SUCCESS_CODE){
if( isset($res['result']) ) {
unset($res['result']);
}
if( isset($res['request_time']) ) {
unset($res['request_time']);
}
if( isset($res['code']) ) {
unset($res['code']);
}
if( isset($res['status']) ) {
unset($res['status']);
}
return $res;
}
switch ($res["code"]/1){
case self::REQUEST_ERROR:
throw new CodeSpecialException("comment_request_error",$res['status']??'请求失败');
case self::PARAMS_ERROR:
throw new CodeSpecialException("comment_params_error");
case self::NOTNORMAL_ERROR:
throw new CodeSpecialException("comment_notnormal_user");
default:
throw new CodeSpecialException("comment_inner_error",$res['status']??'服务内部错误');
}
}
/**
* 根据commentid获取点赞数量方法
* @param array $params
* @return true
* @throws CodeSpecialException
*/
public static function getLikeNumByCommentId(int $commentId, int $businessId, int $type){
$params = [
'commentId'=>$commentId,
'businessId'=>$businessId,
'type'=>$type
];
$url = config("interface","service.comment.likenum_bycommentid");
if(!$url){
throw new CodeSpecialException("comment_url_error");
}
$res = (new Request())->get($url, $params, 500);
if(!$res || !isset($res["code"])){
throw new CodeSpecialException("comment_unusual");
}
if( $res['code'] == self::UNSUAL_CODE ) {
throw new CodeSpecialException("comment_unusual");
}
if($res["code"] == self::SUCCESS_CODE){
if( isset($res['result']) ) {
unset($res['result']);
}
if( isset($res['request_time']) ) {
unset($res['request_time']);
}
if( isset($res['code']) ) {
unset($res['code']);
}
if( isset($res['status']) ) {
unset($res['status']);
}
return $res;
}
switch ($res["code"]/1){
case self::REQUEST_ERROR:
throw new CodeSpecialException("comment_request_error",$res['message']??'请求失败');
case self::PARAMS_ERROR:
throw new CodeSpecialException("comment_params_error");
case self::NOTNORMAL_ERROR:
throw new CodeSpecialException("comment_notnormal_user");
default:
throw new CodeSpecialException("comment_inner_error");
}
}
/**
* 根据userid获取点赞数量
* @param array $params
* @return true
* @throws CodeSpecialException
*/
public static function getLikeNumByUserid(int $userid,int $businessId, int $type){
$params = [
'userId'=>$userid,
'businessId'=>$businessId,
'type'=>$type
];
$url = config("interface","service.comment.likenum_byuserid");
if(!$url){
throw new CodeSpecialException("comment_url_error");
}
$res = (new Request())->get($url, $params, 500);
if(!$res || !isset($res["code"])){
throw new CodeSpecialException("comment_unusual");
}
if( $res['code'] == self::UNSUAL_CODE ) {
throw new CodeSpecialException("comment_unusual");
}
if($res["code"] == self::SUCCESS_CODE){
if( isset($res['result']) ) {
unset($res['result']);
}
if( isset($res['request_time']) ) {
unset($res['request_time']);
}
if( isset($res['code']) ) {
unset($res['code']);
}
if( isset($res['status']) ) {
unset($res['status']);
}
return $res;
}
switch ($res["code"]/1){
case self::REQUEST_ERROR:
throw new CodeSpecialException("comment_request_error",$res['message']??'请求失败');
case self::PARAMS_ERROR:
throw new CodeSpecialException("comment_params_error");
case self::NOTNORMAL_ERROR:
throw new CodeSpecialException("comment_notnormal_user");
default:
throw new CodeSpecialException("comment_inner_error");
}
}
/**
* 评论举报
* @param array $params
* @return true
* @throws CodeSpecialException
*/
public static function report(array $params){
$url = config("interface","service.comment.report");
if(!$url){
throw new CodeSpecialException("comment_url_error");
}
$res = (new Request())->post($url, $params,300);
if(!$res || !isset($res["code"])){
throw new CodeSpecialException("comment_unusual");
}
if( $res['code'] == self::UNSUAL_CODE ) {
throw new CodeSpecialException("comment_unusual");
}
if($res["code"] == self::SUCCESS_CODE){
if( isset($res['result']) ) {
unset($res['result']);
}
if( isset($res['request_time']) ) {
unset($res['request_time']);
}
if( isset($res['code']) ) {
unset($res['code']);
}
if( isset($res['status']) ) {
unset($res['status']);
}
return $res;
}
switch ($res["code"]/1){
case self::REQUEST_ERROR:
throw new CodeSpecialException("comment_report",$res['message']??'请求失败');
case self::PARAMS_ERROR:
throw new CodeSpecialException("comment_params_error");
case self::NOTNORMAL_ERROR:
throw new CodeSpecialException("comment_notnormal_user");
default:
throw new CodeSpecialException("comment_inner_error");
}
}
/**
* 异步并发请求文章评论和文章下用户点赞
* @param $params [[根据docid获取列表的参数],[根据用户ID+文章ID获取点赞评论]]
* @return array
* @throws CodeSpecialException
*/
public static function getDocListAndUserLike($params){
$send_params = array_values($params);
$send_params_keys = array_keys($params);
$urls = [
config("interface","service.comment.list_by_docid"),
config("interface","service.comment.like_list_byuserid_bydocid")
];
$res = (new Request())->concurrencyGet($urls, $send_params, [], 1);
if(!$res || !is_array($res)){
throw new CodeSpecialException("comment_unusual");
}
$return_data = [];
foreach ($res as $k=>$v) {
$v = $v['response'];
$return_data[$send_params_keys[$k]]['data'] = [];
if($v['code'] == self::SUCCESS_CODE) {
$return_data[$send_params_keys[$k]]['data'] = $v['data'];
}
// if( $v['code'] == self::UNSUAL_CODE ) {
// throw new CodeSpecialException('comment_unusual');
// }
// if( $v['code'] == self::REQUEST_ERROR ){
// throw new CodeSpecialException("comment_request_error",$v['message']??'请求失败');
// }
// if( $v['code'] == self::PARAMS_ERROR ) {
// throw new CodeSpecialException("comment_params_error");
// }
// if( $v['code'] == self::NOTNORMAL_ERROR ) {
// throw new CodeSpecialException("comment_notnormal_user");
// }
// // 成功之后数据处理
// if( $v['code'] == self::SUCCESS_CODE ) {
// $return_data[$send_params_keys[$k]]['data'] = $v['data'];
// }else{
// throw new CodeSpecialException("comment_inner_error");
// }
}
return $return_data;
}
/**
* 批量获取文章的评论数
* @param int $businessId 业务ID
* @param array $docids 多个文章ID
*/
public static function getCommentNumByDocids( int $businessId, array $docids )
{
$return_data = [];
$url = config("interface","service.comment.num_bydocid");
if(!$url){
return $return_data;
}
// 拼接请求的url
foreach ($docids as $docid){
$urls[] = $url;
$params[] = [
'businessId'=>$businessId,
'docId'=>$docid
];
}
$res = (new Request())->concurrencyGet($urls, $params, [500,500],1);
if(!$res || !is_array($res)){
// throw new CodeSpecialException("comment_unusual");
return $return_data;
}
foreach ($res as $val){
if(isset($val['data']['docId']) && !empty($val['data'])){
$return_data[$val['data']['docId']] = $val['data'];
}
}
return $return_data;
}
}
\ No newline at end of file
<?php
namespace Api\PhpServices\Comment;
use Api\PhpUtils\Http\Request;
class CommentService
{
/**
* 错误码
*/
const ERROR_CODE = [
1 => '参数有误',
2 => '添加评论失败',
3 => '获取评论数据失败',
4 => '点赞评论失败',
5 => '获取评论表情失败',
6 => '删除评论失败',
7 => '举报评论失败'
];
/**
* 成功响应
* @param null $data
* @return array|int[]
*/
private function success($data = null)
{
if (is_null($data)) {
return ['code' => 0];
}
return ['code' => 0, 'data'=>$data];
}
/**
* 异常响应
* @param $code
* @return array
*/
private function error($code)
{
return ["code" => $code, "msg" => self::ERROR_CODE[$code]];
}
/**
* 添加评论/回复评论
* 运营中台接口文档地址http://ydwiki.yidian-inc.com/pages/viewpage.action?pageId=59701834
* 接口名称 comment/addComment
* @param array $params
* @return array
*/
public function add(array $params)
{
$url = config("interface", "service.comment.add");
if (empty($url)) {
return $this->error(1);
}
$res = (new Request())->post($url, $params);
if (!isset($res['response']['data']) || empty($res['response']['data'])) {
return $this->error(2);
}
return $this->success($res['response']['data']);
}
/**
* 评论列表
* 运营中台接口文档地址http://ydwiki.yidian-inc.com/pages/viewpage.action?pageId=59701834
* 接口名称 comment/getCommentByDocId
* @param array $params
* @return array
*/
public function getListByDocid(array $params)
{
$url = config("interface", "service.comment.list_by_docid");
if (empty($url)) {
return $this->error(1);
}
$res = (new Request())->get($url, $params);
if (!isset($res['response']['data']) || empty($res['response']['data'])) {
return $this->error(3);
}
return $this->success($res['response']['data']);
}
/**
* 评论点赞
* 运营中台接口文档地址http://ydwiki.yidian-inc.com/pages/viewpage.action?pageId=59701834
* 接口名称 like/getLikeNumber
* @param array $params
* @return array
*/
public function like(array $params)
{
$url = config("interface", "service.comment.like");
if (empty($url)) {
return $this->error(1);
}
$res = (new Request())->post($url, $params);
if (!isset($res['response']['data']) || empty($res['response']['data'])) {
return $this->error(4);
}
return $this->success($res['response']['data']);
}
/**
* 表情
* 营中台接口文档地址http://ydwiki.yidian-inc.com/pages/viewpage.action?pageId=59701834
* 接口名称 expression/getAppExpression
* @param int $businessId 业务ID运营中台定义
* @return array
*/
public function getExpression(int $businessId)
{
$params = [
'businessId'=>$businessId
];
$url = config("interface", "service.comment.expression");
if (empty($url)) {
return $this->error(1);
}
$res = (new Request())->get($url, $params);
if (!isset($res['response']['data']) || empty($res['response']['data'])) {
return $this->error(5);
}
return $this->success($res['response']['data']);
}
/**
* 评论删除
* 运营中台接口文档地址http://ydwiki.yidian-inc.com/pages/viewpage.action?pageId=59701834
* 接口名称 comment/deleteComment
* @param array $params
* @return array
*/
public function delete(array $params)
{
$url = config("interface", "service.comment.delete");
if (empty($url)) {
return $this->error(1);
}
$res = (new Request())->post($url, $params);
if (!isset($res['response']['data']) || empty($res['response']['data'])) {
return $this->error(6);
}
return $this->success($res['response']['data']);
}
/**
* 根据userid和docid获取用户评论列表
* 运营中台接口文档地址 http://ydwiki.yidian-inc.com/pages/viewpage.action?pageId=59701834
* 接口名称 comment/getCommentByUserId
* @param array $params 请求参数 详细的参数看运营中台接口文档
* @return
*/
public function getLikeListByUseridByDocid(array $params)
{
$url = config("interface", "service.comment.like_list_byuserid_bydocid");
if (empty($url)) {
return $this->error(1);
}
$res = (new Request())->get($url, $params);
if (!isset($res['response']['data']) || empty($res['response']['data'])) {
return $this->error(3);
}
return $this->success($res['response']['data']);
}
/**
* 根据commentId获取评论详情
* @doc 运营中台接口文档地址http://ydwiki.yidian-inc.com/pages/viewpage.action?pageId=59701834
* @doc method 接口名称 根据commentId获取评论 接口地址 comment/getCommentByCommentId
* @param array $params 请求参数 详细的参数看运营中台接口文档
* @return array
*/
public function getDetailByTopCommentId(array $params)
{
$url = config("interface", "service.comment.list_bytop_commentid");
if (empty($url)) {
return $this->error(1);
}
$res = (new Request())->get($url, $params);
if (!isset($res['response']['data']) || empty($res['response']['data'])) {
return $this->error(3);
}
return $this->success($res['response']['data']);
}
/**
* 根据userid获取用户评论列表
* 运营中台接口文档地址http://ydwiki.yidian-inc.com/pages/viewpage.action?pageId=59701834
* 接口名称 comment/getCommentByUserId
* @param array $params
* @return array
*/
public function getListByUserid(array $params)
{
$url = config("interface", "service.comment.list_byuserid");
if (empty($url)) {
return $this->error(1);
}
$res = (new Request())->get($url, $params);
if (!isset($res['response']['data']) || empty($res['response']['data'])) {
return $this->error(3);
}
return $this->success($res['response']['data']);
}
/**
* 根据userid和docid获取用户评论列表方法
* 运营中台接口文档地址http://ydwiki.yidian-inc.com/pages/viewpage.action?pageId=59701834
* 接口名称 comment/getCommentByUserId
* @param array $params
* @return array
*/
public function getListByUseridByDocid(array $params)
{
$url = config("interface", "service.comment.list_byuserid_bydocid");
if (empty($url)) {
return $this->error(1);
}
$res = (new Request())->get($url, $params);
if (!isset($res['response']['data']) || empty($res['response']['data'])) {
return $this->error(3);
}
return $this->success($res['response']['data']);
}
/**
* 根据docid获取评论的数量
* 运营中台接口文档地址http://ydwiki.yidian-inc.com/pages/viewpage.action?pageId=59701834
* 接口名称 comment/getCommentNumberByDocId
* @param int $businessId 业务ID
* @param string $docId 文章ID
* @return array
*/
public function getCommentNumByDocid(int $businessId, string $docId)
{
$params = [
'businessId'=>$businessId,
'docId'=>$docId
];
$url = config("interface", "service.comment.num_bydocid");
if (empty($url)) {
return $this->error(1);
}
$res = (new Request())->get($url, $params);
if (!isset($res['response']['data']) || empty($res['response']['data'])) {
return $this->error(3);
}
return $this->success($res['response']['data']);
}
/**
* 根据commentId获取回复数量
* 运营中台接口文档地址http://ydwiki.yidian-inc.com/pages/viewpage.action?pageId=59701834
* 接口名称 comment/getCommentNumberByCommentId
* @param int $businessId 业务ID
* @param int $commentId 评论ID
* @return array
*/
public function getReplyNumByCommentId(int $commentId, int $businessId)
{
$params = [
'commentId'=>$commentId,
'businessId'=>$businessId
];
$url = config("interface", "service.comment.replynum_bycommentid");
if (empty($url)) {
return $this->error(1);
}
$res = (new Request())->get($url, $params);
if (!isset($res['response']['data']) || empty($res['response']['data'])) {
return $this->error(3);
}
return $this->success($res['response']['data']);
}
/**
* 根据userid获取回复数量
* @param array $params
* @return array
*/
public function getReplyNumByUserid(array $params)
{
$url = config("interface", "service.comment.replynum_byuserid");
if (empty($url)) {
return $this->error(1);
}
$res = (new Request())->get($url, $params);
if (!isset($res['response']['data']) || empty($res['response']['data'])) {
return $this->error(3);
}
return $this->success($res['response']['data']);
}
/**
* 根据commentid获取点赞数量方法
* @param int $commentId
* @param int $businessId
* @param int $type
* @return array
*/
public function getLikeNumByCommentId(int $commentId, int $businessId, int $type)
{
$params = [
'commentId'=>$commentId,
'businessId'=>$businessId,
'type'=>$type
];
$url = config("interface", "service.comment.likenum_bycommentid");
if (empty($url)) {
return $this->error(1);
}
$res = (new Request())->get($url, $params);
if (!isset($res['response']['data']) || empty($res['response']['data'])) {
return $this->error(3);
}
return $this->success($res['response']['data']);
}
/**
* 根据userid获取点赞数量
* @param int $userid
* @param int $businessId
* @param int $type
* @return array
*/
public function getLikeNumByUserid(int $userid, int $businessId, int $type)
{
$params = [
'userId'=>$userid,
'businessId'=>$businessId,
'type'=>$type
];
$url = config("interface", "service.comment.likenum_byuserid");
if (empty($url)) {
return $this->error(1);
}
$res = (new Request())->get($url, $params);
if (!isset($res['response']['data']) || empty($res['response']['data'])) {
return $this->error(3);
}
return $this->success($res['response']['data']);
}
/**
* 评论举报
* @param array $params
* @return array
*/
public function report(array $params)
{
$url = config("interface", "service.comment.report");
if (empty($url)) {
return $this->error(1);
}
$res = (new Request())->post($url, $params);
if (!isset($res['response']['data']) || empty($res['response']['data'])) {
return $this->error(7);
}
return $this->success($res['response']['data']);
}
/**
* 异步并发请求文章评论和文章下用户对评论点赞
* @param array $params [ 0 => [根据docid获取列表的参数], 1 => [根据用户ID+文章ID获取点赞评论]]
* @return array
*/
public function getDocListAndUserLike($params)
{
if (empty($params)) {
return $this->error(1);
}
$urls = [
0 => config("interface", "service.comment.list_by_docid"),
1 => config("interface", "service.comment.like_list_byuserid_bydocid")
];
$res = (new Request())->concurrencyGet($urls, $params);
if (empty($res) || !is_array($res)) {
return $this->error(3);
}
$ret = [];
foreach ($res as $k => $v) {
$ret[$k]['data'] = $v['response']['data'] ?? [];
}
return $this->success($ret);
}
/**
* 批量获取文章的评论数
* @param int $businessId 业务ID
* @param array $docids 多个文章ID
* @return array
*/
public function getCommentNumByDocids(int $businessId, array $docids)
{
$return_data = [];
$url = config("interface", "service.comment.num_bydocid");
if (!$url) {
return $return_data;
}
$urls = $params = [];
foreach ($docids as $docid) {
$urls[] = $url;
$params[] = [
'businessId'=>$businessId,
'docId'=>$docid
];
}
$res = (new Request())->concurrencyGet($urls, $params);
if (empty($res) || !is_array($res)) {
return $this->error(3);
}
$ret = [];
foreach ($docids as $k => $docid) {
if (isset($res[$k]['response']['data']) && !empty($res[$k]['response']['data'])) {
$ret[$docid] = $res[$k]['response']['data'];
} else {
$ret[$docid] = [];
}
}
return $this->success($ret);
}
}
<?php
/**
* Description of InfoFlow.php
*
* @author caoyunmeng
* Date: 2021/3/1
* Time: 2:32 PM
*/
namespace Api\PhpServices\InfoFlow;
use Api\PhpUtils\Http\Request;
use Api\PhpServices\ThumbsUp\ThumbsUp;
class InfoFlow
{
/**
* 错误码
*/
const ERROR_CODE = [
1 => '参数有误',
2 => '获取信息流失败',
3 => '获取推荐信息流为空',
4 => '获取推荐信息流错误',
5 => '获取运营卡片错误',
6 => '获取封面图失败'
];
/**
* 成功响应
* @param null $data
* @return array|int[]
*/
private function success($data = null)
{
if (is_null($data)) {
return ['code' => 0];
}
return ['code' => 0, 'data'=>$data];
}
/**
* 异常响应
* @param $code
* @return array
*/
private function error($code)
{
return ["code" => $code, "msg" => self::ERROR_CODE[$code]];
}
/**
* @param $request_data array 并发请求参数拼接
* @param string $appid 端标识
* @param bool $userid 是否需要返回是否已点赞
*
* @return array
*/
public function getInfoFLow($request_data, $appid, $userid = false)
{
$flow = $this->getInfos($request_data);
//并发请求数据成功
if(isset($flow['code']) && $flow['code'] == 0){
$advert = [];
if(isset($flow['data']['advert']) && !empty($flow['data']['advert'])){
$advert = $flow['data']['advert'];
}
$tool_documents = [];
if(isset($flow['data']['tool']) && !empty($flow['data']['tool'])){
$tool = $flow['data']['tool'];
if(isset($tool['code']) && $tool['code'] == 0 && !empty($tool['documents'])){
$tool_documents = $tool['documents'];
}else{
return $this->error(5);
}
}
if(isset($flow['data']['recommend']) && !empty($flow['data']['recommend'])){
$recommend = $flow['data']['recommend'];
if(isset($recommend['code']) && $recommend['code'] == 0){
$recommend_result = $recommend['response'];
if(empty($recommend_result)){
return $this->error(3);
}
}else{
return $this->error(4);
}
}else{
return $this->error(3);
}
$mix_flow = $this->mixSort($recommend_result, $tool_documents, $advert);
//获取是否已点赞
if($userid){
$thumbup = new ThumbsUp();
foreach ($mix_flow as &$item){
$docid = '';
if((isset($item['docid']) && !empty($item['docid']))){
$docid = $item['docid'];
}
if(isset($item['id']) && isset($item['type']) && $item['type'] == 'doc'){
$docid = $item['id'];
$item['docid'] = $item['id'];
}
if(!empty($docid)){
$item['is_like'] = $thumbup->hasThumbsUp($appid, $userid, $docid);
}
}
}
return ['code' => 0, 'data' => $mix_flow];
}else{
return $flow;
}
}
/**
* 并发请求从推荐、运营、广告处获取相关信息列表
* @param $request_data
* @return array
*/
public function getInfos($request_data)
{
//稍后会移到yaconf中
$info_flow_keys = [
0 => 'recommend',
1 => 'tool',
2 => 'advert'
];
$keys = array_flip($info_flow_keys);
$urls = $methods = $params = $timeouts = $content_types = $headers = [];
foreach ($request_data as $info_flow_key => $info_flow_conf) {
//验证必传参数
if (!in_array($info_flow_key, $info_flow_keys) || empty($info_flow_conf)) {
return $this->error(1);
}
if (!isset($info_flow_conf['url']) || empty($info_flow_conf['url'])) {
return $this->error(1);
}
if (!isset($info_flow_conf['method']) || empty($info_flow_conf['method'])) {
return $this->error(1);
}
$info_flow_conf['method'] = strtoupper($info_flow_conf['method']);
if (!in_array($info_flow_conf['method'], ['GET', 'POST'])) {
return $this->error(1);
}
if (!isset($info_flow_conf['timeout']) || empty($info_flow_conf['timeout'])) {
return $this->error(1);
}
//验证非必传参数
if (isset($info_flow_conf['params']) && empty($info_flow_conf['params'])) {
return $this->error(1);
}
if (isset($info_flow_conf['content_type']) && empty($info_flow_conf['content_type'])) {
return $this->error(1);
}
if (isset($info_flow_conf['headers']) && empty($info_flow_conf['headers'])) {
return $this->error(1);
}
//构造请求参数
$_key = $keys[$info_flow_key];
$urls[$_key] = $info_flow_conf['url'];
$methods[$_key] = $info_flow_conf['method'];
$timeouts[$_key] = $info_flow_conf['timeout'];
if (isset($info_flow_conf['params'])) {
$params[$_key] = $info_flow_conf['params'];
}
if (isset($info_flow_conf['content_type'])) {
$content_types[$_key] = $info_flow_conf['content_type'];
}
if (isset($info_flow_conf['headers'])) {
$headers[$_key] = $info_flow_conf['headers'];
}
}
$request = new Request();
$ret = $request->concurrencyBlend($urls, $methods, $params, $timeouts, $content_types, $headers);
if (empty($ret)) {
return $this->error(2);
}
$list = [];
foreach ($ret as $k => $v) {
$_key = $info_flow_keys[$k];
$list[$_key] = $v;
}
return $this->success($list);
}
/**
* 将相关信息流列表做融合
* @param array $recommend 推荐信息流数据(二维数组)
* @param array $tool 运营卡片数据(二维数组)
* @param array $advert 广告数据(二维数组)
* @return array
*/
public function mixSort(array $recommend=[], array $tool=[], array $advert=[])
{
// 定义每个上游数据根据各方权重出现的位置
// 各方权重:
// 推荐流--recommend -1,3
// 运营卡片--tool 1,
// 广告--advert 1,2;各方出现顺序 blender -1,miss 1,miss 2,blender 3 根据权重出现的顺序 1,2,3,4 暂时不考虑广告
$card_position = [
'recommend'=>[
-1 => 1,
3 => 4,
],
'tool'=>[
1 => 2,
2 => 3
],
// advert的这期咱不考虑
// 'advert'=>[
// 1=>3,
// 2=>5
// ]
];
// order_arr 展示顺序 weight_arr 权重
$order_arr = $weight_arr = [];
foreach ($card_position as $cval) {
foreach ($cval as $cckey=>$ccval) {
array_push($order_arr, $ccval);
array_push($weight_arr, $cckey);
}
}
// 增加各方数据标识--card_source、各方根据权重出现的顺序--card_position_order 字段
// $recommend 数据
$recommend = array_map(function ($recommend_val) use ($card_position) {
$recommend_val['card_source'] = 'recommend'.$recommend_val['card_number']; // 给card_source增加序号,为的是好看数据
if (isset($card_position['recommend'][$recommend_val['card_weight']])) {
$recommend_val['card_position_order'] = $card_position['recommend'][$recommend_val['card_weight']];
} else {
// 不在排序中的数据,位置出现顺序就给一个默认值
$recommend_val['card_position_order'] = -99;
}
return $recommend_val;
}, $recommend);
// 运营数据
$tool = array_map(function ($tool_val) use ($card_position) {
$tool_val['card_source'] = 'tool'.$tool_val['card_number']; // 给card_source增加序号,为的是好看数据
if (isset($card_position['tool'][$tool_val['card_weight']])) {
$tool_val['card_position_order'] = $card_position['tool'][$tool_val['card_weight']];
} else {
$tool_val['card_position_order'] = -99;
}
return $tool_val;
}, $tool);
// todo 如果需要考虑广告时,可以增加广告的
// 合并各方数据
$all_array = array_merge($recommend, $tool);
// 初始化新数组
$new_arr = [];
// 计算需要初始化数组的长度
$total_new_arr_count = count($all_array) ;
for ($i=0;$i<$total_new_arr_count;$i++) {
$new_arr[$i] = [];
}
// need_sort_data 存放根据权重需要排序的数据; nosort_other_data 存放不需要排序的数据
$need_sort_data = $nosort_other_data = $need_card_source = [];
// 根据权重做数据分组
$this->getRecDataByWeight($all_array, $need_sort_data, $nosort_other_data, $need_card_source, $weight_arr, $order_arr);
// 根据出现顺序从小到大排序 顺序越小的,优先考虑根据位置放入新的数组中
sort($order_arr);
foreach ($order_arr as $wval) {
if (!isset($need_sort_data[$wval]) || empty($need_sort_data[$wval])) {
continue;
}
// 依次处理数据
$this->sortWeightData($new_arr, $need_sort_data[$wval]);
}
$again_news_data = [];
$all_card_source = $need_card_source;
$news_card_source = array_column($new_arr, 'card_source');
$again_news_arr = array_diff($all_card_source, $news_card_source);
if (!empty($again_news_arr)) {
foreach ($all_array as $all_key => $all_val) {
if (in_array($all_val['card_source'], $again_news_arr)) {
$again_news_data[$all_key] = $all_val;
}
}
}
// 最后合并不规则数据
$new_arr = array_values(array_filter(array_merge($new_arr, $again_news_data, $nosort_other_data)));
return $new_arr;
}
/**
* 根据权重和每个权重要出现的位置划分数据
* @param array $arr 参与排序的数据
* @param array $need_sort_data 需要根据权重排序的数据
* @param array $nosort_other_data 不需要参与根据权重排序的数据
* @param array $limit_arr 权重数组
* @param array $order_arr 排序数组
* @param mixed $need_card_source
* @return array
*/
private function getRecDataByWeight($arr, &$need_sort_data, &$nosort_other_data, &$need_card_source, $limit_arr = [], $order_arr = [])
{
foreach ($arr as $value) {
// 根据每个权重要出现的位置顺序 + 序号 进行数据分组
if (!empty($limit_arr) && in_array($value['card_weight'], $limit_arr) && in_array($value['card_position_order'], $order_arr)) {
$need_sort_data[$value['card_position_order']][$value['card_number']] = $value;
$need_card_source[] = $value['card_source'];
} else {
$nosort_other_data[] = $value;
}
}
return ['need_sort_data'=>$need_sort_data, 'nosort_other_data'=>$nosort_other_data, 'need_card_source'=>$need_card_source];
}
/**
* 根据权重排序
* @param array $news_arr 每次排序好的数据
* @param array $sort_data 需要排序的数据
* @return mixed
*/
private function sortWeightData(&$news_arr, $sort_data=[])
{
// position_find_data 需要重新找位置的数据
$position_find_data = [];
// 1.1 根据顺序放入对应的数据
foreach ($news_arr as $news_key => &$news_value) {
if (isset($sort_data[$news_key])) {
if (empty($sort_data[$news_key])) {
continue;
}
// 根据权重顺序+序号card_number放入新数组中对应的序号
if (empty($news_value)) {
$news_arr[$news_key] = $sort_data[$news_key];
} else {
// 同一个序号被高权重的数据占了,把挤出来的数据放入到一个数组中,重新找距离它最近的位置
array_push($position_find_data, $sort_data[$news_key]);
}
}
}
// 1.2 处理被挤出来的数据的位置
if (!empty($position_find_data)) {
foreach ($news_arr as $new_key => &$new_value) {
// 被挤出来的数据依次找到位置之后,直接结束本次循环
if (empty($position_find_data)) {
break;
}
// 获取第一组数据
$first_data = current($position_find_data);
// 位置已经被权重高的给占位了 或者找位置的card_number > 可用的空位置时 则跳过 保证依次向下找最近的位置
if (!empty($new_value) || ($new_key < $first_data['card_number'])) {
continue;
}
// 依次放入数据
$news_arr[$new_key] = array_shift($position_find_data);
}
}
return $news_arr;
}
public function selectCovers($doc_ids, $userid = 0){
$url = config('interface', 'service.flow.cover_select');
$params = [
'docids' => implode(',', $doc_ids),
'userid' => $userid
];
$timeout = 3000;
//获取文章详情
$ret = (new Request())->post($url, $params, $timeout);
if (!empty($ret['code']) || !isset($ret['response']['result']) || empty($ret['response']['result'])) {
return $this->error(6);
}
return $this->success($ret['response']['result']);
}
}
##信息流服务
功能点:
1. 并发请求从推荐、运营、广告处获取相关信息列表 @邓伟伟
2. 将获取到的相关信息列表进行信息融合 @王丽敬
3. 取文章的动态计数
4. 判断是否已点赞
```php
调用并发请求示例
$request_data = [
"recommend" => [
"method" => 'Get',
"url" => 'http://sso.dengwei4378.com',
"timeout" => 2
],
"tool" => [
"method" => 'post',
"url" => 'http://lock-screen-push.int.yidian-inc.com/lock-screen/list',
"params" => [
"bizid" => "YDZX",
"uid" => "765073697",
"platform" => "1",
"appid" => "hipu"
],
"timeout" => 2,
'content_type' => 'json',
'headers' => [
'Content-type' => 'application/json',
'User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3100.0 Safari/537.36'
]
],
"advert" => [
"method" => 'Get',
"url" => 'http://gateway.wemedia.yidian-inc.com/wemedia-macross-achievement:prod/achievement/challenge/medal/getChallengeMedal',
"params" => [
'mediaId' => 2396707
],
"timeout" => 2
],
];
$info_flow_service = new InfoFlow();
$ret = $info_flow_service->getInfos($request_data);
var_dump($ret);
exit;
```
```php
调用卡片融合方法示例
$recommend = [
['card_number'=>0,'card_weight'=>-1],
['card_number'=>1,'card_weight'=>3]
];
$tool = [
['card_number'=>1,'card_weight'=>1],
['card_number'=>2,'card_weight'=>2]
];
$flows = new InfoFlow();
$res = $flows->mixSort( $recommend, $tool, $advert=[] );
print_r($res);
exit();
```
\ No newline at end of file
...@@ -100,5 +100,28 @@ class JwUser ...@@ -100,5 +100,28 @@ class JwUser
} }
return $city_list; return $city_list;
} }
/**
* 保存用户与token的对应关系接口
* 支持的token prefix:MMPP 小米推送,UMPP 友盟推送,GTPP 个推
*
*/
public function savePushToken($params)
{
$url = config('interface','service.jw_user.save_push_token');
if(!$url){
throw new CodeSpecialException("failed");
}
if (empty($params)) {
throw new CodeSpecialException("failed");
}
$pushToken = (new TimeOut())->runPost($url, $params);
if(!$pushToken){
throw new CodeSpecialException("timeout");
}
return $pushToken;
}
} }
...@@ -5,8 +5,8 @@ use Api\PhpUtils\Http\Request; ...@@ -5,8 +5,8 @@ use Api\PhpUtils\Http\Request;
class Ksyun class Ksyun
{ {
private const jinshan_ak = 'AKLTTpZx6fNBQsGSKe5chqHdXA'; //AccessKey private const jinshan_ak = 'AKLTnATdoXUnR72IDSGgN2WSOQ'; //AccessKey
private const jinshan_sk = 'OG9Bk93RUHwaH71U9K+OtWkvx44AdMheywjFlifILikvh96jNGgznJm+AyR5l4wPhw=='; //SecretKey private const jinshan_sk = 'OMw7UAOkrLVsRevuP44ctAlfzriDzUm9+JvOFoYuiSoLgaLJWi+kjUa+4G3EWXFakQ=='; //SecretKey
private const bp_bucket = 'bp-yidian'; private const bp_bucket = 'bp-yidian';
private const get_down_from_ksyun = 'http://10.103.34.109:8007/auth/url-get'; private const get_down_from_ksyun = 'http://10.103.34.109:8007/auth/url-get';
...@@ -68,9 +68,10 @@ class Ksyun ...@@ -68,9 +68,10 @@ class Ksyun
/** /**
* 返回bucket * 返回bucket
* @param $appid * @param $appid
* @param $scenario string 区分业务场景
* @return string * @return string
*/ */
public static function getBucket($appid) :string public static function getBucket($appid,$scenario) :string
{ {
if ($appid === 'merchant-b' || $appid === 'merchant-c') { if ($appid === 'merchant-b' || $appid === 'merchant-c') {
return self::bp_bucket; return self::bp_bucket;
...@@ -81,10 +82,11 @@ class Ksyun ...@@ -81,10 +82,11 @@ class Ksyun
/** /**
* 生成objectid 和 bucket * 生成objectid 和 bucket
* @param $appid * @param $appid
* @param $scenario string 区分业务场景
* @return array * @return array
*/ */
public static function getObjectAndBucket($appid):array public static function getObjectAndBucket($appid,$scenario):array
{ {
return ['bucket' => self::getBucket($appid),'objectId' => md5(uniqid(mt_rand(), true))]; return ['bucket' => self::getBucket($appid,$scenario),'objectId' => md5(uniqid(mt_rand(), true))];
} }
} }
\ No newline at end of file
<?php
/**
* Description of
*
* @author zhiyuan
* Date: 2021/6/12
* Time: 10:32 PM
*/
namespace Api\PhpServices\LifeAccount;
use Api\PhpUtils\Common\TimeOut;
use Api\PhpUtils\Http\Request;
use App\Exception\custom\CodeSpecialException;
class Account
{
/**
* 批量获取生活号角色表数据
*
*@param $params['role_id'] 主键id
*
*/
public static function getRoleList($params)
{
$url = config('interface', 'merchant.account.get_role_list');
if (!$url) {
throw new CodeSpecialException("failed");
}
if (!array_key_exists('role_id', $params) || !array_key_exists('page', $params) || !array_key_exists('page_size', $params)) {
throw new CodeSpecialException("failed");
}
$list = (new TimeOut())->runGet($url, $params);
if (!$list) {
throw new CodeSpecialException("timeout");
}
return $list;
}
}
<?php <?php
/** /**
* Description of Sensitive.php
* *
* @author haiming * @author haiming
* Date: 2021/5/21 * Date: 2021/5/21
......
<?php
namespace Api\PhpServices\Subscribe;
abstract class Subscribe
{
/**
* 错误码
*/
const ERROR_CODE = [
1 => '参数有误',
2 => '订阅失败',
3 => '请勿重复订阅',
4 => '取消订阅失败',
5 => '获取订阅列表失败'
];
/**
* 成功响应
* @param null $data
* @return array|int[]
*/
protected function success($data = null)
{
if (is_null($data)) {
return ['code' => 0];
}
return ['code' => 0, 'data'=>$data];
}
/**
* 异常响应
* @param $code
* @return array
*/
protected function error($code)
{
return ["code" => $code, "msg" => self::ERROR_CODE[$code]];
}
/**
* @param int $userid
* @param string $subscribe_id
* @param string $name
* @return array
*/
abstract protected function add($userid, $subscribe_id);
/**
* @param int $userid
* @param array $subscribe_ids 支持批量
* @return array
*/
abstract protected function delete($userid, $subscribe_ids);
/**
* @param int $userid
* @param int $page
* @param int $page_size
* @return array
*/
abstract protected function getList($userid, $page, $page_size = 100);
}
<?php
namespace Api\PhpServices\Subscribe;
use Api\PhpUtils\Http\Request;
class WeMediaSubscribe extends Subscribe
{
/**
* @param int $userid
* @param string $subscribe_id
* @return array
*/
public function add($userid, $subscribe_id)
{
if (empty($userid) || empty($subscribe_id)) {
return $this->error(1);
}
$params = [
"created_channels" => [
[
"channel_id" => $subscribe_id,
"create_status" => 0,
"insert_at" => 0
]
]
];
$url = config('interface', 'service.subscribe.add') . '?userid=' . $userid;
$request = new Request();
$ret = $request->post($url, $params);
if (!isset($ret['response']['code']) || !empty($ret['response']['code']) || !isset($ret['response']['created_channels'])) {
return $this->error(2);
}
if (isset($ret['response']['failed_channels']) && !empty($ret['response']['failed_channels'])) {
return $this->error(2);
}
if (isset($ret['response']['repeat_channels']) && !empty($ret['response']['repeat_channels'])) {
return $this->error(3);
}
return $this->success();
}
/**
* @param int $userid
* @param array $subscribe_ids 支持批量
* @return array
*/
public function delete($userid, $subscribe_ids)
{
if (empty($userid) || !is_array($subscribe_ids) || empty($subscribe_ids)) {
return $this->error(1);
}
$params = [];
foreach ($subscribe_ids as $k => $subscribe_id) {
$params['deleted_channels'][$k]['channel_id'] = $subscribe_id;
}
$url = config('interface', 'service.subscribe.delete') . '?userid=' . $userid;
$request = new Request();
$ret = $request->post($url, $params);
if (!isset($ret['response']['code']) || !empty($ret['response']['code'])) {
return $this->error(4);
}
return $this->success();
}
/**
* @param int $userid
* @param int $page
* @param int $page_size
* @return array
*/
public function getList($userid, $page, $page_size = 100)
{
if (empty($userid) || empty($page)) {
return $this->error(1);
}
$url = config('interface', 'service.subscribe.get_list');
$params = [
'userid' => $userid,
'start' => ($page - 1) * $page_size,
'count' => $page_size
];
$request = new Request();
$ret = $request->get($url, $params);
if (!isset($ret['response']['code']) || !empty($ret['response']['code']) || !isset($ret['response']['channels'])) {
return $this->error(5);
}
$ret = $ret['response'];
//提取所需字段
$list = [
'list' => [],
'has_more' => $ret['hasmore']
];
foreach ($ret['channels'] as $k => $v) {
if (!isset($v['id']) || empty($v['id']) || !isset($v['name']) || empty($v['name'])) {
continue;
}
$list['list'][$k]['subscribe_id'] = $v['fromId'] ?? '';
$list['list'][$k]['name'] = $v['name'];
$list['list'][$k]['wm_id'] = $v['fromId'] ?? '';
$list['list'][$k]['image'] = $v['image'] ?? '';
$list['list'][$k]['summary'] = $v['summary'] ?? '';
$list['list'][$k]['authentication'] = $v['authentication'] ?? '';
}
return $this->success($list);
}
}
## 点赞服务
点赞服务使用说明
1、点赞&取消点赞
2、获取点赞的list
3、获取点赞的count
4、是否赞过
#### Usage:
1、点赞&取消点赞 ThumbsUpNews
```
use Api\PhpServices\ThumbsUp\ThumbsUp;
$thumbsup = new ThumbsUp();
$thumbsup->thumbsUp($appid,$userid,$docid);//点赞&取消点赞
```
2、获取点赞的list
```
use Api\PhpServices\ThumbsUp\ThumbsUp;
$thumbsup = new ThumbsUp();
$thumbsup->getList($appid, $userid, $docid);//获取点赞的列表
```
3、获取点赞的count
```
use Api\PhpServices\ThumbsUp\ThumbsUp;
$thumbsup = new ThumbsUp();
$thumbsup->userThumbsUpNum($appid, $userid);//获取点赞的数量
```
4、是否赞过
```
use Api\PhpServices\ThumbsUp\ThumbsUp;
$thumbsup = new ThumbsUp();
$thumbsup->hasThumbsUp($appid, $userid, $docid);
```
\ No newline at end of file
<?php
/**
* @function 点赞公共服务
* @author zhangxiaojing-inc.yidian.com
* @date 2021-02-08
* TODO:是否需要修改redis 是否需要文章点赞数增加 是否允许未发布状态的文章点赞
*/
namespace Api\PhpServices\ThumbsUp;
use Api\PhpServices\ThumbsUp\models\ThumbsUp as ThumbsUpModel;
use Api\PhpUtils\Common\IP;
/**
* Class ThumbsUp
* @package Api\PhpServices\ThumbsUp
*/
class ThumbsUp
{
protected $model;
/**
* 错误码
*/
const ERROR_CODE = [
1 => '参数有误',
2 => '已点赞',
3 => '点赞失败',
4 => '取消点赞失败',
5 => '查询点赞列表失败',
6 => '获取点赞数失败'
];
public function __construct()
{
$this->model = ThumbsUpModel::getInstance();
}
/**
* 是否已点赞
* @param string $appid
* @param int $userid
* @param string $docid
* @return bool
*/
public function hasThumbsUp($appid, $userid, $docid)
{
$params = [
'userid' => intval($userid),
'appid' => $appid,
'docid' => $docid,
];
$has = $this->model->count($params);
if ($has > 0) {
return true;
}
return false;
}
/**
* 点赞
* @param string $appid
* @param int $userid
* @param string $docid
* @return array
*/
public function thumbsUp($appid, $userid, $docid)
{
if (!$this->hasThumbsUp($appid, $userid, $docid)) {
$insert = [
'id' => md5($userid . '-doc-' . $docid . '-appid-' . $appid),
'userid' => intval($userid),
'docid' => $docid,
'appid' => $appid,
'ip' => IP::ip(),
'createTime' => $_SERVER['REQUEST_TIME'],
];
$res = $this->model->add($insert);
if ($res) {
return $this->success();
}
return $this->error(3);
}
return $this->success();
}
/**
* 批量取消&取消点赞
* @param string $appid
* @param int $userid
* @param array $doc_ids
* @return array
*/
public function del($appid, $userid, array $doc_ids)
{
$res = $this->model->delete([
'appid' => $appid,
'userid' => intval($userid),
'docid' => [
'$in' => $doc_ids
]
]);
if ($res) {
return $this->success();
}
return $this->error(4);
}
/**
* 赞过的列表
* @param string $appid
* @param int $userid
* @param int $start
* @param int $limit
* @param array $order
* @return array
*/
public function getList($appid, $userid, $start = 0, $limit = 20, $order = ["createTime" => -1])
{
//去查询点赞的表。返回对应的docid的list
$params = [
'userid' => intval($userid),
'appid' => $appid,
];
$fields = [
'_id' => 0
];
$sort = $order;
$limit = [
'start' => $start,
'count' => $limit
];
$res = $this->model->getMany($params, $fields, $sort, $limit);
return $this->success($res);
}
/**
* 获取用户赞数
* @param string $appid
* @param int $userid
* @return array
*/
public function userThumbsUpNum($appid, $userid)
{
$params = [
'userid' => intval($userid),
'appid' => $appid
];
return $this->model->count($params);
}
/**
* 用户是否已点赞文章(批量)
* @param array $userid
* @param array $doc_ids
* @return array
*/
public function isThumbsUp($userid, array $doc_ids)
{
$res = [];
if(empty($userid) || !is_array($doc_ids) || empty($doc_ids)){
return $res;
}
$params = [
'userid' => $userid,
'docid' => [
'$in' => $doc_ids
]
];
$fields = [
'_id' => 0,
'docid' => 1
];
$res = $this->model->getMany($params, $fields);
return $res;
}
/**
* 成功响应
* @param null $data
* @return array|int[]
*/
private function success($data = null)
{
if (is_null($data)) {
return ['code' => 0];
}
return ['code' => 0, 'data' => $data];
}
/**
* 异常响应
* @param $code
* @return array
*/
private function error($code)
{
return ["code" => $code, "msg" => self::ERROR_CODE[$code]];
}
}
<?php
namespace Api\PhpServices\ThumbsUp\models;
use Api\PhpUtils\Mongo\Base;
class ThumbsUp extends Base
{
protected static $instance;
protected function getConfigIndex()
{
return "thumbsup";
}
protected function getCollectionName()
{
return "data";
}
protected function getWhere($params)
{
return $params;
}
protected function getQueryOptions($fields = [], $sort = [], $limit = [])
{
$options = [
'maxTimeMS' => 800,
'limit' => 100
];
if (is_array($fields) && !empty($fields)) {
$options['projection'] = $fields;
}
if (is_array($sort) && !empty($sort)) {
$options['sort'] = $sort;
}
if (is_array($limit)) {
if (isset($limit['start'])) {
$options['skip'] = intval($limit['start']);
}
if (isset($limit['count'])) {
$options['limit'] = intval($limit['count']);
}
}
return $options;
}
}
### bp暂未接入
``` ```
/** /**
* 申请 towerpro key * 申请 towerpro key
*/ */
......
## 接入tuffy统一实验平台 ## 接入tuffy统一实验平台,bp暂未接入
#### 数据组wiki地址 #### 数据组wiki地址
<url>http://ydwiki.yidian-inc.com/pages/viewpage.action?pageId=34241933</url> <url>http://ydwiki.yidian-inc.com/pages/viewpage.action?pageId=34241933</url>
......
<?php
namespace Api\PhpServices\UserInfo;
use Api\PhpUtils\Common\TimeOut;
use Api\PhpUtils\Http\Request;
use App\Exception\custom\CodeSpecialException;
class User
{
/**
* 获取用户信息
*/
public function info($userid){
$url = config("interface", "service.userinfo.get");
if(!$url){
throw new CodeSpecialException("failed");
}
$params = ["userid"=>$userid];
$res = (new TimeOut())->runGet($url, $params);
if(!$res){
throw new CodeSpecialException("timeout");
}
return $res;
}
/**
* 修改用户昵称
*/
public function modifyNickname($userid, $nickname, $appid, $partner, $key){
$url = config("interface", "service.userinfo.modify_nickname");
if(!$url){
throw new CodeSpecialException("failed");
}
$params = [
"userid" => $userid,
"nickname" => $nickname,
"appid" => $appid,
"partner" => $partner,
"key" => $key,
];
$res = (new TimeOut())->runGet($url, $params);
if(!$res){
throw new CodeSpecialException("timeout");
}
return $res;
}
/**
* 修改用户头像
*/
public function modifyProfile($userid, $profile, $appid, $partner, $key){
$url = config("interface", "service.userinfo.modify_profile");
if(!$url){
throw new CodeSpecialException("failed");
}
$params = [
"userid" => $userid,
"profile" => $profile,
"appid" => $appid,
"partner" => $partner,
"key" => $key,
];
$res = (new TimeOut())->runGet($url, $params);
if(!$res){
throw new CodeSpecialException("timeout");
}
return $res;
}
}
\ No newline at end of file
<?php
namespace Api\PhpServices\WeMedia;
use Api\PhpUtils\Http\Request;
class WeMediaService
{
/**
* 错误码
*/
const ERROR_CODE = [
1 => '参数有误',
2 => '获取一点号作者信息失败',
3 => '获取一点号作者文章流失败',
4 => '获取一点号作者视频流失败'
];
/**
* 成功响应
* @param null $data
* @return array|int[]
*/
private function success($data = null)
{
if (is_null($data)) {
return ['code' => 0];
}
return ['code' => 0, 'data'=>$data];
}
/**
* 异常响应
* @param $code
* @return array
*/
private function error($code)
{
return ["code" => $code, "msg" => self::ERROR_CODE[$code]];
}
/**
* 获取一点号作者信息
* @param int $wm_id 比如m230600
* @return array
*/
public function getInfo($userid, $wm_id)
{
if (empty($wm_id)) {
return $this->error(1);
}
$params = [
'userid' => intval($userid),
'wm_id' => $wm_id
];
$request = new Request();
$ret = $request->get(config('interface', 'service.wemedia.get_profile_info'), $params);
if (!empty($ret['response']['code']) || !isset($ret['response']['result']) || empty($ret['response']['result'])) {
return $this->error(2);
}
$ret = $ret['response']['result'];
if(!isset($ret['profile_info']) || empty($ret['profile_info']) || !isset($ret['profile_navigation']['columns']) || empty($ret['profile_navigation']['columns'])){
return $this->error(2);
}
//填充数据
$profile_info = $ret['profile_info'];
$profile_navigation = $ret['profile_navigation']['columns'];
$result = [
'wm_id' => 'm' . ltrim($profile_info['id'], 'm'),
'uid' => $profile_info['uid'],
'media_name' => $profile_info['media_name'],
'media_pic' => $profile_info['media_pic'],
'authentication' => $profile_info['authentication'],
//发文数
'postcount' => $profile_info['postcount'],
//阅读量
'account_click' => $profile_info['account_click'],
//粉丝数
'follower_count' => $profile_info['follower_count'],
//订阅数
'following_count' => $profile_info['following_count'],
//该wm_id是否已被userid订阅
'is_subscribed' => $profile_info['is_subscribed'],
'subscribe_id' => $profile_info['subscribe_id'],
'navigation' => $profile_navigation
];
return $this->success($result);
}
/**
* 获取订阅关系
* @param int $userid
* @param array $wm_ids ['m10001','m10002']
* @return array
*/
public function getSubscribedStatus($userid, $wm_ids){
if (empty($userid) || !is_array($wm_ids) || empty($wm_ids)) {
return $this->error(1);
}
$url = config('interface', 'service.subscribe.get_list');
$params = [
'userid' => $userid,
'start' => 0,
'count' => 10000
];
$request = new Request();
$ret = $request->get($url, $params);
if (!isset($ret['response']) || empty($ret['response'])) {
return $this->error(2);
}
$ret = $ret['response'];
if (!isset($ret['code']) || !empty($ret['code']) || !isset($ret['channels'])) {
return $this->error(2);
}
$result = [];
//设置默认值false
foreach ($wm_ids as $k => $wm_id) {
$result[$wm_id]['is_subscribed'] = false;
$result[$wm_id]['subscribe_id'] = '';
}
//匹配是否订阅
foreach ($ret['channels'] as $k => $v) {
if(isset($v['fromId']) && in_array($v['fromId'], $wm_ids)){
$result[$v['fromId']]['is_subscribed'] = true;
$result[$v['fromId']]['subscribe_id'] = $v['fromId'];
}
}
return $this->success($result);
}
public function getDocFlow($wm_id, $page)
{
if (empty($wm_id)) {
return $this->error(1);
}
$params = [
'wm_id' => $wm_id,
'cstart' => ($page - 1) * 30,
];
$request = new Request();
$ret = $request->get(config('interface', 'service.wemedia.get_news_list'), $params);
if (!empty($ret['response']['code']) || !isset($ret['response']['result']) || empty($ret['response']['result'])) {
return $this->error(3);
}
return $this->success($ret['response']['result']);
}
public function getVideoFlow($wm_id, $page)
{
if (empty($wm_id)) {
return $this->error(1);
}
$params = [
'wm_id' => $wm_id,
'cstart' => ($page - 1) * 30,
];
$request = new Request();
$ret = $request->get(config('interface', 'service.wemedia.get_video_list'), $params);
if (!empty($ret['response']['code']) || !isset($ret['response']['result']) || empty($ret['response']['result'])) {
return $this->error(4);
}
return $this->success($ret['response']['result']);
}
}
...@@ -6,15 +6,8 @@ use Api\PhpUtils\Mongo\MongoBase; ...@@ -6,15 +6,8 @@ use Api\PhpUtils\Mongo\MongoBase;
class XhMongo extends MongoBase class XhMongo extends MongoBase
{ {
private $domian ;
public function __construct($domain)
{
$this->domian = $domain;
}
protected function getConfigIndex() protected function getConfigIndex()
{ {
//需要在yaconf 配置 mongo
return 'xhprof'; return 'xhprof';
} }
...@@ -25,7 +18,6 @@ class XhMongo extends MongoBase ...@@ -25,7 +18,6 @@ class XhMongo extends MongoBase
protected function getCollectionName() protected function getCollectionName()
{ {
// 根据 domain 来生成对应的collection return 'xhprof';
return $this->domian.'_'.'xhprof';
} }
} }
\ No newline at end of file
...@@ -37,15 +37,40 @@ class XhProfilerService ...@@ -37,15 +37,40 @@ class XhProfilerService
*/ */
public function end($domain): void public function end($domain): void
{ {
//根据域名选择开不开启 分析
if ($this->judgeSwitch($domain) === false)
{
return ;
}
// 结束分析器,生产性能检测数据 // 结束分析器,生产性能检测数据
$profiler_data = $this->profiler->disable(); $profiler_data = $this->profiler->disable();
//将数据存储到 指定mongodb中 $profiler_data = $this->dealProfile($profiler_data,$domain);
$mongo = new XhMongo('test'); $mongo = XhMongo::getInstance();
$mongo->insertOne($profiler_data); $mongo->insertOne($profiler_data);
// $this->profiler->save($profiler_data); }
private function dealProfile(array $profile,$domain)
{
$profile['profile'] = $this->encodeProfile($profile['profile']);
$profile['env'] = $domain;
return $profile;
}
private function encodeProfile(array $profile)
{
$results = array();
foreach ($profile as $k => $v) {
if (strpos($k, '.') !== false) {
$k = str_replace('.', '_', $k);
}
$results[$k] = $v;
}
return $results;
} }
......
配合yaf框架使用的基础库 生活圈商户系统工具类库,配合yaf框架使用的基础库
\ No newline at end of file \ No newline at end of file
{ {
"name": "api/php_utils", "name": "api/php_utils",
"description": "api php_utils", "description": "bp api php_utils",
"type": "library", "type": "library",
"require": { "require": {
"php": ">=7.2", "php": ">=7.2",
......
...@@ -30,57 +30,6 @@ EGyaCHE1zu4LsWiovTLpYhV1Ya9Ks/6ynUecn1P8D3OAKaCuD3DLlawLCRmWlc2E ...@@ -30,57 +30,6 @@ EGyaCHE1zu4LsWiovTLpYhV1Ya9Ks/6ynUecn1P8D3OAKaCuD3DLlawLCRmWlc2E
pnwYuJIrEf/OnB7A2QIDAQAB pnwYuJIrEf/OnB7A2QIDAQAB
-----END PUBLIC KEY-----'; -----END PUBLIC KEY-----';
/**
* VPN项目 SERVER端私钥与客户端公钥
*/
const HUBBLE_PRIVATE_KEY_STR = '-----BEGIN PRIVATE KEY-----
MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAL38wjPQ0SqaBWWH
1r6Ot+Cb5wqcHcZDtZ6P3W3BjZM49WOm2RgT71FAZSqpAEFF2ZHFb6/E6Q4GzVYY
sCc36I3HACIBC7HutettRylzYeD6sIc6Cc0Qep1e0qmDIQ7CpqUZafvgVl0DMAzg
HH+6J70H83abZtNahcrFQNkFoEkTAgMBAAECgYAzY64oE+CwFE9HYlHs42/LWoBJ
N2c6XNBAnot3h7ZCz1JY7SWlxKakJLX4rxP5k+pA6tXGBo4/lAlws2bahN3rHDrs
n9Yp/LNHo/w91ewF+lofeDnqE5EELllaEB/q7pHb2QI/OS7NmaR3Ya4oaIMQ6HmS
/fpPhzRO85KhVu+BKQJBAORMBTkTcfMSEc026oi5NHCKUX4pdxxocR+CiMK3LpM4
m33QsuqSx3wHr1cwmextweKxk/DV9QOmHKLSBdT97jcCQQDVCqkyY+0qFEjkJ9hp
CUmRf5bgCBpCwo/X5Ds+kpW0aGnygTyqEAZWKFYNWrfxZ2oTTMgk6GO9ey5q9oBy
qW4FAkEA2hnOO5LaH8+5dgXq1iepc4KRDChtBJS6zdGU+gCq3DcORYpmAzeqoFFv
L6rcwkSxH/NqVIDzDENbxClFLRBSzQJBAIdTtFKcAyT9qae0X9Wo3qCb6Zz5yKSr
rm+3PKLsvkfRI6u1yHFGqJ/GE5N8Eug3hrwnw+Md822Dd+LeHo23bnkCQFUZLyaO
AJs9kaIOS8OCId89fQNTHOXaITxPAF29WZtMZ0UoN9kr4TnqzljHyi4k6RUk+n5N
aavtRtfecEWBSKM=
-----END PRIVATE KEY-----';
const HUBBLE_PUBLIC_KEY_STR = '-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCzGJjG6q4T6ddlsL9mflAkJTsZ
KkXgfdyBSiLFLxU+vncB5qEm8LkHi7M8NRcJ7MEaxWO5OyZ1K8YUIS/LI5/PHBP8
e9l6pxBysN4O29xK8YgMr++okxbzEj2BTJqP8RZMAllOS/FtoObcSvIVgJW+zvxG
HrOB+O1JK1HozVV7UwIDAQAB
-----END PUBLIC KEY-----';
/**
* 地铁项目 SERVER端私钥与客户端公钥
*/
const METRO_PRIVATE_KEY_STR = '-----BEGIN PRIVATE KEY-----
MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAL8A0U/w8iLhDb/h
thD1PXHPKvovy5p8eym+jMMcE3GSml2MKNYWYfQlAmH7UQCigtpT8lqH47u3/co3
c1PDgXgtOO2FHoKT2T6eoxVbigSupbdvgh/aQUrMULVdkjvWjBnVRSl9+uP4oYhY
wJyFI2+xWtWrG4TEt/zBIl9uMdIjAgMBAAECgYEAoP8Gb3SwFLhQh6GwfoDIpwqx
tirdWr18b0ZfjgI3XW7uUNXYggRh0pHzfTWCJJ/W3kMOMEMEsXE4KeAthLhxgq7g
bJaWYW8n2N8uT/7jmmb1ETOXcExIyKOBSkrH4Tc5sotTR/b0fNt1/wDGaMC6Akwa
rASUqP++tVi1HxOsqdECQQDj60eT1cTvE9YILJ2y254OtSHZ8IcBFULAJGJbGzB+
E5x/z/evwWj6tNhIZQ+5uB0UGEr1BJYitglFpNid52aJAkEA1okvz6KUfmX4jN1J
VYkcyOsOD+jg+0ZlXtpZouIO5RoH7N5TV6tZZNZ5Q9xS4nBH/ym6xGWfnNBiAv5K
Of6ISwJBAKva1HXcUkoTIue2/JHIlz1vxr6WZrWiWlqXFLKtpbrq/q5BGfokVAv2
IL81tM3MzeBBEQP/GVXC/OrOiadGvEECQBf3IUEnn0DzcS2DNsL4Wx/SqjJ6yE8p
kP9kkujQKevL2aDLQTIk8QqDru42uYeUFWbaqYNw+sCQwrIk5/PMjDsCQDhIYzQJ
3yJRBu1qR0MtYe31nGNheNgxFdWPBHb2esVBRjpJHCBgq3yD7F8/fqS2VS4kuZVg
vijw5aJoY41NBh0=
-----END PRIVATE KEY-----';
const METRO_PUBLIC_KEY_STR = '-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDA9oxWHFsNGFhCrlnNDZkrkhXg
hjo2KfqV5PTG1ytUdqI4UL+gvt0cV0rc3PC1iMk0PBWIM7w0SqqmLp95JH0g6TnU
AIgT6PrMFgXpFVW0MVgn6vtsfi0AAcArkKimbl9o5pQEz36m4OjqTlyhMQKUDVmu
iRaFoFfqBezeUC0gywIDAQAB
-----END PUBLIC KEY-----';
/** /**
* 商户系统C端 SERVER端私钥与客户端公钥 * 商户系统C端 SERVER端私钥与客户端公钥
*/ */
...@@ -105,6 +54,31 @@ MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDatQ6W6EjzO2HsfSmNeFQt7iAT ...@@ -105,6 +54,31 @@ MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDatQ6W6EjzO2HsfSmNeFQt7iAT
FHYZ0W5URuWPyPAvKnsMJz/vPpYVi1C1cvE/Sguz24qA6819Jr+HyhMADiyCohia FHYZ0W5URuWPyPAvKnsMJz/vPpYVi1C1cvE/Sguz24qA6819Jr+HyhMADiyCohia
l/zmTGPztP0rXGEHbU5MuQAHrFcDcOwgWcjtHggOV/XxNbmAJf/AwToSfQKkmsJ2 l/zmTGPztP0rXGEHbU5MuQAHrFcDcOwgWcjtHggOV/XxNbmAJf/AwToSfQKkmsJ2
PE1lYJXINxgETj88uwIDAQAB PE1lYJXINxgETj88uwIDAQAB
-----END PUBLIC KEY-----';
/**
* 商户系统C端-测试 SERVER端私钥与客户端公钥
*/
const TEST_MERCHANT_C_PRIVATE_KEY_STR = '-----BEGIN PRIVATE KEY-----
MIICeAIBADANBgkqhkiG9w0BAQEFAASCAmIwggJeAgEAAoGBAMX9eY3yNnhcRt0I
f//WJvVztaqT7GTkwDDxSeUgtbyXGjOKz9Mgahkk5lWyAlLqKXUpd+5Fksue5YWU
LL6OogoiTBNNNsPWoc9l0Wj0KKVdK3ZjnICZEz1LmjiLa++rAB/7fMYUbs6cRtK8
Nl8n9a6cjReYaW9r7tb/pSdC+T0HAgMBAAECgYEAmxEwn/UhplkXg0yB+909fCaZ
FTVwA4GJ6YtBxfw9eqyZ7957cS9FCdZ1tI6L9WbC+6lz7iF9nI8h0uI/vSu3Snm/
MFYGkcsolDBFYsTPru5GouHh4bW6X5Ge6fmz7JgGaqzOtsbD5oh7zN9SsUUb0jqM
9zR5qbw5i8Krut66zGECQQDo8CmWy5jtSJ7wUGBVECHX4dPO2lwyAC13u4Pat8dg
8YA6VzdzzHdhlWLaGuPICKPjBwxVxP6qKT8bPiAYeIgXAkEA2ZeNYQ8lN5v+hosR
dU3FVwva3d7OmIT7unEMk2Nav1YqUHLektsAYZQW1kOtfUvmtWXlba34a7E8FRow
Wt4YkQJBAJYF/7MoQ8EnUX5TNgfzEOj6gDEsf86QQLhpo91dGeM9ByoL/CHvoT/P
N9BjGys9LVhNtMsUyjQLxqIkHAXGs1cCQQDF4+olkpOjfpC+Ji5Lg95sqxBzZlZ4
KcGSr4vjY6G9kAzNu5qm7tvq4rbeSRC4elYpNbGxzV23+6mL+5Rsn76xAkBmABwk
XXLMgdt6NG4x3cM4WeMPbJPWHOXRLRRMukDGW+HklFkpHFbuGSXv+FkjCWhnE9QX
98wubX4hRtsNX8UH
-----END PRIVATE KEY-----';
const TEST_MERCHANT_C_PUBLIC_KEY_STR = '-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDKTlW0/1dpGK2FeUHvOf1Vus7g
yy4Yx6r0JTtZUfC0u7/Tr/2DaD4xt+OLOW/mY158azfHJO1yBIhSyxi9sKILmiV5
fpbAOKUeRJelNa6tXC+1E8dooh+s1NmZaGXn2F6HK0OtU5Qc/Ebqunm+re8Ek2lN
2ezqViipdMY2tosl2QIDAQAB
-----END PUBLIC KEY-----'; -----END PUBLIC KEY-----';
/** /**
* 商户系统B端 SERVER端私钥与客户端公钥 * 商户系统B端 SERVER端私钥与客户端公钥
...@@ -130,6 +104,31 @@ MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQD2RdTxS2mxmFQUDSeBvUr4wTTX ...@@ -130,6 +104,31 @@ MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQD2RdTxS2mxmFQUDSeBvUr4wTTX
ugBJw71/jXXo1l5mB4SOhP0fW7UwZSb3myfCMFJZQnCFdxY8LCFvEZYz4f/o8wVA ugBJw71/jXXo1l5mB4SOhP0fW7UwZSb3myfCMFJZQnCFdxY8LCFvEZYz4f/o8wVA
mDIZoqwIClqMBt2uJvAa4eVwn1Zr1GOnaYs+X8wakZUyIYvQgn98tr2EwN11u4ek mDIZoqwIClqMBt2uJvAa4eVwn1Zr1GOnaYs+X8wakZUyIYvQgn98tr2EwN11u4ek
GeBFb3ObYV22i+jziwIDAQAB GeBFb3ObYV22i+jziwIDAQAB
-----END PUBLIC KEY-----';
/**
* 商户系统B端-测试 SERVER端私钥与客户端公钥
*/
const TEST_MERCHANT_B_PRIVATE_KEY_STR = '-----BEGIN PRIVATE KEY-----
MIICeQIBADANBgkqhkiG9w0BAQEFAASCAmMwggJfAgEAAoGBAKQGB1lqs3dCTGGj
qONSu5gMBucejojaF23073kIBdwfzZYSxZWw0P+YaXU6JkE8JCaaakNhTNuJmntG
3RBBJe1xaeWZo4Jca2SGy0cR0uMM5mAMtBL2AZ/1RU+D2CKbBl9H0uxB4FF+td2g
Q/C/spKDX4CDQGe1wZxr3Cyh11/JAgMBAAECgYEAoO7BWzxT5dmI8+wOEyzjnuV+
CFp041WI03wVUp1KkpYpsuusLZkVFxNFtZ1eV3dYyP+M75uSO30hs37t+7rQKDyD
9H+WzJCqe5KR5J7xvs5DWuXLCzgNYq8KdXYk+Zy8RuwB9eaWcy1F/i2dYxoz3JUw
Xsmu36Mp994bJJsLKAECQQDRA8quM9YzMXoBd/QTTw5pzKFlrNl+7eF2SMNOdCZB
IVjfOh3/d39A1I46HsvMfd1L9DMvcgz8J3/RK0/iNVWBAkEAyOUeJXH/NhbfXHr4
633DpS+jBKywCYkdhqJEh0Q3dRg/qk6q+9I2f2wS1JPmGq4FMeOxrXjpjAK97Djb
k8z+SQJBAM10obXNZJ/b4acx521Xh75+FKSiXQVFBhxEeB9VUwkwo3CCa1xkdWUf
y1LcVM6FZpOzzuCzhooStbTBk3uzm4ECQQCJWMuhgiyfyEdxLMneBp+p4cWsPnwk
KNA86de8OxFHRwrP3vTbMb78ouDE4VDiULNQhoFFPnM9u+opBD5q8C2xAkEAv2W3
fw+LtVaDnpfWWCN5y6W4gzRtfdSdSvsZpS+EY/RG0cpmN+WR+86ft3WdIIr2Bnm4
RcPnfPSsz3dgAaCR2A==
-----END PRIVATE KEY-----';
const TEST_MERCHANT_B_PUBLIC_KEY_STR = '-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC+2roRCWyvIl04NtZnNxyYPLAP
nM+7fL+6wGhhc3ilqk4zgr+hxdftUJ30NDkTqjbWe4wvd4ax1xVAS4la5PAK6g5W
BEFar4gu3JgkmyfT3NtwXCd7kZuH98k/7oSVQbxYc9ydwoqwDdXoIVOKtK5YWkoL
+WjPxg37zWCi3Wq5dQIDAQAB
-----END PUBLIC KEY-----'; -----END PUBLIC KEY-----';
/** /**
* TEST SERVER端私钥与客户端公钥 * TEST SERVER端私钥与客户端公钥
...@@ -162,22 +161,22 @@ mnRjVUtXBgEF0A9xt2QVNMQovtjJ2rkg43gVByDKbOsUqbJYjA12IpALMdECHCMl ...@@ -162,22 +161,22 @@ mnRjVUtXBgEF0A9xt2QVNMQovtjJ2rkg43gVByDKbOsUqbJYjA12IpALMdECHCMl
'pub_key' => self::PUBLIC_KEY_STR, 'pub_key' => self::PUBLIC_KEY_STR,
'pri_key' => self::PRIVATE_KEY_STR, 'pri_key' => self::PRIVATE_KEY_STR,
], ],
'hubble' => [
'pub_key' => self::HUBBLE_PUBLIC_KEY_STR,
'pri_key' => self::HUBBLE_PRIVATE_KEY_STR,
],
'metro' => [
'pub_key' => self::METRO_PUBLIC_KEY_STR,
'pri_key' => self::METRO_PRIVATE_KEY_STR,
],
'merchant-c' => [ 'merchant-c' => [
'pub_key' => self::MERCHANT_C_PUBLIC_KEY_STR, 'pub_key' => self::MERCHANT_C_PUBLIC_KEY_STR,
'pri_key' => self::MERCHANT_C_PRIVATE_KEY_STR, 'pri_key' => self::MERCHANT_C_PRIVATE_KEY_STR,
], ],
'test-merchant-c' => [
'pub_key' => self::TEST_MERCHANT_C_PUBLIC_KEY_STR,
'pri_key' => self::TEST_MERCHANT_C_PRIVATE_KEY_STR,
],
'merchant-b' => [ 'merchant-b' => [
'pub_key' => self::MERCHANT_B_PUBLIC_KEY_STR, 'pub_key' => self::MERCHANT_B_PUBLIC_KEY_STR,
'pri_key' => self::MERCHANT_B_PRIVATE_KEY_STR, 'pri_key' => self::MERCHANT_B_PRIVATE_KEY_STR,
], ],
'test-merchant-b' => [
'pub_key' => self::TEST_MERCHANT_B_PUBLIC_KEY_STR,
'pri_key' => self::TEST_MERCHANT_B_PRIVATE_KEY_STR,
],
'test' => [ 'test' => [
'pub_key' => self::TEST_PUBLIC_KEY_STR, 'pub_key' => self::TEST_PUBLIC_KEY_STR,
'pri_key' => self::TEST_PRIVATE_KEY_STR, 'pri_key' => self::TEST_PRIVATE_KEY_STR,
......
...@@ -18,21 +18,21 @@ final class ElasticUtil ...@@ -18,21 +18,21 @@ final class ElasticUtil
/** /**
* ElasticUtil constructor. * ElasticUtil constructor.
* @param $hosts
*/ */
public function __construct() public function __construct($hosts)
{ {
$hosts = ['http://localhost:9200']; //todo 读取yaconf
$this->client = ClientBuilder::create()->setHosts($hosts)->build(); $this->client = ClientBuilder::create()->setHosts($hosts)->build();
} }
/** /**
* @param $hosts
* @return ElasticUtil * @return ElasticUtil
*/ */
public static function getInstance(): ElasticUtil public static function getInstance($hosts): ElasticUtil
{ {
if (empty(self::$instance)) { if (empty(self::$instance)) {
self::$instance = new self(); self::$instance = new self($hosts);
} }
return self::$instance; return self::$instance;
} }
......
...@@ -175,6 +175,236 @@ class Request ...@@ -175,6 +175,236 @@ class Request
} }
} }
/**
* 上传文件
*
*/
public function uploadPut($url, $post = [], $timeout = 0,$content_type = '', $headers = [])
{
$ch = self::CURL($url, $timeout, $headers, $post, false, $has_curl_file=false, "PUT");
if (is_resource($ch) === true)
{
}
$response = curl_exec($ch);
if ($error = curl_error($ch))
{
$this->result['code'] = $this->fail_code;
$this->result['msg'] = $error;
}
else
{
$this->result['code'] = $this->success_code;
$this->result['response'] = $response;
}
curl_close($ch); // 关闭 cURL 释放资源
return $response;
}
static function CURL($url, $timeout, $headers = false, $post = false, $proxy = false, $has_curl_file = null, $method='GET', $curl_opts = array())
{
$ch = curl_init($url);
if (is_resource($ch) === true)
{
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TCP_NODELAY, true);
curl_setopt($ch, CURLOPT_NOSIGNAL, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_BUFFERSIZE, 10240);
curl_setopt($ch, CURLOPT_TIMEOUT_MS, $timeout);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT_MS, $timeout);
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
if ($headers !== false)
{
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
}
if ($proxy !== false)
{
curl_setopt($ch, CURLOPT_PROXY, $proxy);
}
if (!empty($curl_opts))
{
foreach ($curl_opts as $opt => $val)
{
curl_setopt($ch, $opt, $val);
}
}
switch ($method) {
case 'HEAD':
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'HEAD');
break;
case 'GET':
break;
case 'POST':
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
if($has_curl_file !== null)
{
curl_setopt($ch, CURLOPT_SAFE_UPLOAD, $has_curl_file);
}
break;
case 'DELETE':
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
break;
case 'PUT':
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
break;
default:
die('httpUtil bad method');
break;
}
}
return $ch;
}
public function put($url, $params = [], $timeout = 0,$content_type = '', $headers = [], $retry = 0, $use_mon = true, $proxy = '')
{
try {
//验参
if (empty($url) || !is_array($params)) {
throw new \Exception('params error');
}
$this->log['url'] = $url;
$this->log['params'] = $params;
//构造client
$config = [];
if (!empty($retry) && is_int($retry)) {
$config['retry'] = $retry;
}
$client = (new Base())->initClient($config, $url, $params);
//构造配置
if (!empty($params)) {
if ($content_type == 'json') {
$options['json'] = $params;
} elseif ($content_type == 'multipart') {
$options['multipart'] = $params;
} else {
$options['form_params'] = $params;
}
}
if (!empty($timeout)) {
$options['timeout'] = $timeout / 1000;
}
if (!empty($headers)) {
$options['headers'] = $headers;
}
if (!empty($proxy)) {
$options['proxy'] = $proxy;
}
$options['on_stats'] = function (TransferStats $stats) use ($use_mon, $url) {
$this->result['http_code'] = $stats->getHandlerStat('http_code');
if (!empty($use_mon)) {
//MonUtil::proxyMon($url, $stats->getHandlerStat('http_code'), round($stats->getHandlerStat('total_time'),4) * 1000);
}
};
//put请求
//@method ResponseInterface put(string|UriInterface $uri, array $options = [])
$promise = $client->put($url, $options);
$promise->then(
function (Response $resp) {
//$ret = $this->log['response'] = $resp->getBody()->getContents();
$ret = empty(json_decode($ret, true)) ? $ret : json_decode($ret, true);
$this->result['code'] = $this->success_code;
$this->result['response'] = $ret;
},
function (RequestException $e) {
$this->log['response'] = $e->getMessage();
throw new \Exception($e->getMessage());
}
);
$promise->wait();
} catch (\Exception $e) {
$this->result['code'] = $this->fail_code;
$this->result['msg'] = $e->getMessage();
} finally {
$this->addLog('put');
return $this->result;
}
}
public function head($url, $params = [], $timeout = 0, $content_type = '',$headers = [], $retry = 0, $use_mon = true, $proxy = '')
{
try {
//验参
if (empty($url) || !is_array($params)) {
throw new \Exception('params error');
}
$this->log['url'] = $url;
$this->log['params'] = $params;
//构造client
$config = [];
if (!empty($retry) && is_int($retry)) {
$config['retry'] = $retry;
}
$this->client = (new Base())->initClient($config, $url, $params);
//构造配置
if (!empty($params)) {
if ($content_type == 'json') {
$options['json'] = $params;
} elseif ($content_type == 'multipart') {
$options['multipart'] = $params;
} else {
$options['form_params'] = $params;
}
}
if (!empty($timeout)) {
$options['timeout'] = $timeout / 1000;
}
if (!empty($headers)) {
$options['headers'] = $headers;
}
if (!empty($proxy)) {
$options['proxy'] = $proxy;
}
$options['on_stats'] = function (TransferStats $stats) use ($use_mon, $url) {
$this->result['http_code'] = $stats->getHandlerStat('http_code');
if (!empty($use_mon)) {
//MonUtil::proxyMon($url, $stats->getHandlerStat('http_code'), round($stats->getHandlerStat('total_time'),4) * 1000);
}
};
//异步head请求
// @method ResponseInterface head(string|UriInterface $uri, array $options = [])
$promise = $this->client->head($url, $options);
$promise->then(
function (Response $resp) {
$ret = $this->log['response'] = $resp->getBody()->getContents();
$ret = empty(json_decode($ret, true)) ? $ret : json_decode($ret, true);
$this->result['code'] = $this->success_code;
$this->result['response'] = $ret;
},
function (RequestException $e) {
$this->log['response'] = $e->getMessage();
throw new \Exception($e->getMessage());
}
);
$promise->wait();
} catch (\Exception $e) {
$this->result['code'] = $this->fail_code;
$this->result['msg'] = $e->getMessage();
} finally {
$this->addLog('head');
return $this->result;
}
}
/** /**
* 并发执行get请求 * 并发执行get请求
* @param array $urls [0=>xxx,1=>xxx] * @param array $urls [0=>xxx,1=>xxx]
......
<?php
namespace Api\PhpUtils\Kafka;
class KafkaProducer extends Singleton
{
private $log_level = LOG_WARNING;
private $delivery_callback = false;
private $context = false;
private $conf = array(
'socket.timeout.ms' => 50,
'socket.blocking.max.ms' => 50,
'queue.buffering.max.ms' => 1,
'topic.metadata.refresh.sparse' => true,
'topic.metadata.refresh.interval.ms' => 600,
'socket.nagle.disable' => true,
'internal.termination.signal' => SIGIO,
'request.required.acks' => 1,
);
private $produce;
/**
* KafkaProducer constructor.
*
* @param bool $delivery_callback $delivery_callback [发送后的回调函数]
* @param bool $context 上下文参数
*/
protected function __construct($delivery_callback = false, $context = false, $conf = false)
{
if (is_callable($delivery_callback))
{
$this->delivery_callback = $delivery_callback;
}
$this->context = $context;
$this->log_level = LOG_WARNING;
if ($conf != false)
{
$this->conf = $conf;
}
pcntl_sigprocmask(SIG_BLOCK, array(SIGIO));
$this->ensure_connect();
}
/**
* 连接kafka
*
* @return bool
*/
private function ensure_connect()
{
$conf = new \RdKafka\Conf();
if (!empty($this->conf))
{
foreach ($this->conf as $key => $value)
{
$conf->set($key, $value);
}
}
//Set delivery report callback
$context = $this->context;
if ($this->delivery_callback != false)
{
$conf->setDrMsgCb($this->delivery_callback);
}
else
{
$conf->setDrMsgCb(
function ($kafka, $message) use ($context) {
if ($message->err)
{
$msg = $message->errstr() . ' topic : ' . $message->topic_name . (empty($context) ? (' payload : ' . $message->payload) : (' context: ' . json_encode($context)));
//LogUtil::ERROR('kafka produce callback error', $msg);
}
else
{
$msg = ' topic : ' . $message->topic_name . (empty($context) ? (' payload : ' . $message->payload) : (' context: ' . json_encode($context)));
//LogUtil::INFO('kafka produce callback success', $msg);
}
});
}
//Set error callback
$conf->setErrorCb(
function ($kafka, $err, $reason) {
//LogUtil::WARNING('kafka error callback', rd_kafka_err2str($err).' reason: '.$reason);
if ($err == RD_KAFKA_RESP_ERR__ALL_BROKERS_DOWN)
{
return false;
}
});
$this->produce = new \RdKafka\Producer($conf);
//$this->produce->setLogLevel($this->log_level);
}
/**
* 单条发送
* 因为rdkafka使用异步发送发送消息,因此本函数无法捕获发送是否成功,如需捕获需使用callback方式,但不适合fpm
* @param string $broker_list kafka集群地址
* @param [str] $topic
* @param [str] $message
* @param [str] $key
* @return bool
*/
public function produce($broker_list, $topic, $message, $key = NULL)
{
$this->produce->addBrokers($broker_list);
$topic = $this->produce->newTopic($topic);
/**
* Producing messages
* The first argument is the partition. RD_KAFKA_PARTITION_UA stands for unassigned, and lets librdkafka choose the partition.
* 第一个参数是分区,RD_KAFKA_PARTITION_UA 表示未分配,并且由 librdkafka 选择分区。
* The second argument are message flags and should be either 0 or RD_KAFKA_MSG_F_BLOCK to block produce on full queue.
* 第二个参数是消息标志,为 0 或 RD_KAFKA_MSG_F_BLOCK,当队列满了时阻止生产消息。
* The message payload can be anything.
* 消息可以是任何内容。
*/
$topic->produce(RD_KAFKA_PARTITION_UA, 0, $message, $key);
$outQlen = $this->produce->getOutQLen();
while ($outQlen > 0)
{
$outQlen = $this->produce->getOutQLen();
$this->produce->poll(5);
}
return true;
}
}
\ No newline at end of file
<?php
/**
* Description of Singleton.php
*
* @author caoyunmeng
* Date: 2021/3/6
* Time: 5:38 PM
*/
namespace Api\PhpUtils\Kafka;
class Singleton
{
/**
* The actual singleton's instance almost always resides inside a static
* field. In this case, the static field is an array, where each subclass of
* the Singleton stores its own instance.
*/
private static $instances = null;
/**
* Singleton's constructor should not be public. However, it can't be
* private either if we want to allow subclassing.
*/
protected function __construct() { }
/**
* Cloning and unserialization are not permitted for singletons.
*/
protected function __clone() { }
/**
* 防止反序列化
*/
public function __wakeup() { }
/**
* The method you use to get the Singleton's instance.
*/
public static function getInstance($delivery_callback = false, $context = false, $conf = false)
{
if(self::$instances === null){
self::$instances = new static($delivery_callback, $context, $conf);
}
return self::$instances;
}
}
Lock工具库
\ No newline at end of file
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
namespace Api\PhpUtils\Log; namespace Api\PhpUtils\Log;
class DaemoLog class DaemonLog
{ {
public static function info($task_name, $msg) public static function info($task_name, $msg)
......
<?php
namespace Api\PhpUtils\Mongo;
use MongoDB\Client;
abstract class Base
{
protected $collection = null;
/**
* 根据配置,构建collection连接实例
* https://docs.mongodb.com/php-library/v1.4/
*/
public function __construct()
{
$db_conf = config('mongo', $this->getConfigIndex());
if (!empty($db_conf) && isset($db_conf['uriOptions']) && isset($db_conf['driverOptions'])) {
//某些配置项值必须是数字
foreach ($db_conf['uriOptions'] as $key => $v) {
$keys = ['connectTimeoutMS', 'socketTimeoutMS', 'wTimeoutMS'];
if (in_array($key, $keys)) {
$db_conf['uriOptions'][$key] = intval($v);
}
}
//初始化客户端
//兼容多个复制集的情况(rs_interact1.mongo.int.yidian-inc.com:27017,rs_interact2.mongo.int.yidian-inc.com:27017,rs_interact3.mongo.int.yidian-inc.com:27017)
if(strpos($db_conf['host'], ':') !== false){
$client = new Client(
"mongodb://{$db_conf['host']}",
$db_conf['uriOptions'],
$db_conf['driverOptions']
);
}else{
$client = new Client(
"mongodb://{$db_conf['host']}:{$db_conf['port']}",
$db_conf['uriOptions'],
$db_conf['driverOptions']
);
}
//初始化数据库
$this->collection = $client->selectCollection($db_conf['db'], $this->getCollectionName());
}
}
/**
* 获取子类实例
* @return object|string
*/
public static function getInstance()
{
try {
$dao_name = get_called_class();
if (empty(static::$instance)) {
static::$instance = new $dao_name();
}
return static::$instance;
} catch (\Exception $e) {
return 'mongo connect failed';
}
}
/**
* 获取数据库配置,由子类实现
* @return string
*/
abstract protected function getConfigIndex();
/**
* 获取表名,由子类实现
* @return string
*/
abstract protected function getCollectionName();
/**
* 获取where条件数组,由子类实现
* @param array $params
* @return array
*/
abstract protected function getWhere($params);
/**
* 获取query options数组,由子类实现
* @param array $fields
* @param array $sort
* @param int $limit
* @return mixed
*/
abstract protected function getQueryOptions($fields = [], $sort = [], $limit = null);
/**
* 新增
* @param array $data
* @return int(新增行数)|string(错误信息)
*/
public function add($data)
{
try {
if (!is_array($data) || empty($data)) {
throw new \Exception('data error');
}
$ret = $this->collection->insertOne($data);
$cnt = $ret->getInsertedCount();
if (empty($cnt)) {
throw new \Exception('add failed');
}
return $cnt;
} catch (\Exception $e) {
return $e->getMessage();
}
}
/**
* 新增多条
* @param array $data
* @return int(新增行数)|string(错误信息)
*/
public function addMany($data)
{
try {
if (!is_array($data) || empty($data) || count($data) == count($data, COUNT_RECURSIVE)) {
throw new \Exception('data error');
}
$ret = $this->collection->insertMany($data);
$cnt = $ret->getInsertedCount();
if (empty($cnt)) {
throw new \Exception('addMany failed');
}
return $cnt;
} catch (\Exception $e) {
return $e->getMessage();
}
}
/**
* 删除
* @param array $params
* @return int(删除行数)|string(错误信息)
*/
public function delete($params)
{
try {
if (!is_array($params) || empty($params)) {
throw new \Exception('params error');
}
$where = $this->getWhere($params);
if (empty($where)) {
throw new \Exception('where can not be null');
}
$ret = $this->collection->deleteMany($where);
$cnt = $ret->getDeletedCount();
if (empty($cnt)) {
throw new \Exception('delete failed');
}
return $cnt;
} catch (\Exception $e) {
return $e->getMessage();
}
}
/**
* 更新
* @param array $params
* @param array $data
* @return int(更新行数)|string(错误信息)
*/
public function update($params, $data)
{
try {
if (empty($params) || !is_array($params) || empty($data) || !is_array($data)) {
throw new \Exception('params or data error');
}
$where = $this->getWhere($params);
if (empty($where)) {
throw new \Exception('where can not be null');
}
$data = [
'$set' => $data
];
$ret = $this->collection->updateMany($where, $data);
$cnt = $ret->getModifiedCount();
if (empty($cnt)) {
throw new \Exception('update failed');
}
return $cnt;
} catch (\Exception $e) {
return $e->getMessage();
}
}
/**
* 获取单条结果
* @param array $params
* @param array $fields
* @param array $sort
* @param array $limit ['start' => 0, 'count' => 10]
* @return string|array
*/
public function get($params, $fields = [], $sort = [], $limit = [])
{
try {
if (!is_array($params) || empty($params)) {
throw new \Exception('params error');
}
$ret = $this->collection->findOne($this->getWhere($params), $this->getQueryOptions($fields, $sort, $limit));
return empty($ret) ? [] : $ret;
} catch (\Exception $e) {
return $e->getMessage();
}
}
/**
* 获取多条结果
* @param array $params
* @param array $fields
* @param array $sort
* @param array $limit
* @return string|array
*/
public function getMany($params, $fields = [], $sort = [], $limit = [])
{
try {
if (!is_array($params) || empty($params)) {
throw new \Exception('params error');
}
$ret = [];
$cursor = $this->collection->find($this->getWhere($params), $this->getQueryOptions($fields, $sort, $limit));
foreach ($cursor as $k => $document) {
$ret[$k] = $document;
}
return empty($ret) ? [] : $ret;
} catch (\Exception $e) {
return $e->getMessage();
}
}
/**
* count
* @param array $params
* @param string $column
* @return string|int
*/
public function count($params)
{
try {
if (!is_array($params) || empty($params)) {
throw new \Exception('params error');
}
return $cursor = $this->collection->countDocuments($this->getWhere($params));
} catch (\Exception $e) {
return $e->getMessage();
}
}
}
<?php
namespace Api\PhpUtils\Mysql;
use Medoo\Medoo;
abstract class Base
{
private $db = null;
/**
* 根据数据库配置参数,构建数据库连接实例
* 具体PDO配置参考 https://www.cnblogs.com/hf8051/p/4673030.html
* @param string $db_type 写库|读库
* @throws $e 抛出异常,由getWriteInstance()或getInstance()捕获
*/
public function __construct($db_type)
{
try {
$db_conf = config('mysql', $this->getConfigIndex());
if (!empty($db_conf) && isset($db_conf[$db_type]) && !empty($db_conf[$db_type])) {
//设置连接超时时间
$connect_timeout = 30;
if(isset($db_conf['connect_timeout'])){
$connect_timeout = intval($db_conf['connect_timeout']);
}
//设置读超时时间
$read_timeout = 30;
if(isset($db_conf['read_timeout'])){
$read_timeout = intval($db_conf['read_timeout']);
}
ini_set('mysqlnd.net_read_timeout', $read_timeout);
$this->db = new Medoo(
[
'database_type' => $db_conf['database_type'],
'port' => $db_conf['port'],
'database_name' => $db_conf['name'],
'charset' => $db_conf['charset'],
'server' => $db_conf[$db_type]['host'],
'username' => $db_conf[$db_type]['username'],
'password' => $db_conf[$db_type]['password'],
'option' => [
\PDO::ATTR_STRINGIFY_FETCHES => false,
\PDO::ATTR_EMULATE_PREPARES => false,
\PDO::ATTR_CASE => \PDO::CASE_NATURAL,
\PDO::ATTR_TIMEOUT => $connect_timeout
]
]
);
}else{
throw new \Exception('mysql config not exist');
}
}catch (\Exception $e){
throw $e;
}
}
/**
* 获取子类写库实例
* @return object|string (错误信息)
*/
public static function getWriteInstance()
{
try {
$dao_name = get_called_class();
if (empty(static::$write)) {
static::$write = new $dao_name('write');
}
return static::$write;
} catch (\Exception $e) {
return 'mysql getWriteInstance failed : ' . $e->getMessage();
}
}
/**
* 获取子类读库实例(默认)
* @return object|string (错误信息)
*/
public static function getInstance()
{
try {
$dao_name = get_called_class();
if (empty(static::$read)) {
static::$read = new $dao_name('read');
}
return static::$read;
} catch (\Exception $e) {
return 'mysql getInstance failed : ' . $e->getMessage();
}
}
/**
* 获取数据库配置,由子类实现
* @return string
*/
abstract protected function getConfigIndex();
/**
* 获取表名,由子类实现
* @return string
*/
abstract protected function getTableName();
/**
* 获取主键名,由子类实现
* @return string
*/
abstract protected function getPKey();
/**
* 获取where条件数组,由子类实现
* @param array $params
* @return array
*/
abstract protected function getWhere($params);
/**
* 构造排序
* @param array $order ['id' => 'desc', 'name' => 'asc']
* @return array
*/
private function getOrder($order)
{
if (is_array($order) && !empty($order)) {
foreach ($order as $k => $v) {
$order[$k] = strtoupper($v);
}
}
return $order;
}
/**
* 构造分页
* @param array $limit ['start' => 0, 'count' => 10]
* @return array
*/
private function getLimit($limit)
{
$start = isset($limit['start']) ? intval($limit['start']) : 0;
$count = isset($limit['count']) ? intval($limit['count']) : 100;
return [$start, $count];
}
/**
* 新增
* @param array $data
* @return int(最新的id)|string(错误信息)
*/
public function add($data)
{
try {
if (!is_array($data) || empty($data)) {
throw new \Exception('data error');
}
$this->db->insert($this->getTableName(), $data);
$new_id = $this->db->id();
if (empty($new_id)) {
throw new \Exception('add failed');
}
return $new_id;
} catch (\Exception $e) {
return $e->getMessage();
}
}
/**
* 新增多条
* @param array $data
* @return int(新增的行数)|string(错误信息)
*/
public function addMany($data)
{
try {
if (!is_array($data) || empty($data) || count($data) == count($data, COUNT_RECURSIVE)) {
throw new \Exception('data error');
}
$ret = $this->db->insert($this->getTableName(), $data);
$cnt = $ret->rowCount();
if (empty($cnt)) {
throw new \Exception('addMany failed');
}
return $cnt;
} catch (\Exception $e) {
return $e->getMessage();
}
}
/**
* 删除
* @param array $params
* @return int(删除行数)|string(错误信息)
*/
public function delete($params)
{
try {
if (!is_array($params) || empty($params)) {
throw new \Exception('params error');
}
$where = $this->getWhere($params);
if (empty($where)) {
throw new \Exception('where can not be null');
}
$ret = $this->db->delete($this->getTableName(), $where);
$cnt = $ret->rowCount();
if (empty($cnt)) {
throw new \Exception('delete failed');
}
return $cnt;
} catch (\Exception $e) {
return $e->getMessage();
}
}
/**
* 更新
* @param array $params
* @param array $data
* @return int(更新行数)|string(错误信息)
*/
public function update($params, $data)
{
try {
if (empty($params) || !is_array($params) || empty($data) || !is_array($data)) {
throw new \Exception('params or data error');
}
$where = $this->getWhere($params);
if (empty($where)) {
throw new \Exception('where can not be null');
}
$ret = $this->db->update($this->getTableName(), $data, $where);
$cnt = $ret->rowCount();
if (empty($cnt)) {
throw new \Exception('update failed');
}
return $cnt;
} catch (\Exception $e) {
return $e->getMessage();
}
}
/**
* 获取单条结果
* @param array $params
* @param array|string $column
* @param array $order
* @return string|array
*/
public function get($params, $column = '*', $order = [])
{
try {
if (!is_array($params) || empty($params)) {
throw new \Exception('params error');
}
$where = $this->getWhere($params);
if (is_array($order) && !empty($order)) {
$where['ORDER'] = $this->getOrder($order);
}
$ret = $this->db->get($this->getTableName(), $column, $where);
return empty($ret) ? [] : $ret;
} catch (\Exception $e) {
return $e->getMessage();
}
}
/**
* 获取多条结果
* @param $params
* @param array|string $column
* @param array $order ['id' => 'desc', 'name' => 'asc']
* @param array $limit ['start' => 0, 'count' => 10]
* @return string|array
*/
public function getMany($params, $column = '*', $order = [], $limit = [])
{
try {
if (!is_array($params) || empty($params)) {
throw new \Exception('params error');
}
$where = $this->getWhere($params);
if (is_array($order) && !empty($order)) {
$where['ORDER'] = $this->getOrder($order);
}
if (is_array($limit) && !empty($limit)) {
$where['LIMIT'] = $this->getLimit($limit);
}
$ret = $this->db->select($this->getTableName(), $column, $where);
return empty($ret) ? [] : $ret;
} catch (\Exception $e) {
return $e->getMessage();
}
}
/**
* count
* @param array $params
* @param string $column
* @return string|int
*/
public function count($params, $column = '*')
{
try {
if (!is_array($params) || empty($params) || !is_string($column) || empty($column)) {
throw new \Exception('params error');
}
return $this->db->count($this->getTableName(), $column, $this->getWhere($params));
} catch (\Exception $e) {
return $e->getMessage();
}
}
/**
* max
* @param array $params
* @param string $column
* @return string|int
*/
public function max($params, $column)
{
try {
if (!is_array($params) || empty($params) || !is_string($column) || empty($column)) {
throw new \Exception('params error');
}
return $this->db->max($this->getTableName(), $column, $this->getWhere($params));
} catch (\Exception $e) {
return $e->getMessage();
}
}
/**
* min
* @param array $params
* @param string $column
* @return string|int
*/
public function min($params, $column)
{
try {
if (!is_array($params) || empty($params) || !is_string($column) || empty($column)) {
throw new \Exception('params error');
}
return $this->db->min($this->getTableName(), $column, $this->getWhere($params));
} catch (\Exception $e) {
return $e->getMessage();
}
}
/**
* avg
* @param array $params
* @param string $column
* @return string|int
*/
public function avg($params, $column)
{
try {
if (!is_array($params) || empty($params) || !is_string($column) || empty($column)) {
throw new \Exception('params error');
}
return $this->db->avg($this->getTableName(), $column, $this->getWhere($params));
} catch (\Exception $e) {
return $e->getMessage();
}
}
/**
* sum
* @param array $params
* @param string $column
* @return string|int
*/
public function sum($params, $column)
{
try {
if (!is_array($params) || empty($params) || !is_string($column) || empty($column)) {
throw new \Exception('params error');
}
return $this->db->sum($this->getTableName(), $column, $this->getWhere($params));
} catch (\Exception $e) {
return $e->getMessage();
}
}
}
<?php
namespace Api\PhpUtils\Mysql;
use Medoo\Medoo;
abstract class DB
{
private static $instance;
public static function getInstance(...$args)
{
if(!isset(self::$instance)){
self::$instance=new static(...$args);
}
return self::$instance;
}
private function __construct($config_db_name, array $options = [])
{
try {
$db_conf = config('mysql', $config_db_name);
if(!$db_conf){
throw new \Exception('mysql config not exist');
}
ini_set('mysqlnd.net_read_timeout', $db_conf['read_timeout'] ?? 30 );
$this->db = new Medoo(
[
'database_type' => $db_conf['database_type'] ?? "",
'database_name' => $db_conf['name'] ?? "",
'charset' => $db_conf['charset'] ?? "",
'port' => $db_conf[$this->type]['port'] ?? $db_conf['port'] ?? "",
'server' => $db_conf[$this->type]['host'] ?? "",
'username' => $db_conf[$this->type]['username'] ?? "",
'password' => $db_conf[$this->type]['password'] ?? "",
'option' => array_replace([
\PDO::ATTR_STRINGIFY_FETCHES => false,
\PDO::ATTR_EMULATE_PREPARES => false,
\PDO::ATTR_CASE => \PDO::CASE_NATURAL,
\PDO::ATTR_TIMEOUT => $db_conf['connect_timeout'] ?? 30
], $options)
]
);
}catch (\Exception $e){
throw $e;
}
}
}
\ No newline at end of file
...@@ -145,7 +145,7 @@ abstract class MysqlBase ...@@ -145,7 +145,7 @@ abstract class MysqlBase
self::$sqlResut = call_user_func_array([self::$dbConnect[$type], $method], $arguments); self::$sqlResut = call_user_func_array([self::$dbConnect[$type], $method], $arguments);
if (!self::catchError($method, $arguments)) { if (!self::catchError($method, $arguments)) {
// 如果失败重试一次 // 如果失败重试一次
self::$dbCurrentConnect = self::$dbConnect[$type] = self::getConnection($type, true); self::$dbCurrentConnect = self::$dbConnect[$type] = self::getConnection($type);
self::$sqlResut = call_user_func_array([self::$dbConnect[$type], $method], $arguments); self::$sqlResut = call_user_func_array([self::$dbConnect[$type], $method], $arguments);
if (!self::catchError($method, $arguments)) { if (!self::catchError($method, $arguments)) {
return false; return false;
......
<?php
namespace Api\PhpUtils\Mysql;
use Medoo\Medoo;
class ReadDB extends DB
{
public $type = "write";
}
\ No newline at end of file
<?php
namespace Api\PhpUtils\Mysql;
use Medoo\Medoo;
class WriteDB extends DB
{
public $type = "write";
}
\ No newline at end of file
<?php
namespace Api\PhpUtils\Redis;
use Redis;
class Base
{
private $timeout = 1;
private $redis;
public function __construct($host, $port)
{
$this->redis = new Redis();
$this->redis->connect($host, $port, $this->timeout, null, 100);
}
public function get(): Redis
{
return $this->redis;
}
}
<?php
namespace Api\PhpUtils\Redis;
use Api\PhpUtils\Http\Request;
use Redis;
class Codis
{
const EXPIRE_AFTER_ONE_SECOND = 1;
const EXPIRE_AFTER_FIVE_SECONDS = 5;
const EXPIRE_AFTER_TEN_SECONDS = 10;
const EXPIRE_AFTER_ONE_MINUTE = 60;
const EXPIRE_AFTER_FIVE_MINUTES = 300;
const EXPIRE_AFTER_TEN_MINUTES = 600;
const EXPIRE_AFTER_HALF_HOUR = 1800;
const EXPIRE_AFTER_ONE_HOUR = 3600;
const EXPIRE_AFTER_SIX_HOURS = 21600;
const EXPIRE_AFTER_TWELVE_HOURS = 43200;
const EXPIRE_AFTER_ONE_DAY = 86400;
const EXPIRE_AFTER_THREE_DAYS = 259200;
const EXPIRE_AFTER_ONE_WEEK = 604800;
const EXPIRE_AFTER_FIFTEEN_DAYS = 1296000;
const EXPIRE_AFTER_ONE_MONTH = 2592000;
private $server_name;
private $server_list;
private $connect_server;
private $redis;
public function __construct($server_name = 'main')
{
$this->server_name = $server_name;
$this->connect();
}
public function connectServer()
{
return $this->connect_server;
}
public function serverList()
{
return $this->server_list;
}
public function getInstance(): Redis
{
return $this->redis;
}
/**
* 获取 redis 操作实例.
*/
private function connect(): bool
{
$ok = $this->getTopomServer();
if (empty($ok)) {
return false;
}
// 随机选取一个地址,若连接失败,重新选择地址,最多三次
$flag = false;
for ($i = 0; $i < 3; ++$i) {
$index = array_rand($this->server_list);
$connect_server = $this->server_list[$index];
list($host, $port) = explode(':', $connect_server);
try {
$redis = new Base($host, $port);
} catch (\Exception $e) {
continue;
}
$flag = true;
$this->redis = $redis->get();
$this->connect_server = $connect_server;
break;
}
return $flag;
}
/**
* 从 topom 获取 server 列表.
*/
private function getTopomServer(): bool
{
$conf = config('redis', 'codis');
if (!isset($conf[$this->server_name]['topom']) || empty($conf[$this->server_name]['topom'])) {
return false;
}
$url = $conf[$this->server_name]['topom'];
$request = new Request();
$res = $request->get($url);
$res = $res["response"];
if (empty($res) || !isset($res['stats']['proxy']['models']) || empty($res['stats']['proxy']['models'])) {
return false;
}
$servers = $res['stats']['proxy']['models'];
$server_list = [];
foreach ($servers as $s) {
$token = $s['token'];
if (isset($res['stats']['proxy']['stats'][$token]['stats']['online']) && true === $res['stats']['proxy']['stats'][$token]['stats']['online']) {
$server_list[] = $s['proxy_addr'];
}
}
if (empty($server_list)) {
return false;
}
$this->server_list = $server_list;
return true;
}
}
...@@ -4,4 +4,4 @@ ...@@ -4,4 +4,4 @@
require_once __DIR__ . '/composer/autoload_real.php'; require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInited946ede6e68f25941b9b85608fbe09a::getLoader(); return ComposerAutoloaderInit1ac03c60750dc59c6c21518ecbd0a3fd::getLoader();
...@@ -32,7 +32,7 @@ private static $installed = array ( ...@@ -32,7 +32,7 @@ private static $installed = array (
'aliases' => 'aliases' =>
array ( array (
), ),
'reference' => 'edf34efd699a9adb743ae22e7e4d1afe0e44a01a', 'reference' => 'd4137182c34400313923cd9c6371f57874a58299',
'name' => 'yidian/yaf_demo', 'name' => 'yidian/yaf_demo',
), ),
'versions' => 'versions' =>
...@@ -45,7 +45,7 @@ private static $installed = array ( ...@@ -45,7 +45,7 @@ private static $installed = array (
array ( array (
0 => '9999999-dev', 0 => '9999999-dev',
), ),
'reference' => '1a73d985fc0743343751d4aad8e34cc3bc7f12bc', 'reference' => 'd844921e94a920bf28fc1427851edbec63d78501',
), ),
'api/php_utils' => 'api/php_utils' =>
array ( array (
...@@ -55,7 +55,7 @@ private static $installed = array ( ...@@ -55,7 +55,7 @@ private static $installed = array (
array ( array (
0 => '9999999-dev', 0 => '9999999-dev',
), ),
'reference' => '8ea0f5ec5e1c909fa76ec171e8698a4622aaec5a', 'reference' => '94bec4fc5b52829a32f22a40d283faa4f2b596de',
), ),
'catfan/medoo' => 'catfan/medoo' =>
array ( array (
...@@ -132,6 +132,15 @@ private static $installed = array ( ...@@ -132,6 +132,15 @@ private static $installed = array (
), ),
'reference' => '18fca8cc8d0c2cc07f76605760d20632bb3dab96', 'reference' => '18fca8cc8d0c2cc07f76605760d20632bb3dab96',
), ),
'perftools/php-profiler' =>
array (
'pretty_version' => '0.18.0',
'version' => '0.18.0.0',
'aliases' =>
array (
),
'reference' => '794c435f615ab9ca4347e386b4d8c6524fe9e3ae',
),
'psr/http-message' => 'psr/http-message' =>
array ( array (
'pretty_version' => 'dev-master', 'pretty_version' => 'dev-master',
...@@ -184,7 +193,7 @@ private static $installed = array ( ...@@ -184,7 +193,7 @@ private static $installed = array (
'aliases' => 'aliases' =>
array ( array (
), ),
'reference' => 'edf34efd699a9adb743ae22e7e4d1afe0e44a01a', 'reference' => 'd4137182c34400313923cd9c6371f57874a58299',
), ),
), ),
); );
......
...@@ -12,18 +12,13 @@ return array( ...@@ -12,18 +12,13 @@ return array(
'Api\\PhpServices\\Certification\\PkcsKeyGenerator' => $vendorDir . '/api/php_services/src/Certification/PkcsKeyGenerator.php', 'Api\\PhpServices\\Certification\\PkcsKeyGenerator' => $vendorDir . '/api/php_services/src/Certification/PkcsKeyGenerator.php',
'Api\\PhpServices\\Certification\\SocialCreditCertification' => $vendorDir . '/api/php_services/src/Certification/SocialCreditCertification.php', 'Api\\PhpServices\\Certification\\SocialCreditCertification' => $vendorDir . '/api/php_services/src/Certification/SocialCreditCertification.php',
'Api\\PhpServices\\Certification\\ThreeElementsCertification' => $vendorDir . '/api/php_services/src/Certification/ThreeElementsCertification.php', 'Api\\PhpServices\\Certification\\ThreeElementsCertification' => $vendorDir . '/api/php_services/src/Certification/ThreeElementsCertification.php',
'Api\\PhpServices\\ChameleonPackage\\Package' => $vendorDir . '/api/php_services/src/ChameleonPackage/Package.php',
'Api\\PhpServices\\Collect\\Collect' => $vendorDir . '/api/php_services/src/Collect/Collect.php',
'Api\\PhpServices\\Collect\\models\\Collect' => $vendorDir . '/api/php_services/src/Collect/models/Collect.php',
'Api\\PhpServices\\Comment\\Comment' => $vendorDir . '/api/php_services/src/Comment/Comment.php',
'Api\\PhpServices\\Comment\\CommentService' => $vendorDir . '/api/php_services/src/Comment/CommentService.php',
'Api\\PhpServices\\Daemon\\Daemon' => $vendorDir . '/api/php_services/src/Daemon/Daemon.php', 'Api\\PhpServices\\Daemon\\Daemon' => $vendorDir . '/api/php_services/src/Daemon/Daemon.php',
'Api\\PhpServices\\Daemon\\DaemonServiceInterface' => $vendorDir . '/api/php_services/src/Daemon/DaemonServiceInterface.php', 'Api\\PhpServices\\Daemon\\DaemonServiceInterface' => $vendorDir . '/api/php_services/src/Daemon/DaemonServiceInterface.php',
'Api\\PhpServices\\Doc\\DocDynamic' => $vendorDir . '/api/php_services/src/Doc/DocDynamic.php', 'Api\\PhpServices\\Doc\\DocDynamic' => $vendorDir . '/api/php_services/src/Doc/DocDynamic.php',
'Api\\PhpServices\\Idgen\\Idgen' => $vendorDir . '/api/php_services/src/Idgen/Idgen.php', 'Api\\PhpServices\\Idgen\\Idgen' => $vendorDir . '/api/php_services/src/Idgen/Idgen.php',
'Api\\PhpServices\\InfoFlow\\InfoFlow' => $vendorDir . '/api/php_services/src/InfoFlow/InfoFlow.php',
'Api\\PhpServices\\JwUser\\JwUser' => $vendorDir . '/api/php_services/src/JwUser/JwUser.php', 'Api\\PhpServices\\JwUser\\JwUser' => $vendorDir . '/api/php_services/src/JwUser/JwUser.php',
'Api\\PhpServices\\Ksy\\Ksyun' => $vendorDir . '/api/php_services/src/Ksy/Ksyun.php', 'Api\\PhpServices\\Ksy\\Ksyun' => $vendorDir . '/api/php_services/src/Ksy/Ksyun.php',
'Api\\PhpServices\\LifeAccount\\Account' => $vendorDir . '/api/php_services/src/LifeAccount/Account.php',
'Api\\PhpServices\\Login\\Login' => $vendorDir . '/api/php_services/src/Login/Login.php', 'Api\\PhpServices\\Login\\Login' => $vendorDir . '/api/php_services/src/Login/Login.php',
'Api\\PhpServices\\PushToken\\Android' => $vendorDir . '/api/php_services/src/PushToken/Android.php', 'Api\\PhpServices\\PushToken\\Android' => $vendorDir . '/api/php_services/src/PushToken/Android.php',
'Api\\PhpServices\\PushToken\\Base' => $vendorDir . '/api/php_services/src/PushToken/Base.php', 'Api\\PhpServices\\PushToken\\Base' => $vendorDir . '/api/php_services/src/PushToken/Base.php',
...@@ -33,14 +28,10 @@ return array( ...@@ -33,14 +28,10 @@ return array(
'Api\\PhpServices\\Session\\RedisSessionHandler' => $vendorDir . '/api/php_services/src/Session/RedisSessionHandler.php', 'Api\\PhpServices\\Session\\RedisSessionHandler' => $vendorDir . '/api/php_services/src/Session/RedisSessionHandler.php',
'Api\\PhpServices\\Session\\Session' => $vendorDir . '/api/php_services/src/Session/Session.php', 'Api\\PhpServices\\Session\\Session' => $vendorDir . '/api/php_services/src/Session/Session.php',
'Api\\PhpServices\\Session\\SessionManager' => $vendorDir . '/api/php_services/src/Session/SessionManager.php', 'Api\\PhpServices\\Session\\SessionManager' => $vendorDir . '/api/php_services/src/Session/SessionManager.php',
'Api\\PhpServices\\Subscribe\\Subscribe' => $vendorDir . '/api/php_services/src/Subscribe/Subscribe.php',
'Api\\PhpServices\\Subscribe\\WeMediaSubscribe' => $vendorDir . '/api/php_services/src/Subscribe/WeMediaSubscribe.php',
'Api\\PhpServices\\ThumbsUp\\ThumbsUp' => $vendorDir . '/api/php_services/src/ThumbsUp/ThumbsUp.php',
'Api\\PhpServices\\ThumbsUp\\models\\ThumbsUp' => $vendorDir . '/api/php_services/src/ThumbsUp/models/ThumbsUp.php',
'Api\\PhpServices\\Towerpro\\Towerpro' => $vendorDir . '/api/php_services/src/Towerpro/Towerpro.php', 'Api\\PhpServices\\Towerpro\\Towerpro' => $vendorDir . '/api/php_services/src/Towerpro/Towerpro.php',
'Api\\PhpServices\\Tuffy\\TuffyService' => $vendorDir . '/api/php_services/src/Tuffy/TuffyService.php', 'Api\\PhpServices\\Tuffy\\TuffyService' => $vendorDir . '/api/php_services/src/Tuffy/TuffyService.php',
'Api\\PhpServices\\UserInfo\\User' => $vendorDir . '/api/php_services/src/UserInfo/User.php', 'Api\\PhpServices\\XhProfiler\\XhMongo' => $vendorDir . '/api/php_services/src/XhProfiler/XhMongo.php',
'Api\\PhpServices\\WeMedia\\WeMediaService' => $vendorDir . '/api/php_services/src/WeMedia/WeMediaService.php', 'Api\\PhpServices\\XhProfiler\\XhProfilerService' => $vendorDir . '/api/php_services/src/XhProfiler/XhProfilerService.php',
'Api\\PhpUtils\\Cache\\ApcuUtil' => $vendorDir . '/api/php_utils/src/Cache/ApcuUtil.php', 'Api\\PhpUtils\\Cache\\ApcuUtil' => $vendorDir . '/api/php_utils/src/Cache/ApcuUtil.php',
'Api\\PhpUtils\\Cache\\CacheUtil' => $vendorDir . '/api/php_utils/src/Cache/CacheUtil.php', 'Api\\PhpUtils\\Cache\\CacheUtil' => $vendorDir . '/api/php_utils/src/Cache/CacheUtil.php',
'Api\\PhpUtils\\Common\\BaseConvert' => $vendorDir . '/api/php_utils/src/Common/BaseConvert.php', 'Api\\PhpUtils\\Common\\BaseConvert' => $vendorDir . '/api/php_utils/src/Common/BaseConvert.php',
...@@ -57,24 +48,16 @@ return array( ...@@ -57,24 +48,16 @@ return array(
'Api\\PhpUtils\\Hystrix\\ApcuStateStorage' => $vendorDir . '/api/php_utils/src/Hystrix/ApcuStateStorage.php', 'Api\\PhpUtils\\Hystrix\\ApcuStateStorage' => $vendorDir . '/api/php_utils/src/Hystrix/ApcuStateStorage.php',
'Api\\PhpUtils\\Hystrix\\DemoCommand' => $vendorDir . '/api/php_utils/src/Hystrix/DemoCommand.php', 'Api\\PhpUtils\\Hystrix\\DemoCommand' => $vendorDir . '/api/php_utils/src/Hystrix/DemoCommand.php',
'Api\\PhpUtils\\Hystrix\\Hystrix' => $vendorDir . '/api/php_utils/src/Hystrix/Hystrix.php', 'Api\\PhpUtils\\Hystrix\\Hystrix' => $vendorDir . '/api/php_utils/src/Hystrix/Hystrix.php',
'Api\\PhpUtils\\Kafka\\KafkaProducer' => $vendorDir . '/api/php_utils/src/Kafka/KafkaProducer.php',
'Api\\PhpUtils\\Kafka\\KafkaUtil' => $vendorDir . '/api/php_utils/src/Kafka/KafkaUtil.php', 'Api\\PhpUtils\\Kafka\\KafkaUtil' => $vendorDir . '/api/php_utils/src/Kafka/KafkaUtil.php',
'Api\\PhpUtils\\Kafka\\Singleton' => $vendorDir . '/api/php_utils/src/Kafka/Singleton.php', 'Api\\PhpUtils\\Ksy\\Ks3Util' => $vendorDir . '/api/php_utils/src/Ksy/Ks3Util.php',
'Api\\PhpUtils\\Log\\DaemoLog' => $vendorDir . '/api/php_utils/src/Log/DaemoLog.php', 'Api\\PhpUtils\\Log\\DaemonLog' => $vendorDir . '/api/php_utils/src/Log/DaemonLog.php',
'Api\\PhpUtils\\Log\\FileLog' => $vendorDir . '/api/php_utils/src/Log/FileLog.php', 'Api\\PhpUtils\\Log\\FileLog' => $vendorDir . '/api/php_utils/src/Log/FileLog.php',
'Api\\PhpUtils\\Message\\Email' => $vendorDir . '/api/php_utils/src/Message/Email.php', 'Api\\PhpUtils\\Message\\Email' => $vendorDir . '/api/php_utils/src/Message/Email.php',
'Api\\PhpUtils\\Mon\\MonUtil' => $vendorDir . '/api/php_utils/src/Mon/MonUtil.php', 'Api\\PhpUtils\\Mon\\MonUtil' => $vendorDir . '/api/php_utils/src/Mon/MonUtil.php',
'Api\\PhpUtils\\Mongo\\Base' => $vendorDir . '/api/php_utils/src/Mongo/Base.php',
'Api\\PhpUtils\\Mongo\\MongoBase' => $vendorDir . '/api/php_utils/src/Mongo/MongoBase.php', 'Api\\PhpUtils\\Mongo\\MongoBase' => $vendorDir . '/api/php_utils/src/Mongo/MongoBase.php',
'Api\\PhpUtils\\Mysql\\Base' => $vendorDir . '/api/php_utils/src/Mysql/Base.php',
'Api\\PhpUtils\\Mysql\\DB' => $vendorDir . '/api/php_utils/src/Mysql/DB.php',
'Api\\PhpUtils\\Mysql\\MysqlBase' => $vendorDir . '/api/php_utils/src/Mysql/MysqlBase.php', 'Api\\PhpUtils\\Mysql\\MysqlBase' => $vendorDir . '/api/php_utils/src/Mysql/MysqlBase.php',
'Api\\PhpUtils\\Mysql\\MysqlClusterBase' => $vendorDir . '/api/php_utils/src/Mysql/MysqlClusterBase.php', 'Api\\PhpUtils\\Mysql\\MysqlClusterBase' => $vendorDir . '/api/php_utils/src/Mysql/MysqlClusterBase.php',
'Api\\PhpUtils\\Mysql\\ReadDB' => $vendorDir . '/api/php_utils/src/Mysql/ReadDB.php',
'Api\\PhpUtils\\Mysql\\WriteDB' => $vendorDir . '/api/php_utils/src/Mysql/WriteDB.php',
'Api\\PhpUtils\\RabbitMq\\DelayRabbitMq' => $vendorDir . '/api/php_utils/src/RabbitMq/DelayRabbitMq.php', 'Api\\PhpUtils\\RabbitMq\\DelayRabbitMq' => $vendorDir . '/api/php_utils/src/RabbitMq/DelayRabbitMq.php',
'Api\\PhpUtils\\Redis\\Base' => $vendorDir . '/api/php_utils/src/Redis/Base.php',
'Api\\PhpUtils\\Redis\\Codis' => $vendorDir . '/api/php_utils/src/Redis/Codis.php',
'Api\\PhpUtils\\Redis\\RedisUtil' => $vendorDir . '/api/php_utils/src/Redis/RedisUtil.php', 'Api\\PhpUtils\\Redis\\RedisUtil' => $vendorDir . '/api/php_utils/src/Redis/RedisUtil.php',
'Api\\PhpUtils\\Validate\\Validate' => $vendorDir . '/api/php_utils/src/Validate/Validate.php', 'Api\\PhpUtils\\Validate\\Validate' => $vendorDir . '/api/php_utils/src/Validate/Validate.php',
'Api\\PhpUtils\\Validate\\ValidateRule' => $vendorDir . '/api/php_utils/src/Validate/ValidateRule.php', 'Api\\PhpUtils\\Validate\\ValidateRule' => $vendorDir . '/api/php_utils/src/Validate/ValidateRule.php',
...@@ -86,16 +69,28 @@ return array( ...@@ -86,16 +69,28 @@ return array(
'App\\Exception\\ExceptionHandler' => $baseDir . '/application/exception/ExceptionHandler.php', 'App\\Exception\\ExceptionHandler' => $baseDir . '/application/exception/ExceptionHandler.php',
'App\\Exception\\custom\\Code' => $baseDir . '/application/exception/custom/Code.php', 'App\\Exception\\custom\\Code' => $baseDir . '/application/exception/custom/Code.php',
'App\\Exception\\custom\\CodeSpecialException' => $baseDir . '/application/exception/custom/CodeSpecialException.php', 'App\\Exception\\custom\\CodeSpecialException' => $baseDir . '/application/exception/custom/CodeSpecialException.php',
'App\\Exception\\custom\\GoodsException' => $baseDir . '/application/exception/custom/GoodsException.php',
'App\\Exception\\custom\\ParamException' => $baseDir . '/application/exception/custom/ParamException.php', 'App\\Exception\\custom\\ParamException' => $baseDir . '/application/exception/custom/ParamException.php',
'App\\Exception\\custom\\SignException' => $baseDir . '/application/exception/custom/SignException.php', 'App\\Exception\\custom\\SignException' => $baseDir . '/application/exception/custom/SignException.php',
'App\\Exception\\custom\\TestException' => $baseDir . '/application/exception/custom/TestException.php', 'App\\Exception\\custom\\TestException' => $baseDir . '/application/exception/custom/TestException.php',
'App\\Models\\demo\\mongo\\Test' => $baseDir . '/application/models/demo/mongo/Test.php', 'App\\Models\\demo\\mongo\\Test' => $baseDir . '/application/models/demo/mongo/Test.php',
'App\\Models\\demo\\mongo\\User' => $baseDir . '/application/models/demo/mongo/User.php', 'App\\Models\\demo\\mongo\\User' => $baseDir . '/application/models/demo/mongo/User.php',
'App\\Models\\demo\\mysql\\User' => $baseDir . '/application/models/demo/mysql/User.php', 'App\\Models\\demo\\mysql\\User' => $baseDir . '/application/models/demo/mysql/User.php',
'App\\Models\\goods\\mysql\\Category' => $baseDir . '/application/models/goods/mysql/Category.php',
'App\\Models\\goods\\mysql\\GoodsOperationRecord' => $baseDir . '/application/models/goods/mysql/GoodsOperationRecord.php',
'App\\Models\\goods\\mysql\\GoodsSku' => $baseDir . '/application/models/goods/mysql/GoodsSku.php',
'App\\Models\\goods\\mysql\\GoodsSkuStores' => $baseDir . '/application/models/goods/mysql/GoodsSkuStores.php',
'App\\Models\\goods\\mysql\\GoodsSnapshot' => $baseDir . '/application/models/goods/mysql/GoodsSnapshot.php',
'App\\Models\\goods\\mysql\\GoodsSpu' => $baseDir . '/application/models/goods/mysql/GoodsSpu.php',
'App\\Models\\goods\\mysql\\InventoryOperationRecord' => $baseDir . '/application/models/goods/mysql/InventoryOperationRecord.php',
'App\\Models\\goods\\mysql\\Shop' => $baseDir . '/application/models/goods/mysql/Shop.php',
'App\\Plugins\\Hook' => $baseDir . '/application/plugins/Hook.php', 'App\\Plugins\\Hook' => $baseDir . '/application/plugins/Hook.php',
'App\\Services\\demo\\ElasticService' => $baseDir . '/application/services/demo/ElasticService.php', 'App\\Services\\demo\\ElasticService' => $baseDir . '/application/services/demo/ElasticService.php',
'App\\Services\\demo\\MongoService' => $baseDir . '/application/services/demo/MongoService.php', 'App\\Services\\demo\\MongoService' => $baseDir . '/application/services/demo/MongoService.php',
'App\\Services\\demo\\MysqlService' => $baseDir . '/application/services/demo/MysqlService.php', 'App\\Services\\demo\\MysqlService' => $baseDir . '/application/services/demo/MysqlService.php',
'App\\Services\\goods\\CategoryService' => $baseDir . '/application/services/goods/CategoryService.php',
'App\\Services\\goods\\ElasticService' => $baseDir . '/application/services/goods/ElasticService.php',
'App\\Services\\goods\\GoodsService' => $baseDir . '/application/services/goods/GoodsService.php',
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php', 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
'Daemon\\Test' => $baseDir . '/daemon/Test.php', 'Daemon\\Test' => $baseDir . '/daemon/Test.php',
'Elasticsearch\\Client' => $vendorDir . '/elasticsearch/elasticsearch/src/Elasticsearch/Client.php', 'Elasticsearch\\Client' => $vendorDir . '/elasticsearch/elasticsearch/src/Elasticsearch/Client.php',
...@@ -761,4 +756,23 @@ return array( ...@@ -761,4 +756,23 @@ return array(
'React\\Promise\\PromisorInterface' => $vendorDir . '/react/promise/src/PromisorInterface.php', 'React\\Promise\\PromisorInterface' => $vendorDir . '/react/promise/src/PromisorInterface.php',
'React\\Promise\\RejectedPromise' => $vendorDir . '/react/promise/src/RejectedPromise.php', 'React\\Promise\\RejectedPromise' => $vendorDir . '/react/promise/src/RejectedPromise.php',
'React\\Promise\\UnhandledRejectionException' => $vendorDir . '/react/promise/src/UnhandledRejectionException.php', 'React\\Promise\\UnhandledRejectionException' => $vendorDir . '/react/promise/src/UnhandledRejectionException.php',
'Xhgui\\Profiler\\Exception\\ProfilerException' => $vendorDir . '/perftools/php-profiler/src/Exception/ProfilerException.php',
'Xhgui\\Profiler\\Profiler' => $vendorDir . '/perftools/php-profiler/src/Profiler.php',
'Xhgui\\Profiler\\ProfilerFactory' => $vendorDir . '/perftools/php-profiler/src/ProfilerFactory.php',
'Xhgui\\Profiler\\Profilers\\AbstractProfiler' => $vendorDir . '/perftools/php-profiler/src/Profilers/AbstractProfiler.php',
'Xhgui\\Profiler\\Profilers\\ProfilerInterface' => $vendorDir . '/perftools/php-profiler/src/Profilers/ProfilerInterface.php',
'Xhgui\\Profiler\\Profilers\\Tideways' => $vendorDir . '/perftools/php-profiler/src/Profilers/Tideways.php',
'Xhgui\\Profiler\\Profilers\\TidewaysXHProf' => $vendorDir . '/perftools/php-profiler/src/Profilers/TidewaysXHProf.php',
'Xhgui\\Profiler\\Profilers\\UProfiler' => $vendorDir . '/perftools/php-profiler/src/Profilers/UProfiler.php',
'Xhgui\\Profiler\\Profilers\\XHProf' => $vendorDir . '/perftools/php-profiler/src/Profilers/XHProf.php',
'Xhgui\\Profiler\\ProfilingData' => $vendorDir . '/perftools/php-profiler/src/ProfilingData.php',
'Xhgui\\Profiler\\ProfilingFlags' => $vendorDir . '/perftools/php-profiler/src/ProfilingFlags.php',
'Xhgui\\Profiler\\SaverFactory' => $vendorDir . '/perftools/php-profiler/src/SaverFactory.php',
'Xhgui\\Profiler\\Saver\\AbstractSaver' => $vendorDir . '/perftools/php-profiler/src/Saver/AbstractSaver.php',
'Xhgui\\Profiler\\Saver\\FileSaver' => $vendorDir . '/perftools/php-profiler/src/Saver/FileSaver.php',
'Xhgui\\Profiler\\Saver\\MongoSaver' => $vendorDir . '/perftools/php-profiler/src/Saver/MongoSaver.php',
'Xhgui\\Profiler\\Saver\\PdoSaver' => $vendorDir . '/perftools/php-profiler/src/Saver/PdoSaver.php',
'Xhgui\\Profiler\\Saver\\SaverInterface' => $vendorDir . '/perftools/php-profiler/src/Saver/SaverInterface.php',
'Xhgui\\Profiler\\Saver\\StackSaver' => $vendorDir . '/perftools/php-profiler/src/Saver/StackSaver.php',
'Xhgui\\Profiler\\Saver\\UploadSaver' => $vendorDir . '/perftools/php-profiler/src/Saver/UploadSaver.php',
); );
...@@ -6,6 +6,7 @@ $vendorDir = dirname(dirname(__FILE__)); ...@@ -6,6 +6,7 @@ $vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir); $baseDir = dirname($vendorDir);
return array( return array(
'Xhgui\\Profiler\\' => array($vendorDir . '/perftools/php-profiler/src'),
'React\\Promise\\' => array($vendorDir . '/react/promise/src'), 'React\\Promise\\' => array($vendorDir . '/react/promise/src'),
'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'), 'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'), 'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'),
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer // autoload_real.php @generated by Composer
class ComposerAutoloaderInited946ede6e68f25941b9b85608fbe09a class ComposerAutoloaderInit1ac03c60750dc59c6c21518ecbd0a3fd
{ {
private static $loader; private static $loader;
...@@ -24,15 +24,15 @@ class ComposerAutoloaderInited946ede6e68f25941b9b85608fbe09a ...@@ -24,15 +24,15 @@ class ComposerAutoloaderInited946ede6e68f25941b9b85608fbe09a
require __DIR__ . '/platform_check.php'; require __DIR__ . '/platform_check.php';
spl_autoload_register(array('ComposerAutoloaderInited946ede6e68f25941b9b85608fbe09a', 'loadClassLoader'), true, true); spl_autoload_register(array('ComposerAutoloaderInit1ac03c60750dc59c6c21518ecbd0a3fd', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
spl_autoload_unregister(array('ComposerAutoloaderInited946ede6e68f25941b9b85608fbe09a', 'loadClassLoader')); spl_autoload_unregister(array('ComposerAutoloaderInit1ac03c60750dc59c6c21518ecbd0a3fd', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) { if ($useStaticLoader) {
require __DIR__ . '/autoload_static.php'; require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInited946ede6e68f25941b9b85608fbe09a::getInitializer($loader)); call_user_func(\Composer\Autoload\ComposerStaticInit1ac03c60750dc59c6c21518ecbd0a3fd::getInitializer($loader));
} else { } else {
$map = require __DIR__ . '/autoload_namespaces.php'; $map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) { foreach ($map as $namespace => $path) {
...@@ -53,19 +53,19 @@ class ComposerAutoloaderInited946ede6e68f25941b9b85608fbe09a ...@@ -53,19 +53,19 @@ class ComposerAutoloaderInited946ede6e68f25941b9b85608fbe09a
$loader->register(true); $loader->register(true);
if ($useStaticLoader) { if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInited946ede6e68f25941b9b85608fbe09a::$files; $includeFiles = Composer\Autoload\ComposerStaticInit1ac03c60750dc59c6c21518ecbd0a3fd::$files;
} else { } else {
$includeFiles = require __DIR__ . '/autoload_files.php'; $includeFiles = require __DIR__ . '/autoload_files.php';
} }
foreach ($includeFiles as $fileIdentifier => $file) { foreach ($includeFiles as $fileIdentifier => $file) {
composerRequireed946ede6e68f25941b9b85608fbe09a($fileIdentifier, $file); composerRequire1ac03c60750dc59c6c21518ecbd0a3fd($fileIdentifier, $file);
} }
return $loader; return $loader;
} }
} }
function composerRequireed946ede6e68f25941b9b85608fbe09a($fileIdentifier, $file) function composerRequire1ac03c60750dc59c6c21518ecbd0a3fd($fileIdentifier, $file)
{ {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file; require $file;
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
namespace Composer\Autoload; namespace Composer\Autoload;
class ComposerStaticInited946ede6e68f25941b9b85608fbe09a class ComposerStaticInit1ac03c60750dc59c6c21518ecbd0a3fd
{ {
public static $files = array ( public static $files = array (
'7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php', '7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php',
...@@ -17,6 +17,10 @@ class ComposerStaticInited946ede6e68f25941b9b85608fbe09a ...@@ -17,6 +17,10 @@ class ComposerStaticInited946ede6e68f25941b9b85608fbe09a
); );
public static $prefixLengthsPsr4 = array ( public static $prefixLengthsPsr4 = array (
'X' =>
array (
'Xhgui\\Profiler\\' => 15,
),
'R' => 'R' =>
array ( array (
'React\\Promise\\' => 14, 'React\\Promise\\' => 14,
...@@ -60,6 +64,10 @@ class ComposerStaticInited946ede6e68f25941b9b85608fbe09a ...@@ -60,6 +64,10 @@ class ComposerStaticInited946ede6e68f25941b9b85608fbe09a
); );
public static $prefixDirsPsr4 = array ( public static $prefixDirsPsr4 = array (
'Xhgui\\Profiler\\' =>
array (
0 => __DIR__ . '/..' . '/perftools/php-profiler/src',
),
'React\\Promise\\' => 'React\\Promise\\' =>
array ( array (
0 => __DIR__ . '/..' . '/react/promise/src', 0 => __DIR__ . '/..' . '/react/promise/src',
...@@ -145,18 +153,13 @@ class ComposerStaticInited946ede6e68f25941b9b85608fbe09a ...@@ -145,18 +153,13 @@ class ComposerStaticInited946ede6e68f25941b9b85608fbe09a
'Api\\PhpServices\\Certification\\PkcsKeyGenerator' => __DIR__ . '/..' . '/api/php_services/src/Certification/PkcsKeyGenerator.php', 'Api\\PhpServices\\Certification\\PkcsKeyGenerator' => __DIR__ . '/..' . '/api/php_services/src/Certification/PkcsKeyGenerator.php',
'Api\\PhpServices\\Certification\\SocialCreditCertification' => __DIR__ . '/..' . '/api/php_services/src/Certification/SocialCreditCertification.php', 'Api\\PhpServices\\Certification\\SocialCreditCertification' => __DIR__ . '/..' . '/api/php_services/src/Certification/SocialCreditCertification.php',
'Api\\PhpServices\\Certification\\ThreeElementsCertification' => __DIR__ . '/..' . '/api/php_services/src/Certification/ThreeElementsCertification.php', 'Api\\PhpServices\\Certification\\ThreeElementsCertification' => __DIR__ . '/..' . '/api/php_services/src/Certification/ThreeElementsCertification.php',
'Api\\PhpServices\\ChameleonPackage\\Package' => __DIR__ . '/..' . '/api/php_services/src/ChameleonPackage/Package.php',
'Api\\PhpServices\\Collect\\Collect' => __DIR__ . '/..' . '/api/php_services/src/Collect/Collect.php',
'Api\\PhpServices\\Collect\\models\\Collect' => __DIR__ . '/..' . '/api/php_services/src/Collect/models/Collect.php',
'Api\\PhpServices\\Comment\\Comment' => __DIR__ . '/..' . '/api/php_services/src/Comment/Comment.php',
'Api\\PhpServices\\Comment\\CommentService' => __DIR__ . '/..' . '/api/php_services/src/Comment/CommentService.php',
'Api\\PhpServices\\Daemon\\Daemon' => __DIR__ . '/..' . '/api/php_services/src/Daemon/Daemon.php', 'Api\\PhpServices\\Daemon\\Daemon' => __DIR__ . '/..' . '/api/php_services/src/Daemon/Daemon.php',
'Api\\PhpServices\\Daemon\\DaemonServiceInterface' => __DIR__ . '/..' . '/api/php_services/src/Daemon/DaemonServiceInterface.php', 'Api\\PhpServices\\Daemon\\DaemonServiceInterface' => __DIR__ . '/..' . '/api/php_services/src/Daemon/DaemonServiceInterface.php',
'Api\\PhpServices\\Doc\\DocDynamic' => __DIR__ . '/..' . '/api/php_services/src/Doc/DocDynamic.php', 'Api\\PhpServices\\Doc\\DocDynamic' => __DIR__ . '/..' . '/api/php_services/src/Doc/DocDynamic.php',
'Api\\PhpServices\\Idgen\\Idgen' => __DIR__ . '/..' . '/api/php_services/src/Idgen/Idgen.php', 'Api\\PhpServices\\Idgen\\Idgen' => __DIR__ . '/..' . '/api/php_services/src/Idgen/Idgen.php',
'Api\\PhpServices\\InfoFlow\\InfoFlow' => __DIR__ . '/..' . '/api/php_services/src/InfoFlow/InfoFlow.php',
'Api\\PhpServices\\JwUser\\JwUser' => __DIR__ . '/..' . '/api/php_services/src/JwUser/JwUser.php', 'Api\\PhpServices\\JwUser\\JwUser' => __DIR__ . '/..' . '/api/php_services/src/JwUser/JwUser.php',
'Api\\PhpServices\\Ksy\\Ksyun' => __DIR__ . '/..' . '/api/php_services/src/Ksy/Ksyun.php', 'Api\\PhpServices\\Ksy\\Ksyun' => __DIR__ . '/..' . '/api/php_services/src/Ksy/Ksyun.php',
'Api\\PhpServices\\LifeAccount\\Account' => __DIR__ . '/..' . '/api/php_services/src/LifeAccount/Account.php',
'Api\\PhpServices\\Login\\Login' => __DIR__ . '/..' . '/api/php_services/src/Login/Login.php', 'Api\\PhpServices\\Login\\Login' => __DIR__ . '/..' . '/api/php_services/src/Login/Login.php',
'Api\\PhpServices\\PushToken\\Android' => __DIR__ . '/..' . '/api/php_services/src/PushToken/Android.php', 'Api\\PhpServices\\PushToken\\Android' => __DIR__ . '/..' . '/api/php_services/src/PushToken/Android.php',
'Api\\PhpServices\\PushToken\\Base' => __DIR__ . '/..' . '/api/php_services/src/PushToken/Base.php', 'Api\\PhpServices\\PushToken\\Base' => __DIR__ . '/..' . '/api/php_services/src/PushToken/Base.php',
...@@ -166,14 +169,10 @@ class ComposerStaticInited946ede6e68f25941b9b85608fbe09a ...@@ -166,14 +169,10 @@ class ComposerStaticInited946ede6e68f25941b9b85608fbe09a
'Api\\PhpServices\\Session\\RedisSessionHandler' => __DIR__ . '/..' . '/api/php_services/src/Session/RedisSessionHandler.php', 'Api\\PhpServices\\Session\\RedisSessionHandler' => __DIR__ . '/..' . '/api/php_services/src/Session/RedisSessionHandler.php',
'Api\\PhpServices\\Session\\Session' => __DIR__ . '/..' . '/api/php_services/src/Session/Session.php', 'Api\\PhpServices\\Session\\Session' => __DIR__ . '/..' . '/api/php_services/src/Session/Session.php',
'Api\\PhpServices\\Session\\SessionManager' => __DIR__ . '/..' . '/api/php_services/src/Session/SessionManager.php', 'Api\\PhpServices\\Session\\SessionManager' => __DIR__ . '/..' . '/api/php_services/src/Session/SessionManager.php',
'Api\\PhpServices\\Subscribe\\Subscribe' => __DIR__ . '/..' . '/api/php_services/src/Subscribe/Subscribe.php',
'Api\\PhpServices\\Subscribe\\WeMediaSubscribe' => __DIR__ . '/..' . '/api/php_services/src/Subscribe/WeMediaSubscribe.php',
'Api\\PhpServices\\ThumbsUp\\ThumbsUp' => __DIR__ . '/..' . '/api/php_services/src/ThumbsUp/ThumbsUp.php',
'Api\\PhpServices\\ThumbsUp\\models\\ThumbsUp' => __DIR__ . '/..' . '/api/php_services/src/ThumbsUp/models/ThumbsUp.php',
'Api\\PhpServices\\Towerpro\\Towerpro' => __DIR__ . '/..' . '/api/php_services/src/Towerpro/Towerpro.php', 'Api\\PhpServices\\Towerpro\\Towerpro' => __DIR__ . '/..' . '/api/php_services/src/Towerpro/Towerpro.php',
'Api\\PhpServices\\Tuffy\\TuffyService' => __DIR__ . '/..' . '/api/php_services/src/Tuffy/TuffyService.php', 'Api\\PhpServices\\Tuffy\\TuffyService' => __DIR__ . '/..' . '/api/php_services/src/Tuffy/TuffyService.php',
'Api\\PhpServices\\UserInfo\\User' => __DIR__ . '/..' . '/api/php_services/src/UserInfo/User.php', 'Api\\PhpServices\\XhProfiler\\XhMongo' => __DIR__ . '/..' . '/api/php_services/src/XhProfiler/XhMongo.php',
'Api\\PhpServices\\WeMedia\\WeMediaService' => __DIR__ . '/..' . '/api/php_services/src/WeMedia/WeMediaService.php', 'Api\\PhpServices\\XhProfiler\\XhProfilerService' => __DIR__ . '/..' . '/api/php_services/src/XhProfiler/XhProfilerService.php',
'Api\\PhpUtils\\Cache\\ApcuUtil' => __DIR__ . '/..' . '/api/php_utils/src/Cache/ApcuUtil.php', 'Api\\PhpUtils\\Cache\\ApcuUtil' => __DIR__ . '/..' . '/api/php_utils/src/Cache/ApcuUtil.php',
'Api\\PhpUtils\\Cache\\CacheUtil' => __DIR__ . '/..' . '/api/php_utils/src/Cache/CacheUtil.php', 'Api\\PhpUtils\\Cache\\CacheUtil' => __DIR__ . '/..' . '/api/php_utils/src/Cache/CacheUtil.php',
'Api\\PhpUtils\\Common\\BaseConvert' => __DIR__ . '/..' . '/api/php_utils/src/Common/BaseConvert.php', 'Api\\PhpUtils\\Common\\BaseConvert' => __DIR__ . '/..' . '/api/php_utils/src/Common/BaseConvert.php',
...@@ -190,24 +189,16 @@ class ComposerStaticInited946ede6e68f25941b9b85608fbe09a ...@@ -190,24 +189,16 @@ class ComposerStaticInited946ede6e68f25941b9b85608fbe09a
'Api\\PhpUtils\\Hystrix\\ApcuStateStorage' => __DIR__ . '/..' . '/api/php_utils/src/Hystrix/ApcuStateStorage.php', 'Api\\PhpUtils\\Hystrix\\ApcuStateStorage' => __DIR__ . '/..' . '/api/php_utils/src/Hystrix/ApcuStateStorage.php',
'Api\\PhpUtils\\Hystrix\\DemoCommand' => __DIR__ . '/..' . '/api/php_utils/src/Hystrix/DemoCommand.php', 'Api\\PhpUtils\\Hystrix\\DemoCommand' => __DIR__ . '/..' . '/api/php_utils/src/Hystrix/DemoCommand.php',
'Api\\PhpUtils\\Hystrix\\Hystrix' => __DIR__ . '/..' . '/api/php_utils/src/Hystrix/Hystrix.php', 'Api\\PhpUtils\\Hystrix\\Hystrix' => __DIR__ . '/..' . '/api/php_utils/src/Hystrix/Hystrix.php',
'Api\\PhpUtils\\Kafka\\KafkaProducer' => __DIR__ . '/..' . '/api/php_utils/src/Kafka/KafkaProducer.php',
'Api\\PhpUtils\\Kafka\\KafkaUtil' => __DIR__ . '/..' . '/api/php_utils/src/Kafka/KafkaUtil.php', 'Api\\PhpUtils\\Kafka\\KafkaUtil' => __DIR__ . '/..' . '/api/php_utils/src/Kafka/KafkaUtil.php',
'Api\\PhpUtils\\Kafka\\Singleton' => __DIR__ . '/..' . '/api/php_utils/src/Kafka/Singleton.php', 'Api\\PhpUtils\\Ksy\\Ks3Util' => __DIR__ . '/..' . '/api/php_utils/src/Ksy/Ks3Util.php',
'Api\\PhpUtils\\Log\\DaemoLog' => __DIR__ . '/..' . '/api/php_utils/src/Log/DaemoLog.php', 'Api\\PhpUtils\\Log\\DaemonLog' => __DIR__ . '/..' . '/api/php_utils/src/Log/DaemonLog.php',
'Api\\PhpUtils\\Log\\FileLog' => __DIR__ . '/..' . '/api/php_utils/src/Log/FileLog.php', 'Api\\PhpUtils\\Log\\FileLog' => __DIR__ . '/..' . '/api/php_utils/src/Log/FileLog.php',
'Api\\PhpUtils\\Message\\Email' => __DIR__ . '/..' . '/api/php_utils/src/Message/Email.php', 'Api\\PhpUtils\\Message\\Email' => __DIR__ . '/..' . '/api/php_utils/src/Message/Email.php',
'Api\\PhpUtils\\Mon\\MonUtil' => __DIR__ . '/..' . '/api/php_utils/src/Mon/MonUtil.php', 'Api\\PhpUtils\\Mon\\MonUtil' => __DIR__ . '/..' . '/api/php_utils/src/Mon/MonUtil.php',
'Api\\PhpUtils\\Mongo\\Base' => __DIR__ . '/..' . '/api/php_utils/src/Mongo/Base.php',
'Api\\PhpUtils\\Mongo\\MongoBase' => __DIR__ . '/..' . '/api/php_utils/src/Mongo/MongoBase.php', 'Api\\PhpUtils\\Mongo\\MongoBase' => __DIR__ . '/..' . '/api/php_utils/src/Mongo/MongoBase.php',
'Api\\PhpUtils\\Mysql\\Base' => __DIR__ . '/..' . '/api/php_utils/src/Mysql/Base.php',
'Api\\PhpUtils\\Mysql\\DB' => __DIR__ . '/..' . '/api/php_utils/src/Mysql/DB.php',
'Api\\PhpUtils\\Mysql\\MysqlBase' => __DIR__ . '/..' . '/api/php_utils/src/Mysql/MysqlBase.php', 'Api\\PhpUtils\\Mysql\\MysqlBase' => __DIR__ . '/..' . '/api/php_utils/src/Mysql/MysqlBase.php',
'Api\\PhpUtils\\Mysql\\MysqlClusterBase' => __DIR__ . '/..' . '/api/php_utils/src/Mysql/MysqlClusterBase.php', 'Api\\PhpUtils\\Mysql\\MysqlClusterBase' => __DIR__ . '/..' . '/api/php_utils/src/Mysql/MysqlClusterBase.php',
'Api\\PhpUtils\\Mysql\\ReadDB' => __DIR__ . '/..' . '/api/php_utils/src/Mysql/ReadDB.php',
'Api\\PhpUtils\\Mysql\\WriteDB' => __DIR__ . '/..' . '/api/php_utils/src/Mysql/WriteDB.php',
'Api\\PhpUtils\\RabbitMq\\DelayRabbitMq' => __DIR__ . '/..' . '/api/php_utils/src/RabbitMq/DelayRabbitMq.php', 'Api\\PhpUtils\\RabbitMq\\DelayRabbitMq' => __DIR__ . '/..' . '/api/php_utils/src/RabbitMq/DelayRabbitMq.php',
'Api\\PhpUtils\\Redis\\Base' => __DIR__ . '/..' . '/api/php_utils/src/Redis/Base.php',
'Api\\PhpUtils\\Redis\\Codis' => __DIR__ . '/..' . '/api/php_utils/src/Redis/Codis.php',
'Api\\PhpUtils\\Redis\\RedisUtil' => __DIR__ . '/..' . '/api/php_utils/src/Redis/RedisUtil.php', 'Api\\PhpUtils\\Redis\\RedisUtil' => __DIR__ . '/..' . '/api/php_utils/src/Redis/RedisUtil.php',
'Api\\PhpUtils\\Validate\\Validate' => __DIR__ . '/..' . '/api/php_utils/src/Validate/Validate.php', 'Api\\PhpUtils\\Validate\\Validate' => __DIR__ . '/..' . '/api/php_utils/src/Validate/Validate.php',
'Api\\PhpUtils\\Validate\\ValidateRule' => __DIR__ . '/..' . '/api/php_utils/src/Validate/ValidateRule.php', 'Api\\PhpUtils\\Validate\\ValidateRule' => __DIR__ . '/..' . '/api/php_utils/src/Validate/ValidateRule.php',
...@@ -219,16 +210,28 @@ class ComposerStaticInited946ede6e68f25941b9b85608fbe09a ...@@ -219,16 +210,28 @@ class ComposerStaticInited946ede6e68f25941b9b85608fbe09a
'App\\Exception\\ExceptionHandler' => __DIR__ . '/../..' . '/application/exception/ExceptionHandler.php', 'App\\Exception\\ExceptionHandler' => __DIR__ . '/../..' . '/application/exception/ExceptionHandler.php',
'App\\Exception\\custom\\Code' => __DIR__ . '/../..' . '/application/exception/custom/Code.php', 'App\\Exception\\custom\\Code' => __DIR__ . '/../..' . '/application/exception/custom/Code.php',
'App\\Exception\\custom\\CodeSpecialException' => __DIR__ . '/../..' . '/application/exception/custom/CodeSpecialException.php', 'App\\Exception\\custom\\CodeSpecialException' => __DIR__ . '/../..' . '/application/exception/custom/CodeSpecialException.php',
'App\\Exception\\custom\\GoodsException' => __DIR__ . '/../..' . '/application/exception/custom/GoodsException.php',
'App\\Exception\\custom\\ParamException' => __DIR__ . '/../..' . '/application/exception/custom/ParamException.php', 'App\\Exception\\custom\\ParamException' => __DIR__ . '/../..' . '/application/exception/custom/ParamException.php',
'App\\Exception\\custom\\SignException' => __DIR__ . '/../..' . '/application/exception/custom/SignException.php', 'App\\Exception\\custom\\SignException' => __DIR__ . '/../..' . '/application/exception/custom/SignException.php',
'App\\Exception\\custom\\TestException' => __DIR__ . '/../..' . '/application/exception/custom/TestException.php', 'App\\Exception\\custom\\TestException' => __DIR__ . '/../..' . '/application/exception/custom/TestException.php',
'App\\Models\\demo\\mongo\\Test' => __DIR__ . '/../..' . '/application/models/demo/mongo/Test.php', 'App\\Models\\demo\\mongo\\Test' => __DIR__ . '/../..' . '/application/models/demo/mongo/Test.php',
'App\\Models\\demo\\mongo\\User' => __DIR__ . '/../..' . '/application/models/demo/mongo/User.php', 'App\\Models\\demo\\mongo\\User' => __DIR__ . '/../..' . '/application/models/demo/mongo/User.php',
'App\\Models\\demo\\mysql\\User' => __DIR__ . '/../..' . '/application/models/demo/mysql/User.php', 'App\\Models\\demo\\mysql\\User' => __DIR__ . '/../..' . '/application/models/demo/mysql/User.php',
'App\\Models\\goods\\mysql\\Category' => __DIR__ . '/../..' . '/application/models/goods/mysql/Category.php',
'App\\Models\\goods\\mysql\\GoodsOperationRecord' => __DIR__ . '/../..' . '/application/models/goods/mysql/GoodsOperationRecord.php',
'App\\Models\\goods\\mysql\\GoodsSku' => __DIR__ . '/../..' . '/application/models/goods/mysql/GoodsSku.php',
'App\\Models\\goods\\mysql\\GoodsSkuStores' => __DIR__ . '/../..' . '/application/models/goods/mysql/GoodsSkuStores.php',
'App\\Models\\goods\\mysql\\GoodsSnapshot' => __DIR__ . '/../..' . '/application/models/goods/mysql/GoodsSnapshot.php',
'App\\Models\\goods\\mysql\\GoodsSpu' => __DIR__ . '/../..' . '/application/models/goods/mysql/GoodsSpu.php',
'App\\Models\\goods\\mysql\\InventoryOperationRecord' => __DIR__ . '/../..' . '/application/models/goods/mysql/InventoryOperationRecord.php',
'App\\Models\\goods\\mysql\\Shop' => __DIR__ . '/../..' . '/application/models/goods/mysql/Shop.php',
'App\\Plugins\\Hook' => __DIR__ . '/../..' . '/application/plugins/Hook.php', 'App\\Plugins\\Hook' => __DIR__ . '/../..' . '/application/plugins/Hook.php',
'App\\Services\\demo\\ElasticService' => __DIR__ . '/../..' . '/application/services/demo/ElasticService.php', 'App\\Services\\demo\\ElasticService' => __DIR__ . '/../..' . '/application/services/demo/ElasticService.php',
'App\\Services\\demo\\MongoService' => __DIR__ . '/../..' . '/application/services/demo/MongoService.php', 'App\\Services\\demo\\MongoService' => __DIR__ . '/../..' . '/application/services/demo/MongoService.php',
'App\\Services\\demo\\MysqlService' => __DIR__ . '/../..' . '/application/services/demo/MysqlService.php', 'App\\Services\\demo\\MysqlService' => __DIR__ . '/../..' . '/application/services/demo/MysqlService.php',
'App\\Services\\goods\\CategoryService' => __DIR__ . '/../..' . '/application/services/goods/CategoryService.php',
'App\\Services\\goods\\ElasticService' => __DIR__ . '/../..' . '/application/services/goods/ElasticService.php',
'App\\Services\\goods\\GoodsService' => __DIR__ . '/../..' . '/application/services/goods/GoodsService.php',
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
'Daemon\\Test' => __DIR__ . '/../..' . '/daemon/Test.php', 'Daemon\\Test' => __DIR__ . '/../..' . '/daemon/Test.php',
'Elasticsearch\\Client' => __DIR__ . '/..' . '/elasticsearch/elasticsearch/src/Elasticsearch/Client.php', 'Elasticsearch\\Client' => __DIR__ . '/..' . '/elasticsearch/elasticsearch/src/Elasticsearch/Client.php',
...@@ -894,14 +897,33 @@ class ComposerStaticInited946ede6e68f25941b9b85608fbe09a ...@@ -894,14 +897,33 @@ class ComposerStaticInited946ede6e68f25941b9b85608fbe09a
'React\\Promise\\PromisorInterface' => __DIR__ . '/..' . '/react/promise/src/PromisorInterface.php', 'React\\Promise\\PromisorInterface' => __DIR__ . '/..' . '/react/promise/src/PromisorInterface.php',
'React\\Promise\\RejectedPromise' => __DIR__ . '/..' . '/react/promise/src/RejectedPromise.php', 'React\\Promise\\RejectedPromise' => __DIR__ . '/..' . '/react/promise/src/RejectedPromise.php',
'React\\Promise\\UnhandledRejectionException' => __DIR__ . '/..' . '/react/promise/src/UnhandledRejectionException.php', 'React\\Promise\\UnhandledRejectionException' => __DIR__ . '/..' . '/react/promise/src/UnhandledRejectionException.php',
'Xhgui\\Profiler\\Exception\\ProfilerException' => __DIR__ . '/..' . '/perftools/php-profiler/src/Exception/ProfilerException.php',
'Xhgui\\Profiler\\Profiler' => __DIR__ . '/..' . '/perftools/php-profiler/src/Profiler.php',
'Xhgui\\Profiler\\ProfilerFactory' => __DIR__ . '/..' . '/perftools/php-profiler/src/ProfilerFactory.php',
'Xhgui\\Profiler\\Profilers\\AbstractProfiler' => __DIR__ . '/..' . '/perftools/php-profiler/src/Profilers/AbstractProfiler.php',
'Xhgui\\Profiler\\Profilers\\ProfilerInterface' => __DIR__ . '/..' . '/perftools/php-profiler/src/Profilers/ProfilerInterface.php',
'Xhgui\\Profiler\\Profilers\\Tideways' => __DIR__ . '/..' . '/perftools/php-profiler/src/Profilers/Tideways.php',
'Xhgui\\Profiler\\Profilers\\TidewaysXHProf' => __DIR__ . '/..' . '/perftools/php-profiler/src/Profilers/TidewaysXHProf.php',
'Xhgui\\Profiler\\Profilers\\UProfiler' => __DIR__ . '/..' . '/perftools/php-profiler/src/Profilers/UProfiler.php',
'Xhgui\\Profiler\\Profilers\\XHProf' => __DIR__ . '/..' . '/perftools/php-profiler/src/Profilers/XHProf.php',
'Xhgui\\Profiler\\ProfilingData' => __DIR__ . '/..' . '/perftools/php-profiler/src/ProfilingData.php',
'Xhgui\\Profiler\\ProfilingFlags' => __DIR__ . '/..' . '/perftools/php-profiler/src/ProfilingFlags.php',
'Xhgui\\Profiler\\SaverFactory' => __DIR__ . '/..' . '/perftools/php-profiler/src/SaverFactory.php',
'Xhgui\\Profiler\\Saver\\AbstractSaver' => __DIR__ . '/..' . '/perftools/php-profiler/src/Saver/AbstractSaver.php',
'Xhgui\\Profiler\\Saver\\FileSaver' => __DIR__ . '/..' . '/perftools/php-profiler/src/Saver/FileSaver.php',
'Xhgui\\Profiler\\Saver\\MongoSaver' => __DIR__ . '/..' . '/perftools/php-profiler/src/Saver/MongoSaver.php',
'Xhgui\\Profiler\\Saver\\PdoSaver' => __DIR__ . '/..' . '/perftools/php-profiler/src/Saver/PdoSaver.php',
'Xhgui\\Profiler\\Saver\\SaverInterface' => __DIR__ . '/..' . '/perftools/php-profiler/src/Saver/SaverInterface.php',
'Xhgui\\Profiler\\Saver\\StackSaver' => __DIR__ . '/..' . '/perftools/php-profiler/src/Saver/StackSaver.php',
'Xhgui\\Profiler\\Saver\\UploadSaver' => __DIR__ . '/..' . '/perftools/php-profiler/src/Saver/UploadSaver.php',
); );
public static function getInitializer(ClassLoader $loader) public static function getInitializer(ClassLoader $loader)
{ {
return \Closure::bind(function () use ($loader) { return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInited946ede6e68f25941b9b85608fbe09a::$prefixLengthsPsr4; $loader->prefixLengthsPsr4 = ComposerStaticInit1ac03c60750dc59c6c21518ecbd0a3fd::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInited946ede6e68f25941b9b85608fbe09a::$prefixDirsPsr4; $loader->prefixDirsPsr4 = ComposerStaticInit1ac03c60750dc59c6c21518ecbd0a3fd::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInited946ede6e68f25941b9b85608fbe09a::$classMap; $loader->classMap = ComposerStaticInit1ac03c60750dc59c6c21518ecbd0a3fd::$classMap;
}, null, ClassLoader::class); }, null, ClassLoader::class);
} }
......
...@@ -6,14 +6,15 @@ ...@@ -6,14 +6,15 @@
"version_normalized": "dev-master", "version_normalized": "dev-master",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://git.yidian-inc.com:8021/api0/php_services.git", "url": "https://git.yidian-inc.com:8021/bp/php_services.git",
"reference": "1a73d985fc0743343751d4aad8e34cc3bc7f12bc" "reference": "d844921e94a920bf28fc1427851edbec63d78501"
}, },
"require": { "require": {
"api/php_utils": "dev-master", "api/php_utils": "dev-master",
"perftools/php-profiler": "^0.18.0",
"php": ">=7.2" "php": ">=7.2"
}, },
"time": "2021-06-04T02:02:53+00:00", "time": "2021-06-16T09:09:58+00:00",
"default-branch": true, "default-branch": true,
"type": "library", "type": "library",
"installation-source": "source", "installation-source": "source",
...@@ -22,7 +23,7 @@ ...@@ -22,7 +23,7 @@
"Api\\PhpServices\\": "src/" "Api\\PhpServices\\": "src/"
} }
}, },
"description": "api php_services", "description": "bp api php_services",
"install-path": "../api/php_services" "install-path": "../api/php_services"
}, },
{ {
...@@ -31,8 +32,8 @@ ...@@ -31,8 +32,8 @@
"version_normalized": "dev-master", "version_normalized": "dev-master",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://git.yidian-inc.com:8021/api0/php_utils.git", "url": "https://git.yidian-inc.com:8021/bp/php_utils.git",
"reference": "8ea0f5ec5e1c909fa76ec171e8698a4622aaec5a" "reference": "94bec4fc5b52829a32f22a40d283faa4f2b596de"
}, },
"require": { "require": {
"catfan/medoo": "1.7.10", "catfan/medoo": "1.7.10",
...@@ -45,7 +46,7 @@ ...@@ -45,7 +46,7 @@
"mongodb/mongodb": "1.4.3", "mongodb/mongodb": "1.4.3",
"php": ">=7.2" "php": ">=7.2"
}, },
"time": "2021-06-03T09:25:37+00:00", "time": "2021-06-16T09:15:06+00:00",
"default-branch": true, "default-branch": true,
"type": "library", "type": "library",
"installation-source": "source", "installation-source": "source",
...@@ -54,7 +55,7 @@ ...@@ -54,7 +55,7 @@
"Api\\PhpUtils\\": "src/" "Api\\PhpUtils\\": "src/"
} }
}, },
"description": "api php_utils", "description": "bp api php_utils",
"install-path": "../api/php_utils" "install-path": "../api/php_utils"
}, },
{ {
...@@ -70,13 +71,7 @@ ...@@ -70,13 +71,7 @@
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/catfan/Medoo/zipball/2d675f73e23f63bbaeb9a8aa33318659a3d3c32f", "url": "https://api.github.com/repos/catfan/Medoo/zipball/2d675f73e23f63bbaeb9a8aa33318659a3d3c32f",
"reference": "2d675f73e23f63bbaeb9a8aa33318659a3d3c32f", "reference": "2d675f73e23f63bbaeb9a8aa33318659a3d3c32f",
"shasum": "", "shasum": ""
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
}, },
"require": { "require": {
"ext-pdo": "*", "ext-pdo": "*",
...@@ -330,13 +325,7 @@ ...@@ -330,13 +325,7 @@
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/f4db5a78a5ea468d4831de7f0bf9d9415e348699", "url": "https://api.github.com/repos/guzzle/guzzle/zipball/f4db5a78a5ea468d4831de7f0bf9d9415e348699",
"reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699", "reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699",
"shasum": "", "shasum": ""
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
}, },
"require": { "require": {
"guzzlehttp/promises": "^1.0", "guzzlehttp/promises": "^1.0",
...@@ -408,13 +397,7 @@ ...@@ -408,13 +397,7 @@
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/guzzle/promises/zipball/8e7d04f1f6450fef59366c399cfad4b9383aa30d", "url": "https://api.github.com/repos/guzzle/promises/zipball/8e7d04f1f6450fef59366c399cfad4b9383aa30d",
"reference": "8e7d04f1f6450fef59366c399cfad4b9383aa30d", "reference": "8e7d04f1f6450fef59366c399cfad4b9383aa30d",
"shasum": "", "shasum": ""
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
}, },
"require": { "require": {
"php": ">=5.5" "php": ">=5.5"
...@@ -473,13 +456,7 @@ ...@@ -473,13 +456,7 @@
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/dc960a912984efb74d0a90222870c72c87f10c91", "url": "https://api.github.com/repos/guzzle/psr7/zipball/dc960a912984efb74d0a90222870c72c87f10c91",
"reference": "dc960a912984efb74d0a90222870c72c87f10c91", "reference": "dc960a912984efb74d0a90222870c72c87f10c91",
"shasum": "", "shasum": ""
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
}, },
"require": { "require": {
"php": ">=5.4.0", "php": ">=5.4.0",
...@@ -557,13 +534,7 @@ ...@@ -557,13 +534,7 @@
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/mongodb/mongo-php-library/zipball/18fca8cc8d0c2cc07f76605760d20632bb3dab96", "url": "https://api.github.com/repos/mongodb/mongo-php-library/zipball/18fca8cc8d0c2cc07f76605760d20632bb3dab96",
"reference": "18fca8cc8d0c2cc07f76605760d20632bb3dab96", "reference": "18fca8cc8d0c2cc07f76605760d20632bb3dab96",
"shasum": "", "shasum": ""
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
}, },
"require": { "require": {
"ext-hash": "*", "ext-hash": "*",
...@@ -617,6 +588,71 @@ ...@@ -617,6 +588,71 @@
}, },
"install-path": "../mongodb/mongodb" "install-path": "../mongodb/mongodb"
}, },
{
"name": "perftools/php-profiler",
"version": "0.18.0",
"version_normalized": "0.18.0.0",
"source": {
"type": "git",
"url": "https://github.com/perftools/php-profiler.git",
"reference": "794c435f615ab9ca4347e386b4d8c6524fe9e3ae"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/perftools/php-profiler/zipball/794c435f615ab9ca4347e386b4d8c6524fe9e3ae",
"reference": "794c435f615ab9ca4347e386b4d8c6524fe9e3ae",
"shasum": ""
},
"require": {
"ext-json": "*",
"php": "^5.3.0 || ^7.0 || ^8.0"
},
"conflict": {
"perftools/xhgui-collector": "<1.8"
},
"require-dev": {
"alcaeus/mongo-php-adapter": "^1.1",
"perftools/xhgui-collector": "^1.8"
},
"suggest": {
"alcaeus/mongo-php-adapter": "Adapter to provide ext-mongo interface on top of mongo-php-library (PHP>=5.6)",
"ext-curl": "cURL extension for upload saver",
"ext-mongo": "mongo extension (PHP>=5.3,<7.0)",
"ext-mongodb": "mongodb extension (PHP>=5.4)",
"ext-tideways": "Use tideways to profile",
"ext-uprofiler": "Use uprofiler to profile",
"ext-xhprof": "Use xhprof to profile",
"perftools/xhgui-collector": "For mongodb or pdo savers"
},
"time": "2021-01-21T17:55:51+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"Xhgui\\Profiler\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Lauri Piisang",
"email": "lauri.piisang@eesti.ee"
},
{
"name": "Elan Ruusamäe",
"email": "glen@pld-linux.org"
}
],
"description": "PHP Profiling based on XHGUI",
"support": {
"issues": "https://github.com/perftools/php-profiler/issues",
"source": "https://github.com/perftools/php-profiler/tree/0.18.0"
},
"install-path": "../perftools/php-profiler"
},
{ {
"name": "psr/http-message", "name": "psr/http-message",
"version": "dev-master", "version": "dev-master",
...@@ -630,13 +666,7 @@ ...@@ -630,13 +666,7 @@
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/php-fig/http-message/zipball/efd67d1dc14a7ef4fc4e518e7dee91c271d524e4", "url": "https://api.github.com/repos/php-fig/http-message/zipball/efd67d1dc14a7ef4fc4e518e7dee91c271d524e4",
"reference": "efd67d1dc14a7ef4fc4e518e7dee91c271d524e4", "reference": "efd67d1dc14a7ef4fc4e518e7dee91c271d524e4",
"shasum": "", "shasum": ""
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
}, },
"require": { "require": {
"php": ">=5.3.0" "php": ">=5.3.0"
...@@ -747,13 +777,7 @@ ...@@ -747,13 +777,7 @@
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822",
"reference": "120b605dfeb996808c31b6477290a714d356e822", "reference": "120b605dfeb996808c31b6477290a714d356e822",
"shasum": "", "shasum": ""
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
}, },
"require": { "require": {
"php": ">=5.6" "php": ">=5.6"
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
'aliases' => 'aliases' =>
array ( array (
), ),
'reference' => 'edf34efd699a9adb743ae22e7e4d1afe0e44a01a', 'reference' => 'd4137182c34400313923cd9c6371f57874a58299',
'name' => 'yidian/yaf_demo', 'name' => 'yidian/yaf_demo',
), ),
'versions' => 'versions' =>
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
array ( array (
0 => '9999999-dev', 0 => '9999999-dev',
), ),
'reference' => '1a73d985fc0743343751d4aad8e34cc3bc7f12bc', 'reference' => 'd844921e94a920bf28fc1427851edbec63d78501',
), ),
'api/php_utils' => 'api/php_utils' =>
array ( array (
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
array ( array (
0 => '9999999-dev', 0 => '9999999-dev',
), ),
'reference' => '8ea0f5ec5e1c909fa76ec171e8698a4622aaec5a', 'reference' => '94bec4fc5b52829a32f22a40d283faa4f2b596de',
), ),
'catfan/medoo' => 'catfan/medoo' =>
array ( array (
...@@ -106,6 +106,15 @@ ...@@ -106,6 +106,15 @@
), ),
'reference' => '18fca8cc8d0c2cc07f76605760d20632bb3dab96', 'reference' => '18fca8cc8d0c2cc07f76605760d20632bb3dab96',
), ),
'perftools/php-profiler' =>
array (
'pretty_version' => '0.18.0',
'version' => '0.18.0.0',
'aliases' =>
array (
),
'reference' => '794c435f615ab9ca4347e386b4d8c6524fe9e3ae',
),
'psr/http-message' => 'psr/http-message' =>
array ( array (
'pretty_version' => 'dev-master', 'pretty_version' => 'dev-master',
...@@ -158,7 +167,7 @@ ...@@ -158,7 +167,7 @@
'aliases' => 'aliases' =>
array ( array (
), ),
'reference' => 'edf34efd699a9adb743ae22e7e4d1afe0e44a01a', 'reference' => 'd4137182c34400313923cd9c6371f57874a58299',
), ),
), ),
); );
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment