Commit 797ba4df authored by luhongguang's avatar luhongguang

update:调整商品sku_id

parent c50cb0e3
...@@ -8,6 +8,7 @@ use Api\PhpServices\Idgen\Idgen; ...@@ -8,6 +8,7 @@ use Api\PhpServices\Idgen\Idgen;
use Api\PhpServices\Ksy\Ksyun; use Api\PhpServices\Ksy\Ksyun;
use Api\PhpServices\Sensitive\Sensitive; use Api\PhpServices\Sensitive\Sensitive;
use Api\PhpUtils\Common\BaseConvert; use Api\PhpUtils\Common\BaseConvert;
use Api\PhpUtils\Common\GoodsSkuId;
use App\Exception\custom\GoodsException; use App\Exception\custom\GoodsException;
use App\Models\goods\mysql\Category; use App\Models\goods\mysql\Category;
use App\Models\goods\mysql\GoodsOperationRecord; use App\Models\goods\mysql\GoodsOperationRecord;
...@@ -65,8 +66,8 @@ class GoodsService ...@@ -65,8 +66,8 @@ class GoodsService
"merchant_id" => $params["merchant_id"], "merchant_id" => $params["merchant_id"],
]; ];
$shopId = self::addShop($lifeAccount); $shopId = self::addShop($lifeAccount);
$spuId = self::addGoodsSpu($shopId, $params); $spuData = self::addGoodsSpu($shopId, $params);
$skuId = self::addGoodsSku($spuId, $shopId, $params); $skuId = self::addGoodsSku($spuData, $shopId, $params);
//商品操作记录 //商品操作记录
$res = self::getSnowIdgenId("goods"); $res = self::getSnowIdgenId("goods");
...@@ -75,7 +76,7 @@ class GoodsService ...@@ -75,7 +76,7 @@ class GoodsService
} }
$record = [ $record = [
"goods_operation_record_id" => $res[0], "goods_operation_record_id" => $res[0],
"goods_spu_id" => $spuId, "goods_spu_id" => $spuData["goods_spu_id"],
"goods_sku_id" => $skuId, "goods_sku_id" => $skuId,
"operator_id" => $params["user_id"], "operator_id" => $params["user_id"],
"operator_name" => $params["user_name"], "operator_name" => $params["user_name"],
...@@ -112,7 +113,8 @@ class GoodsService ...@@ -112,7 +113,8 @@ class GoodsService
if (!$checkName["can_use"]) { if (!$checkName["can_use"]) {
throw new GoodsException(['cus' => 17]); throw new GoodsException(['cus' => 17]);
} }
GoodsSpu::save([
$spuParams = [
"goods_spu_id" => $spuId, "goods_spu_id" => $spuId,
"shop_id" => $shopId, "shop_id" => $shopId,
"life_account_id" => $spuData["life_account_id"], "life_account_id" => $spuData["life_account_id"],
...@@ -126,8 +128,9 @@ class GoodsService ...@@ -126,8 +128,9 @@ class GoodsService
"rule_limit" => $spuData["rule_limit"], "rule_limit" => $spuData["rule_limit"],
"rule_desc" => $spuData["rule_desc"], "rule_desc" => $spuData["rule_desc"],
"rule_refund" => $spuData["rule_refund"], "rule_refund" => $spuData["rule_refund"],
]); ];
return $spuId; GoodsSpu::save($spuParams);
return $spuParams;
} }
/** /**
...@@ -138,13 +141,13 @@ class GoodsService ...@@ -138,13 +141,13 @@ class GoodsService
* @return mixed * @return mixed
* @throws GoodsException * @throws GoodsException
*/ */
private static function addGoodsSku($spuId, $shopId, $skuData = []) private static function addGoodsSku($spuData, $shopId, $skuData = [])
{ {
$res = self::getIdgenId(substr($shopId, -2), "goods"); $res = self::getIdgenId(substr($shopId, -2), "goods");
if (empty($res)) { if (empty($res)) {
throw new GoodsException(['cus' => 2]); throw new GoodsException(['cus' => 2]);
} }
$skuId = $res[0]; $skuId = GoodsSkuId::generateGoodSkuId($res[0], $skuData["category_1_id"], $skuData["category_2_id"], $spuData["type"]);
if ($skuData["expiration_time"] < date("Y-m-d H:i:s")) { if ($skuData["expiration_time"] < date("Y-m-d H:i:s")) {
throw new GoodsException(['cus' => 16]); throw new GoodsException(['cus' => 16]);
...@@ -168,7 +171,7 @@ class GoodsService ...@@ -168,7 +171,7 @@ class GoodsService
$skuParams = [ $skuParams = [
"goods_sku_id" => $skuId, "goods_sku_id" => $skuId,
"goods_spu_id" => $spuId, "goods_spu_id" => $spuData["goods_spu_id"],
"life_account_id" => $skuData["life_account_id"], "life_account_id" => $skuData["life_account_id"],
"shop_id" => $shopId, "shop_id" => $shopId,
"user_id" => $skuData["user_id"], "user_id" => $skuData["user_id"],
...@@ -626,8 +629,7 @@ class GoodsService ...@@ -626,8 +629,7 @@ class GoodsService
public static function getGoodsSkuInfo($params = []) public static function getGoodsSkuInfo($params = [])
{ {
$data = []; $data = [];
$goodsSkuId = BaseConvert::otherToDec($params["goods_sku_id"]); $goodsSku = GoodsSku::get("*", ["goods_sku_id" => $params["goods_sku_id"]]);
$goodsSku = GoodsSku::get("*", ["goods_sku_id" => $goodsSkuId]);
if (empty($goodsSku)) { if (empty($goodsSku)) {
throw new GoodsException(["cus" => 15]); throw new GoodsException(["cus" => 15]);
} }
...@@ -843,8 +845,7 @@ class GoodsService ...@@ -843,8 +845,7 @@ class GoodsService
public static function getGoodsRealTimeInfo($params) public static function getGoodsRealTimeInfo($params)
{ {
$data = []; $data = [];
$goodsSkuId = BaseConvert::otherToDec($params["goods_sku_id"]); $goodsSku = GoodsSku::get("*", ["goods_sku_id" => $params["goods_sku_id"], "version" => $params["version"]]);
$goodsSku = GoodsSku::get("*", ["goods_sku_id" => $goodsSkuId, "version" => $params["version"]]);
if (empty($goodsSku)) { if (empty($goodsSku)) {
throw new GoodsException(["cus" => 15]); throw new GoodsException(["cus" => 15]);
} }
...@@ -864,8 +865,7 @@ class GoodsService ...@@ -864,8 +865,7 @@ class GoodsService
public static function getGoodsSnapshotInfo($params) public static function getGoodsSnapshotInfo($params)
{ {
$data = []; $data = [];
$goodsSkuId = BaseConvert::otherToDec($params["goods_sku_id"]); $goodsSnapshot = GoodsSnapshot::getRecord(["goods_sku_id" => $params["goods_sku_id"], "version" => $params["version"]]);
$goodsSnapshot = GoodsSnapshot::getRecord(["goods_sku_id" => $goodsSkuId, "version" => $params["version"]]);
if (empty($goodsSnapshot)) { if (empty($goodsSnapshot)) {
throw new GoodsException(["cus" => 23]); throw new GoodsException(["cus" => 23]);
} }
...@@ -909,8 +909,7 @@ class GoodsService ...@@ -909,8 +909,7 @@ class GoodsService
public static function checkGoodsMarketing($params) public static function checkGoodsMarketing($params)
{ {
$data = []; $data = [];
$goodsSkuId = BaseConvert::otherToDec($params["goods_sku_id"]); $goodsSku = GoodsSku::get("*", ["goods_sku_id" => $params["goods_sku_id"], "version" => $params["version"]]);
$goodsSku = GoodsSku::get("*", ["goods_sku_id" => $goodsSkuId, "version" => $params["version"]]);
if (empty($goodsSku)) { if (empty($goodsSku)) {
throw new GoodsException(["cus" => 15]); throw new GoodsException(["cus" => 15]);
} }
......
...@@ -16,14 +16,12 @@ class TccService ...@@ -16,14 +16,12 @@ class TccService
/** /**
* 下单 商品tcc try * 下单 商品tcc try
* @param $encryptGoodsSkuId * @param $goodsSkuId
* @param $tid * @param $tid
* @return int * @return int
*/ */
public static function placeAnOrderTry($encryptGoodsSkuId, $tid) public static function placeAnOrderTry($goodsSkuId, $tid)
{ {
$goodsSkuId = BaseConvert::otherToDec($encryptGoodsSkuId);
$tccInfo = Tcc::getRecordMaster(["t_id" => $tid, "goods_sku_id" => $goodsSkuId, "status" => Tcc::STATUS_TRY]); $tccInfo = Tcc::getRecordMaster(["t_id" => $tid, "goods_sku_id" => $goodsSkuId, "status" => Tcc::STATUS_TRY]);
//有结果返回原来的结果,幂等 //有结果返回原来的结果,幂等
if (!empty($tccInfo)) { if (!empty($tccInfo)) {
...@@ -88,14 +86,12 @@ class TccService ...@@ -88,14 +86,12 @@ class TccService
/** /**
* 下单 商品tcc confirm * 下单 商品tcc confirm
* @param $encryptGoodsSkuId * @param $goodsSkuId
* @param $tid * @param $tid
* @return int * @return int
*/ */
public static function placeAnOrderConfirm($encryptGoodsSkuId, $tid) public static function placeAnOrderConfirm($goodsSkuId, $tid)
{ {
$goodsSkuId = BaseConvert::otherToDec($encryptGoodsSkuId);
$tccInfo = Tcc::getRecordMaster(["t_id" => $tid, "goods_sku_id" => $goodsSkuId, "status" => Tcc::STATUS_CONFIRM]); $tccInfo = Tcc::getRecordMaster(["t_id" => $tid, "goods_sku_id" => $goodsSkuId, "status" => Tcc::STATUS_CONFIRM]);
//有结果返回原来的结果,幂等 //有结果返回原来的结果,幂等
if (!empty($tccInfo)) { if (!empty($tccInfo)) {
...@@ -165,14 +161,12 @@ class TccService ...@@ -165,14 +161,12 @@ class TccService
/** /**
* 下单 商品tcc cancel * 下单 商品tcc cancel
* @param $encryptGoodsSkuId * @param $goodsSkuId
* @param $tid * @param $tid
* @return int * @return int
*/ */
public static function placeAnOrderCancel($encryptGoodsSkuId, $tid) public static function placeAnOrderCancel($goodsSkuId, $tid)
{ {
$goodsSkuId = BaseConvert::otherToDec($encryptGoodsSkuId);
$tccInfo = Tcc::getRecordMaster(["t_id" => $tid, "goods_sku_id" => $goodsSkuId, "status" => Tcc::STATUS_CANCEL]); $tccInfo = Tcc::getRecordMaster(["t_id" => $tid, "goods_sku_id" => $goodsSkuId, "status" => Tcc::STATUS_CANCEL]);
//有结果返回原来的结果,幂等 //有结果返回原来的结果,幂等
if (!empty($tccInfo)) { if (!empty($tccInfo)) {
...@@ -242,14 +236,12 @@ class TccService ...@@ -242,14 +236,12 @@ class TccService
/** /**
* 取消订单单 商品tcc try * 取消订单单 商品tcc try
* @param $encryptGoodsSkuId * @param $goodsSkuId
* @param $tid * @param $tid
* @return int * @return int
*/ */
public static function cancelOrderTry($encryptGoodsSkuId, $tid) public static function cancelOrderTry($goodsSkuId, $tid)
{ {
$goodsSkuId = BaseConvert::otherToDec($encryptGoodsSkuId);
$tccInfo = Tcc::getRecordMaster(["t_id" => $tid, "goods_sku_id" => $goodsSkuId, "status" => Tcc::STATUS_TRY]); $tccInfo = Tcc::getRecordMaster(["t_id" => $tid, "goods_sku_id" => $goodsSkuId, "status" => Tcc::STATUS_TRY]);
//有结果返回原来的结果,幂等 //有结果返回原来的结果,幂等
if (!empty($tccInfo)) { if (!empty($tccInfo)) {
...@@ -313,14 +305,12 @@ class TccService ...@@ -313,14 +305,12 @@ class TccService
/** /**
* 取消订单单 商品tcc confirm * 取消订单单 商品tcc confirm
* @param $encryptGoodsSkuId * @param $goodsSkuId
* @param $tid * @param $tid
* @return int * @return int
*/ */
public static function cancelOrderConfirm($encryptGoodsSkuId, $tid) public static function cancelOrderConfirm($goodsSkuId, $tid)
{ {
$goodsSkuId = BaseConvert::otherToDec($encryptGoodsSkuId);
$tccInfo = Tcc::getRecordMaster(["t_id" => $tid, "goods_sku_id" => $goodsSkuId, "status" => Tcc::STATUS_CONFIRM]); $tccInfo = Tcc::getRecordMaster(["t_id" => $tid, "goods_sku_id" => $goodsSkuId, "status" => Tcc::STATUS_CONFIRM]);
//有结果返回原来的结果,幂等 //有结果返回原来的结果,幂等
if (!empty($tccInfo)) { if (!empty($tccInfo)) {
...@@ -390,14 +380,12 @@ class TccService ...@@ -390,14 +380,12 @@ class TccService
/** /**
* 取消订单单 商品tcc cancel * 取消订单单 商品tcc cancel
* @param $encryptGoodsSkuId * @param $goodsSkuId
* @param $tid * @param $tid
* @return int * @return int
*/ */
public static function cancelOrderCancel($encryptGoodsSkuId, $tid) public static function cancelOrderCancel($goodsSkuId, $tid)
{ {
$goodsSkuId = BaseConvert::otherToDec($encryptGoodsSkuId);
$tccInfo = Tcc::getRecordMaster(["t_id" => $tid, "goods_sku_id" => $goodsSkuId, "status" => Tcc::STATUS_CANCEL]); $tccInfo = Tcc::getRecordMaster(["t_id" => $tid, "goods_sku_id" => $goodsSkuId, "status" => Tcc::STATUS_CANCEL]);
//有结果返回原来的结果,幂等 //有结果返回原来的结果,幂等
if (!empty($tccInfo)) { if (!empty($tccInfo)) {
...@@ -467,14 +455,12 @@ class TccService ...@@ -467,14 +455,12 @@ class TccService
/** /**
* 判断一个tcc是否完成 * 判断一个tcc是否完成
* @param $encryptGoodsSkuId * @param $goodsSkuId
* @param $tid * @param $tid
* @return int * @return int
*/ */
public static function tccIsFinish($encryptGoodsSkuId, $tid) public static function tccIsFinish($goodsSkuId, $tid)
{ {
$goodsSkuId = BaseConvert::otherToDec($encryptGoodsSkuId);
$tccInfo = Tcc::getRecord([ $tccInfo = Tcc::getRecord([
"t_id" => $tid, "t_id" => $tid,
"goods_sku_id" => $goodsSkuId, "goods_sku_id" => $goodsSkuId,
......
<?php
namespace Api\PhpUtils\Common;
class GoodsSkuId
{
/**
* 生成加密后的 sku_id
* id 非雪花算法生成的sku_id
* category_1_id 一级分类的id,两位,不足两位在十位补零
* category_2_id 二级分类的id,两位,不足三位在百位补零
* spu 商品类型,1虚拟商品,2实体商品
*
* @param $id
* @param $category1Id
* @param $category2Id
* @param $spuType
* @return string
*/
public static function generateGoodSkuId($id, $category1Id, $category2Id, $spuType)
{
if (strlen($category1Id) == 1) {
$category1Id = "0" . $category1Id;
}
if (strlen($category2Id) == 2) {
$category2Id = "0" . $category2Id;
}
$idStr = $id . $category1Id . $category2Id . $spuType;
//转62进制
$tmp = BaseConvert::decToOther($idStr);
$len = strlen($tmp);
$len = $len < 6 ? 6 : $len;
if ($len % 2 == 1) {
$tmp = '0' . $tmp;
$len += 1;
}
$tmp = str_pad(strval($tmp), $len < 6 ? 6 : $len, '0', STR_PAD_LEFT);
$sum = 0;
for ($i = 0; $i < $len / 2; $i++) {
$sum *= 137;
$sum += ord($tmp[$i]) ^ ord($tmp[$len - $i - 1]);
}
$code = '';
$base = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
for ($i = 2; $i > 0; $i--) {
$idx = $sum % 62;
$sum = ($sum - $idx) / 62;
$code = $base[$idx] . $code;
}
return $tmp . $code;
}
}
\ No newline at end of file
...@@ -84,20 +84,30 @@ class MonUtil{ ...@@ -84,20 +84,30 @@ class MonUtil{
return $result; return $result;
} }
/**
public static function mongoMon($mysql_host,$operator,$request_time = -799) * @param $db_host string 链接数据的集群
* @param $operator string 数据库操作
* @param $db_name string 数据库名字 比如mysql ,mongodb
* @param int $request_time
*/
public static function dbMon($db_host,$operator,$db_name,$request_time = -799)
{ {
if ( empty($operator) || !is_string($db_host) || empty($db_name)) {
if (empty($mysql_host) || empty($operator)) {
return ; return ;
} }
if (empty($db_host)) {
$host = 'unknow';
} else {
$host = str_replace(array(".", ":", "/"),array("_", "_", "-"), $db_host);
}
//记录请求量 //记录请求量
self::counting('mongodb.'.$mysql_host , (string)$operator,0) . "\n"; self::counting($db_name.'.'.$host,(string)$operator,1);
//耗时打点 //耗时打点
if(!empty($request_time) && is_numeric($request_time) && $request_time != -799){ if(!empty($request_time) && is_numeric($request_time) && $request_time != -799){
$result = self::timing((string)('mongodb.'.$mysql_host.$operator), "TotalTime", $request_time); $result = self::timing(($db_name.'.'.$host.$operator), "TotalTime", $request_time);
} }
} }
......
...@@ -42,6 +42,7 @@ abstract class MongoBase ...@@ -42,6 +42,7 @@ abstract class MongoBase
private $client = null; private $client = null;
private $database = null; private $database = null;
private $collection = null; private $collection = null;
private $host = 'unknow';
const W = 1; // 要求进行写入确认 const W = 1; // 要求进行写入确认
const WTIMEOUTMS = 1000; // 写入关注超时时间 const WTIMEOUTMS = 1000; // 写入关注超时时间
const MAXTIMEMS = 100; //最大执行时间,毫秒 const MAXTIMEMS = 100; //最大执行时间,毫秒
...@@ -65,6 +66,7 @@ abstract class MongoBase ...@@ -65,6 +66,7 @@ abstract class MongoBase
{ {
$conf = config('mongo', $this->getConfigIndex()); $conf = config('mongo', $this->getConfigIndex());
if (!empty($conf)) { if (!empty($conf)) {
$this->host = $conf['host'];
$uriOptions = []; $uriOptions = [];
$driverOptions = []; $driverOptions = [];
if (isset($conf['uriOptions'])) { if (isset($conf['uriOptions'])) {
...@@ -215,7 +217,7 @@ abstract class MongoBase ...@@ -215,7 +217,7 @@ abstract class MongoBase
$start_time = microtime(true); $start_time = microtime(true);
$res = $this->collection->insertOne($document, $options); $res = $this->collection->insertOne($document, $options);
$end_time = microtime(true); $end_time = microtime(true);
MonUtil::mongoMon($this->client->getManager()->getServers(),'insertOne',$end_time-$start_time); MonUtil::dbMon($this->host ?? 'unknow','insertOne','mongodb',$end_time-$start_time);
return $res; return $res;
} }
...@@ -239,7 +241,7 @@ abstract class MongoBase ...@@ -239,7 +241,7 @@ abstract class MongoBase
$start_time = microtime(true); $start_time = microtime(true);
$res = $this->collection->insertMany($documents, $options); $res = $this->collection->insertMany($documents, $options);
$end_time = microtime(true); $end_time = microtime(true);
MonUtil::mongoMon($this->client->getManager()->getServers(),'insertMany',$end_time-$start_time); MonUtil::dbMon($this->host ?? 'unknow','insertMany','mongodb',$end_time-$start_time);
return $res; return $res;
} }
...@@ -263,7 +265,7 @@ abstract class MongoBase ...@@ -263,7 +265,7 @@ abstract class MongoBase
$start_time = microtime(true); $start_time = microtime(true);
$res = $this->collection->deleteOne($filter, $options); $res = $this->collection->deleteOne($filter, $options);
$end_time = microtime(true); $end_time = microtime(true);
MonUtil::mongoMon($this->client->getManager()->getServers(),'deleteOne',$end_time-$start_time); MonUtil::dbMon($this->host ?? 'unknow','deleteOne','mongodb',$end_time-$start_time);
return $res; return $res;
} }
...@@ -305,7 +307,7 @@ abstract class MongoBase ...@@ -305,7 +307,7 @@ abstract class MongoBase
$start_time = microtime(true); $start_time = microtime(true);
$res = $this->collection->findOne($filter, $options); $res = $this->collection->findOne($filter, $options);
$end_time = microtime(true); $end_time = microtime(true);
MonUtil::mongoMon($this->client->getManager()->getServers(),'findOne',$end_time-$start_time); MonUtil::dbMon($this->host ?? 'unknow','findOne','mongodb',$end_time-$start_time);
return $res; return $res;
} }
......
...@@ -1459,7 +1459,7 @@ class Medoo ...@@ -1459,7 +1459,7 @@ class Medoo
return $result; return $result;
} }
public function insert($table, $datas) public function insert($table, $datas, $options = null)
{ {
$stack = []; $stack = [];
$columns = []; $columns = [];
......
...@@ -206,6 +206,7 @@ abstract class MysqlBase ...@@ -206,6 +206,7 @@ abstract class MysqlBase
\PDO::ATTR_STRINGIFY_FETCHES => false, \PDO::ATTR_STRINGIFY_FETCHES => false,
\PDO::ATTR_EMULATE_PREPARES => false, \PDO::ATTR_EMULATE_PREPARES => false,
\PDO::ATTR_CASE => \PDO::CASE_NATURAL, \PDO::ATTR_CASE => \PDO::CASE_NATURAL,
\PDO::ATTR_ORACLE_NULLS => \PDO::NULL_TO_STRING,
\PDO::ATTR_TIMEOUT => intval(self::$iniConf['connect_timeout'] ?? 10) \PDO::ATTR_TIMEOUT => intval(self::$iniConf['connect_timeout'] ?? 10)
], $options) ], $options)
]; ];
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace Api\PhpUtils\Mysql; namespace Api\PhpUtils\Mysql;
use Api\PhpUtils\Mon\MonUtil;
use Api\PhpUtils\Mysql\Medoo; use Api\PhpUtils\Mysql\Medoo;
use Api\PhpUtils\Log\FileLog; use Api\PhpUtils\Log\FileLog;
...@@ -183,6 +184,9 @@ abstract class MysqlClusterBase ...@@ -183,6 +184,9 @@ abstract class MysqlClusterBase
} }
self::$dbCurrentConnect = self::$dbConnect[$type.':'.$dbShardingIndex]; self::$dbCurrentConnect = self::$dbConnect[$type.':'.$dbShardingIndex];
//增加mon 打点
$start_time = microtime(true);
self::$sqlResut = call_user_func_array([self::$dbConnect[$type.':'.$dbShardingIndex], $method], $arguments); self::$sqlResut = call_user_func_array([self::$dbConnect[$type.':'.$dbShardingIndex], $method], $arguments);
if (!self::catchError($method, $arguments)) { if (!self::catchError($method, $arguments)) {
...@@ -193,6 +197,9 @@ abstract class MysqlClusterBase ...@@ -193,6 +197,9 @@ abstract class MysqlClusterBase
return false; return false;
} }
} }
$end_time = microtime(true);
MonUtil::dbMon(self::dbCurrentConnect['server'].'_'.self::dbCurrentConnect['port'] ?? 'unknow_mysql',$method,'mysql',$end_time-$start_time);
return self::formatResult($method, $arguments); return self::formatResult($method, $arguments);
} }
...@@ -201,7 +208,7 @@ abstract class MysqlClusterBase ...@@ -201,7 +208,7 @@ abstract class MysqlClusterBase
* *
* @param [string] $type 读或写 * @param [string] $type 读或写
* @param boolean $flush 是否强制重新连接,重试等场景使用 * @param boolean $flush 是否强制重新连接,重试等场景使用
* @return void * @return
*/ */
public static function getConnection($type, $dbShardingIndex, $flush = false) public static function getConnection($type, $dbShardingIndex, $flush = false)
{ {
...@@ -235,6 +242,7 @@ abstract class MysqlClusterBase ...@@ -235,6 +242,7 @@ abstract class MysqlClusterBase
\PDO::ATTR_STRINGIFY_FETCHES => false, \PDO::ATTR_STRINGIFY_FETCHES => false,
\PDO::ATTR_EMULATE_PREPARES => false, \PDO::ATTR_EMULATE_PREPARES => false,
\PDO::ATTR_CASE => \PDO::CASE_NATURAL, \PDO::ATTR_CASE => \PDO::CASE_NATURAL,
\PDO::ATTR_ORACLE_NULLS => \PDO::NULL_TO_STRING,
\PDO::ATTR_TIMEOUT => intval(self::$iniConf['connect_timeout'] ?? 10) \PDO::ATTR_TIMEOUT => intval(self::$iniConf['connect_timeout'] ?? 10)
], $options) ], $options)
]; ];
......
...@@ -4,6 +4,7 @@ namespace Api\PhpUtils\Redis; ...@@ -4,6 +4,7 @@ namespace Api\PhpUtils\Redis;
use Api\PhpUtils\Http\Request; use Api\PhpUtils\Http\Request;
use Api\PhpUtils\Cache\ApcuUtil; use Api\PhpUtils\Cache\ApcuUtil;
use Api\PhpUtils\Log\FileLog; use Api\PhpUtils\Log\FileLog;
use Api\PhpUtils\Mon\MonUtil;
use Redis; use Redis;
class RedisUtil class RedisUtil
...@@ -653,6 +654,12 @@ class RedisUtil ...@@ -653,6 +654,12 @@ class RedisUtil
if (!$this->redis) { if (!$this->redis) {
return false; return false;
} }
return call_user_func_array([$this->redis, $method], $args); //增加mon打点
$start_time = microtime(true);
$res = call_user_func_array([$this->redis, $method], $args);
$end_time = microtime(true);
MonUtil::dbMon($this->connectServer ?? 'unknow_redis',$method,'redis',$end_time-$start_time);
return $res;
} }
} }
...@@ -32,7 +32,7 @@ private static $installed = array ( ...@@ -32,7 +32,7 @@ private static $installed = array (
'aliases' => 'aliases' =>
array ( array (
), ),
'reference' => '2c92ea9e9ceb03dd50ff5f10f4fd2d1273841535', 'reference' => 'c50cb0e34c92016172f9993b5c1a0b1badbaee4c',
'name' => 'yidian/yaf_demo', 'name' => 'yidian/yaf_demo',
), ),
'versions' => 'versions' =>
...@@ -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' => '1368a385a7b4bda8d18ecd177209a16731922825', 'reference' => 'b890a125414f3b44c8f395f947f55bea0bbc83af',
), ),
'elasticsearch/elasticsearch' => 'elasticsearch/elasticsearch' =>
array ( array (
...@@ -184,7 +184,7 @@ private static $installed = array ( ...@@ -184,7 +184,7 @@ private static $installed = array (
'aliases' => 'aliases' =>
array ( array (
), ),
'reference' => '2c92ea9e9ceb03dd50ff5f10f4fd2d1273841535', 'reference' => 'c50cb0e34c92016172f9993b5c1a0b1badbaee4c',
), ),
), ),
); );
......
...@@ -38,6 +38,7 @@ return array( ...@@ -38,6 +38,7 @@ return array(
'Api\\PhpUtils\\Common\\BaseConvert' => $vendorDir . '/api/php_utils/src/Common/BaseConvert.php', 'Api\\PhpUtils\\Common\\BaseConvert' => $vendorDir . '/api/php_utils/src/Common/BaseConvert.php',
'Api\\PhpUtils\\Common\\Docid' => $vendorDir . '/api/php_utils/src/Common/Docid.php', 'Api\\PhpUtils\\Common\\Docid' => $vendorDir . '/api/php_utils/src/Common/Docid.php',
'Api\\PhpUtils\\Common\\Geo' => $vendorDir . '/api/php_utils/src/Common/Geo.php', 'Api\\PhpUtils\\Common\\Geo' => $vendorDir . '/api/php_utils/src/Common/Geo.php',
'Api\\PhpUtils\\Common\\GoodsSkuId' => $vendorDir . '/api/php_utils/src/Common/GoodsSkuId.php',
'Api\\PhpUtils\\Common\\IP' => $vendorDir . '/api/php_utils/src/Common/IP.php', 'Api\\PhpUtils\\Common\\IP' => $vendorDir . '/api/php_utils/src/Common/IP.php',
'Api\\PhpUtils\\Common\\Rsa' => $vendorDir . '/api/php_utils/src/Common/Rsa.php', 'Api\\PhpUtils\\Common\\Rsa' => $vendorDir . '/api/php_utils/src/Common/Rsa.php',
'Api\\PhpUtils\\Common\\TimeOut' => $vendorDir . '/api/php_utils/src/Common/TimeOut.php', 'Api\\PhpUtils\\Common\\TimeOut' => $vendorDir . '/api/php_utils/src/Common/TimeOut.php',
...@@ -92,6 +93,7 @@ return array( ...@@ -92,6 +93,7 @@ return array(
'App\\Models\\goods\\mysql\\GoodsSpu' => $baseDir . '/application/models/goods/mysql/GoodsSpu.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\\InventoryOperationRecord' => $baseDir . '/application/models/goods/mysql/InventoryOperationRecord.php',
'App\\Models\\goods\\mysql\\Shop' => $baseDir . '/application/models/goods/mysql/Shop.php', 'App\\Models\\goods\\mysql\\Shop' => $baseDir . '/application/models/goods/mysql/Shop.php',
'App\\Models\\goods\\mysql\\Tcc' => $baseDir . '/application/models/goods/mysql/Tcc.php',
'App\\Models\\shop\\mysql\\Shop' => $baseDir . '/application/models/shop/mysql/Shop.php', 'App\\Models\\shop\\mysql\\Shop' => $baseDir . '/application/models/shop/mysql/Shop.php',
'App\\Models\\shop\\mysql\\SubShop' => $baseDir . '/application/models/shop/mysql/SubShop.php', 'App\\Models\\shop\\mysql\\SubShop' => $baseDir . '/application/models/shop/mysql/SubShop.php',
'App\\Plugins\\Hook' => $baseDir . '/application/plugins/Hook.php', 'App\\Plugins\\Hook' => $baseDir . '/application/plugins/Hook.php',
...@@ -104,6 +106,7 @@ return array( ...@@ -104,6 +106,7 @@ return array(
'App\\Services\\goods\\ElasticGoodService' => $baseDir . '/application/services/goods/ElasticGoodService.php', 'App\\Services\\goods\\ElasticGoodService' => $baseDir . '/application/services/goods/ElasticGoodService.php',
'App\\Services\\goods\\GoodsService' => $baseDir . '/application/services/goods/GoodsService.php', 'App\\Services\\goods\\GoodsService' => $baseDir . '/application/services/goods/GoodsService.php',
'App\\Services\\shop\\ShopService' => $baseDir . '/application/services/shop/ShopService.php', 'App\\Services\\shop\\ShopService' => $baseDir . '/application/services/shop/ShopService.php',
'App\\Services\\tcc\\TccService' => $baseDir . '/application/services/tcc/TccService.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',
......
...@@ -174,6 +174,7 @@ class ComposerStaticInit48fd9e88279ffd9162a19bdedd5d5a0a ...@@ -174,6 +174,7 @@ class ComposerStaticInit48fd9e88279ffd9162a19bdedd5d5a0a
'Api\\PhpUtils\\Common\\BaseConvert' => __DIR__ . '/..' . '/api/php_utils/src/Common/BaseConvert.php', 'Api\\PhpUtils\\Common\\BaseConvert' => __DIR__ . '/..' . '/api/php_utils/src/Common/BaseConvert.php',
'Api\\PhpUtils\\Common\\Docid' => __DIR__ . '/..' . '/api/php_utils/src/Common/Docid.php', 'Api\\PhpUtils\\Common\\Docid' => __DIR__ . '/..' . '/api/php_utils/src/Common/Docid.php',
'Api\\PhpUtils\\Common\\Geo' => __DIR__ . '/..' . '/api/php_utils/src/Common/Geo.php', 'Api\\PhpUtils\\Common\\Geo' => __DIR__ . '/..' . '/api/php_utils/src/Common/Geo.php',
'Api\\PhpUtils\\Common\\GoodsSkuId' => __DIR__ . '/..' . '/api/php_utils/src/Common/GoodsSkuId.php',
'Api\\PhpUtils\\Common\\IP' => __DIR__ . '/..' . '/api/php_utils/src/Common/IP.php', 'Api\\PhpUtils\\Common\\IP' => __DIR__ . '/..' . '/api/php_utils/src/Common/IP.php',
'Api\\PhpUtils\\Common\\Rsa' => __DIR__ . '/..' . '/api/php_utils/src/Common/Rsa.php', 'Api\\PhpUtils\\Common\\Rsa' => __DIR__ . '/..' . '/api/php_utils/src/Common/Rsa.php',
'Api\\PhpUtils\\Common\\TimeOut' => __DIR__ . '/..' . '/api/php_utils/src/Common/TimeOut.php', 'Api\\PhpUtils\\Common\\TimeOut' => __DIR__ . '/..' . '/api/php_utils/src/Common/TimeOut.php',
...@@ -228,6 +229,7 @@ class ComposerStaticInit48fd9e88279ffd9162a19bdedd5d5a0a ...@@ -228,6 +229,7 @@ class ComposerStaticInit48fd9e88279ffd9162a19bdedd5d5a0a
'App\\Models\\goods\\mysql\\GoodsSpu' => __DIR__ . '/../..' . '/application/models/goods/mysql/GoodsSpu.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\\InventoryOperationRecord' => __DIR__ . '/../..' . '/application/models/goods/mysql/InventoryOperationRecord.php',
'App\\Models\\goods\\mysql\\Shop' => __DIR__ . '/../..' . '/application/models/goods/mysql/Shop.php', 'App\\Models\\goods\\mysql\\Shop' => __DIR__ . '/../..' . '/application/models/goods/mysql/Shop.php',
'App\\Models\\goods\\mysql\\Tcc' => __DIR__ . '/../..' . '/application/models/goods/mysql/Tcc.php',
'App\\Models\\shop\\mysql\\Shop' => __DIR__ . '/../..' . '/application/models/shop/mysql/Shop.php', 'App\\Models\\shop\\mysql\\Shop' => __DIR__ . '/../..' . '/application/models/shop/mysql/Shop.php',
'App\\Models\\shop\\mysql\\SubShop' => __DIR__ . '/../..' . '/application/models/shop/mysql/SubShop.php', 'App\\Models\\shop\\mysql\\SubShop' => __DIR__ . '/../..' . '/application/models/shop/mysql/SubShop.php',
'App\\Plugins\\Hook' => __DIR__ . '/../..' . '/application/plugins/Hook.php', 'App\\Plugins\\Hook' => __DIR__ . '/../..' . '/application/plugins/Hook.php',
...@@ -240,6 +242,7 @@ class ComposerStaticInit48fd9e88279ffd9162a19bdedd5d5a0a ...@@ -240,6 +242,7 @@ class ComposerStaticInit48fd9e88279ffd9162a19bdedd5d5a0a
'App\\Services\\goods\\ElasticGoodService' => __DIR__ . '/../..' . '/application/services/goods/ElasticGoodService.php', 'App\\Services\\goods\\ElasticGoodService' => __DIR__ . '/../..' . '/application/services/goods/ElasticGoodService.php',
'App\\Services\\goods\\GoodsService' => __DIR__ . '/../..' . '/application/services/goods/GoodsService.php', 'App\\Services\\goods\\GoodsService' => __DIR__ . '/../..' . '/application/services/goods/GoodsService.php',
'App\\Services\\shop\\ShopService' => __DIR__ . '/../..' . '/application/services/shop/ShopService.php', 'App\\Services\\shop\\ShopService' => __DIR__ . '/../..' . '/application/services/shop/ShopService.php',
'App\\Services\\tcc\\TccService' => __DIR__ . '/../..' . '/application/services/tcc/TccService.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',
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://git.yidian-inc.com:8021/bp/php_utils.git", "url": "https://git.yidian-inc.com:8021/bp/php_utils.git",
"reference": "1368a385a7b4bda8d18ecd177209a16731922825" "reference": "b890a125414f3b44c8f395f947f55bea0bbc83af"
}, },
"require": { "require": {
"elasticsearch/elasticsearch": "~7.0", "elasticsearch/elasticsearch": "~7.0",
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
"mongodb/mongodb": "1.4.3", "mongodb/mongodb": "1.4.3",
"php": ">=7.2" "php": ">=7.2"
}, },
"time": "2021-06-22T06:30:51+00:00", "time": "2021-06-23T01:45:00+00:00",
"default-branch": true, "default-branch": true,
"type": "library", "type": "library",
"installation-source": "source", "installation-source": "source",
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
'aliases' => 'aliases' =>
array ( array (
), ),
'reference' => '2c92ea9e9ceb03dd50ff5f10f4fd2d1273841535', 'reference' => 'c50cb0e34c92016172f9993b5c1a0b1badbaee4c',
'name' => 'yidian/yaf_demo', 'name' => 'yidian/yaf_demo',
), ),
'versions' => 'versions' =>
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
array ( array (
0 => '9999999-dev', 0 => '9999999-dev',
), ),
'reference' => '1368a385a7b4bda8d18ecd177209a16731922825', 'reference' => 'b890a125414f3b44c8f395f947f55bea0bbc83af',
), ),
'elasticsearch/elasticsearch' => 'elasticsearch/elasticsearch' =>
array ( array (
...@@ -158,7 +158,7 @@ ...@@ -158,7 +158,7 @@
'aliases' => 'aliases' =>
array ( array (
), ),
'reference' => '2c92ea9e9ceb03dd50ff5f10f4fd2d1273841535', 'reference' => 'c50cb0e34c92016172f9993b5c1a0b1badbaee4c',
), ),
), ),
); );
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