Commit 31f4272b authored by jianghaiming's avatar jianghaiming

update:合并master

parents f4944c56 a4fa1e3c
[26-Jun-2021 14:46:09 Asia/Shanghai] daemon:GoodsToEs 6245 [INFO]: process start now
[26-Jun-2021 14:46:09 Asia/Shanghai] daemon:GoodsToEs 6297 [INFO]: master process pid:6298
[26-Jun-2021 14:46:09 Asia/Shanghai] PHP Warning: Use of undefined constant ROOT_PATH - assumed 'ROOT_PATH' (this will throw an Error in a future version of PHP) in /Users/admin/works/php/goods/vendor/api/php_services/src/Daemon/Daemon.php on line 139
[26-Jun-2021 14:46:09 Asia/Shanghai] PHP Stack trace:
[26-Jun-2021 14:46:09 Asia/Shanghai] PHP 1. {main}() /Users/admin/works/php/goods/public/cli.php:0
[26-Jun-2021 14:46:09 Asia/Shanghai] PHP 2. Yaf\Dispatcher->dispatch($request = class Yaf\Request\Simple { public $method = ''; public $module = 'Cli'; public $controller = 'Daemon'; public $action = 'run'; public $uri:protected = ''; public $base_uri:protected = NULL; public $dispatched:protected = TRUE; public $routed:protected = TRUE; public $language:protected = ''; public $params:protected = ['t' => 'GoodsToEs'] }) /Users/admin/works/php/goods/public/cli.php:33
[26-Jun-2021 14:46:09 Asia/Shanghai] PHP 3. DaemonController->RunAction() /Users/admin/works/php/goods/public/cli.php:33
[26-Jun-2021 14:46:09 Asia/Shanghai] PHP 4. Api\PhpServices\Daemon\Daemon->start() /Users/admin/works/php/goods/application/modules/Cli/controllers/Daemon.php:52
[26-Jun-2021 14:46:09 Asia/Shanghai] PHP 5. Api\PhpServices\Daemon\Daemon->daemon() /Users/admin/works/php/goods/vendor/api/php_services/src/Daemon/Daemon.php:70
...@@ -14,6 +14,8 @@ class GoodsException extends BaseException ...@@ -14,6 +14,8 @@ class GoodsException extends BaseException
const PRINTER_ALREADY_EXIST = 36; const PRINTER_ALREADY_EXIST = 36;
const EMPTY_OTA_ID = 37; const EMPTY_OTA_ID = 37;
const OTA_NOT_EXIST = 38; const OTA_NOT_EXIST = 38;
const RULE_LIMIT_ERROR = 50;
const NOT_FIND_MARKETING = 51;
protected $cus = [ protected $cus = [
0 => '商品创建失败,请稍后重试', 0 => '商品创建失败,请稍后重试',
...@@ -65,6 +67,9 @@ class GoodsException extends BaseException ...@@ -65,6 +67,9 @@ class GoodsException extends BaseException
46 => '已经执行过cancel', 46 => '已经执行过cancel',
47 => 'sku rollback error', 47 => 'sku rollback error',
48 => '请满足以下条件后提交,售价-分销总金额-手续费>=结算价', 48 => '请满足以下条件后提交,售价-分销总金额-手续费>=结算价',
49 => '库存不得小于已售库存',
self::RULE_LIMIT_ERROR => '单人可买上限填写错误',
self::NOT_FIND_MARKETING => '找不到活动',
52 => '商品过期时间小于等于上架时间', 52 => '商品过期时间小于等于上架时间',
]; ];
} }
\ No newline at end of file
...@@ -38,5 +38,6 @@ class MarketingException extends BaseException ...@@ -38,5 +38,6 @@ class MarketingException extends BaseException
self::TAKE_PLACE_NOT_EXIST => '自提点不存在', self::TAKE_PLACE_NOT_EXIST => '自提点不存在',
21 => "活动开始时间不能大于或者等于结束时间", 21 => "活动开始时间不能大于或者等于结束时间",
22 => "自提点不能为空", 22 => "自提点不能为空",
33 => '分润金额+手续费不能大于售价金额',
]; ];
} }
\ No newline at end of file
...@@ -21,5 +21,6 @@ class UserException extends BaseException ...@@ -21,5 +21,6 @@ class UserException extends BaseException
7 => '手机号获取失败', 7 => '手机号获取失败',
8 => '绑定手机号失败', 8 => '绑定手机号失败',
9 => '该手机号已绑定其他用户不能重复绑定', 9 => '该手机号已绑定其他用户不能重复绑定',
10 => 'mysql 异常',
]; ];
} }
\ No newline at end of file
...@@ -329,4 +329,14 @@ class GoodsController extends Base ...@@ -329,4 +329,14 @@ class GoodsController extends Base
$res = GoodsSnapshotsService::pindanGoodsSnapshots($this->params); $res = GoodsSnapshotsService::pindanGoodsSnapshots($this->params);
$this->success(["result" => $res]); $this->success(["result" => $res]);
} }
/**
* 通过goods_sku_id 获取 拼单商品的ota信息
* @throws Exception
*/
public function take_place_by_goods_sku_idsAction()
{
$res = GoodsService::getOtaInfoByGoodsSkuIds($this->params);
$this->success(["result" => $res]);
}
} }
\ No newline at end of file
...@@ -34,8 +34,17 @@ class MarketingfororderController extends Base ...@@ -34,8 +34,17 @@ class MarketingfororderController extends Base
public function take_place_listAction() public function take_place_listAction()
{ {
$params = $this->params; $params = $this->params;
$data = MarketingForOrderService::getMarketingTakePlaceList($params);
$this->success(["result" => $data]); $takePlaceList = MarketingForOrderService::getMarketingTakePlaceList($params);
$addressList = [];
//
if (!empty($takePlaceList))
$addressList = array_values(array_unique(array_column($takePlaceList, 'address')));
//
$this->success(["result" => [
'take_place_list' => $takePlaceList,
'address_list' => $addressList
]]);
} }
} }
\ No newline at end of file
...@@ -33,6 +33,9 @@ class UserController extends Base ...@@ -33,6 +33,9 @@ class UserController extends Base
{ {
$params = $this->params; $params = $this->params;
$user = UserService::userWechatBind($params); $user = UserService::userWechatBind($params);
if( $user === false ) {
throw new UserException(['cus' => 10]);
}
$userInfo['result'] = $user; $userInfo['result'] = $user;
$this->success($userInfo); $this->success($userInfo);
} }
......
...@@ -12,6 +12,7 @@ use Api\PhpUtils\Common\BaseConvert; ...@@ -12,6 +12,7 @@ use Api\PhpUtils\Common\BaseConvert;
use Api\PhpUtils\Common\GoodsSkuId; use Api\PhpUtils\Common\GoodsSkuId;
use Api\PhpUtils\Http\HttpUtil; use Api\PhpUtils\Http\HttpUtil;
use App\Exception\custom\GoodsException; use App\Exception\custom\GoodsException;
use App\Exception\custom\MarketingException;
use App\Models\goods\mysql\Category; use App\Models\goods\mysql\Category;
use App\Models\goods\mysql\GoodsOperationRecord; use App\Models\goods\mysql\GoodsOperationRecord;
use App\Models\goods\mysql\GoodsSku; use App\Models\goods\mysql\GoodsSku;
...@@ -20,6 +21,7 @@ use App\Models\goods\mysql\GoodsSkuSubShop; ...@@ -20,6 +21,7 @@ use App\Models\goods\mysql\GoodsSkuSubShop;
use App\Models\goods\mysql\GoodsSnapshot; use App\Models\goods\mysql\GoodsSnapshot;
use App\Models\goods\mysql\GoodsSpu; use App\Models\goods\mysql\GoodsSpu;
use App\Models\goods\mysql\LifeAccountShopNum; use App\Models\goods\mysql\LifeAccountShopNum;
use App\Models\goods\mysql\Ota;
use App\Models\goods\mysql\PaySuccessGoodsCallbackRecord; use App\Models\goods\mysql\PaySuccessGoodsCallbackRecord;
use App\Models\goods\mysql\PindanGoodsSku; use App\Models\goods\mysql\PindanGoodsSku;
use App\Models\goods\mysql\Shop; use App\Models\goods\mysql\Shop;
...@@ -36,6 +38,7 @@ use App\Services\common\CommonService; ...@@ -36,6 +38,7 @@ use App\Services\common\CommonService;
use Api\PhpUtils\Http\Request; use Api\PhpUtils\Http\Request;
use App\Exception\custom\InterfaceException; use App\Exception\custom\InterfaceException;
class GoodsService class GoodsService
{ {
const CHARGEFEE = 0.006; const CHARGEFEE = 0.006;
...@@ -824,10 +827,8 @@ class GoodsService ...@@ -824,10 +827,8 @@ class GoodsService
"goods_version" => (int)$skuData["goods_version"] + 1, "goods_version" => (int)$skuData["goods_version"] + 1,
]; ];
//验证结算价格 //验证结算价格/分销金额
if (!empty($params["clear_price"])) { self::checkClearPrice($goodsSkuId, $skuParams);
self::checkClearPrice($goodsSkuId, $skuParams);
}
if (self::isInitGoodsStatus($params, $skuData)) { if (self::isInitGoodsStatus($params, $skuData)) {
$skuParams["audit_status"] = GoodsSku::STATUS_AUDIT; $skuParams["audit_status"] = GoodsSku::STATUS_AUDIT;
...@@ -889,6 +890,9 @@ class GoodsService ...@@ -889,6 +890,9 @@ class GoodsService
$clearPrice = $skuParams["clear_price"]; $clearPrice = $skuParams["clear_price"];
$price = $skuParams["price"]; $price = $skuParams["price"];
$chargeFee = !empty($price) ? (float)bcmul($price , self::CHARGEFEE,2) : 0; //手续费 (分) $chargeFee = !empty($price) ? (float)bcmul($price , self::CHARGEFEE,2) : 0; //手续费 (分)
if ($chargeFee<1) {
$chargeFee = 0;
}
if ($clearPrice > 0 && $clearPrice > $price) { if ($clearPrice > 0 && $clearPrice > $price) {
throw new GoodsException(['cus' => 39]); throw new GoodsException(['cus' => 39]);
} }
...@@ -904,22 +908,41 @@ class GoodsService ...@@ -904,22 +908,41 @@ class GoodsService
if (!empty($marketings)) { if (!empty($marketings)) {
foreach ($marketings as $marketing) { foreach ($marketings as $marketing) {
if ($marketing["commission_mode"] == Marketing::COMMISSION_MODE_RATE) { if ($clearPrice > 0) {
$commissionTotal = ($marketing["first_commission_value"] + $marketing["second_commission_value"]) / 10000 * $price; if ($marketing["commission_mode"] == Marketing::COMMISSION_MODE_RATE) {
if (($price - $commissionTotal - $chargeFee) < $clearPrice) { $commissionTotal = ($marketing["first_commission_value"] + $marketing["second_commission_value"]) / 10000 * $price;
throw new GoodsException(['cus' => 40]); if (($price - $commissionTotal - $chargeFee) < $clearPrice) {
throw new GoodsException(['cus' => 40]);
}
} }
}
if ($marketing["commission_mode"] == Marketing::COMMISSION_MODE_FIXED) { if ($marketing["commission_mode"] == Marketing::COMMISSION_MODE_FIXED) {
$commissionTotal = ($marketing["first_commission_value"] + $marketing["second_commission_value"]); $commissionTotal = ($marketing["first_commission_value"] + $marketing["second_commission_value"]);
if (($price - $commissionTotal - $chargeFee) < $clearPrice) { if (($price - $commissionTotal - $chargeFee) < $clearPrice) {
throw new GoodsException(['cus' => 40]); throw new GoodsException(['cus' => 40]);
}
}
}else{
//比例计算
if ($marketing["commission_mode"] == Marketing::COMMISSION_MODE_RATE) {
$commissionTotal = ($marketing["first_commission_value"] + $marketing["second_commission_value"]) / 10000 * $price;
if ($price < ($commissionTotal+$chargeFee)) {
throw new MarketingException(['cus'=>33]);
}
}
//固定金额
if ($marketing["commission_mode"] == Marketing::COMMISSION_MODE_FIXED) {
$commissionTotal = ($marketing["first_commission_value"] + $marketing["second_commission_value"]);
if ($price < ($commissionTotal+$chargeFee)) {
throw new MarketingException(['cus'=>33]);
}
} }
} }
} }
}else{ }else{
if (($price - $chargeFee) < $clearPrice) { if ($clearPrice > 0 && (($price - $chargeFee) < $clearPrice)) {
throw new GoodsException(['cus' => 40]); throw new GoodsException(['cus' => 40]);
} }
} }
...@@ -1776,7 +1799,7 @@ class GoodsService ...@@ -1776,7 +1799,7 @@ class GoodsService
if (!empty($marketing) && $marketing["marketing_type"] == Marketing::MARKETING_TYPE_PINDAN) { if (!empty($marketing) && $marketing["marketing_type"] == Marketing::MARKETING_TYPE_PINDAN) {
$marketingPindan = MarketingPindan::getRecord(["marketing_id" => $marketingId]); $marketingPindan = MarketingPindan::getRecord(["marketing_id" => $marketingId]);
if (!empty($marketingPindan)) { if (!empty($marketingPindan)) {
$rowCount = MarketingPindan::save(["participate_number" => $marketingPindan["participate_number"] + $num] $rowCount = MarketingPindan::save(["participate_number[+]" => $num]
, ["marketing_pindan_id" => $marketingPindan["marketing_pindan_id"]]); , ["marketing_pindan_id" => $marketingPindan["marketing_pindan_id"]]);
if ($rowCount <= 0) { if ($rowCount <= 0) {
GoodsSku::rollback(); GoodsSku::rollback();
...@@ -1897,4 +1920,29 @@ class GoodsService ...@@ -1897,4 +1920,29 @@ class GoodsService
} }
return true; return true;
} }
/**
* 通过goods_sku_id 获取 拼单商品的ota信息
* @param array $params
* @return array
*/
public static function getOtaInfoByGoodsSkuIds($params = [])
{
$data = [];
$goodsSkuIds = empty($params["goods_sku_ids"]) ? [] : $params["goods_sku_ids"];
if (!empty($goodsSkuIds)) {
$pindanGoodsSkus = PindanGoodsSku::select(["goods_sku_id", "ota_id"], ["goods_sku_id" => $goodsSkuIds]);
$otaIds = array_column($pindanGoodsSkus, "ota_id");
$otaInfos = Ota::select("*", ["ota_id" => $otaIds]);
$otaIds = array_column($otaInfos, "ota_id");
$otaInfos = array_column($otaInfos, null, "ota_id");
foreach ($pindanGoodsSkus as $sku) {
if (in_array($sku["ota_id"], $otaIds)) {
$data[$sku["goods_sku_id"]] = $otaInfos[$sku["ota_id"]];
}
}
}
return $data;
}
} }
\ No newline at end of file
...@@ -143,6 +143,7 @@ class MarketingPindanGoodsService ...@@ -143,6 +143,7 @@ class MarketingPindanGoodsService
"goods_name" => $spuData["marketing_name"], "goods_name" => $spuData["marketing_name"],
"desc_pic_url" => $spuData["desc_pic_url"], "desc_pic_url" => $spuData["desc_pic_url"],
"desc" => $spuData["desc"], "desc" => $spuData["desc"],
"rule_limit" => empty($skuData["rule_limit"]) ? 0 : $skuData["rule_limit"],
"goods_type" => empty($spuData["goods_type"]) ? GoodsSpu::TYPE_ENTITY : $spuData["goods_type"], "goods_type" => empty($spuData["goods_type"]) ? GoodsSpu::TYPE_ENTITY : $spuData["goods_type"],
"goods_sub_type" => empty($spuData["goods_sub_type"]) ? GoodsSpu::SUB_TYPE_INSTANT : $spuData["goods_sub_type"], "goods_sub_type" => empty($spuData["goods_sub_type"]) ? GoodsSpu::SUB_TYPE_INSTANT : $spuData["goods_sub_type"],
"belong_type" => empty($spuData["belong_type"]) ? GoodsSpu::BELONG_TYPE_DISANFANG : $spuData["belong_type"], "belong_type" => empty($spuData["belong_type"]) ? GoodsSpu::BELONG_TYPE_DISANFANG : $spuData["belong_type"],
...@@ -191,6 +192,12 @@ class MarketingPindanGoodsService ...@@ -191,6 +192,12 @@ class MarketingPindanGoodsService
if ($checkGoodsDesc) { if ($checkGoodsDesc) {
throw new GoodsException(['cus' => 20]); throw new GoodsException(['cus' => 20]);
} }
//判断是否是整数
if (!empty($skuData["rule_limit"]) && (!is_numeric($skuData["rule_limit"]) || strpos($skuData["rule_limit"], ".") !== false)) {
throw new GoodsException(['cus' => GoodsException::RULE_LIMIT_ERROR]);
}
$skuParams = [ $skuParams = [
"goods_sku_id" => $skuId, "goods_sku_id" => $skuId,
"goods_spu_id" => $spuData["goods_spu_id"], "goods_spu_id" => $spuData["goods_spu_id"],
...@@ -202,6 +209,7 @@ class MarketingPindanGoodsService ...@@ -202,6 +209,7 @@ class MarketingPindanGoodsService
"goods_name" => $skuData["goods_name"], "goods_name" => $skuData["goods_name"],
"desc_pic_url" => $skuData["desc_pic_url"], "desc_pic_url" => $skuData["desc_pic_url"],
"desc" => $skuData["desc"], "desc" => $skuData["desc"],
"rule_limit" => empty($skuData["rule_limit"]) ? 0 : $skuData["rule_limit"],
"inventory_total" => $skuData["inventory"], "inventory_total" => $skuData["inventory"],
"inventory_rest" => $skuData["inventory"], "inventory_rest" => $skuData["inventory"],
"original_price" => empty($skuData["original_price"]) ? "" : $skuData["original_price"] * 100, "original_price" => empty($skuData["original_price"]) ? "" : $skuData["original_price"] * 100,
...@@ -267,6 +275,7 @@ class MarketingPindanGoodsService ...@@ -267,6 +275,7 @@ class MarketingPindanGoodsService
return GoodsSpu::save([ return GoodsSpu::save([
"desc_pic_url" => $params["desc_pic_url"], "desc_pic_url" => $params["desc_pic_url"],
"desc" => $params["desc"], "desc" => $params["desc"],
"rule_limit" => empty($params["rule_limit"]) ? 0 : $params["rule_limit"],
], ["goods_spu_id" => $goodsSpu["goods_spu_id"]]); ], ["goods_spu_id" => $goodsSpu["goods_spu_id"]]);
} }
...@@ -282,7 +291,12 @@ class MarketingPindanGoodsService ...@@ -282,7 +291,12 @@ class MarketingPindanGoodsService
private static function editGoodsSku($goodsSkuId, $skuData, $params = []) private static function editGoodsSku($goodsSkuId, $skuData, $params = [])
{ {
$inventoryCount = $skuData["inventory_rest"] + $params["inventory_add"]; $inventoryCount = $skuData["inventory_rest"] + $params["inventory_add"];
//$inventoryCount = $params["inventory"]; $inventoryTotal = $skuData["inventory_total"] + $params["inventory_add"];
if ($inventoryTotal < $skuData["inventory_lock"] + $skuData["total_amount_order"]) {
throw new GoodsException(['cus' => 49]);
}
if ($inventoryCount < 0) { if ($inventoryCount < 0) {
throw new GoodsException(['cus' => 18]); throw new GoodsException(['cus' => 18]);
} }
...@@ -303,12 +317,17 @@ class MarketingPindanGoodsService ...@@ -303,12 +317,17 @@ class MarketingPindanGoodsService
throw new GoodsException(['cus' => 34]); throw new GoodsException(['cus' => 34]);
} }
//判断是否是整数
if (!empty($params["rule_limit"]) && (!is_numeric($params["rule_limit"]) || strpos($params["rule_limit"], ".") !== false)) {
throw new GoodsException(['cus' => GoodsException::RULE_LIMIT_ERROR]);
}
$skuParams = [ $skuParams = [
"goods_name" => $params["goods_name"], "goods_name" => $params["goods_name"],
"desc_pic_url" => $params["desc_pic_url"], "desc_pic_url" => $params["desc_pic_url"],
"desc" => $params["desc"], "desc" => $params["desc"],
"inventory_total" => $skuData["inventory_total"] + $params["inventory_add"], "rule_limit" => empty($params["rule_limit"]) ? 0 : $params["rule_limit"],
"inventory_total" => $inventoryTotal,
"ota_id" => empty($params["ota_id"]) ? 0 : $params["ota_id"], "ota_id" => empty($params["ota_id"]) ? 0 : $params["ota_id"],
"inventory_rest" => $inventoryCount, "inventory_rest" => $inventoryCount,
"original_price" => empty($params["original_price"]) ? "" : $params["original_price"] * 100, "original_price" => empty($params["original_price"]) ? "" : $params["original_price"] * 100,
......
...@@ -193,9 +193,6 @@ class DistributorService ...@@ -193,9 +193,6 @@ class DistributorService
} }
$jwUserId = ''; $jwUserId = '';
// if (empty($distributorCode)) {
// throw new DistributorException(['cus'=>9]);
// }
$info = Distributor::getRecord(['user_id' => $shareUserId]); $info = Distributor::getRecord(['user_id' => $shareUserId]);
if (empty($info)) { if (empty($info)) {
......
...@@ -11,6 +11,7 @@ use App\Models\marketing\mysql\Marketing; ...@@ -11,6 +11,7 @@ use App\Models\marketing\mysql\Marketing;
use App\Models\marketing\mysql\MarketingGoods; use App\Models\marketing\mysql\MarketingGoods;
use App\Models\marketing\mysql\MarketingTakePlace; use App\Models\marketing\mysql\MarketingTakePlace;
use App\Models\marketing\mysql\TakePlace; use App\Models\marketing\mysql\TakePlace;
use App\Services\marketing\MarketingService;
class MarketingForOrderService class MarketingForOrderService
{ {
...@@ -22,7 +23,8 @@ class MarketingForOrderService ...@@ -22,7 +23,8 @@ class MarketingForOrderService
public static function getMarketingList($params) public static function getMarketingList($params)
{ {
$where['marketing_type'] = !empty($params['marketing_type']) ? $params['marketing_type'] : Marketing::MARKETING_TYPE_PINDAN; $where['marketing_type'] = !empty($params['marketing_type']) ? $params['marketing_type'] : Marketing::MARKETING_TYPE_PINDAN;
return Marketing::select(["marketing_id", "marketing_name", "create_time"], ["marketing_type" => $where['marketing_type']]); $where['life_account_id'] = MarketingService::getPublicLifeAccountId();
return Marketing::select(["marketing_id", "marketing_name", "create_time"], $where);
} }
/** /**
...@@ -58,10 +60,10 @@ class MarketingForOrderService ...@@ -58,10 +60,10 @@ class MarketingForOrderService
$takePlaceList = []; $takePlaceList = [];
if (!empty($takePlaceIdList)) { if (!empty($takePlaceIdList)) {
$takePlaceIdArr = array_column($takePlaceIdList, "take_place_id"); $takePlaceIdArr = array_column($takePlaceIdList, "take_place_id");
$takePlaceList = TakePlace::select(["take_place_id", "take_place_name", "create_time"], ["take_place_id" => $takePlaceIdArr]); $takePlaceList = TakePlace::select(["take_place_id", "take_place_name", "create_time", "address"], ["take_place_id" => $takePlaceIdArr]);
} }
} else { } else {
$takePlaceList = TakePlace::select(["take_place_id", "take_place_name", "create_time"]); $takePlaceList = TakePlace::select(["take_place_id", "take_place_name", "create_time", "address"]);
} }
return $takePlaceList; return $takePlaceList;
} }
......
...@@ -52,7 +52,8 @@ class MarketingGoodsService ...@@ -52,7 +52,8 @@ class MarketingGoodsService
} }
public static function marketingGoodsList($params) public static function marketingGoodsList($params)
{ {
$limit = !empty($params['num']) ? $params['num'] : 20; //@todo 分页放大100倍,主要解决商品到期和商品库存为零的过滤场景
$limit = !empty($params['num']) ? $params['num']*100 : 1000;
$userId = !empty($params['user_id']) ? $params['user_id'] : ''; $userId = !empty($params['user_id']) ? $params['user_id'] : '';
...@@ -108,7 +109,7 @@ class MarketingGoodsService ...@@ -108,7 +109,7 @@ class MarketingGoodsService
$onlineStatus = !empty($goodsSkuList[$value['goods_sku_id']]['online_status']) ? $goodsSkuList[$value['goods_sku_id']]['online_status'] : ''; $onlineStatus = !empty($goodsSkuList[$value['goods_sku_id']]['online_status']) ? $goodsSkuList[$value['goods_sku_id']]['online_status'] : '';
if (!empty($inventoryRest) && $expirationTime> date("Y-m-d H:i:s") && $onlineStatus == 1 ) { if (!empty($inventoryRest) && $expirationTime > date("Y-m-d H:i:s") && $onlineStatus == 1 ) {
$list[$i]['inventory_rest'] = !empty($goodsSkuList[$value['goods_sku_id']]['inventory_rest']) ? $goodsSkuList[$value['goods_sku_id']]['inventory_rest'] : ''; $list[$i]['inventory_rest'] = !empty($goodsSkuList[$value['goods_sku_id']]['inventory_rest']) ? $goodsSkuList[$value['goods_sku_id']]['inventory_rest'] : '';
$list[$i] = $value; $list[$i] = $value;
$list[$i]['life_account_id'] = !empty($goodsSkuList[$value['goods_sku_id']]['life_account_id']) ? $goodsSkuList[$value['goods_sku_id']]['life_account_id'] : ''; $list[$i]['life_account_id'] = !empty($goodsSkuList[$value['goods_sku_id']]['life_account_id']) ? $goodsSkuList[$value['goods_sku_id']]['life_account_id'] : '';
...@@ -164,8 +165,9 @@ class MarketingGoodsService ...@@ -164,8 +165,9 @@ class MarketingGoodsService
} }
} }
} }
$result = ['result' => $list ,'last_id' => $lastId]; $hasmore = !empty($list) ? 1 : 0 ;
$result = ['result' => $list ,'last_id' => $lastId, 'hasmore' => $hasmore];
return $result; return $result;
} }
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
namespace App\Services\marketing; namespace App\Services\marketing;
use Api\PhpServices\Ksy\Ks3Api; use Api\PhpServices\Ksy\Ks3Api;
use Api\PhpUtils\Http\HttpUtil;
use App\Exception\custom\InterfaceException;
use App\Models\goods\mysql\Ota; use App\Models\goods\mysql\Ota;
use App\Models\goods\mysql\PindanGoodsSku; use App\Models\goods\mysql\PindanGoodsSku;
use App\Models\marketing\mysql\Marketing; use App\Models\marketing\mysql\Marketing;
...@@ -91,7 +93,7 @@ class MarketingService ...@@ -91,7 +93,7 @@ class MarketingService
$where = [ $where = [
'online_status' => 1, 'online_status' => 1,
'rule_refund' => 2, //'rule_refund' => 2,
"expiration_time[>]" => date("Y-m-d"), "expiration_time[>]" => date("Y-m-d"),
]; ];
...@@ -287,9 +289,10 @@ class MarketingService ...@@ -287,9 +289,10 @@ class MarketingService
if (!empty($priceData[$value["marketing_id"]])) { if (!empty($priceData[$value["marketing_id"]])) {
$currentLifeAccountId = $priceData[$value["marketing_id"]]["publish_life_account_id"]; $currentLifeAccountId = $priceData[$value["marketing_id"]]["publish_life_account_id"];
//小程序前端过滤掉线上测试生活号发布的活动 //小程序前端过滤掉线上测试生活号发布的活动
// if ($params['from'] == 1 && $currentLifeAccountId == self::ONLINE_LIFE_ACCOUNT_ID_TEST) { //TODO::预发环境要调整这里
// continue; if ($params['from'] == 1 && $currentLifeAccountId == self::ONLINE_LIFE_ACCOUNT_ID_TEST) {
// } continue;
}
$lists[$key]["publish_life_account_id"] = $currentLifeAccountId; $lists[$key]["publish_life_account_id"] = $currentLifeAccountId;
if (!empty($lifeAccountList[$currentLifeAccountId])) { if (!empty($lifeAccountList[$currentLifeAccountId])) {
...@@ -502,7 +505,25 @@ class MarketingService ...@@ -502,7 +505,25 @@ class MarketingService
throw new GoodsException(['cus' => 48]); throw new GoodsException(['cus' => 48]);
} }
} }
}else{
//比例计算
if ($commissionMode == Marketing::COMMISSION_MODE_RATE) {
$commissionTotal = ($firstCommissionRate + $secondCommissionRate) / 10000 * $price;
if ($price < ($commissionTotal+$chargeFee)) {
throw new MarketingException(['cus'=>33]);
}
}
//固定金额
if ($commissionMode == Marketing::COMMISSION_MODE_FIXED) {
$commissionTotal = ($firstCommissionRate + $secondCommissionRate);
if ($price < ($commissionTotal+$chargeFee)) {
throw new MarketingException(['cus'=>33]);
}
}
} }
$colums[$key]['marketing_id'] = $marketingId; $colums[$key]['marketing_id'] = $marketingId;
$colums[$key]['goods_spu_id'] = $value['goods_spu_id']; $colums[$key]['goods_spu_id'] = $value['goods_spu_id'];
...@@ -763,11 +784,16 @@ class MarketingService ...@@ -763,11 +784,16 @@ class MarketingService
} }
} }
$marketingGoods = []; $marketingGoods = [];
foreach ($skuInfoList as $key => $skuInfo) { $tempSkuInfoList = array_column($skuInfoList, null, "goods_sku_id");
$marketingGoods[$key]["goods_spu_id"] = $skuInfo["goods_spu_id"]; foreach ($goodsSkuId as $key => $skuId) {
$marketingGoods[$key]["goods_sku_id"] = $skuInfo["goods_sku_id"]; if (empty($tempSkuInfoList[$skuId]["goods_spu_id"])) {
continue;
}
$marketingGoods[$key]["goods_spu_id"] = $tempSkuInfoList[$skuId]["goods_spu_id"];
$marketingGoods[$key]["goods_sku_id"] = $skuId;
$marketingGoods[$key]["marketing_id"] = $marketingId; $marketingGoods[$key]["marketing_id"] = $marketingId;
} }
MarketingGoods::save($marketingGoods); MarketingGoods::save($marketingGoods);
//自提点 //自提点
...@@ -901,13 +927,16 @@ class MarketingService ...@@ -901,13 +927,16 @@ class MarketingService
private static function pindanMarketingInfo($params) private static function pindanMarketingInfo($params)
{ {
$marketingInfo = Marketing::getRecord(['marketing_id' => $params['marketing_id'], "marketing_type" => Marketing::MARKETING_TYPE_PINDAN]); $marketingInfo = Marketing::getRecord(['marketing_id' => $params['marketing_id'], "marketing_type" => Marketing::MARKETING_TYPE_PINDAN]);
if (empty($marketingInfo))
throw new GoodsException(['cus' => GoodsException::NOT_FIND_MARKETING]);
$pindanMarketing = MarketingPindan::getRecord(['marketing_id' => $params['marketing_id']]); $pindanMarketing = MarketingPindan::getRecord(['marketing_id' => $params['marketing_id']]);
$lifeAccountList = CommonService::getlifeAccountList(['life_account_id' => [$pindanMarketing["publish_life_account_id"]]]); $lifeAccountList = CommonService::getlifeAccountList(['life_account_id' => [$pindanMarketing["publish_life_account_id"]]]);
$goodsSkuList = MarketingGoods::marketingGoodsList(['marketing_id' => $params['marketing_id']]); $marketingGoodsList = MarketingGoods::marketingGoodsList(['marketing_id' => $params['marketing_id'], "ORDER" => ["id" => "ASC"]]);
if (!empty($marketingGoodsList)) {
if (!empty($goodsSkuList)) { $goodsSkuId = array_column($marketingGoodsList , 'goods_sku_id');
$goodsSkuId = array_column($goodsSkuList , 'goods_sku_id');
$goodsSkuList = PindanGoodsSku::select('*', ['goods_sku_id' => $goodsSkuId]); $goodsSkuList = PindanGoodsSku::select('*', ['goods_sku_id' => $goodsSkuId]);
} }
empty($goodsSkuList) && $goodsSkuList = []; empty($goodsSkuList) && $goodsSkuList = [];
...@@ -945,6 +974,15 @@ class MarketingService ...@@ -945,6 +974,15 @@ class MarketingService
$info['marketing_info'] = $marketingData; $info['marketing_info'] = $marketingData;
//有用户登录时候,当前用户购买的商品数量信息
$haveBuyGoodsStatistics = [];
if (!empty($params["user_id"])) {
$haveBuyGoodsStatistics = self::getHaveBuyGoodsStatistics(["user_id" => $params["user_id"], "marketing_id" => $marketingData["id"]]);
}
//活动中所有购买的商品数量信息
$allHaveBuyGoodsStatistics = self::getHaveBuyGoodsStatistics(["marketing_id" => $marketingData["id"]]);
if (!empty($goodsSkuList)) { if (!empty($goodsSkuList)) {
$otaIds = array_unique(array_column($goodsSkuList, "ota_id")); $otaIds = array_unique(array_column($goodsSkuList, "ota_id"));
$otas = Ota::select(["ota_id", "ota_name"], ["ota_id" => $otaIds]); $otas = Ota::select(["ota_id", "ota_name"], ["ota_id" => $otaIds]);
...@@ -952,12 +990,40 @@ class MarketingService ...@@ -952,12 +990,40 @@ class MarketingService
$otasData[$item["ota_id"]] = $item; $otasData[$item["ota_id"]] = $item;
} }
foreach ($goodsSkuList as $key => $item) { //这里是为了排序,按查 marketing_goods 出来的顺序排序
$tempGoodsSkuList = array_column($goodsSkuList, null, "goods_sku_id");
foreach ($marketingGoodsList as $key => $value) {
if (empty($tempGoodsSkuList[$value["goods_sku_id"]])) {
continue;
}
$item = $tempGoodsSkuList[$value["goods_sku_id"]];
$goodsSkuList[$key] = $item;
$goodsSkuList[$key]["desc_pic_url_list"] = GoodsService::getUrlList($item["desc_pic_url"]); $goodsSkuList[$key]["desc_pic_url_list"] = GoodsService::getUrlList($item["desc_pic_url"]);
$goodsSkuList[$key]["ota_name"] = empty($otasData[$item["ota_id"]]["ota_name"]) ? "" : $otasData[$item["ota_id"]]["ota_name"]; $goodsSkuList[$key]["ota_name"] = empty($otasData[$item["ota_id"]]["ota_name"]) ? "" : $otasData[$item["ota_id"]]["ota_name"];
$goodsSkuList[$key]["original_price"] = empty($item["original_price"]) ? '' : sprintf("%.2f", (int)$item["original_price"] / 100); $goodsSkuList[$key]["original_price"] = empty($item["original_price"]) ? '' : sprintf("%.2f", (int)$item["original_price"] / 100);
$goodsSkuList[$key]["price"] = sprintf("%.2f", $item["price"] / 100); $goodsSkuList[$key]["price"] = sprintf("%.2f", $item["price"] / 100);
$goodsSkuList[$key]["have_buy_goods_count"] = 0;
//前端当前登录人的数据
$haveBuyGoodsSkuIds = array_keys($haveBuyGoodsStatistics);
if (in_array($item["goods_sku_id"], $haveBuyGoodsSkuIds)) {
$goodsSkuList[$key]["have_buy_goods_count"] = $haveBuyGoodsStatistics[$item["goods_sku_id"]];
}
//后台展示所有购买的数量
$goodsSkuList[$key]["all_have_buy_goods_count"] = 0;
$allHaveBuyGoodsSkuIds = array_keys($allHaveBuyGoodsStatistics);
if (in_array($item["goods_sku_id"], $allHaveBuyGoodsSkuIds)) {
$goodsSkuList[$key]["all_have_buy_goods_count"] = $allHaveBuyGoodsStatistics[$item["goods_sku_id"]];
}
} }
foreach ($goodsSkuList as $key => $item) {
if ($item["inventory_rest"] == 0) {
unset($goodsSkuList[$key]);
array_push($goodsSkuList, $item);
}
}
$goodsSkuList = array_values($goodsSkuList);
} }
$takePlaceIds = MarketingTakePlace::getRecords(["marketing_id" => $marketingData["id"]], ["take_place_id"]); $takePlaceIds = MarketingTakePlace::getRecords(["marketing_id" => $marketingData["id"]], ["take_place_id"]);
...@@ -1014,4 +1080,24 @@ class MarketingService ...@@ -1014,4 +1080,24 @@ class MarketingService
"count" => $count]], []); "count" => $count]], []);
return $res['id_snow'][$type] ?? []; return $res['id_snow'][$type] ?? [];
} }
/**
* 指定活动的已购买商品统计
* @param array $params
* @return array|mixed
* @throws InterfaceException
*/
public static function getHaveBuyGoodsStatistics($params = [])
{
$url = config('interface', 'order.order.have_buy_order_statistics');
if (empty($url)) {
throw new InterfaceException(['cus' => 0]);
}
$res = HttpUtil::get($url, $params);
$data = [];
if ($res['code'] == 0 && isset($res['response']["result"])) {
$data = $res["response"]["result"];
}
return $data;
}
} }
\ No newline at end of file
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
"require": { "require": {
"php": "7.2.*", "php": "7.2.*",
"ext-json": "*", "ext-json": "*",
"api/php_utils":"1.0.10", "api/php_utils":"1.0.12",
"api/php_services":"1.0.1", "api/php_services":"1.0.9",
"ext-openssl": "*" "ext-openssl": "*"
}, },
"minimum-stability": "dev", "minimum-stability": "dev",
......
This diff is collapsed.
...@@ -6,8 +6,9 @@ namespace Daemon; ...@@ -6,8 +6,9 @@ namespace Daemon;
use Api\PhpServices\Daemon\DaemonServiceInterface; use Api\PhpServices\Daemon\DaemonServiceInterface;
use Api\PhpUtils\Log\DaemonLog; use Api\PhpUtils\Log\DaemonLog;
use App\Services\marketing\MarketingService; use App\Models\marketing\mysql\Marketing;
use Api\PhpServices\Wechat\Msg; use Api\PhpServices\Wechat\Msg;
use App\Models\marketing\mysql\MarketingPindan;
class Pindan implements DaemonServiceInterface class Pindan implements DaemonServiceInterface
{ {
...@@ -22,15 +23,18 @@ class Pindan implements DaemonServiceInterface ...@@ -22,15 +23,18 @@ class Pindan implements DaemonServiceInterface
} }
try{ try{
//查询进行中的拼单活动 //查询进行中的 今天开始的 拼单活动 --昨天16:40以后开始的活动 视为新上的活动
$params['marketing_type'] = 4;//1分销 2团购 3秒杀 4团餐 $lastStartTime = date("Y-m-d 16:40:00",strtotime('-1 days'));
$params['online_status'] = 1;//状态 , 1启用,2关闭,3 到期 $now = date("Y-m-d H:i:00");
$params['activity_status'] = 2;//1 未开始,2进行中,3已结束 $where['marketing_type'] = 4;
$params['page'] = 1; $where['online_status'] = 1;
$params['page_size'] = 1; $where["start_time[<=]"] = $now;
$list = MarketingService::marketingList($params); $where["start_time[>]"] = $lastStartTime;
$where["end_time[>=]"] = $now;
$where['ORDER'] = ["update_time" => "DESC"];
$marketing = Marketing::get(['marketing_id','marketing_name','start_time'], $where);
if(empty($list['result'])) { if(empty($marketing)) {
DaemonLog::info( DaemonLog::info(
'DaemonServiceInterface_pindan', 'DaemonServiceInterface_pindan',
'no need to send at'.date('Y-m-d H:i:s') 'no need to send at'.date('Y-m-d H:i:s')
...@@ -38,6 +42,7 @@ class Pindan implements DaemonServiceInterface ...@@ -38,6 +42,7 @@ class Pindan implements DaemonServiceInterface
sleep(60); sleep(60);
return false; return false;
} }
$pindan = MarketingPindan::get(["pindan_desc"], ["marketing_id" => $marketing["marketing_id"]]);
//给订阅用户发送消息 //给订阅用户发送消息
//http://ydwiki.yidian-inc.com/pages/viewpage.action?pageId=71667995 //http://ydwiki.yidian-inc.com/pages/viewpage.action?pageId=71667995
...@@ -47,10 +52,11 @@ class Pindan implements DaemonServiceInterface ...@@ -47,10 +52,11 @@ class Pindan implements DaemonServiceInterface
$type = 2; // 1 公众号 2 小程序 $type = 2; // 1 公众号 2 小程序
//活动信息 //活动信息
$params = [ $params = [
self::emojiFilter($list['result'][0]['marketing_name']), self::emojiFilter($marketing['marketing_name']),
$list['result'][0]['create_time'], $marketing['start_time'],
$list['result'][0]['pindan_desc'] ?: self::DEFAULT_DESC $pindan['pindan_desc'] ?: self::DEFAULT_DESC
]; ];
//发送消息 //发送消息
DaemonLog::info( DaemonLog::info(
'DaemonServiceInterface_pindan', 'DaemonServiceInterface_pindan',
......
{
"name": "xxx",
"version": "0.0.0",
}
\ No newline at end of file
...@@ -232,4 +232,23 @@ class JwUser ...@@ -232,4 +232,23 @@ class JwUser
} }
return !empty($ret['response']) ? $ret['response'] : []; return !empty($ret['response']) ? $ret['response'] : [];
} }
/**
* 是否关注公众号
*/
public static function isSubscribe($params)
{
$url = config('interface', 'service.jw_user.is_subscribe');
if (!$url) {
throw new CodeSpecialException("failed");
}
//$ret = (new TimeOut())->runPost($url, $params);
$ret = (new Request())->post($url, $params, 0, '', '', 0, true, 'jw_user');
FileLog::info('getWechatOpenid', json_encode($ret));
if (!$ret) {
throw new CodeSpecialException("timeout");
}
return !empty($ret['response']) ? $ret['response'] : [];
}
} }
...@@ -39,6 +39,11 @@ class FeiPrinter extends \Api\PhpServices\Printer\Printer ...@@ -39,6 +39,11 @@ class FeiPrinter extends \Api\PhpServices\Printer\Printer
*/ */
private const API_PRINTER_STATUS = "Open_queryPrinterStatus"; private const API_PRINTER_STATUS = "Open_queryPrinterStatus";
/**
* 添加打印机
*/
private const API_ADD_PRINTER = "Open_printerAddlist";
/** /**
* @param string $apiName api 名字 * @param string $apiName api 名字
...@@ -74,10 +79,20 @@ class FeiPrinter extends \Api\PhpServices\Printer\Printer ...@@ -74,10 +79,20 @@ class FeiPrinter extends \Api\PhpServices\Printer\Printer
/** /**
* @inheritDoc * @inheritDoc
* @throws \Exception
*/ */
public function addPrinter(array $param): bool public function addPrinter(array $param): bool
{ {
// TODO: Implement addPrinter() method. $res = $this->request(self::API_ADD_PRINTER, [
'printerContent' => "{$param['printer_sn']} # {$param['printer_key']} # {$param['ota_name']}",
]);
if ($res['code'] == 0 && isset($res['response'])) {
if ($res['response']['ret'] == 0) {
return $res['response']['data'];
}
throw new \Exception($res['response']['msg']);
}
throw new \Exception("接口调用异常");
} }
/** /**
...@@ -90,24 +105,26 @@ class FeiPrinter extends \Api\PhpServices\Printer\Printer ...@@ -90,24 +105,26 @@ class FeiPrinter extends \Api\PhpServices\Printer\Printer
/** /**
* @inheritDoc * @inheritDoc
* @throws \Exception
*/ */
public function getPrinterStatus(string $printerId): string public function getPrinterStatus(string $printerId): string
{ {
$res = $this->request(self::API_PRINTER_STATUS, [ $res = $this->request(self::API_PRINTER_STATUS, [
'sn' => $printerId, 'sn' => $printerId,
]); ]);
if ($res['code'] == 0 && isset($res['response'])) { if ($res['code'] == 0 && isset($res['response'])) {
if ($res['response']['ret'] == 0) { if ($res['response']['ret'] == 0) {
return $res['response']['data']; return $res['response']['data'];
} }
throw new Exception($res['response']['msg']); throw new \Exception($res['response']['msg']);
} }
throw new Exception("接口调用异常"); throw new \Exception("接口调用异常");
} }
/** /**
* @inheritDoc * @inheritDoc
* @throws \Exception
*/ */
public function printContent(string $printerId, array $content):string public function printContent(string $printerId, array $content):string
{ {
...@@ -133,13 +150,14 @@ class FeiPrinter extends \Api\PhpServices\Printer\Printer ...@@ -133,13 +150,14 @@ class FeiPrinter extends \Api\PhpServices\Printer\Printer
if ($res['response']['ret'] == 0) { if ($res['response']['ret'] == 0) {
return $res['response']['data']; return $res['response']['data'];
} }
throw new Exception($res['response']['msg']); throw new \Exception($res['response']['msg']);
} }
throw new Exception("接口调用异常"); throw new \Exception("接口调用异常");
} }
/** /**
* @inheritDoc * @inheritDoc
* @throws \Exception
*/ */
public function getOrderStatus(string $orderId): bool public function getOrderStatus(string $orderId): bool
{ {
...@@ -150,8 +168,8 @@ class FeiPrinter extends \Api\PhpServices\Printer\Printer ...@@ -150,8 +168,8 @@ class FeiPrinter extends \Api\PhpServices\Printer\Printer
if ($res['response']['ret'] == 0) { if ($res['response']['ret'] == 0) {
return (bool) $res['response']['data']; return (bool) $res['response']['data'];
} }
throw new Exception($res['response']['msg']); throw new \Exception($res['response']['msg']);
} }
throw new Exception("接口调用异常"); throw new \Exception("接口调用异常");
} }
} }
\ No newline at end of file
...@@ -3,6 +3,9 @@ ...@@ -3,6 +3,9 @@
namespace Api\PhpServices\ShopImage; namespace Api\PhpServices\ShopImage;
use Api\PhpServices\Ksy\Ksyun;
use Api\PhpUtils\Ksy\Ks3Util;
use Api\PhpUtils\Log\FileLog;
use Endroid\QrCode\ErrorCorrectionLevel; use Endroid\QrCode\ErrorCorrectionLevel;
use Endroid\QrCode\QrCode; use Endroid\QrCode\QrCode;
...@@ -203,7 +206,7 @@ class GetImage ...@@ -203,7 +206,7 @@ class GetImage
// 老价格 // 老价格
if($old_price){ if($old_price){
$color = ImageColorAllocate ($im, 187, 187, 187); $color = ImageColorAllocate ($im, 187, 187, 187);
imagettftext($im, 13,0, 173, 957, $color ,$this->font_h, "¥".$price); imagettftext($im, 13,0, 173, 957, $color ,$this->font_h, "¥".$old_price);
$del_path = __DIR__.'/images/3_del.png'; $del_path = __DIR__.'/images/3_del.png';
list($del_w,$del_h) = getimagesize($del_path); list($del_w,$del_h) = getimagesize($del_path);
...@@ -247,7 +250,9 @@ class GetImage ...@@ -247,7 +250,9 @@ class GetImage
imagedestroy($tuijian_img); imagedestroy($tuijian_img);
imagedestroy($qr_img); imagedestroy($qr_img);
imagedestroy($logo_im); imagedestroy($logo_im);
imagedestroy($del_im); if($old_price){
imagedestroy($del_im);
}
imagedestroy($user_im); imagedestroy($user_im);
} }
...@@ -391,4 +396,75 @@ class GetImage ...@@ -391,4 +396,75 @@ class GetImage
} }
return $res; return $res;
} }
public function buildShareImgByGoodsAvatarSrc($goodsAvatarSrc){
$tmpImg = '/tmp/'.md5($goodsAvatarSrc);
file_put_contents($tmpImg,file_get_contents($goodsAvatarSrc));
if(!is_file($tmpImg)){
return '';
}
$imgType = getimagesize($tmpImg);
$descW = 500;
$descH = $imgType[1]/$imgType[0] * $descW;
if($descH > 280){
$descH = 280;
}
$baseRS = imagecreatefrompng(__DIR__.DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR.'goods_share_bg.png');
if(!$baseRS){
unlink($tmpImg);
return '';
}
switch ($imgType[2]){
case IMG_PNG:
$srcRS = imagecreatefrompng($tmpImg);
break;
case 3:
$srcRS = imagecreatefrompng($tmpImg);
break;
case IMG_JPEG:
$srcRS = imagecreatefromjpeg($tmpImg);
break;
case IMG_GIF:
$srcRS = imagecreatefromgif($tmpImg);
break;
}
if(!isset($srcRS) || !$srcRS){
unlink($tmpImg);
return '';
}
unlink($tmpImg);
$res = imagecopyresized($baseRS,$srcRS,0,0,0,0,$descW,$descH,$imgType[0],$imgType[1] );
if(!$res){
imagedestroy($srcRS);
imagedestroy($baseRS);
return '';
}
ob_start();
//header('Content-type:Images/png');
$ret = imagepng($baseRS,null,9);
// $imgContent = file_get_contents($tmpImg);
$imgContent = ob_get_clean();
if($ret){
imagedestroy($srcRS);
imagedestroy($baseRS);
if($imgContent){
return $this->uploadImage($imgContent);
}
return '';
}else{
imagedestroy($srcRS);
imagedestroy($baseRS);
}
return '';
}
private function uploadImage($fileContent){
$appid = 'merchant-b';
$scenario = 'id_card';
$object = Ksyun::getObjectAndBucket($appid,$scenario);
$bucket = $object['bucket'];
$objectKey = $object['objectId'].'.jpeg';
$str = Ks3Util::put_object($fileContent,$bucket,$objectKey, $timeout = 5000);
$url = Ksyun::getUrlFromKsyn($bucket.'/'.$objectKey, $appid);
return $url;
}
} }
<?php
namespace Api\PhpServices\User;
use Api\PhpUtils\Http\Request;
use Api\PhpUtils\Log\FileLog;
class WechatBind
{
/**
* 获取微信绑定用户信息
*
* @param array $params
* $params['openid'=> 'openid', 'user_id'=> 123],非必填,至少一个
* @return array
*/
public static function getUserWechatBind($params)
{
$url = config('interface', 'goods.public.user_wechat_bind');
$res = (new Request())->get($url, $params);
if ($res['code'] == 0 && isset($res['response'])) {
return !empty($res['response']['result']) ? $res['response']['result'] : [];
}
return [];
}
/**
* 是否是新微信用户, 默认注册时间24小时以内算是新用户
*
* @param string $openid
* @return array
*/
public static function isNewWechatUser($openid, int $timeInterval = 86400)
{
$url = config('interface', 'goods.public.user_wechat_bind');
$res = (new Request())->get($url, ['openid'=> $openid]);
if ($res['code'] == 0 && isset($res['response'])) {
if(empty($res['response']['result'])) {
return true;//没有查到数据暂时先认定为新用户
}
$userInfo = $res['response']['result'];
$userInfo = current($userInfo);
if ((strtotime($userInfo['create_time']) + $timeInterval) > time()) {
return true;
}
}
// 没有查询到对应的openid数据
FileLog::error("调用isNewWechatUser方法未获取到数据:", json_encode(['openid' => $openid, 'timeInterval' => $timeInterval, 'res' => $res]));
return false;
}
}
...@@ -393,7 +393,7 @@ class IP ...@@ -393,7 +393,7 @@ class IP
foreach ($ip as $one) foreach ($ip as $one)
{ {
if (!self::is_intranet($one) && $one !== '') if ($one !== '' && !self::is_intranet($one) && !self::is_shq($one))
{ {
$internet_ips[] = $one; $internet_ips[] = $one;
} }
...@@ -417,4 +417,76 @@ class IP ...@@ -417,4 +417,76 @@ class IP
($long >= 2886729728 && $long <= 2887778303) || //172.15.0.0 ~ 172.31.255.255 ($long >= 2886729728 && $long <= 2887778303) || //172.15.0.0 ~ 172.31.255.255
($long >= 3232235520 && $long <= 3232301055); //192.168.0.0 ~ 192.168.255.255 ($long >= 3232235520 && $long <= 3232301055); //192.168.0.0 ~ 192.168.255.255
} }
/**
* 判断是否简网生活圈优客云ip
*
* @param $ip
* @return bool
*/
public static function is_shq($ip)
{
$ipIgnoreArray = ['123.59.135.125',
'106.75.78.45',
'106.75.106.72',
'106.75.24.149',
'106.75.90.178',
'106.75.25.238',
'106.75.7.123',
'117.50.10.4',
'117.50.13.14',
'106.75.70.11',
'106.75.120.33',
'106.75.103.119',
'106.75.126.234',
'106.75.8.17',
'106.75.66.217',
'106.75.26.98',
'117.50.101.102',
'106.75.28.8',
'123.59.137.102',
'106.75.72.206',
'106.75.27.141',
'106.75.49.133',
'117.50.107.175',
'106.75.95.163',
'106.75.21.36',
'106.75.99.29',
'106.75.7.229',
'106.75.27.151',
'106.75.115.25',
'117.50.105.119',
'106.75.110.215',
'106.75.26.223',
'106.75.122.185',
'117.50.59.107',
'117.50.4.46',
'117.50.82.165',
'106.75.109.124',
'117.50.95.34',
'123.59.53.82',
'117.50.90.239',
'106.75.25.179',
'106.75.126.16',
'106.75.50.87',
'106.75.30.181',
'106.75.126.121',
'106.75.61.99',
'106.75.93.183',
'117.50.90.105',
'106.75.6.131',
'106.75.24.77',
'106.75.78.10',
'106.75.18.203',
'117.50.100.125',
'106.75.32.125',
'117.50.95.3',
'117.50.13.104',
'117.50.39.114',
'117.50.1.29',
'117.50.39.93',
'117.50.0.170'
];
return in_array($ip, $ipIgnoreArray);
}
} }
...@@ -26,7 +26,7 @@ class Email ...@@ -26,7 +26,7 @@ class Email
return false; return false;
} }
if (empty($from)) { if (empty($from)) {
$from = 'noreply@yidian-inc.com'; $from = 'bp-noreply@yidian-inc.com';
} }
try { try {
$email = explode('@', $from); $email = explode('@', $from);
......
...@@ -4,4 +4,4 @@ ...@@ -4,4 +4,4 @@
require_once __DIR__ . '/composer/autoload_real.php'; require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit5871a7b0b10b793d91ef1c8029b23ea5::getLoader(); return ComposerAutoloaderInit14d712e6ba9ca61e9e636d6cf65f43bf::getLoader();
...@@ -338,7 +338,7 @@ class ClassLoader ...@@ -338,7 +338,7 @@ class ClassLoader
* Loads the given class or interface. * Loads the given class or interface.
* *
* @param string $class The name of the class * @param string $class The name of the class
* @return bool|null True if loaded, null otherwise * @return true|null True if loaded, null otherwise
*/ */
public function loadClass($class) public function loadClass($class)
{ {
...@@ -347,6 +347,8 @@ class ClassLoader ...@@ -347,6 +347,8 @@ class ClassLoader
return true; return true;
} }
return null;
} }
/** /**
......
This diff is collapsed.
...@@ -38,6 +38,7 @@ return array( ...@@ -38,6 +38,7 @@ return array(
'Api\\PhpServices\\Sms\\Sms' => $vendorDir . '/api/php_services/src/Sms/Sms.php', 'Api\\PhpServices\\Sms\\Sms' => $vendorDir . '/api/php_services/src/Sms/Sms.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\\User\\WechatBind' => $vendorDir . '/api/php_services/src/User/WechatBind.php',
'Api\\PhpServices\\Wechat\\Msg' => $vendorDir . '/api/php_services/src/Wechat/Msg.php', 'Api\\PhpServices\\Wechat\\Msg' => $vendorDir . '/api/php_services/src/Wechat/Msg.php',
'Api\\PhpServices\\XhProfiler\\XhMongo' => $vendorDir . '/api/php_services/src/XhProfiler/XhMongo.php', 'Api\\PhpServices\\XhProfiler\\XhMongo' => $vendorDir . '/api/php_services/src/XhProfiler/XhMongo.php',
'Api\\PhpServices\\XhProfiler\\XhProfilerService' => $vendorDir . '/api/php_services/src/XhProfiler/XhProfilerService.php', 'Api\\PhpServices\\XhProfiler\\XhProfilerService' => $vendorDir . '/api/php_services/src/XhProfiler/XhProfilerService.php',
......
...@@ -8,18 +8,18 @@ $baseDir = dirname($vendorDir); ...@@ -8,18 +8,18 @@ $baseDir = dirname($vendorDir);
return array( return array(
'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php', 'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php',
'6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php', '6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php',
'320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php',
'8825ede83f2f289127722d4e842cf7e8' => $vendorDir . '/symfony/polyfill-intl-grapheme/bootstrap.php',
'e69f7f6ee287b969198c3c9d6777bd38' => $vendorDir . '/symfony/polyfill-intl-normalizer/bootstrap.php',
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php', '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
'e69f7f6ee287b969198c3c9d6777bd38' => $vendorDir . '/symfony/polyfill-intl-normalizer/bootstrap.php',
'8825ede83f2f289127722d4e842cf7e8' => $vendorDir . '/symfony/polyfill-intl-grapheme/bootstrap.php',
'320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php',
'b6b991a57620e2fb6b2f66f03fe9ddc2' => $vendorDir . '/symfony/string/Resources/functions.php', 'b6b991a57620e2fb6b2f66f03fe9ddc2' => $vendorDir . '/symfony/string/Resources/functions.php',
'0d59ee240a4cd96ddbb4ff164fccea4d' => $vendorDir . '/symfony/polyfill-php73/bootstrap.php',
'7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php', '7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php',
'ad155f8f1cf0d418fe49e248db8c661b' => $vendorDir . '/react/promise/src/functions_include.php', 'ad155f8f1cf0d418fe49e248db8c661b' => $vendorDir . '/react/promise/src/functions_include.php',
'0d59ee240a4cd96ddbb4ff164fccea4d' => $vendorDir . '/symfony/polyfill-php73/bootstrap.php',
'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php', 'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php',
'a0edc8309cc5e1d60e3047b5df6b7052' => $vendorDir . '/guzzlehttp/psr7/src/functions_include.php',
'a9ed0d27b5a698798a89181429f162c5' => $vendorDir . '/khanamiryan/qrcode-detector-decoder/lib/Common/customFunctions.php', 'a9ed0d27b5a698798a89181429f162c5' => $vendorDir . '/khanamiryan/qrcode-detector-decoder/lib/Common/customFunctions.php',
'8592c7b0947d8a0965a9e8c3d16f9c24' => $vendorDir . '/elasticsearch/elasticsearch/src/autoload.php', 'a0edc8309cc5e1d60e3047b5df6b7052' => $vendorDir . '/guzzlehttp/psr7/src/functions_include.php',
'37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php', '37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php',
'3a37ebac017bc098e9a86b35401e7a68' => $vendorDir . '/mongodb/mongodb/src/functions.php', '3a37ebac017bc098e9a86b35401e7a68' => $vendorDir . '/mongodb/mongodb/src/functions.php',
'8592c7b0947d8a0965a9e8c3d16f9c24' => $vendorDir . '/elasticsearch/elasticsearch/src/autoload.php',
); );
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer // autoload_real.php @generated by Composer
class ComposerAutoloaderInit5871a7b0b10b793d91ef1c8029b23ea5 class ComposerAutoloaderInit14d712e6ba9ca61e9e636d6cf65f43bf
{ {
private static $loader; private static $loader;
...@@ -24,15 +24,15 @@ class ComposerAutoloaderInit5871a7b0b10b793d91ef1c8029b23ea5 ...@@ -24,15 +24,15 @@ class ComposerAutoloaderInit5871a7b0b10b793d91ef1c8029b23ea5
require __DIR__ . '/platform_check.php'; require __DIR__ . '/platform_check.php';
spl_autoload_register(array('ComposerAutoloaderInit5871a7b0b10b793d91ef1c8029b23ea5', 'loadClassLoader'), true, true); spl_autoload_register(array('ComposerAutoloaderInit14d712e6ba9ca61e9e636d6cf65f43bf', '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('ComposerAutoloaderInit5871a7b0b10b793d91ef1c8029b23ea5', 'loadClassLoader')); spl_autoload_unregister(array('ComposerAutoloaderInit14d712e6ba9ca61e9e636d6cf65f43bf', '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\ComposerStaticInit5871a7b0b10b793d91ef1c8029b23ea5::getInitializer($loader)); call_user_func(\Composer\Autoload\ComposerStaticInit14d712e6ba9ca61e9e636d6cf65f43bf::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 ComposerAutoloaderInit5871a7b0b10b793d91ef1c8029b23ea5 ...@@ -53,19 +53,19 @@ class ComposerAutoloaderInit5871a7b0b10b793d91ef1c8029b23ea5
$loader->register(true); $loader->register(true);
if ($useStaticLoader) { if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInit5871a7b0b10b793d91ef1c8029b23ea5::$files; $includeFiles = Composer\Autoload\ComposerStaticInit14d712e6ba9ca61e9e636d6cf65f43bf::$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) {
composerRequire5871a7b0b10b793d91ef1c8029b23ea5($fileIdentifier, $file); composerRequire14d712e6ba9ca61e9e636d6cf65f43bf($fileIdentifier, $file);
} }
return $loader; return $loader;
} }
} }
function composerRequire5871a7b0b10b793d91ef1c8029b23ea5($fileIdentifier, $file) function composerRequire14d712e6ba9ca61e9e636d6cf65f43bf($fileIdentifier, $file)
{ {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file; require $file;
......
...@@ -4,25 +4,25 @@ ...@@ -4,25 +4,25 @@
namespace Composer\Autoload; namespace Composer\Autoload;
class ComposerStaticInit5871a7b0b10b793d91ef1c8029b23ea5 class ComposerStaticInit14d712e6ba9ca61e9e636d6cf65f43bf
{ {
public static $files = array ( public static $files = array (
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php', 'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
'6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php', '6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php',
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
'8825ede83f2f289127722d4e842cf7e8' => __DIR__ . '/..' . '/symfony/polyfill-intl-grapheme/bootstrap.php',
'e69f7f6ee287b969198c3c9d6777bd38' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/bootstrap.php',
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
'e69f7f6ee287b969198c3c9d6777bd38' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/bootstrap.php',
'8825ede83f2f289127722d4e842cf7e8' => __DIR__ . '/..' . '/symfony/polyfill-intl-grapheme/bootstrap.php',
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
'b6b991a57620e2fb6b2f66f03fe9ddc2' => __DIR__ . '/..' . '/symfony/string/Resources/functions.php', 'b6b991a57620e2fb6b2f66f03fe9ddc2' => __DIR__ . '/..' . '/symfony/string/Resources/functions.php',
'0d59ee240a4cd96ddbb4ff164fccea4d' => __DIR__ . '/..' . '/symfony/polyfill-php73/bootstrap.php',
'7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php', '7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php',
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php', 'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
'0d59ee240a4cd96ddbb4ff164fccea4d' => __DIR__ . '/..' . '/symfony/polyfill-php73/bootstrap.php',
'c964ee0ededf28c96ebd9db5099ef910' => __DIR__ . '/..' . '/guzzlehttp/promises/src/functions_include.php', 'c964ee0ededf28c96ebd9db5099ef910' => __DIR__ . '/..' . '/guzzlehttp/promises/src/functions_include.php',
'a0edc8309cc5e1d60e3047b5df6b7052' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/functions_include.php',
'a9ed0d27b5a698798a89181429f162c5' => __DIR__ . '/..' . '/khanamiryan/qrcode-detector-decoder/lib/Common/customFunctions.php', 'a9ed0d27b5a698798a89181429f162c5' => __DIR__ . '/..' . '/khanamiryan/qrcode-detector-decoder/lib/Common/customFunctions.php',
'8592c7b0947d8a0965a9e8c3d16f9c24' => __DIR__ . '/..' . '/elasticsearch/elasticsearch/src/autoload.php', 'a0edc8309cc5e1d60e3047b5df6b7052' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/functions_include.php',
'37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php', '37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php',
'3a37ebac017bc098e9a86b35401e7a68' => __DIR__ . '/..' . '/mongodb/mongodb/src/functions.php', '3a37ebac017bc098e9a86b35401e7a68' => __DIR__ . '/..' . '/mongodb/mongodb/src/functions.php',
'8592c7b0947d8a0965a9e8c3d16f9c24' => __DIR__ . '/..' . '/elasticsearch/elasticsearch/src/autoload.php',
); );
public static $prefixLengthsPsr4 = array ( public static $prefixLengthsPsr4 = array (
...@@ -267,6 +267,7 @@ class ComposerStaticInit5871a7b0b10b793d91ef1c8029b23ea5 ...@@ -267,6 +267,7 @@ class ComposerStaticInit5871a7b0b10b793d91ef1c8029b23ea5
'Api\\PhpServices\\Sms\\Sms' => __DIR__ . '/..' . '/api/php_services/src/Sms/Sms.php', 'Api\\PhpServices\\Sms\\Sms' => __DIR__ . '/..' . '/api/php_services/src/Sms/Sms.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\\User\\WechatBind' => __DIR__ . '/..' . '/api/php_services/src/User/WechatBind.php',
'Api\\PhpServices\\Wechat\\Msg' => __DIR__ . '/..' . '/api/php_services/src/Wechat/Msg.php', 'Api\\PhpServices\\Wechat\\Msg' => __DIR__ . '/..' . '/api/php_services/src/Wechat/Msg.php',
'Api\\PhpServices\\XhProfiler\\XhMongo' => __DIR__ . '/..' . '/api/php_services/src/XhProfiler/XhMongo.php', 'Api\\PhpServices\\XhProfiler\\XhMongo' => __DIR__ . '/..' . '/api/php_services/src/XhProfiler/XhMongo.php',
'Api\\PhpServices\\XhProfiler\\XhProfilerService' => __DIR__ . '/..' . '/api/php_services/src/XhProfiler/XhProfilerService.php', 'Api\\PhpServices\\XhProfiler\\XhProfilerService' => __DIR__ . '/..' . '/api/php_services/src/XhProfiler/XhProfilerService.php',
...@@ -1300,9 +1301,9 @@ class ComposerStaticInit5871a7b0b10b793d91ef1c8029b23ea5 ...@@ -1300,9 +1301,9 @@ class ComposerStaticInit5871a7b0b10b793d91ef1c8029b23ea5
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 = ComposerStaticInit5871a7b0b10b793d91ef1c8029b23ea5::$prefixLengthsPsr4; $loader->prefixLengthsPsr4 = ComposerStaticInit14d712e6ba9ca61e9e636d6cf65f43bf::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit5871a7b0b10b793d91ef1c8029b23ea5::$prefixDirsPsr4; $loader->prefixDirsPsr4 = ComposerStaticInit14d712e6ba9ca61e9e636d6cf65f43bf::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit5871a7b0b10b793d91ef1c8029b23ea5::$classMap; $loader->classMap = ComposerStaticInit14d712e6ba9ca61e9e636d6cf65f43bf::$classMap;
}, null, ClassLoader::class); }, null, ClassLoader::class);
} }
......
This diff is collapsed.
This diff is collapsed.
...@@ -280,7 +280,7 @@ class OptionsResolver implements Options ...@@ -280,7 +280,7 @@ class OptionsResolver implements Options
* Returns true if {@link setDefault()} was called for this option. * Returns true if {@link setDefault()} was called for this option.
* An option is also considered set if it was set to null. * An option is also considered set if it was set to null.
* *
* @return bool Whether a default value is set * @return bool
*/ */
public function hasDefault(string $option) public function hasDefault(string $option)
{ {
...@@ -315,7 +315,7 @@ class OptionsResolver implements Options ...@@ -315,7 +315,7 @@ class OptionsResolver implements Options
* *
* An option is required if it was passed to {@link setRequired()}. * An option is required if it was passed to {@link setRequired()}.
* *
* @return bool Whether the option is required * @return bool
*/ */
public function isRequired(string $option) public function isRequired(string $option)
{ {
...@@ -325,7 +325,7 @@ class OptionsResolver implements Options ...@@ -325,7 +325,7 @@ class OptionsResolver implements Options
/** /**
* Returns the names of all required options. * Returns the names of all required options.
* *
* @return string[] The names of the required options * @return string[]
* *
* @see isRequired() * @see isRequired()
*/ */
...@@ -341,7 +341,7 @@ class OptionsResolver implements Options ...@@ -341,7 +341,7 @@ class OptionsResolver implements Options
* to {@link setDefault()}. This option must be passed explicitly to * to {@link setDefault()}. This option must be passed explicitly to
* {@link resolve()}, otherwise an exception will be thrown. * {@link resolve()}, otherwise an exception will be thrown.
* *
* @return bool Whether the option is missing * @return bool
*/ */
public function isMissing(string $option) public function isMissing(string $option)
{ {
...@@ -351,9 +351,7 @@ class OptionsResolver implements Options ...@@ -351,9 +351,7 @@ class OptionsResolver implements Options
/** /**
* Returns the names of all options missing a default value. * Returns the names of all options missing a default value.
* *
* @return string[] The names of the missing options * @return string[]
*
* @see isMissing()
*/ */
public function getMissingOptions() public function getMissingOptions()
{ {
...@@ -392,7 +390,7 @@ class OptionsResolver implements Options ...@@ -392,7 +390,7 @@ class OptionsResolver implements Options
* Returns true for any option passed to {@link setDefault()}, * Returns true for any option passed to {@link setDefault()},
* {@link setRequired()} or {@link setDefined()}. * {@link setRequired()} or {@link setDefined()}.
* *
* @return bool Whether the option is defined * @return bool
*/ */
public function isDefined(string $option) public function isDefined(string $option)
{ {
...@@ -402,7 +400,7 @@ class OptionsResolver implements Options ...@@ -402,7 +400,7 @@ class OptionsResolver implements Options
/** /**
* Returns the names of all defined options. * Returns the names of all defined options.
* *
* @return string[] The names of the defined options * @return string[]
* *
* @see isDefined() * @see isDefined()
*/ */
...@@ -869,7 +867,7 @@ class OptionsResolver implements Options ...@@ -869,7 +867,7 @@ class OptionsResolver implements Options
* - Options have invalid types; * - Options have invalid types;
* - Options have invalid values. * - Options have invalid values.
* *
* @return array The merged and validated options * @return array
* *
* @throws UndefinedOptionsException If an option name is undefined * @throws UndefinedOptionsException If an option name is undefined
* @throws InvalidOptionsException If an option doesn't fulfill the * @throws InvalidOptionsException If an option doesn't fulfill the
...@@ -932,7 +930,7 @@ class OptionsResolver implements Options ...@@ -932,7 +930,7 @@ class OptionsResolver implements Options
* *
* @param bool $triggerDeprecation Whether to trigger the deprecation or not (true by default) * @param bool $triggerDeprecation Whether to trigger the deprecation or not (true by default)
* *
* @return mixed The option value * @return mixed
* *
* @throws AccessException If accessing this method outside of * @throws AccessException If accessing this method outside of
* {@link resolve()} * {@link resolve()}
...@@ -1194,7 +1192,7 @@ class OptionsResolver implements Options ...@@ -1194,7 +1192,7 @@ class OptionsResolver implements Options
* *
* @param string $option The option name * @param string $option The option name
* *
* @return bool Whether the option is set * @return bool
* *
* @throws AccessException If accessing this method outside of {@link resolve()} * @throws AccessException If accessing this method outside of {@link resolve()}
* *
...@@ -1241,7 +1239,7 @@ class OptionsResolver implements Options ...@@ -1241,7 +1239,7 @@ class OptionsResolver implements Options
* *
* This may be only a subset of the defined options. * This may be only a subset of the defined options.
* *
* @return int Number of options * @return int
* *
* @throws AccessException If accessing this method outside of {@link resolve()} * @throws AccessException If accessing this method outside of {@link resolve()}
* *
......
...@@ -227,7 +227,7 @@ class PropertyAccessorBuilder ...@@ -227,7 +227,7 @@ class PropertyAccessorBuilder
/** /**
* Sets a cache system. * Sets a cache system.
* *
* @return PropertyAccessorBuilder The builder object * @return PropertyAccessorBuilder
*/ */
public function setCacheItemPool(CacheItemPoolInterface $cacheItemPool = null) public function setCacheItemPool(CacheItemPoolInterface $cacheItemPool = null)
{ {
...@@ -279,7 +279,7 @@ class PropertyAccessorBuilder ...@@ -279,7 +279,7 @@ class PropertyAccessorBuilder
/** /**
* Builds and returns a new PropertyAccessor object. * Builds and returns a new PropertyAccessor object.
* *
* @return PropertyAccessorInterface The built PropertyAccessor * @return PropertyAccessorInterface
*/ */
public function getPropertyAccessor() public function getPropertyAccessor()
{ {
......
...@@ -73,7 +73,7 @@ interface PropertyAccessorInterface ...@@ -73,7 +73,7 @@ interface PropertyAccessorInterface
* @param object|array $objectOrArray The object or array to traverse * @param object|array $objectOrArray The object or array to traverse
* @param string|PropertyPathInterface $propertyPath The property path to read * @param string|PropertyPathInterface $propertyPath The property path to read
* *
* @return mixed The value at the end of the property path * @return mixed
* *
* @throws Exception\InvalidArgumentException If the property path is invalid * @throws Exception\InvalidArgumentException If the property path is invalid
* @throws Exception\AccessException If a property/index does not exist or is not public * @throws Exception\AccessException If a property/index does not exist or is not public
...@@ -91,7 +91,7 @@ interface PropertyAccessorInterface ...@@ -91,7 +91,7 @@ interface PropertyAccessorInterface
* @param object|array $objectOrArray The object or array to check * @param object|array $objectOrArray The object or array to check
* @param string|PropertyPathInterface $propertyPath The property path to check * @param string|PropertyPathInterface $propertyPath The property path to check
* *
* @return bool Whether the value can be set * @return bool
* *
* @throws Exception\InvalidArgumentException If the property path is invalid * @throws Exception\InvalidArgumentException If the property path is invalid
*/ */
...@@ -106,7 +106,7 @@ interface PropertyAccessorInterface ...@@ -106,7 +106,7 @@ interface PropertyAccessorInterface
* @param object|array $objectOrArray The object or array to check * @param object|array $objectOrArray The object or array to check
* @param string|PropertyPathInterface $propertyPath The property path to check * @param string|PropertyPathInterface $propertyPath The property path to check
* *
* @return bool Whether the property path can be read * @return bool
* *
* @throws Exception\InvalidArgumentException If the property path is invalid * @throws Exception\InvalidArgumentException If the property path is invalid
*/ */
......
...@@ -170,7 +170,7 @@ class PropertyPathBuilder ...@@ -170,7 +170,7 @@ class PropertyPathBuilder
/** /**
* Returns the length of the current path. * Returns the length of the current path.
* *
* @return int The path length * @return int
*/ */
public function getLength() public function getLength()
{ {
...@@ -180,7 +180,7 @@ class PropertyPathBuilder ...@@ -180,7 +180,7 @@ class PropertyPathBuilder
/** /**
* Returns the current property path. * Returns the current property path.
* *
* @return PropertyPathInterface|null The constructed property path * @return PropertyPathInterface|null
*/ */
public function getPropertyPath() public function getPropertyPath()
{ {
...@@ -192,7 +192,7 @@ class PropertyPathBuilder ...@@ -192,7 +192,7 @@ class PropertyPathBuilder
/** /**
* Returns the current property path as string. * Returns the current property path as string.
* *
* @return string The property path as string * @return string
*/ */
public function __toString() public function __toString()
{ {
......
...@@ -21,14 +21,14 @@ interface PropertyPathInterface extends \Traversable ...@@ -21,14 +21,14 @@ interface PropertyPathInterface extends \Traversable
/** /**
* Returns the string representation of the property path. * Returns the string representation of the property path.
* *
* @return string The path as string * @return string
*/ */
public function __toString(); public function __toString();
/** /**
* Returns the length of the property path, i.e. the number of elements. * Returns the length of the property path, i.e. the number of elements.
* *
* @return int The path length * @return int
*/ */
public function getLength(); public function getLength();
...@@ -40,14 +40,14 @@ interface PropertyPathInterface extends \Traversable ...@@ -40,14 +40,14 @@ interface PropertyPathInterface extends \Traversable
* *
* If this property path only contains one item, null is returned. * If this property path only contains one item, null is returned.
* *
* @return self|null The parent path or null * @return self|null
*/ */
public function getParent(); public function getParent();
/** /**
* Returns the elements of the property path as array. * Returns the elements of the property path as array.
* *
* @return array An array of property/index names * @return array
*/ */
public function getElements(); public function getElements();
...@@ -56,7 +56,7 @@ interface PropertyPathInterface extends \Traversable ...@@ -56,7 +56,7 @@ interface PropertyPathInterface extends \Traversable
* *
* @param int $index The index key * @param int $index The index key
* *
* @return string A property or index name * @return string
* *
* @throws Exception\OutOfBoundsException If the offset is invalid * @throws Exception\OutOfBoundsException If the offset is invalid
*/ */
...@@ -67,7 +67,7 @@ interface PropertyPathInterface extends \Traversable ...@@ -67,7 +67,7 @@ interface PropertyPathInterface extends \Traversable
* *
* @param int $index The index in the property path * @param int $index The index in the property path
* *
* @return bool Whether the element at this index is a property * @return bool
* *
* @throws Exception\OutOfBoundsException If the offset is invalid * @throws Exception\OutOfBoundsException If the offset is invalid
*/ */
...@@ -78,7 +78,7 @@ interface PropertyPathInterface extends \Traversable ...@@ -78,7 +78,7 @@ interface PropertyPathInterface extends \Traversable
* *
* @param int $index The index in the property path * @param int $index The index in the property path
* *
* @return bool Whether the element at this index is an array index * @return bool
* *
* @throws Exception\OutOfBoundsException If the offset is invalid * @throws Exception\OutOfBoundsException If the offset is invalid
*/ */
......
...@@ -34,7 +34,7 @@ final class ConstructorExtractor implements PropertyTypeExtractorInterface ...@@ -34,7 +34,7 @@ final class ConstructorExtractor implements PropertyTypeExtractorInterface
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getTypes(string $class, string $property, array $context = []) public function getTypes(string $class, string $property, array $context = []): ?array
{ {
foreach ($this->extractors as $extractor) { foreach ($this->extractors as $extractor) {
$value = $extractor->getTypesFromConstructor($class, $property); $value = $extractor->getTypesFromConstructor($class, $property);
......
...@@ -554,7 +554,7 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp ...@@ -554,7 +554,7 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp
foreach ($reflectionType instanceof \ReflectionUnionType ? $reflectionType->getTypes() : [$reflectionType] as $type) { foreach ($reflectionType instanceof \ReflectionUnionType ? $reflectionType->getTypes() : [$reflectionType] as $type) {
$phpTypeOrClass = $reflectionType instanceof \ReflectionNamedType ? $reflectionType->getName() : (string) $type; $phpTypeOrClass = $reflectionType instanceof \ReflectionNamedType ? $reflectionType->getName() : (string) $type;
if ('null' === $phpTypeOrClass || 'mixed' === $phpTypeOrClass) { if ('null' === $phpTypeOrClass || 'mixed' === $phpTypeOrClass || 'never' === $phpTypeOrClass) {
continue; continue;
} }
......
...@@ -18,7 +18,7 @@ interface InflectorInterface ...@@ -18,7 +18,7 @@ interface InflectorInterface
* *
* If the method can't determine the form with certainty, several possible singulars are returned. * If the method can't determine the form with certainty, several possible singulars are returned.
* *
* @return string[] An array of possible singular forms * @return string[]
*/ */
public function singularize(string $plural): array; public function singularize(string $plural): array;
...@@ -27,7 +27,7 @@ interface InflectorInterface ...@@ -27,7 +27,7 @@ interface InflectorInterface
* *
* If the method can't determine the form with certainty, several possible plurals are returned. * If the method can't determine the form with certainty, several possible plurals are returned.
* *
* @return string[] An array of possible plural forms * @return string[]
*/ */
public function pluralize(string $singular): array; public function pluralize(string $singular): array;
} }
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