Commit f5f7e75e authored by 卢洪光's avatar 卢洪光

Merge branch 'pre_release' into 'master'

Pre release

See merge request bp/goods!55
parents 824b111a b0f541db
......@@ -22,26 +22,33 @@ class BaseException extends \Exception
*/
public function __construct($params = [])
{
if (!is_array($params)) {
if (empty($params)) {
return;
}
if (!is_array($params)) {
return $this->setCusMsg($params);
}
$this->code = $params['code'] ?? Registry::get('config')->exception->user->code;
$this->msg = $params['msg'] ?? Registry::get('config')->exception->user->msg;
if (isset($params['cus']) && $this->cus && isset($this->cus[intval($params['cus'])]) && $this->base_code) {
return $this->setCusMsg($params['cus'],$params['data']??'');
}
}
//每个服务都有自己的codePrefix
$appid = \Yaf\Application::app()->getConfig()->get("appid");
$codePrefix = \Yaconf::get('bizcode.prefix.' . $appid);
$codePrefix = intval($codePrefix);
public function setCusMsg($cus,$data = '')
{
//每个服务都有自己的codePrefix
$appid = \Yaf\Application::app()->getConfig()->get("appid");
$codePrefix = \Yaconf::get('bizcode.prefix.' . $appid);
$codePrefix = intval($codePrefix);
$cus_code = intval($params['cus']);
$base_code = intval($this->base_code);
$cus_code = intval($cus);
$base_code = intval($this->base_code);
$this->code = $codePrefix + $base_code + $cus_code;
$this->msg = isset($params['data']) ? vsprintf($this->cus[$cus_code],$params['data']) : $this->cus[$cus_code];
}
$this->code = $codePrefix + $base_code + $cus_code;
$this->msg = !empty($data) ? vsprintf($this->cus[$cus_code],$data) : $this->cus[$cus_code];
}
public function __get($name): bool
......
......@@ -3,7 +3,6 @@
namespace App\Exception\custom;
use App\Exception\BaseException;
class MarketingException extends BaseException
......@@ -13,6 +12,20 @@ class MarketingException extends BaseException
const LIFE_ACCOUNT_NO_EXIST = 16;
const RELATION_ALREADY_EXIST = 17;
const TAKE_PLACE_NOT_EXIST = 20;
const COLONEL_APPLY_FAILED = 24;
const COLONEL_CONFIG_NULL = 25;
const COLONEL_LEVEL_SIX = 26;
const COLONEL_AUDIT_STATUS = 27;
const COLONEL_AUDIT_STATUS_FAILED = 28;
const COMMIT_ERROR = 29;
const COLONEL_TAKE_PLACE_EXIST = 30;
const COLONEL_TAKE_PLACE_PARAMS = 31;
const COLONEL_TAKE_PLACE_FAILED = 32;
const COLONEL_AUDIT_STATUS_USE = 34;
const COLONEL_ADD_FAILED = 35;
const COLONEL_TAKE_PLACE_EDIT_FAILED = 36;
const COLONEL_APPLY_EXIST = 37;
const COLONEL_DATE_ERROR = 38;
protected $cus = [
0 => '活动名称不能为空',
......@@ -38,6 +51,21 @@ class MarketingException extends BaseException
self::TAKE_PLACE_NOT_EXIST => '自提点不存在',
21 => "活动开始时间不能大于或者等于结束时间",
22 => "自提点不能为空",
23 => '分润金额+手续费不能大于售价金额',
self::COLONEL_APPLY_FAILED => '团长申请失败',
self::COLONEL_CONFIG_NULL => "团长分销配置内容不能为空",
self::COLONEL_LEVEL_SIX => "档位最多设定6档",
self::COLONEL_AUDIT_STATUS => '团长审核状态错误',
self::COLONEL_AUDIT_STATUS_FAILED => '团长审核失败',
self::COMMIT_ERROR => '事务commit失败',
self::COLONEL_TAKE_PLACE_EXIST => '自提点名称已存在',
self::COLONEL_TAKE_PLACE_PARAMS => '自提点信息不存在',
self::COLONEL_TAKE_PLACE_FAILED => '自提点添加失败',
33 => '分润金额+手续费不能大于售价金额',
self::COLONEL_AUDIT_STATUS_USE => '该团长已审核',
self::COLONEL_ADD_FAILED => '团长入库失败',
self::COLONEL_TAKE_PLACE_EDIT_FAILED => '修改团长自提点失败',
self::COLONEL_APPLY_EXIST => '当前用户已提交团长申请',
self::COLONEL_DATE_ERROR => '当前日期的配置不能修改',
];
}
\ No newline at end of file
}
......@@ -41,7 +41,7 @@ class BaseValidate extends Validate
protected function isMobile($value)
{
$rule = '^1(3|4|5|7|8)[0-9]\d{8}$^';
$rule = '^1(3|4|5|6|7|8|9)[0-9]\d{8}$^';
$result = preg_match($rule, $value);
if ($result) {
return true;
......@@ -49,4 +49,19 @@ class BaseValidate extends Validate
return false;
}
}
protected function isDate($value)
{
//匹配日期格式
if (preg_match("/^([0-9]{4})-([0-9]{2})-([0-9]{2})$/", $value, $parts)) {
//检测是否为日期
if (checkdate($parts[2], $parts[3], $parts[1])) {
return true;
} else {
return false;
}
} else {
return false;
}
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: pengfei@yidian-inc.com
* Date: 2021/8/24 1:32 下午
*/
namespace Validate;
class ColonelAddPointValidate extends BaseValidate
{
protected $rule = [
'colonel_apply_id' => 'require',
'longitude' => 'require',
'latitude' => 'require',
'location' => 'require',
'address' => 'require',
'province' => 'require',
'city' => 'require',
'area' => 'require',
'contact_name' => 'require',
'phone' => 'isMobile',
'take_place_name' => 'require',
];
protected $message = [
'colonel_apply_id' => '申请id不能为空',
'longitude' => '位置经度不能为空',
'latitude' => '位置纬度不能为空',
'location' => '自提点地址不能为空',
'address' => '详细地址不能为空',
'province' => '省份不能为空',
'city' => '城市不能为空',
'area' => '地区不能为空',
'contact_name' => '联系人不能为空',
'phone' => '请输入正确的手机号',
'take_place_name' => '自提点名称不能为空',
];
}
<?php
/**
* Created by PhpStorm.
* User: pengfei@yidian-inc.com
* Date: 2021/8/20 3:11 下午
*/
namespace Validate;
class ColonelApplyValidate extends BaseValidate
{
protected $rule = [
'user_id' => 'require',
'phone' => 'isMobile',
'contact_name' => 'require',
];
protected $message = [
'user_id' => '用户id不能为空',
'phone' => '请输入正确的手机号',
'contact_name' => '联系人不能为空'
];
}
<?php
namespace Validate;
class ColonelAuditValidate extends BaseValidate
{
protected $rule = [
'colonel_apply_id' => 'require',
'audit_status' => 'require',
];
protected $message = [
"colonel_apply_id" => "申请id不能为空",
"audit_status" => "审核状态不能为空",
];
}
<?php
namespace Validate;
class ColonelCenterValidate extends BaseValidate
{
protected $rule = [
'user_id' => 'require',
];
protected $message = [
'user_id' => 'user_id 参数不能为空',
];
}
\ No newline at end of file
<?php
namespace Validate;
class ColonelConfigValidate extends BaseValidate
{
protected $rule = [
'date' => 'require|isDate',
'config' => 'require',
];
protected $message = [
'date' => 'date 参数格式错误',
'config' => 'config 参数不能为空',
'marketing_id' => 'marketing_id 参数不能为空',
];
public function sceneAdd()
{
return $this->only(["date","config","marketing_id"])->append("marketing_id", "require");
}
}
\ No newline at end of file
......@@ -22,4 +22,9 @@ class MarketingOnlineStatusValidate extends BaseValidate
"marketing_type" => "marketing_type 不能为空",
"online_status" => "online_status 不能为空",
];
public function sceneYingxiao()
{
return $this->only(['marketing_id','online_status']);
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: pengfei@yidian-inc.com
* Date: 2021/8/23 1:46 下午
*/
namespace App\Models\marketing\mysql;
use Api\PhpUtils\Mysql\MysqlBase;
class ColonelDistributorColonel extends MysqlBase
{
const TABLE_NAME = 'colonel_distributor_colonel';
const CONFIG_INDEX = 'marketing';
const PRIMARY_KEY = 'colonel_id';
const COLONEL_SOURCE_APPLY = 1; //用户申请
const COLONEL_SOURCE_ADMIN = 2; //运营添加
const DEFAULT_COLUMN = ['colonel_id','user_id','take_place_id','phone','contact_name','colonel_source'];
public static function getColonelUserIds()
{
$colonelUserData = ColonelDistributorColonel::select(['user_id']);
return array_column((array)$colonelUserData, 'user_id');
}
public static function getRecord(array $where, $column = '*')
{
return self::get($column, $where);
}
public static function getRecords(array $where, $column = '*')
{
return self::select($column, $where);
}
public static function updateRecord(array $columns, array $where)
{
return self::update($columns, $where);
}
public static function insertRecord(array $column) : int
{
$id = self::insert($column);
return intval($id);
}
public static function getPages(array $where = [], $column = '*', int $page, int $pageSize, array $orderBy = ['colonel_apply_id' => 'DESC'])
{
if (empty($column)) {
$column = self::DEFAULT_COLUMN;
}
$data = $where;
$count = self::count([], $where);
if (empty($count)) {
return ['list' => [],'count' => 0];
}
if (!empty($page) && !empty($pageSize)) {
$offset = ($page - 1) * $pageSize;
$data['LIMIT'] = [$offset,$pageSize];
}
if (!empty($orderBy)) {
$data['ORDER'] = $orderBy;
}
$result = self::select($column, $data);
return ['result' => $result,'count' => $count];
}
}
<?php
/**
* Created by PhpStorm.
* User: pengfei@yidian-inc.com
* Date: 2021/8/20 2:38 下午
*/
namespace App\Models\marketing\mysql;
use Api\PhpUtils\Mysql\MysqlBase;
class ColonelDistributorColonelApply extends MysqlBase
{
const TABLE_NAME = 'colonel_distributor_colonel_apply';
const CONFIG_INDEX = 'marketing';
const PRIMARY_KEY = 'colonel_apply_id';
const STATUS_AUDIT = 0;//待审核
const STATUS_PASS = 1;//审核通过
const STATUS_REJECT = 2;//审核驳回
const DEFAULT_COLUMN = ['colonel_apply_id','audit_status','user_id','phone','contact_name','take_place_name','province','city','area','location','address'];
public static function insertRecord(array $column) : int
{
$id = self::insert($column);
return intval($id);
}
public static function getRecord(array $where, $column = '*')
{
return self::get($column, $where);
}
public static function updateRecord(array $columns, array $where)
{
return self::update($columns, $where);
}
public static function getPages(array $where = [], $column = '*', int $page, int $pageSize, array $orderBy = ['colonel_apply_id' => 'DESC'])
{
if (empty($column)) {
$column = self::DEFAULT_COLUMN;
}
$data = $where;
$count = self::count([], $where);
if (empty($count)) {
return ['list' => [],'count' => 0];
}
if (!empty($page) && !empty($pageSize)) {
$offset = ($page - 1) * $pageSize;
$data['LIMIT'] = [$offset,$pageSize];
}
if (!empty($orderBy)) {
$data['ORDER'] = $orderBy;
}
$result = self::select($column, $data);
return ['result' => $result,'count' => $count];
}
public static function existUser(string $userId) : bool
{
$exist = self::getRecord(['user_id' => $userId], ['colonel_apply_id']);
return !empty($exist);
}
}
<?php
namespace App\Models\marketing\mysql;
use Api\PhpUtils\Mysql\MysqlBase;
class ColonelDistributorConfig extends MysqlBase
{
const TABLE_NAME = 'colonel_distributor_colonel_config';
const CONFIG_INDEX = 'marketing';
const PRIMARY_KEY = 'colonel_config_id';
const TYPE_COLONEL = 1;//团长分销活动
public static function getRecord($where, $columns = [], $options = [])
{
if (empty($columns)) {
$columns = '*';
}
return self::get($columns, $where, $options);
}
public static function getRecordMaster($where, $columns = [], $options = [])
{
if (empty($columns)) {
$columns = '*';
}
return self::selectMaster($columns, $where, $options);
}
public static function insertRecord($columns, $options = [])
{
return self::insert($columns, $options);
}
public static function updateRecord($columns, $where)
{
return self::update($columns, $where);
}
public static function save($data, $where = [], $options = [])
{
if (empty($where)) {
return self::insert($data, $options);
}
return self::update($data, $where);
}
public static function deleteRecord($where)
{
return self::delete($where);
}
}
\ No newline at end of file
<?php
namespace App\Models\marketing\mysql;
use Api\PhpUtils\Mysql\MysqlBase;
class ColonelDistributorInviteOrder extends MysqlBase
{
const TABLE_NAME = 'colonel_distributor_invite_order';
const CONFIG_INDEX = 'marketing';
const PRIMARY_KEY = 'invite_order_id';
const IS_REFUND_NO = 0;//未退款
const IS_REFUND_YES = 1;//已退款
public static function getRecord($where, $columns = [], $options = [])
{
if (empty($columns)) {
$columns = '*';
}
return self::get($columns, $where, $options);
}
public static function getRecordMaster($where, $columns = [], $options = [])
{
if (empty($columns)) {
$columns = '*';
}
return self::selectMaster($columns, $where, $options);
}
public static function insertRecord($columns, $options = [])
{
return self::insert($columns, $options);
}
public static function updateRecord($columns, $where)
{
return self::update($columns, $where);
}
public static function save($data, $where = [], $options = [])
{
if (empty($where)) {
return self::insert($data, $options);
}
return self::update($data, $where);
}
public static function deleteRecord($where)
{
return self::delete($where);
}
}
\ No newline at end of file
<?php
namespace App\Models\marketing\mysql;
use Api\PhpUtils\Mysql\MysqlBase;
class ColonelDistributorInviteOrderNum extends MysqlBase
{
const TABLE_NAME = 'colonel_distributor_invite_order_num';
const CONFIG_INDEX = 'marketing';
const PRIMARY_KEY = 'invite_order_num_id';
public static function getRecord($where, $columns = [], $options = [])
{
if (empty($columns)) {
$columns = '*';
}
return self::get($columns, $where, $options);
}
public static function getRecords(array $where, $column = '*')
{
return (array)self::select($column, $where);
}
public static function getRecordMaster($where, $columns = [], $options = [])
{
if (empty($columns)) {
$columns = '*';
}
return self::selectMaster($columns, $where, $options);
}
public static function insertRecord($columns, $options = [])
{
return self::insert($columns, $options);
}
public static function updateRecord($columns, $where)
{
return self::update($columns, $where);
}
public static function save($data, $where = [], $options = [])
{
if (empty($where)) {
return self::insert($data, $options);
}
return self::update($data, $where);
}
public static function deleteRecord($where)
{
return self::delete($where);
}
}
<?php
namespace App\Models\marketing\mysql;
use Api\PhpUtils\Mysql\MysqlBase;
class ColonelDistributorPayInfo extends MysqlBase
{
const TABLE_NAME = 'colonel_distributor_pay_info';
const CONFIG_INDEX = 'marketing';
const PRIMARY_KEY = 'pay_info_id';
const TYPE_NEW_USER = 1;
const TYPE_FINISH_TARGET = 2;
const STATUS_NOT_USE = 0;
const STATUS_USE = 1;
public static $typeDesc = [
self::TYPE_NEW_USER => "邀请新用户",
self::TYPE_FINISH_TARGET => "完成目标单数",
];
public static function getRecords(array $where, $column = '*')
{
return (array)self::select($column, $where);
}
public static function getRecord($where, $columns = [], $options = [])
{
if (empty($columns)) {
$columns = '*';
}
return self::get($columns, $where, $options);
}
public static function getRecordMaster($where, $columns = [], $options = [])
{
if (empty($columns)) {
$columns = '*';
}
return self::selectMaster($columns, $where, $options);
}
public static function insertRecord($columns, $options = [])
{
return self::insert($columns, $options);
}
public static function updateRecord($columns, $where)
{
return (int)self::update($columns, $where);
}
public static function save($data, $where = [], $options = [])
{
if (empty($where)) {
return self::insert($data, $options);
}
return self::update($data, $where);
}
public static function deleteRecord($where)
{
return self::delete($where);
}
}
......@@ -14,6 +14,8 @@ class Marketing extends MysqlBase
const MARKETING_TYPE_TUANGOU = 2;
const MARKETING_TYPE_MIAOSHA = 3;
const MARKETING_TYPE_PINDAN = 4;
const MARKETING_TYPE_LIEBIAN = 5;
const MARKETING_TYPE_TUANZHANG = 6;
const ONLINE_STATUS_QIDONG = 1;
const ONLINE_STATUS_GUANBI = 2;
......@@ -125,6 +127,24 @@ class Marketing extends MysqlBase
$data['online_status'] = $where['online_status'];
}
if (!empty($where['marketing_type'])) {
$data['marketing_type'] = $where['marketing_type'];
}
return $data;
}
/**
* 判断活动是否在进行中
* @param $marketingId
* @return bool
*/
public static function isGoing($marketingId)
{
if (empty($marketingId)) {
return false;
}
$marketing = self::getRecord(["marketing_id" => $marketingId]);
return !empty($marketing) && $marketing["online_status"] == self::ONLINE_STATUS_QIDONG;
}
}
......@@ -13,6 +13,7 @@ class MarketingPindan extends MysqlBase
const ACTIVITY_STATUS_NO_START = 1;
const ACTIVITY_STATUS_IN_PROGRESS = 2;
const ACTIVITY_STATUS_FINISHED = 3;
const ACTIVITY_STATUS_START_TODAY = 4;//今日上新
public static function getRecord($where, $colums = [])
{
......
......@@ -3,6 +3,7 @@
namespace App\Models\marketing\mysql;
use Api\PhpUtils\Mysql\MysqlBase;
use App\Services\marketing\MarketingService;
/**
* 自提点
......@@ -25,7 +26,7 @@ class TakePlace extends MysqlBase
*/
public static function searchList($params)
{
$lifeAccountId = $params['life_account_id'] ?? 0;
$lifeAccountId = $params['life_account_id'] ?? MarketingService::getPublicLifeAccountId();
$keywords = $params['keywords'] ?? '';
$offset = $params['offset'] ?? 0;
$limit = $params['limit'] ?? 20;
......@@ -53,4 +54,20 @@ class TakePlace extends MysqlBase
return $res;
}
public static function getRecord(array $where, $column = '*')
{
return self::get($column, $where);
}
public static function getRecords(array $where, $column = '*')
{
return self::select($column, $where);
}
public static function existTakePlaceName(string $takePlaceName) : bool
{
$exist = self::getRecord(['take_place_name' => $takePlaceName], ['take_place_id']);
return !empty($exist);
}
}
<?php
namespace App\Base;
use Yaf\Controller_Abstract;
class Job extends Controller_Abstract
{
public function init() {
\Yaf\Dispatcher::getInstance()->disableView();
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: pengfei@yidian-inc.com
* Date: 2021/9/3 2:23 下午
*/
use App\Base\Job;
use Api\PhpServices\Idgen\Idgen;
use App\Models\marketing\mysql\ColonelDistributorColonel;
use App\Models\marketing\mysql\ColonelDistributorConfig;
use App\Models\marketing\mysql\ColonelDistributorInviteOrderNum;
use App\Models\marketing\mysql\ColonelDistributorPayInfo;
use App\Exception\custom\InterfaceException;
use Api\PhpUtils\Http\HttpUtil;
use App\Models\marketing\mysql\Marketing;
use App\Models\user\mysql\UserWechatBind;
use App\Services\marketing\PindanActivityColonelConfigService;
use Api\PhpUtils\Log\JobLog;
use App\Services\marketing\ColonelService;
class ColonelorderController extends Job
{
const REWARD_UNIT = 100; // 奖励单位: 分
const INVITE_NEW_USER_REWARD = 3 * self::REWARD_UNIT; // 邀请新用户奖励
const DEFAULT_USER_BATCH_SIZE = 100; // 批量处理数据条数
const ACTIVITY_OFFLINE_BALANCE = 50 * self::REWARD_UNIT; // 活动余额下线阈值
public $colonelConfigList; // 活动配置
public $settlementDate; // 活动结算日
public $startTime; // 活动结算日-开始时间
public $endTime; // 活动结算日-结束时间
/**
* Notes: 初始化-读取配置
* User: pengfei@yidian-inc.com
* Date: 2021/9/3 4:13 下午
*/
public function init()
{
parent::init();
$this->loadTimeConfig();
$this->colonelConfigList = $this->getColonelConfig($this->settlementDate);
}
/**
* Notes: 计算奖励脚本
* User: pengfei@yidian-inc.com
* Date: 2021/9/3 4:05 下午
* @throws InterfaceException
*/
public function indexAction()
{
$this->loggerInfo('start');
if ($userIdList = ColonelDistributorColonel::getColonelUserIds()) {
$userIdList = array_chunk($userIdList, self::DEFAULT_USER_BATCH_SIZE);
$colonelPayInfoData = [];
foreach ($userIdList as $userIds) {
$this->getInviteOrderData($userIds, $colonelPayInfoData); // 完成目标单数
$this->getInviteNewUserData($userIds, $colonelPayInfoData); // 邀请新用户奖励
}
if (!empty($colonelPayInfoData)) {
try {
$this->loggerInfo('colonelPayInfoCount=' . count($colonelPayInfoData));
$this->handleMarketingBalance($colonelPayInfoData);
$colonelPayInfoData = $this->getFormatPayInfoData($colonelPayInfoData);
$this->handleSavePayInfo($colonelPayInfoData);
$this->loggerInfo('success');
} catch (Exception $e) {
$this->loggerError('error=' . $e->getMessage());
}
}
}
$this->loggerInfo('end');
}
/**
* Notes: 保存奖励信息
* User: pengfei@yidian-inc.com
* Date: 2021/9/7 10:40 上午
* @param $colonelPayInfoData
* @throws Exception
*/
private function handleSavePayInfo($colonelPayInfoData)
{
try {
ColonelDistributorPayInfo::beginTransaction();
if (!$this->addColonelDistributorPayInfo($colonelPayInfoData)) {
throw new Exception(sprintf("写入错误参数 %s", json_encode($colonelPayInfoData)));
}
if (!ColonelDistributorPayInfo::commit()) {
throw new Exception(sprintf("事务提交失败 %s", json_encode($colonelPayInfoData)));
}
} catch (Exception $e) {
ColonelDistributorPayInfo::rollback();
throw new Exception($e->getMessage());
}
}
/**
* Notes: 获取新用户奖励
* User: pengfei@yidian-inc.com
* Date: 2021/9/3 4:47 下午
* @param $userIds
* @param $colonelPayInfoData
* @throws InterfaceException
*/
private function getInviteNewUserData($userIds, &$colonelPayInfoData)
{
if ($inviteNewUserList = $this->getInviteNewUserList($userIds, $this->startTime, $this->endTime)) {
$userNickList = $this->getUserList(array_column($inviteNewUserList, 'user_id'));
foreach ($inviteNewUserList as $newUser) {
$colonelPayInfoData[] = [
'date' => $this->settlementDate,
'type' => ColonelDistributorPayInfo::TYPE_NEW_USER,
'reward' => self::INVITE_NEW_USER_REWARD,
'finish_num' => 1,
'invite_user_id' => $newUser['user_id'],
'invite_user_nick' => empty($userNickList[$newUser['user_id']]['user_nick']) ? '' : $userNickList[$newUser['user_id']]['user_nick'],
'colonel_user_id' => $newUser['inviter_user_id'],
];
}
}
}
/**
* Notes: 获取完成目标单数奖励
* User: pengfei@yidian-inc.com
* Date: 2021/9/3 4:47 下午
* @param $userIds
* @param $colonelPayInfoData
*/
private function getInviteOrderData($userIds, &$colonelPayInfoData)
{
if (!empty($this->colonelConfigList)) {
$inviteOrderNumList = $this->getInviteOrderNum($userIds, $this->settlementDate);
foreach ($inviteOrderNumList as $orderNum) {
foreach ($this->colonelConfigList as $config) {
if ($orderNum['num'] >= $config['assess_order_num']) {
$colonelPayInfoData[] = [
'date' => $this->settlementDate,
'type' => ColonelDistributorPayInfo::TYPE_FINISH_TARGET,
'reward' => $config['reward_amount'] * self::REWARD_UNIT,
'finish_num' => $config['assess_order_num'],
'invite_user_id' => 0,
'invite_user_nick' => '',
'colonel_user_id' => $orderNum['colonel_user_id'],
];
}
}
}
}
}
/**
* 团长任务配置
* @param $settlementDate
* @return array
*/
private function getColonelConfig($settlementDate): array
{
$config = ColonelDistributorConfig::getRecord([
'date[<=]' => $settlementDate,
'type' => ColonelDistributorConfig::TYPE_COLONEL,
'ORDER' => ['date' => 'DESC'],
'LIMIT' => 1
]);
$configData = [];
if (!empty($config['data'])) {
$configData = json_decode($config['data'], true);
}
return $configData;
}
/**
* 获取order num
* @param $colonelUserIds
* @param $date
* @return array
*/
private function getInviteOrderNum($colonelUserIds, $date): array
{
return ColonelDistributorInviteOrderNum::getRecords(
[
'colonel_user_id' => $colonelUserIds,
'date' => $date,
],
['colonel_user_id', 'num']
);
}
/**
* Notes: 获取有效新用户信息
* User: pengfei@yidian-inc.com
* Date: 2021/9/3 4:03 下午
* @param $userIds
* @param $startTime
* @param $endTime
* @return array
* @throws InterfaceException
*/
private function getInviteNewUserList($userIds, $startTime, $endTime): array
{
$url = config('interface', 'coupon.background.wx_invite_relation_list_by_user_ids');
if (empty($url)) {
throw new InterfaceException(['cus' => 0]);
}
$res = HttpUtil::get($url,
['user_ids' => $userIds, 'start_time' => $startTime, 'end_time' => $endTime]);
if (!empty($res['response']['result'])) {
return array_values(array_column($res['response']['result'], null, 'user_id'));
}
return [];
}
/**
* Notes: 获取pay_info数据
* User: pengfei@yidian-inc.com
* Date: 2021/9/7 10:34 上午
* @param $data
* @return array
* @throws Exception
*/
private function getFormatPayInfoData($data): array
{
$count = count($data);
$httpParams = [
[
'type' => 'goods',
'number' => 00,
'count' => $count
]
];
$res = Idgen::get(appConfig('idgen.partner'), appConfig('idgen.key'), [], $httpParams);
$ids = $res['id_datetime']['goods'] ?? [];
if ($count > count($ids)) {
throw new Exception('请求idgen服务失败,' . ['req' => $httpParams, 'res' => $res]);
}
foreach ($data as $key => $item) {
$data[$key]['pay_info_trade_id'] = $ids[$key];
}
return $data;
}
/**
* Notes: 用户信息,获取昵称
* User: pengfei@yidian-inc.com
* Date: 2021/9/3 4:09 下午
* @param $userIds
* @return array
*/
private function getUserList($userIds): array
{
$list = UserWechatBind::select(['user_id', 'user_nick'], ['user_id' => $userIds], []);
return array_column((array)$list, null, 'user_id');
}
/**
* Notes: 写入数据
* User: pengfei@yidian-inc.com
* Date: 2021/9/3 4:10 下午
* @param $data
* @return bool
*/
private function addColonelDistributorPayInfo($data): bool
{
return (int)ColonelDistributorPayInfo::save($data);
}
/**
* Notes: 获取团长分销资余额
* User: pengfei@yidian-inc.com
* Date: 2021/9/9 6:19 下午
* @return array
* @throws Exception
*/
private function getMarketingCapitalPoolBalance(): array
{
if (!$url = config('interface', 'coupon.capitalpool.detail')) {
throw new Exception('没有capitalpool配置');
}
if (!$marketing = ColonelService::getMarketingInfo()) {
throw new Exception('没有获取到资金池');
}
$httpParams = [
'capital_pool_id' => $marketing['capital_pool_id']
];
$response = HttpUtil::post($url, $httpParams, 100000, 3);
$this->loggerInfo("url=$url,request=" . json_encode($httpParams) . ";response=" . json_encode($response));
if (!isset($response['response']['result']['capital_pool_total'])) {
throw new Exception('没有获取到资金池信息,' . ['req' => $httpParams, 'res' => $response]);
}
$result = $response['response']['result'];
$balance = ($result['capital_pool_total'] - $result['capital_pool_lock'] - $result['capital_pool_used']);
return [
'marketing_id' => $marketing['marketing_id'],
'balance' => $balance
];
}
/**
* Notes: 检测资金余额,是否下线活动
* User: pengfei@yidian-inc.com
* Date: 2021/9/9 6:29 下午
* @param $colonelPayInfoData
* @throws Exception
*/
private function handleMarketingBalance($colonelPayInfoData)
{
$totalReward = array_sum(array_column($colonelPayInfoData, 'reward'));
$marketing = $this->getMarketingCapitalPoolBalance();
$diffBalance = $marketing['balance'] - $totalReward;
if (0 >= $diffBalance) {
throw new Exception('资金池可用余额不足');
}
// 达到活动下线条件
if (self::ACTIVITY_OFFLINE_BALANCE >= $diffBalance) {
Marketing::updateRecord(
['online_status' => Marketing::ONLINE_STATUS_GUANBI],
['marketing_id' => $marketing['marketing_id']]
);
}
}
/**
* Notes: 加载配置
* User: pengfei@yidian-inc.com
* Date: 2021/9/8 7:43 下午
*/
private function loadTimeConfig()
{
// 如果传入时间-使用指定时间
$params = $this->getRequest()->getParams();
if (empty($params['date']) || !strtotime($params['date'])) {
$timeRange = PindanActivityColonelConfigService::getSettlementTimeRange();
$this->settlementDate = $timeRange['date'];
$this->startTime = $timeRange['start_time'];
$this->endTime = $timeRange['end_time'];
} else {
$hour = PindanActivityColonelConfigService::ACTIVITY_DEFAULT_HOUR;
$this->settlementDate = $params['date'];
$this->startTime = "{$params['date']} $hour:00:00";
$this->endTime = date('Y-m-d H:i:s', strtotime($this->startTime . ' +1 day'));
}
}
/**
* Notes: 记录 info 日志
* User: pengfei@yidian-inc.com
* Date: 2021/9/3 4:10 下午
* @param $log
*/
private function loggerInfo($log)
{
JobLog::getInstance()->info('colonel_distributor_order', $log)->output();
}
/**
* Notes: 记录 error 日志
* User: pengfei@yidian-inc.com
* Date: 2021/9/3 4:10 下午
* @param $log
*/
private function loggerError($log)
{
JobLog::getInstance()->error('colonel_distributor_order', $log, null, 'bp-server@yidian-inc.com')->output();
}
}
<?php
/**
* Created by PhpStorm.
* User: pengfei@yidian-inc.com
* Date: 2021/9/3 2:23 下午
*/
use App\Base\Job;
use App\Models\marketing\mysql\ColonelDistributorPayInfo;
use Api\PhpUtils\Http\HttpUtil;
use Api\PhpUtils\Log\JobLog;
use App\Services\marketing\ColonelService;
class ColonelwalletController extends Job
{
const CAPITAL_POOL_OP = 200; //200:团长奖励
const WALLET_SERVICE_NAME = 10; // 10生活圈优惠券,11营销活动
const WALLET_SOURCE_NAME = 1; //使用方名,1生活圈,2主端
const WALLET_ORDER_TYPE_USER = 601; // 钱包-邀请新用户奖励类型
const WALLET_ORDER_TYPE_ORDER = 602; // 钱包-邀请下单奖励类型
public $capitalPoolId = null;
/**
* Notes: 初始化-读取配置
* User: pengfei@yidian-inc.com
* Date: 2021/9/10 10:01 上午
*/
public function init()
{
parent::init();
$marketing = ColonelService::getMarketingInfo();
$this->capitalPoolId = $marketing['capital_pool_id'] ?? 0;
}
/**
* Notes: 奖励结算脚本
* User: pengfei@yidian-inc.com
* Date: 2021/9/9 11:17 上午
*/
public function indexAction()
{
$this->loggerInfo('start');
$payInfoList = $this->getPayInfoList();
$this->loggerInfo('payInfoCount=' . count($payInfoList));
if (!empty($payInfoList)) {
try {
if ($this->deductingInventory($payInfoList)) {
if ($this->toWallet($payInfoList)) {
$this->handlePayInfoStatus(array_column($payInfoList, 'pay_info_id'));
}
}
$this->loggerInfo('success');
} catch (Exception $e) {
$this->loggerError('error:' . $e->getMessage());
}
}
$this->loggerInfo('end');
}
/**
* Notes: 结算写入钱包
* User: pengfei@yidian-inc.com
* Date: 2021/9/3 6:04 下午
* @param $payInfoList
* @return bool
* @throws Exception
*/
private function toWallet($payInfoList): bool
{
if (!$url = config('interface', 'wallet.account.transfer')) {
throw new Exception('没有wallet.account.transfer配置');
}
$httpParams = self::getWalletHttpParams();
$list = [];
foreach ($payInfoList as $payInfo) {
$thirdOrderInfo = self::getThirdOrderInfo($payInfo);
$list[] = [
'user_id' => $payInfo['colonel_user_id'],
'service_name' => self::WALLET_SERVICE_NAME,
'source_name' => self::WALLET_SOURCE_NAME,
'third_order_id' => $payInfo['pay_info_trade_id'],
'third_order_id_type' => $thirdOrderInfo['type'],
'third_order_desc' => $thirdOrderInfo['desc'],
'amount' => $payInfo['reward'],
'extra' => ''
];
}
$httpParams['list'] = $list;
$response = HttpUtil::post($url, $httpParams, 100000, 3);
$this->loggerInfo("url=$url,response:" . json_encode($response));
if (!empty($response['response']['result']) && $response['code'] == 0) {
$this->loggerInfo('调用钱包服务成功,count=' . count($payInfoList));
return true;
} else {
throw new Exception('调用钱包服务失败,' . json_encode(['req' => $httpParams, 'res' => $response]));
}
}
/**
* Notes: 资金池授予用户奖励
* User: pengfei@yidian-inc.com
* Date: 2021/9/3 6:04 下午
* @param $payInfoList
* @return bool
* @throws Exception
*/
private function deductingInventory($payInfoList): bool
{
if (!$url = config('interface', 'coupon.capitalpool.grant_user_amount')) {
throw new Exception('没有grant_user_amount配置');
}
$httpParams = [
'capital_pool_id' => $this->capitalPoolId
];
$body = [];
foreach ($payInfoList as $payInfo) {
$thirdOrderInfo = self::getThirdOrderInfo($payInfo);
$body[] = [
'op' => self::CAPITAL_POOL_OP,
'user_id' => $payInfo['colonel_user_id'],
'amount' => $payInfo['reward'],
'third_order_id' => $payInfo['pay_info_trade_id'],
'third_order_id_type' => $thirdOrderInfo['type'],
'third_order_desc' => $thirdOrderInfo['desc'],
];
}
$httpParams['body'] = $body;
$res = HttpUtil::post($url, $httpParams, 100000, 3);
$this->loggerInfo("url=$url,response:" . json_encode($res));
if ($res['code'] == 0 && isset($res['response']['result'])) {
$this->loggerInfo('调用资金池服务成功,count=' . count($payInfoList));
return true;
} else {
throw new Exception('调用资金池服务失败,' . ['req' => $httpParams,'res' => $res]);
}
}
/**
* Notes: 获取钱包服务请求参数
* User: pengfei@yidian-inc.com
* Date: 2021/9/3 7:34 下午
* @return array
*/
private function getWalletHttpParams(): array
{
// TODO 此处看后期业务发展 看是否需要封装WalletSdk
$date = date('Y-m-d H:i:s');
return [
'transfer_service_id' => appConfig('colonel.wallet.transfer_service_id'),
'sign' => self::getWalletHttpSign($date),
'time' => $date
];
}
/**
* Notes: 获取钱包签名
* User: pengfei@yidian-inc.com
* Date: 2021/9/3 7:34 下午
* @param $date
* @return string
*/
private function getWalletHttpSign($date): string
{
return md5($date . appConfig('colonel.wallet.transfer_service_secret'));
}
/**
* Notes: 获取待结算数据
* User: pengfei@yidian-inc.com
* Date: 2021/9/3 7:23 下午
* @return array
*/
private function getPayInfoList(): array
{
return ColonelDistributorPayInfo::getRecords(['status' => ColonelDistributorPayInfo::STATUS_NOT_USE]);
}
/**
* Notes: 获取描述信息
* User: pengfei@yidian-inc.com
* Date: 2021/9/3 6:10 下午
* @param $payInfo
* @return array
*/
private function getThirdOrderInfo($payInfo): array
{
$info = [];
if ($payInfo['type'] == ColonelDistributorPayInfo::TYPE_NEW_USER) {
$info = [
'desc' => "邀请新用户(" . $payInfo["invite_user_nick"] . ")完成下单奖励",
'type' => self::WALLET_ORDER_TYPE_USER,
];
} elseif ($payInfo['type'] == ColonelDistributorPayInfo::TYPE_FINISH_TARGET) {
$info = [
'desc' => "完成" . $payInfo["finish_num"] . "单用户下单奖励",
'type' => self::WALLET_ORDER_TYPE_ORDER,
];
}
return $info;
}
/**
* Notes: 修改状态
* User: pengfei@yidian-inc.com
* Date: 2021/9/9 11:15 上午
* @param array $payInfoIds
* @return bool
* @throws Exception
*/
private function handlePayInfoStatus(array $payInfoIds): bool
{
$upStatus = ColonelDistributorPayInfo::updateRecord(
['status' => ColonelDistributorPayInfo::STATUS_USE],
['pay_info_id' => $payInfoIds]
);
if (empty($upStatus)) {
throw new Exception('更新pay_info状态失败.pay_info_ids=' . implode(',', $payInfoIds));
}
return $upStatus;
}
/**
* Notes: 记录 info 日志
* User: pengfei@yidian-inc.com
* Date: 2021/9/3 4:10 下午
* @param $log
*/
private function loggerInfo($log)
{
JobLog::getInstance()->info('colonel_distributor_wallet', $log, false)->output();
}
/**
* Notes: 记录 error 日志
* User: pengfei@yidian-inc.com
* Date: 2021/9/3 4:10 下午
* @param $log
*/
private function loggerError($log)
{
JobLog::getInstance()->error('colonel_distributor_wallet', $log, null, 'bp-server@yidian-inc.com')->output();
}
}
<?php
use Api\PhpUtils\Http\Request;
use App\Base\Job;
use App\Exception\custom\InterfaceException;
use App\Models\goods\mysql\Category;
use \App\Models\goods\mysql\GoodsSku;
use \App\Services\goods\GoodsService;
use \App\Services\goods\ElasticGoodService;
use Api\PhpUtils\Log\DaemonLog;
use Api\PhpServices\JwUser\JwUser;
use App\Services\shop\ShopService;
/**
* 同步商品数据到es
* php public/cli.php goodstoes index
* Class GoodsToEsController
*/
class GoodstoesController extends Job
{
public function indexAction()
{
$this->initEsIndex();
$goodsSkuIds = $this->getGoodsSkuIdList();
$this->toEs($goodsSkuIds);
}
private function getGoodsSkuIdList()
{
return GoodsSku::select("goods_sku_id", ['LIMIT' => 10]);
}
private function toEs($goodsSkuIds)
{
if (!empty($goodsSkuIds)) {
foreach ($goodsSkuIds as $goodsSkuId) {
echo "当前正在同步的商品sku_id: $goodsSkuId \n";
$this->updateGoodsInfoToEs($goodsSkuId);
}
}
}
private function initEsIndex()
{
//删除原index
ElasticGoodService::deleteIndex();
//创建空index
ElasticGoodService::createIndex();
}
/**
* 写入到es
* @param $goodsSkuId
* @return array|callable
* @throws InterfaceException
*/
public function updateGoodsInfoToEs($goodsSkuId)
{
$goodsSkuInfoList = GoodsSku::getRecordMaster(["goods_sku_id" => $goodsSkuId]);
if (!empty($goodsSkuInfoList)) {
$goodsSkuInfo = $goodsSkuInfoList[0];
$nameList = Category::select("name", ["category_id" => [$goodsSkuInfo["category_1_id"], $goodsSkuInfo["category_2_id"]]]);
//生活号信息
$url = config('interface', 'merchant.lifeaccount.get_life_account_by_id');
if (empty($url)) {
throw new InterfaceException(['cus' => 0]);
}
$lifeAccountRes = (new Request())->get($url, ["life_account_id" => $goodsSkuInfo["life_account_id"]]);
//门店信息
$subShopList = ShopService::getRelationShop($goodsSkuId);
$latitude = empty($subShopList[0]["latitude"]) ? "" : $subShopList[0]["latitude"];
$longitude = empty($subShopList[0]["longitude"]) ? "" : $subShopList[0]["longitude"];
if (!empty($longitude) && !empty($latitude) && !empty($subShopList)) {
foreach ($subShopList as $subShop) {
$esId = $goodsSkuId."_".$subShop["sub_shop_id"];
$data = [
"goods_sku_id" => $goodsSkuInfo["goods_sku_id"],
"goods_desc_pic_url" => $goodsSkuInfo["desc_pic_url"],
"goods_name" => $goodsSkuInfo["goods_name"],
"inventory_rest" => $goodsSkuInfo["inventory_rest"],
"total_amount_sold" => $goodsSkuInfo["total_amount_sold"],
"original_price" => empty($goodsSkuInfo["original_price"]) ? "" : (string)($goodsSkuInfo["original_price"] / 100),
"price" => $goodsSkuInfo["price"] / 100,
"price_sort" => (int)$goodsSkuInfo["price"],
"audit_status" => $goodsSkuInfo["audit_status"],
"online_status" => $goodsSkuInfo["online_status"],
"desc" => $goodsSkuInfo["desc"],
"category_1_id" => $goodsSkuInfo["category_1_id"],
"category_2_id" => $goodsSkuInfo["category_2_id"],
"category_1_name" => $nameList[0],
"category_2_name" => $nameList[1],
"life_account_id" => $goodsSkuInfo["life_account_id"],
"life_account_name" => empty($lifeAccountRes["response"]["result"]["life_account_name"]) ? "" : $lifeAccountRes["response"]["result"]["life_account_name"],
"life_account_icon" => empty($lifeAccountRes["response"]["result"]["life_account_icon"]) ? "" : $lifeAccountRes["response"]["result"]["life_account_icon"],
"shop_name" => $subShop["shop_name"],
"shop_address" => $subShop["address"],
"shop_location" => $latitude.",".$longitude,
"update_time" => strtotime($goodsSkuInfo["update_time"]),
];
return ElasticGoodService::indexDoc($esId, $data);
}
}
}
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: pengfei@yidian-inc.com
* Date: 2021/8/20 2:06 下午
*/
use App\Base\Base;
use App\Services\marketing\ColonelService;
use \Validate\ColonelApplyValidate;
use \Validate\ColonelConfigValidate;
use \Validate\ColonelAuditValidate;
use \Validate\ColonelCenterValidate;
use \Validate\ColonelAddPointValidate;
use \App\Services\marketing\PindanActivityColonelConfigService;
use \App\Services\marketing\PindanActivityInviteOrderService;
use \App\Services\user\UserService;
class ColonelController extends Base
{
/**
* Notes: 申请成为团长
* User: pengfei@yidian-inc.com
* Date: 2021/8/20 3:21 下午
* @throws \App\Exception\custom\MarketingException
* @throws \App\Exception\custom\ParamException
*/
public function applyAction()
{
$params = $this->params;
(new ColonelApplyValidate())->validate();
$applyId = ColonelService::apply($params);
return $this->success(['result' => ['apply_id' => $applyId]]);
}
/**
* Notes: 是否已申请
* User: pengfei@yidian-inc.com
* Date: 2021/8/25 9:56 上午
* @throws \App\Exception\custom\ParamException
*/
public function is_applyAction()
{
$params = $this->params;
(new ColonelCenterValidate())->validate();
$applyInfo = ColonelService::isApply($params['user_id']);
return $this->success(['result' => $applyInfo]);
}
/**
* 编辑团长分销配置
* @throws \App\Exception\custom\MarketingException
* @throws \App\Exception\custom\ParamException
*/
public function add_configAction()
{
(new ColonelConfigValidate())->scene('add')->validate();
$params = $this->params;
PindanActivityColonelConfigService::editColonelConfig($params);
return $this->success();
}
/**
* 查看团长分销配置
* @throws \App\Exception\custom\ParamException
*/
public function colonel_configAction()
{
$params = $this->params;
$data = PindanActivityColonelConfigService::colonelConfig($params);
return $this->success(["result" => $data]);
}
/**
* Notes: 管理后台 - 申请团长审核列表
* User: pengfei@yidian-inc.com
* Date: 2021/8/23 2:17 下午
*/
public function manage_colonel_apply_listAction()
{
$params = $this->params;
$manageList = ColonelService::getManageApplyList($params);
return $this->success($manageList);
}
/**
* Notes: 管理后台 - 团长审核列表
* User: pengfei@yidian-inc.com
* Date: 2021/8/24 3:09 下午
*/
public function manage_colonel_listAction()
{
$params = $this->params;
$manageList = ColonelService::getManageList($params);
return $this->success($manageList);
}
/**
* Notes: 管理后台 - 申请团长审核
* User: pengfei@yidian-inc.com
* Date: 2021/8/23 2:16 下午
* @throws \App\Exception\custom\MarketingException
*/
public function manage_auditAction()
{
$params = $this->params;
(new ColonelAuditValidate())->validate();
ColonelService::handleManageAudit($params['colonel_apply_id'], $params['audit_status']);
return $this->success();
}
/**
* Notes: 管理后台 - 获取自提点信息
* User: pengfei@yidian-inc.com
* Date: 2021/8/24 2:43 下午
*/
public function manage_show_apply_pointAction()
{
$params = $this->params;
$colonelApply = ColonelService::getTakePlaceInfo($params['colonel_apply_id']);
return $this->success(['result' => $colonelApply]);
}
/**
* Notes: 管理后台 - 添加自提点信息
* User: pengfei@yidian-inc.com
* Date: 2021/8/25 2:52 下午
* @throws \App\Exception\custom\MarketingException
* @throws \App\Exception\custom\ParamException
*/
public function manage_add_apply_pointAction()
{
$params = $this->params;
(new ColonelAddPointValidate())->validate();
$takePlaceId = ColonelService::handleAddTaskPlace($params);
return $this->success(['result' => ['take_place_id' => $takePlaceId]]);
}
/**
* 团长分销下单处理统计数据逻辑
* @throws \App\Exception\custom\MarketingException
*/
public function place_order_process_logicAction()
{
$params = $this->params;
$data = PindanActivityInviteOrderService::placeOrder($params);
return $this->success(["result" => $data]);
}
/**
* 团长分销下单处理统计数据逻辑
* @throws \App\Exception\custom\MarketingException
*/
public function refund_order_process_logicAction()
{
$params = $this->params;
$data = PindanActivityInviteOrderService::refundOrder($params);
return $this->success(["result" => $data]);
}
/**
* 团长分销,任务中心
* @throws Exception
*/
public function task_controlAction()
{
$params = $this->params;
$data = PindanActivityColonelConfigService::getTaskData($params);
return $this->success(["result" => $data]);
}
/**
* 团长分销,数据统计
* @throws Exception
*/
public function colonel_indexAction()
{
(new ColonelCenterValidate())->validate();
$params = $this->params;
$userId = $params["user_id"];
$user = [];
if (!empty($userId)) {
$wechatInfo = UserService::userWechatBind(["user_id" => $userId]);
if (!empty($wechatInfo)) {
$user = [
"user_id" => $wechatInfo[0]["user_id"],
"user_nick" => $wechatInfo[0]["user_nick"],
"user_avatar" => $wechatInfo[0]["user_avatar"]
];
}
$incomeData = PindanActivityInviteOrderService::incomeStatistics(["user_ids" => [$userId]]);
$orderNumData = PindanActivityInviteOrderService::inviteOrderNumberStatistics(["user_ids" => [$userId]]);
return $this->success(["result" => [
"income" => $incomeData[$userId],
"order_num" => $orderNumData[$userId],
"user" => $user]]);
}
return $this->success(["result" => []]);
}
/**
* 团长分销,账单详情
* @throws Exception
*/
public function bill_infoAction()
{
(new ColonelCenterValidate())->validate();
$params = $this->params;
$data = PindanActivityInviteOrderService::getPayInfoList($params);
return $this->success(["result" => $data]);
}
/**
* 团长分销,下单记录
* @throws \App\Exception\custom\ParamException
*/
public function invite_order_recordAction()
{
(new ColonelCenterValidate())->validate();
$params = $this->params;
$data = PindanActivityInviteOrderService::getInviteOrderRecord($params);
return $this->success(["result" => $data]);
}
}
......@@ -155,4 +155,25 @@ class MarketingController extends Base
$this->success();
}
/**
* 切换活动状态
* @throws \App\Exception\custom\ParamException
*/
public function toogle_yingxiao_online_statusAction()
{
(new MarketingOnlineStatusValidate())->scene('yingxiao')->validate();
$res = MarketingService::toogleOnlineStatus($this->params['marketing_id'],$this->params['online_status']);
$this->success(['result' => $res]);
}
/**
* 营销中心-活动列表
* @throws Exception
*/
public function yingxiao_listAction()
{
$lists = MarketingService::yingxiaoList($this->params);
$this->success(['result' => $lists]);
}
}
\ No newline at end of file
......@@ -11,6 +11,8 @@ use Api\PhpServices\Sensitive\Sensitive;
use Api\PhpUtils\Common\BaseConvert;
use Api\PhpUtils\Common\GoodsSkuId;
use Api\PhpUtils\Http\HttpUtil;
use Api\PhpUtils\Lock\FrequencyLockUtil;
use Api\PhpUtils\Log\FileLog;
use App\Exception\custom\GoodsException;
use App\Models\goods\mysql\Category;
use App\Models\goods\mysql\GoodsOperationRecord;
......@@ -498,11 +500,13 @@ class MarketingPindanGoodsService
]);
$row = PindanGoodsSku::save([
"total_amount_sold" => $sku["total_amount_sold"] - $params["num"],
"total_amount_order" => $sku["total_amount_order"] - $params["num"],
"inventory_rest" => $sku["inventory_rest"] + $params["num"],
"total_amount_sold[-]" => $params["num"],
"total_amount_order[-]" => $params["num"],
"inventory_rest[+]" => $params["num"],
], ["goods_sku_id" => $sku["goods_sku_id"], "total_amount_sold[>=]" => $params["num"], "total_amount_order[>=]" => $params["num"]]);
FileLog::info('goods_refund_log', 'json decode error raw:' . json_encode($params));
if ($row < 1){
PindanGoodsSku::rollback();
GoodsRefundRecord::save([
......
<?php
/**
* Created by PhpStorm.
* User: pengfei@yidian-inc.com
* Date: 2021/8/20 2:23 下午
*/
namespace App\Services\marketing;
use App\Exception\custom\MarketingException;
use App\Models\marketing\mysql\ColonelDistributorColonel;
use App\Models\marketing\mysql\ColonelDistributorColonelApply;
use App\Models\marketing\mysql\TakePlace;
use App\Models\user\mysql\UserWechatBind;
use App\Models\marketing\mysql\Marketing;
use Exception;
class ColonelService
{
/**
* Notes: 申请成为团长
* User: pengfei@yidian-inc.com
* Date: 2021/8/20 4:29 下午
* @param array $params
* @return int $applyId
* @throws MarketingException
*/
public static function apply(array $params): int
{
if (ColonelDistributorColonelApply::existUser($params['user_id'])) {
throw new MarketingException(MarketingException::COLONEL_APPLY_EXIST);
}
$colonelData = [
'user_id' => $params['user_id'],
'life_account_id' => MarketingService::getPublicLifeAccountId(),
'phone' => $params['phone'],
'contact_name' => $params['contact_name'],
'take_place_name' => $params['take_place_name'],
'take_place_pic' => $params['take_place_pic'] ?? '',
'longitude' => $params['longitude'] ?? 0,
'latitude' => $params['latitude'] ?? 0,
'location' => $params['location'] ?? '',
'address' => $params['address'] ?? '',
'province' => $params['province'] ?? '',
'city' => $params['city'] ?? '',
'area' => $params['area'] ?? '',
];
try {
if (!empty($colonelData['take_place_name'])) {
$colonelData['take_place_name'] = "【团长】{$colonelData['take_place_name']}";
}
if (!$applyId = ColonelDistributorColonelApply::insertRecord($colonelData)) {
throw new Exception(MarketingException::COLONEL_APPLY_FAILED);
}
return $applyId;
} catch (Exception $e) {
throw new MarketingException($e->getMessage());
}
}
/**
* Notes: 查看用户是否已申请
* User: pengfei@yidian-inc.com
* Date: 2021/8/25 11:42 上午
* @param $userId
* @return array
*/
public static function isApply($userId): array
{
$applyInfo = ColonelDistributorColonelApply::getRecord(['user_id' => $userId],
['colonel_apply_id', 'audit_status']);
return [
// -1.未申请 0.未审核 1.审核通过 2.审核未通过
'apply_status' => isset($applyInfo['audit_status']) ? intval($applyInfo['audit_status']) : -1
];
}
/**
* Notes: 团长申请列表-后台管理
* User: pengfei@yidian-inc.com
* Date: 2021/8/20 8:15 下午
* @param array $params
* @return array
*/
public static function getManageApplyList(array $params): array
{
$params = self::getPageParams($params);
$result = ColonelDistributorColonelApply::getPages([], ColonelDistributorColonelApply::DEFAULT_COLUMN,
$params['page'], $params['page_size']);
if (empty($result['count'])) {
return $result;
}
$userMap = self::getUserMap(array_column($result['result'], 'user_id'));
$takePlaceMap = self::getColonelTakePlaceMap(array_column($result['result'], 'colonel_apply_id'));
foreach ($result['result'] as &$applyVal) {
$applyVal['user_avatar'] = !empty($userMap[$applyVal['user_id']]['user_avatar']) ? $userMap[$applyVal['user_id']]['user_avatar'] : '';
// take_place_status 是否可以添加自提点 - 已审核通过并且未添加过自提点
$applyVal['take_place_status'] = 2;
if ($applyVal['audit_status'] == ColonelDistributorColonelApply::STATUS_PASS) {
if (empty($takePlaceMap[$applyVal['colonel_apply_id']])) {
$applyVal['take_place_status'] = 1;
}
}
}
unset($applyVal);
return $result;
}
/**
* Notes: 团长列表-后台管理
* User: pengfei@yidian-inc.com
* Date: 2021/8/24 3:04 下午
* @param array $params
* @return array
*/
public static function getManageList(array $params): array
{
$params = self::getPageParams($params);
$result = ColonelDistributorColonel::getPages([], ColonelDistributorColonel::DEFAULT_COLUMN, $params['page'],
$params['page_size']);
if (empty($result['count'])) {
return $result;
}
$userIds = array_column($result['result'], 'user_id');
$userMap = self::getUserMap($userIds);
$takePlaceMap = self::getTakePlaceMap(array_column($result['result'], 'take_place_id'));
$incomeMap = PindanActivityInviteOrderService::incomeStatistics(["user_ids" => $userIds]);
foreach ($result['result'] as &$colonelVal) {
$userId = $colonelVal['user_id'];
$takePlaceInfo = !empty($takePlaceMap[$colonelVal['take_place_id']]) ? $takePlaceMap[$colonelVal['take_place_id']] : [];
$colonelVal['take_place_name'] = $takePlaceInfo['take_place_name'] ?? '';
$colonelVal['location'] = $takePlaceInfo['location'] ?? '';
$colonelVal['address'] = $takePlaceInfo['address'] ?? '';
$colonelVal['user_avatar'] = !empty($userMap[$userId]['user_avatar']) ? $userMap[$userId]['user_avatar'] : '';
$colonelVal['no_settlement_income'] = !empty($incomeMap[$userId]['no_settlement']) ? $incomeMap[$userId]['no_settlement'] : 0;
$colonelVal['total_income'] = !empty($incomeMap[$userId]['all_reward']) ? $incomeMap[$userId]['all_reward'] : 0;
}
unset($colonelVal);
return $result;
}
/**
* Notes: 团长申请审核
* User: pengfei@yidian-inc.com
* Date: 2021/8/23 1:54 下午
* @param $applyId
* @param $auditStatus
* @return bool
* @throws MarketingException
*/
public static function handleManageAudit($applyId, $auditStatus): bool
{
// 审核状态参数检测
if (!in_array($auditStatus,
[ColonelDistributorColonelApply::STATUS_PASS, ColonelDistributorColonelApply::STATUS_REJECT])) {
throw new MarketingException(MarketingException::COLONEL_AUDIT_STATUS);
}
// 审核状态数据检测
$applyInfo = ColonelDistributorColonelApply::getRecord(['colonel_apply_id' => $applyId]);
if (empty($applyInfo) || $applyInfo['audit_status'] == ColonelDistributorColonelApply::STATUS_PASS) {
throw new MarketingException(MarketingException::COLONEL_AUDIT_STATUS_USE);
}
try {
ColonelDistributorColonelApply::beginTransaction();
// 修改申请状态
$updateStatus = ColonelDistributorColonelApply::updateRecord([
'audit_status' => $auditStatus,
'update_time' => date('Y-m-d H:i:s')
],
['colonel_apply_id' => $applyId, 'audit_status[!]' => ColonelDistributorColonelApply::STATUS_PASS]
);
if (empty($updateStatus)) {
throw new Exception(MarketingException::COLONEL_AUDIT_STATUS_FAILED);
}
// 审核成功
if ($auditStatus == ColonelDistributorColonelApply::STATUS_PASS) {
if (!self::handleAuditSuccess((array)$applyInfo)) {
throw new Exception(MarketingException::COLONEL_ADD_FAILED);
}
}
if (!ColonelDistributorColonelApply::commit()) {
throw new Exception(MarketingException::COMMIT_ERROR);
}
return true;
} catch (Exception $e) {
ColonelDistributorColonelApply::rollback();
throw new MarketingException($e->getMessage());
}
}
/**
* Notes: 获取自提点信息
* User: pengfei@yidian-inc.com
* Date: 2021/8/24 2:40 下午
* @param $applyId
* @return array
*/
public static function getTakePlaceInfo($applyId): array
{
$where = [
'colonel_apply_id' => $applyId
];
$colonelApply = ColonelDistributorColonelApply::getRecord($where);
return (array)$colonelApply;
}
/**
* Notes: 添加自提点
* User: pengfei@yidian-inc.com
* Date: 2021/8/24 2:41 下午
* @param array $params
* @return int
* @throws MarketingException
*/
public static function handleAddTaskPlace(array $params): int
{
// 自提点名称检测
if (TakePlace::existTakePlaceName($params['take_place_name'])) {
throw new MarketingException(MarketingException::COLONEL_TAKE_PLACE_EXIST);
}
$where = [
'colonel_apply_id' => $params['colonel_apply_id']
];
// 自提点信息检测
if (!$colonelApply = ColonelDistributorColonelApply::getRecord($where)) {
throw new MarketingException(MarketingException::COLONEL_TAKE_PLACE_PARAMS);
}
$params['life_account_id'] = $colonelApply['life_account_id'];
$params['name'] = $params['take_place_name'];
try {
ColonelDistributorColonel::beginTransaction();
// 添加自提点
if (!$takePlaceId = TakePlaceService::add($params)) {
throw new Exception(MarketingException::COLONEL_TAKE_PLACE_FAILED);
}
// 修改自提点id
if (!ColonelDistributorColonel::updateRecord(['take_place_id' => $takePlaceId], $where)) {
throw new Exception(MarketingException::COLONEL_TAKE_PLACE_EDIT_FAILED);
}
if (!ColonelDistributorColonel::commit()) {
throw new Exception(MarketingException::COMMIT_ERROR);
}
return (int)$takePlaceId;
} catch (Exception $e) {
ColonelDistributorColonel::rollback();
throw new MarketingException($e->getMessage());
}
}
/**
* Notes: 团长审核成功
* User: pengfei@yidian-inc.com
* Date: 2021/8/24 11:24 上午
* @param array $applyInfo
* @return int
*/
private static function handleAuditSuccess(array $applyInfo): int
{
// 入库团长表
$colonelData = [
'user_id' => $applyInfo['user_id'],
'colonel_apply_id' => $applyInfo['colonel_apply_id'],
'take_place_id' => 0,
'life_account_id' => $applyInfo['life_account_id'],
'phone' => $applyInfo['phone'],
'contact_name' => $applyInfo['contact_name'],
'colonel_source' => ColonelDistributorColonel::COLONEL_SOURCE_APPLY
];
return ColonelDistributorColonel::insertRecord($colonelData);
}
/**
* Notes: 获取用户信息
* User: pengfei@yidian-inc.com
* Date: 2021/8/20 8:16 下午
* @param array $userIds
* @return array
*/
private static function getUserMap(array $userIds): array
{
$userWechatList = UserWechatBind::getRecords(['user_id' => $userIds], ['user_id', 'user_nick', 'user_avatar']);
return array_column((array)$userWechatList, null, 'user_id');
}
/**
* Notes: 获取团长自提点
* User: pengfei@yidian-inc.com
* Date: 2021/8/20 8:16 下午
* @param array $colonelApplyIds
* @return array
*/
private static function getColonelTakePlaceMap(array $colonelApplyIds): array
{
$colonels = ColonelDistributorColonel::getRecords(['colonel_apply_id' => $colonelApplyIds],
['colonel_apply_id', 'take_place_id']);
return array_column((array)$colonels, 'take_place_id', 'colonel_apply_id');
}
/**
* Notes: 获取默认页码
* User: pengfei@yidian-inc.com
* Date: 2021/8/20 8:16 下午
* @param array $params
* @return int[]
*/
private static function getPageParams(array $params = []): array
{
$params['page'] = !empty($params['page']) ? $params['page'] : 1;
$params['page_size'] = !empty($params['page_size']) ? $params['page_size'] : 20;
return $params;
}
/**
* Notes: 获取自提点信息
* User: pengfei@yidian-inc.com
* Date: 2021/9/8 6:16 下午
* @param array $takePlaceId
* @return array
*/
private static function getTakePlaceMap(array $takePlaceId): array
{
$takePlaces = TakePlace::getRecords(['take_place_id' => $takePlaceId]);
return array_column((array)$takePlaces, null, 'take_place_id');
}
/**
* Notes: 获取团长分销活动
* User: pengfei@yidian-inc.com
* Date: 2021/9/9 6:06 下午
* @return array
*/
public static function getMarketingInfo(): array
{
$where = [
'marketing_type' => Marketing::MARKETING_TYPE_TUANZHANG,
'ORDER' => ['marketing_id' => 'DESC'],
];
$where['ORDER'] = ["create_time" => "DESC"];
$marketing = Marketing::getRecord($where, ['marketing_id', 'capital_pool_id']);
return (array)$marketing;
}
}
......@@ -82,8 +82,11 @@ class MarketingGoodsService
$goodsSkuId = array_column($data, 'goods_sku_id');
}
$goodsSkuList = GoodsSku::getRecordMaster(['goods_sku_id' => $goodsSkuId]);
$goodsSkuList = !empty($goodsSkuList) ? array_column($goodsSkuList,null,'goods_sku_id') : [];
$goodsSkuList = [];
if (!empty($goodsSkuId)) {
$goodsSkuList = GoodsSku::getRecordMaster(['goods_sku_id' => $goodsSkuId]);
$goodsSkuList = !empty($goodsSkuList) ? array_column($goodsSkuList,null,'goods_sku_id') : [];
}
$lastData = end($data);
$lastId = !empty($lastData['id']) ? $lastData['id'] : '';
......@@ -92,8 +95,11 @@ class MarketingGoodsService
$shopId[$key] = !empty($goodsSkuList[$value['goods_sku_id']]['shop_id']) ? $goodsSkuList[$value['goods_sku_id']]['shop_id'] : '';
}
$subShopList = SubShop::getRecordMaster(['shop_id' => $shopId]);
$subShopList = !empty($subShopList) ? array_column($subShopList,null,'shop_id') : [];
$subShopList = [];
if (!empty($shopId)) {
$subShopList = SubShop::getRecordMaster(['shop_id' => $shopId]);
$subShopList = !empty($subShopList) ? array_column($subShopList,null,'shop_id') : [];
}
$marketingList = !empty($marketingList) ? array_column($marketingList,null,'marketing_id') : [];
......
......@@ -4,6 +4,7 @@
namespace App\Services\marketing;
use Api\PhpServices\Ksy\Ks3Api;
use Api\PhpUtils\Http\Request;
use Api\PhpUtils\Http\HttpUtil;
use App\Exception\custom\InterfaceException;
use App\Models\goods\mysql\Ota;
......@@ -147,6 +148,49 @@ class MarketingService
}
}
/**
* 营销中心-活动列表
* @param $params
* @return array
*/
public static function yingxiaoList($params)
{
$where["marketing_type"] = [Marketing::MARKETING_TYPE_LIEBIAN, Marketing::MARKETING_TYPE_TUANZHANG];
$where['ORDER'] = ["create_time" => "DESC"];
$lists = Marketing::getRecords($where);
if ($lists && is_array($lists)) {
$capitalPoolIds = array_column($lists, 'capital_pool_id');
//获取资金池列表信息
$url = config('interface', 'coupon.capitalpool.fetch_map_capitalpool');
$capitalPoolList = (new Request())->get($url, ["capital_pool_ids" => $capitalPoolIds]);
$capitalPoolList = $capitalPoolList['response']['result'] ?: [];
$poolTotal = $poolUsed = $poolLock = 0;
foreach ($lists as &$val) {
if($capitalPoolList[$val['capital_pool_id']]) {
$val['capital_pool'] = $capitalPoolList[$val['capital_pool_id']];
foreach (['capital_pool_total','capital_pool_lock','capital_pool_used'] as $key){
$val['capital_pool'][$key] = sprintf("%0.02f",$val['capital_pool'][$key]/100);
}
$poolTotal += $val['capital_pool']['capital_pool_total'];
$poolUsed += $val['capital_pool']['capital_pool_used'];
$poolLock += $val['capital_pool']['capital_pool_lock'];
}else {
$val['capital_pool'] = [];
}
$val['online_status_desc'] = Marketing::$onlineStatusDesc[$val['online_status']];
}
unset($val);
}
$poolbalance = $poolTotal - $poolUsed - $poolLock;
$poolAnalysis = ['total'=>$poolTotal,'used'=>$poolUsed,'lock'=>$poolLock,'balance'=>$poolbalance];
return ['anlysis'=>$poolAnalysis,'list' => $lists];
}
/**
* 分销活动列表
* @param $params
......@@ -231,6 +275,17 @@ class MarketingService
$params['page'] = !empty($params['page']) ? $params['page'] : 1;
$limit = !empty($params['page_size']) ? $params['page_size'] : 20;
$page = ($params['page'] - 1) * $limit;
//排序规则
$sortField = $params['sort_field'] ?? 'update_time';
$sortType = isset($params['sort_type']) ? strtoupper($params['sort_type']) : 'desc';
//验证sort合法性
if(!in_array($params['sort_field'],['create_time','update_time','end_time','start_time'])) {
$sortField = 'update_time';
}
if(!in_array($params['sort_type'],['asc','desc'])) {
$sortType = 'DESC';
}
$where["marketing_type"] = Marketing::MARKETING_TYPE_PINDAN;
if (!empty($params['marketing_name'])) {
......@@ -248,16 +303,20 @@ class MarketingService
$where["end_time[>=]"] = $now;
} elseif ($params["activity_status"] == MarketingPindan::ACTIVITY_STATUS_FINISHED) {
$where["end_time[<]"] = $now;
}
if (!empty($params['from'])) {
$beforeSevenDay = date("Y-m-d H:i:s", strtotime("-7 day"));
$where["start_time[>]"] = $beforeSevenDay;
//七日内结束的活动
if (!empty($params['from']) && $params['from'] == 1) {
$beforeSevenDay = date("Y-m-d H:i:s", strtotime("-7 day"));
$where["end_time[>]"] = $beforeSevenDay;
}
} elseif ($params["activity_status"] == MarketingPindan::ACTIVITY_STATUS_START_TODAY) {//今日上新-未开始
$where["start_time[>]"] = $now;
$where["start_time[<=]"] = date("Y-m-d 00:00:00",strtotime('+1 days'));
$where["end_time[>=]"] = $now;
}
$where['life_account_id'] = self::getPublicLifeAccountId();
$where['ORDER'] = ["update_time" => "DESC"];
$where['ORDER'] = [$sortField => $sortType];
$where['LIMIT'] = [$page, $limit];
$list = Marketing::select(["marketing_id", "marketing_name", "start_time", "end_time",
"online_status", "update_time", "create_time"]
......@@ -270,7 +329,11 @@ class MarketingService
$marketingIds[] = $value["marketing_id"];
}
//参与人数:当前拼单成功支付的订单总数量
$userCount = self::getHaveBuyGoodsUserCount(["marketing_id" => $marketingIds]);
if(isset($params['need_buy_num']) && $params['need_buy_num']) {
$userCount = self::getHaveBuyGoodsUserCount(["marketing_id" => $marketingIds]);
}else {
$userCount = [];
}
$marketingPindanData = MarketingPindan::select(["marketing_id", "publish_life_account_id",
"min_price", "max_price", "pindan_desc","participate_number", "pindan_pic"]
......@@ -290,11 +353,6 @@ class MarketingService
$lists[$key]["online_status_desc"] = Marketing::$onlineStatusDesc[$value["online_status"]];
if (!empty($priceData[$value["marketing_id"]])) {
$currentLifeAccountId = $priceData[$value["marketing_id"]]["publish_life_account_id"];
//小程序前端过滤掉线上测试生活号发布的活动
//TODO::预发环境要调整这里
if ($params['from'] == 1 && $currentLifeAccountId == self::ONLINE_LIFE_ACCOUNT_ID_TEST) {
continue;
}
$lists[$key]["publish_life_account_id"] = $currentLifeAccountId;
if (!empty($lifeAccountList[$currentLifeAccountId])) {
......@@ -866,6 +924,24 @@ class MarketingService
Marketing::updateRecord($marketingParams, ["marketing_id" => $marketingId, "marketing_type" => $marketingType]);
}
/**
* 切换活动状态
* @param $marketingId
* @param $onlineStatus
* @return \Api\PhpUtils\Mysql\MysqlBase
*/
public static function toogleOnlineStatus($marketingId,$onlineStatus)
{
if(!in_array($onlineStatus,array_keys(Marketing::$onlineStatusDesc))) {
return 0;
}
$data = [
'online_status' => $onlineStatus,
];
return Marketing::updateRecord($data, ["marketing_id" => $marketingId]);
}
/**
* 分销活动详情
* @param $params
......
<?php
namespace App\Services\marketing;
use App\Exception\custom\MarketingException;
use App\Models\marketing\mysql\ColonelDistributorInviteOrderNum;
use App\Models\marketing\mysql\Marketing;
use App\Models\marketing\mysql\ColonelDistributorConfig;
class PindanActivityColonelConfigService
{
// 活动默认时间范围点
const ACTIVITY_DEFAULT_HOUR = 12;
/**
* 编辑团长分销活动配置
* @param array $params
* @return bool
* @throws MarketingException
*/
public static function editColonelConfig($params = [])
{
$date = $params["date"];
$today = date("Y-m-d");
$hour = date("H");
if ($date < $today || ($date == $today && $hour >= 12)) {
throw new MarketingException(['cus' => MarketingException::COLONEL_DATE_ERROR]);
}
$type = empty($params["type"]) ? ColonelDistributorConfig::TYPE_COLONEL : $params["type"];
$configList = $params["config"];
$marketingId = $params["marketing_id"];
if (empty($configList)) {
throw new MarketingException(['cus' => MarketingException::COLONEL_CONFIG_NULL]);
}
if (count($configList) > 6) {
throw new MarketingException(['cus' => MarketingException::COLONEL_LEVEL_SIX]);
}
$idRes = ColonelDistributorConfig::getRecordMaster(["date" => $date, "type" => $type, "marketing_id" => $marketingId], ["colonel_config_id"]);
if (!empty($idRes[0]["colonel_config_id"])) {
ColonelDistributorConfig::save([
"marketing_id" => $marketingId,
"date" => $date,
"type" => $type,
"data" => $configList,
], ["colonel_config_id" => $idRes[0]["colonel_config_id"]]);
} else {
ColonelDistributorConfig::save([
"marketing_id" => $marketingId,
"date" => $date,
"type" => $type,
"data" => $configList,
]);
}
return true;
}
/**
* 团长分销活动配置
* @param array $params
* @return array
*/
public static function colonelConfig($params = [])
{
$day = $params["date"];
$type = empty($params["type"]) ? ColonelDistributorConfig::TYPE_COLONEL : $params["type"];
if(empty($day)) {
//默认取最近更新的一条配置
$config = ColonelDistributorConfig::getRecord([
"type" => $type,"ORDER" => ["update_time" => "DESC"], "LIMIT" => 1
]);
}else {
$config = ColonelDistributorConfig::getRecord(["date" => $day, "type" => $type]);
}
if (empty($config)) {
$config = ColonelDistributorConfig::getRecord([
"date[<=]" => $day,
"ORDER" => ["date" => "DESC"],
"LIMIT" => 1
]);
}
$data = [];
if (!empty($config)) {
$configData = json_decode($config["data"], true);
foreach ($configData as $key => $item) {
$data[$key]["marketing_id"] = $config["marketing_id"];
$data[$key]["date"] = $config["date"];
$data[$key]["level"] = $item["level"];
$data[$key]["assess_order_num"] = $item["assess_order_num"];
$data[$key]["reward_amount"] = $item["reward_amount"];
}
$sortKeys = array_column($data, "level");
array_multisort($sortKeys, SORT_ASC, $data);
}
return $data;
}
/**
* 团长分销活动任务中心列表
* @param array $params
* @return array
*/
public static function getTaskData($params = [])
{
$timeRange = self::getActivityTimeRange();
$date = date("Y-m-d", strtotime($timeRange["start_time"]));
$configList = self::colonelConfig(["date" => $date, "type" => ColonelDistributorConfig::TYPE_COLONEL]);
$marketingId = empty($configList[0]["marketing_id"]) ? 0 : $configList[0]["marketing_id"];
if (!Marketing::isGoing($marketingId)) {
return ["number" => 0, 'list' => []];
}
$num = 0;
if (!empty($params["user_id"])) {
$inviteOrderNumRes = ColonelDistributorInviteOrderNum::getRecord([
"colonel_user_id" => $params["user_id"],
"date" => $date,
]);
$num = empty($inviteOrderNumRes["num"]) ? 0 : $inviteOrderNumRes["num"];
}
if (!empty($configList)) {
foreach ($configList as $key => $config) {
$configList[$key]["is_finish"] = 0;
if ($config["assess_order_num"] <= $num) {
$configList[$key]["is_finish"] = 1;
}
}
}
return ["number" => $num, 'list' => $configList];
}
/**
* Notes: 获取活动时间范围
* User: pengfei@yidian-inc.com
* Date: 2021/9/3 2:50 下午
* @return string[]
*/
public static function getActivityTimeRange() : array
{
// 获取活动时间范围 例如活动时间(2021-09-03) --- 2021-09-03:12:00:00 - 2021-09-04:12:00:00
$hour = ' '.self::ACTIVITY_DEFAULT_HOUR . ':00:00';
if (date('H') >= self::ACTIVITY_DEFAULT_HOUR) {
$startTime = date('Y-m-d').$hour;
$endTime = date('Y-m-d', strtotime('+1 day')).$hour;
} else {
$startTime = date('Y-m-d', strtotime('-1 day')).$hour;
$endTime = date('Y-m-d').$hour;
}
return [
'start_time' => $startTime,
'end_time' => $endTime,
'date' => date('Y-m-d', strtotime($startTime))
];
}
/**
* Notes: 获取结算时间范围
* User: pengfei@yidian-inc.com
* Date: 2021/9/3 2:50 下午
* @return string[]
*/
public static function getSettlementTimeRange() : array
{
// 获取活动时间范围 例如当前时间(2021-09-03 12:00:00) 应结算时间为 2021-08-31-:12:00:00 - 2021-09-01:12:00:00
$hour = ' '.self::ACTIVITY_DEFAULT_HOUR . ':00:00';
$startTime = date('Y-m-d', strtotime('-3 day')).$hour;
$endTime = date('Y-m-d', strtotime('-2 day')).$hour;
return [
'start_time' => $startTime,
'end_time' => $endTime,
'date' => date('Y-m-d', strtotime($startTime))
];
}
}
\ No newline at end of file
<?php
namespace App\Services\marketing;
use Api\PhpUtils\Http\HttpUtil;
use App\Exception\custom\InterfaceException;
use App\Exception\custom\MarketingException;
use App\Models\marketing\mysql\ColonelDistributorColonel;
use App\Models\marketing\mysql\ColonelDistributorConfig;
use App\Models\marketing\mysql\ColonelDistributorInviteOrder;
use App\Models\marketing\mysql\ColonelDistributorInviteOrderNum;
use App\Models\marketing\mysql\ColonelDistributorPayInfo;
use App\Services\user\UserService;
class PindanActivityInviteOrderService
{
/**
* 团长分销下单逻辑
* @param array $params
* @return bool
* @throws MarketingException
*/
public static function placeOrder($params = [])
{
$num = empty($params["num"]) ? 1 : $params["num"];
$inviteOrderData = [
"colonel_user_id" => $params["colonel_user_id"],
"user_id" => $params["user_id"],
"order_id" => $params["order_id"],
"refund_time" => null,
];
$inviteOrder = ColonelDistributorInviteOrder::selectMaster("*", $inviteOrderData, []);
if (!empty($inviteOrder)) {
return true;
}
$timeRange = PindanActivityColonelConfigService::getActivityTimeRange();
$inviteOrderNumData = [
"colonel_user_id" => $params["colonel_user_id"],
"date" => $timeRange['date']
];
$inviteOrderNum = ColonelDistributorInviteOrderNum::selectMaster("*", $inviteOrderNumData, []);
ColonelDistributorInviteOrder::beginTransaction();
$addInviteOrderRes = ColonelDistributorInviteOrder::save($inviteOrderData);
if (!empty($inviteOrderNum)) {
$addInviteOrderNumRes = ColonelDistributorInviteOrderNum::save(["num[+]" => $num], ["invite_order_num_id" => $inviteOrderNum[0]["invite_order_num_id"]]);
} else {
$inviteOrderNumData["num"] = $num;
$addInviteOrderNumRes = ColonelDistributorInviteOrderNum::save($inviteOrderNumData);
}
if (empty($addInviteOrderRes) || empty($addInviteOrderNumRes) || !ColonelDistributorInviteOrder::commit()) {
ColonelDistributorInviteOrder::rollback();
throw new MarketingException(["cus" => MarketingException::COMMIT_ERROR]);
}
return true;
}
/**
* 团长分销退单逻辑
* @param array $params
* @return bool
* @throws MarketingException
*/
public static function refundOrder($params = [])
{
$orderId = $params["order_id"];
$inviteOrder = ColonelDistributorInviteOrder::selectMaster("*", ["order_id" => $orderId], []);
if (!empty($inviteOrder) && $inviteOrder[0]["is_refund"] == ColonelDistributorInviteOrder::IS_REFUND_NO) {
$inviteOrderData = [
"colonel_user_id" => $inviteOrder[0]["colonel_user_id"],
"user_id" => $inviteOrder[0]["user_id"],
"order_id" => $orderId,
];
$inviteOrderNumData = [
"colonel_user_id" => $inviteOrder[0]["colonel_user_id"],
"date" => date("Y-m-d"),
];
ColonelDistributorInviteOrder::beginTransaction();
$addInviteOrderRes = ColonelDistributorInviteOrder::save([
"is_refund" => ColonelDistributorInviteOrder::IS_REFUND_YES,
"refund_time" => date("y-m-d H:i:s")
], $inviteOrderData);
$addInviteOrderNumRes = ColonelDistributorInviteOrderNum::save(["num[-]" => 1], $inviteOrderNumData);
if (empty($addInviteOrderRes) || empty($addInviteOrderNumRes) || !ColonelDistributorInviteOrder::commit()) {
ColonelDistributorInviteOrder::rollback();
throw new MarketingException(["cus" => MarketingException::COMMIT_ERROR]);
}
}
return true;
}
/**
* 团长分销,总收入
* @param array $params
* @return array
*/
public static function incomeStatistics($params = [])
{
$userIds = $params["user_ids"];
$allRewards = ColonelDistributorPayInfo::select(["colonel_user_id", "reward"], ["colonel_user_id" => $userIds], []);
$allData = [];
if (!empty($allRewards)) {
foreach ($allRewards as $item) {
$allData[$item["colonel_user_id"]][] = $item["reward"];
}
}
$data = [];
//未结算收益
$noSettlementStatistics = self::noSettlementStatistics($userIds);
foreach ($noSettlementStatistics as $userId => $item) {
$data[$userId]["no_settlement"] = $item;
}
foreach ($userIds as $userId) {
$data[$userId]["all_reward"] = 0;
if (!empty($allData[$userId])) {
$data[$userId]["all_reward"] = sprintf("%.1f", array_sum($allData[$userId]) / 100);
}
}
return $data;
}
/**
* 未结算收益
* @param $userIds
* @return array
* @throws InterfaceException
*/
private static function noSettlementStatistics($userIds)
{
$timeRange = self::getNoSettlementTimeRange();
$inviteOrderNumList = ColonelDistributorInviteOrderNum::select(["colonel_user_id", "num", "date"], [
"create_time[>]" => $timeRange["start_time"],
"colonel_user_id" => $userIds,
], []);
$inviteOrderNumData = [];
$inviteOrderStatistics = [];
//多个userId, 订单任务累计的未结算收益
if (!empty($inviteOrderNumList)) {
foreach ($inviteOrderNumList as $inviteOrderNum) {
$inviteOrderNumData[$inviteOrderNum["colonel_user_id"]][$inviteOrderNum["date"]] = $inviteOrderNum["num"];
}
if (!empty($inviteOrderNumData)) {
foreach ($inviteOrderNumData as $userId => $itemList) {
foreach ($itemList as $date => $num) {
$configList = self::getColonelConfig($date);
if (!empty($configList)) {
foreach ($configList as $config) {
if ($num >= $config["assess_order_num"]) {
if (empty($inviteOrderStatistics[$userId])) {
$inviteOrderStatistics[$userId] = 0;
}
$inviteOrderStatistics[$userId] += $config['reward_amount'] * 100;
}
}
}
}
}
}
}
//获取新用户奖励
$inviteUserData = [];
$inviteUserStatistics = [];
$inviteUserList = self::getInviteNewUserList($userIds, $timeRange["start_time"], $timeRange["end_time"]);
if (!empty($inviteUserList)) {
foreach ($inviteUserList as $userId => $item) {
$inviteUserData[$item["inviter_user_id"]][] = $userId;
}
foreach ($inviteUserData as $colonelUserId => $item) {
$inviteUserStatistics[$colonelUserId] = count($item) * 3 * 100;
}
}
$statistic = [];
foreach ($userIds as $userId) {
$inviteOrder = empty($inviteOrderStatistics[$userId]) ? 0 : $inviteOrderStatistics[$userId];
$inviteUser = empty($inviteUserStatistics[$userId]) ? 0 : $inviteUserStatistics[$userId];
$statistic[$userId] = sprintf("%.1f", ($inviteOrder + $inviteUser) / 100);;
}
return $statistic;
}
/**
* 获取未结算收益的时间段
* @return array|string[]
*/
public static function getNoSettlementTimeRange() : array
{
// 获取活动时间范围
// 例如当前时间(2021-09-03 11:00:00) 应结算时间为 2021-08-31 12:00:00 ~ 2021-09-03:12:00:00
// 例如当前时间(2021-09-03 13:00:00) 应结算时间为 2021-09-01 12:00:00 ~ 2021-09-03:12:00:00
$nowHour = date("H");
$hour = ' '.PindanActivityColonelConfigService::ACTIVITY_DEFAULT_HOUR . ':00:00';
if ($nowHour < 12) {
$startTime = date('Y-m-d', strtotime('-3 day')).$hour;
} else {
$startTime = date('Y-m-d', strtotime('-2 day')).$hour;
}
//$endTime = date("Y-m-d").$hour;
$endTime = date("Y-m-d H:i:s"); // 结束时间应该取当前时间
return [
'start_time' => $startTime,
'end_time' => $endTime,
];
}
/**
* 指定日期的团长配置
* @param $date
* @return array|mixed
*/
private static function getColonelConfig($date)
{
$config = ColonelDistributorConfig::getRecord([
'date' => $date,
'type' => ColonelDistributorConfig::TYPE_COLONEL
]);
if (empty($config)) {
$config = ColonelDistributorConfig::getRecord([
'date[<=]' => $date,
'ORDER' => ['date' => 'DESC'],
'LIMIT' => 1
]);
}
$configData = [];
if (!empty($config['data'])) {
$configData = json_decode($config['data'], true);
}
return $configData;
}
/**
* 获取新用户奖励
* @param $userIds
* @param $startTime
* @param $endTime
* @return array
* @throws InterfaceException
*/
private static function getInviteNewUserList($userIds, $startTime, $endTime): array
{
$url = config('interface', 'coupon.background.wx_invite_relation_list_by_user_ids');
if (empty($url)) {
throw new InterfaceException(['cus' => 0]);
}
$res = HttpUtil::get($url,
['user_ids' => $userIds, 'start_time' => $startTime, 'end_time' => $endTime]);
if (!empty($res['response']['result'])) {
return array_column($res['response']['result'], null, 'user_id');
}
return [];
}
/**
* 团长分销,累计转化单数
* @param array $params
* @return array
*/
public static function inviteOrderNumberStatistics($params = [])
{
$timeRange = self::getNoSettlementTimeRange();
$userIds = $params["user_ids"];
$allNums = ColonelDistributorInviteOrderNum::select(
["colonel_user_id", "num"],
["colonel_user_id" => $userIds, "create_time[<]" => $timeRange["start_time"]], []);
$allData = array_column($allNums, null, "colonel_user_id");
$data = [];
foreach ($userIds as $userId) {
$data[$userId]["all_order_num"] = 0;
if (!empty($allData[$userId])) {
$data[$userId]["all_order_num"] = $allData[$userId]["num"];
}
}
return $data;
}
/**
* 团长分销,账单详情
* @param array $params
* @return array
*/
public static function getPayInfoList($params = [])
{
$userId = $params["user_id"];
if (empty($userId)) {
return [];
}
$data = $res = [];
$nowHour = date("H");
if ($nowHour < 12) {
$todayNum = 3;
} else {
$todayNum = 2;
}
for ($i = 0; $i < $todayNum; $i++) {
$date = date("Y-m-d", strtotime("-$i day"));
$res[$date]["total"] = 0;
$res[$date]["date"] = $date;
$res[$date]["status"] = 2;
$res[$date]["data"] = [];
}
$weekDay = date("Y-m-d", strtotime("-7 day"));
$payList = ColonelDistributorPayInfo::select("*", [
"colonel_user_id" => $userId,
"date[>=]" => $weekDay,
"ORDER" => ["date" => "DESC"]
], []);
if (!empty($payList)) {
foreach ($payList as $item) {
$tempItem = [];
$tempItem["type"] = $item["type"];
$tempItem["type_desc"] = ColonelDistributorPayInfo::$typeDesc[$item["type"]];
$tempItem["invite_user_id"] = $item["invite_user_id"];
$tempItem["invite_user_nick"] = $item["invite_user_nick"];
$tempItem["reward"] = $item["reward"];
$tempItem["finish_num"] = $item["finish_num"];
$tempItem["status"] = $item["status"];
$data[$item["date"]][] = $tempItem;
}
foreach ($data as $key => $item) {
$rewards = array_column($item, "reward");
$total = array_sum($rewards);
$res[$key]["total"] = $total / 100;
$res[$key]["date"] = $key;
$res[$key]["status"] = 1;
$res[$key]["data"] = $item;
foreach ($item as $k => $v) {
$res[$key]["data"][$k]["reward"] = $v["reward"] / 100;
}
}
}
return array_values($res);
}
/**
* 团长分销,下单记录
* @param array $params
* @return array
*/
public static function getInviteOrderRecord($params = [])
{
$userId = $params["user_id"];
$lastId = empty($params["last_id"]) ? "" : $params["last_id"];
$limit = empty($params["page_size"]) ? 10 : $params["page_size"];
$dateRange = PindanActivityColonelConfigService::getActivityTimeRange();
$where = [];
$where["colonel_user_id"] = $userId;
$where["create_time[>]"] = $dateRange['start_time'];
$where["create_time[<]"] = $dateRange['end_time'];
$where["LIMIT"] = $limit;
$where["ORDER"] = ["invite_order_id" => "DESC"];
if (!empty($lastId)) {
$where["invite_order_id[<]"] = $lastId;
}
$list = ColonelDistributorInviteOrder::select(["invite_order_id", "user_id", "is_refund"], $where, []);
if (!empty($list)) {
$userIds = array_unique(array_column($list, "user_id"));
$userList = UserService::userWechatBind(["user_id"=>$userIds]);
if (!empty($userList)) {
$userList = array_column($userList, null, "user_id");
}
$count = count($list);
foreach ($list as $key => $item) {
if (!empty($userList[$item["user_id"]])) {
$list[$key]["user_nick"] = $userList[$item["user_id"]]["user_nick"];
$list[$key]["user_avatar"] = $userList[$item["user_id"]]["user_avatar"];
} else {
$list[$key]["user_nick"] = "";
$list[$key]["user_avatar"] = "";
}
$lastId = $item["invite_order_id"];
}
if ($count < $limit) {
$lastId = "-1";
}
} else {
$lastId = "-1";
}
return ["list" => $list, "last_id" => $lastId];
}
}
\ No newline at end of file
......@@ -54,7 +54,8 @@ class TakePlaceService
public static function add($params)
{
//验证life_account_id
if(isset($params['life_account_id'])) {
$lifeAccountId = MarketingService::getPublicLifeAccountId();
if(isset($params['life_account_id']) && $params['life_account_id'] != $lifeAccountId) {
$url = config('interface', 'merchant.lifeaccount.get_life_account_by_id');
$lifeAccountRes = (new Request())->get($url, ["life_account_id" => $params["life_account_id"]]);
......@@ -63,9 +64,9 @@ class TakePlaceService
}
}
$lifeAccountId = MarketingService::getPublicLifeAccountId();
$data['life_account_id'] = $params['life_account_id'] ?? $lifeAccountId;
$data['take_place_name'] = $params['name'];
$data['take_place_pic'] = $params['take_place_pic'] ?? '';
$data['longitude'] = $params['longitude'];
$data['latitude'] = $params['latitude'];
$data['location'] = $params['location'];
......
......@@ -3,6 +3,7 @@
namespace App\Services\tcc;
use Api\PhpUtils\Common\GoodsSkuId;
use Api\PhpUtils\Log\FileLog;
use App\Exception\custom\GoodsException;
use App\Models\goods\mysql\GoodsSku;
use App\Models\goods\mysql\PindanGoodsSku;
......@@ -491,7 +492,7 @@ class Tcc2Service
}
}
}
FileLog::info('goods_cancel_confirm_tcc', 'json decode error raw:' . $keys);
if ($isPindan) {
return self::pindanCancelConfirm($goodsInfoList);
} else {
......
......@@ -3,6 +3,7 @@
namespace App\Services\user;
use Api\PhpUtils\Mon\MonUtil;
use App\Models\user\mysql\UserWechatBind;
use Api\PhpUtils\Http\Request;
use App\Services\user\Weixin\WxBizDataCrypt;;
......@@ -27,8 +28,10 @@ class UserService
{
$code = !empty($params['code']) ? $params['code'] : '';//小程序授权code
$openid = !empty($params['openid']) ? $params['openid'] : '';//小程序授权code
$inviteUserId = !empty($params['invite_user_id']) ? intval($params['invite_user_id']) : 0;//邀请用户id
$activityType = !empty($params['activity_type']) ? intval($params['activity_type']) : 0;//活动类型
if (empty($code) && empty($openid)) {
FileLog::error("wechatLogin:获取参数为空", json_encode($params, JSON_UNESCAPED_UNICODE),'','jianghaiming@yidian-inc.com');
FileLog::error("wechatLogin:获取参数为空", json_encode($params, JSON_UNESCAPED_UNICODE), '', 'jianghaiming@yidian-inc.com');
throw new UserException(['cus' => 0]);
}
......@@ -49,30 +52,37 @@ class UserService
//需要授权微信
//if (empty($openid)) {
$appid = \Yaf\Registry::get('config')->wechat->appid;
$secret = \Yaf\Registry::get('config')->wechat->secret;
$grant_type = 'authorization_code';
$loginUrl = 'https://api.weixin.qq.com/sns/jscode2session';
//请求接口,获取用户openid
$params = [
'appid' => $appid,
'secret' => $secret,
'js_code' => $code,
'grant_type' => $grant_type,
];
$response = (new Request())->post($loginUrl, $params);
$appid = \Yaf\Registry::get('config')->wechat->appid;
$secret = \Yaf\Registry::get('config')->wechat->secret;
$grant_type = 'authorization_code';
$loginUrl = 'https://api.weixin.qq.com/sns/jscode2session';
//请求接口,获取用户openid
$params = [
'appid' => $appid,
'secret' => $secret,
'js_code' => $code,
'grant_type' => $grant_type,
];
$begin = microtime(true);
$response = (new Request())->post($loginUrl, $params);
if ($response['code'] == 0) {
$response = $response['response'];
}
$end = microtime(true);
$totalTime = round(($end - $begin), 4) * 1000;
if ($response['code'] == 0) {
$response = $response['response'];
}
if (empty($response) || array_key_exists('errcode', $response)) {
//throw new \Exception('获取openid失败:' . $response['errcode']);
FileLog::error("wechatLogin:获取openid失败", json_encode($params, JSON_UNESCAPED_UNICODE),'','jianghaiming@yidian-inc.com');
throw new UserException(['cus' => 1]);
}
//检查系统是已注册
$openid = !empty($response['openid']) ? $response['openid'] : '';
//mon打点
$env = \Yaf\Application::app()->environ() ?? "dev";
MonUtil::proxyMon($loginUrl, $response['code'], 'weixin_'.$env, $totalTime);
if (empty($response) || array_key_exists('errcode', $response)) {
//throw new \Exception('获取openid失败:' . $response['errcode']);
FileLog::error("wechatLogin:获取openid失败", json_encode($params, JSON_UNESCAPED_UNICODE), '', 'jianghaiming@yidian-inc.com');
throw new UserException(['cus' => 1]);
}
//检查系统是已注册
$openid = !empty($response['openid']) ? $response['openid'] : '';
//}
......@@ -83,51 +93,60 @@ class UserService
'openid' => !empty($response['openid']) ? $response['openid'] : '',
'union_id' => !empty($response['unionid']) ? $response['unionid'] : '',
'session_key' => !empty($response['session_key']) ? $response['session_key'] : '', //默认7200有效期
'invite_user_id' => $inviteUserId,
'activity_type' => $activityType,
'create_time' => date("Y-m-d H:i:s")
];
$sessionKey = !empty($response['session_key']) ? $response['session_key'] : '';
//$newWechatId = UserWechatBind::save($insert);
$newWechatId =UserWechatBind::insertDuplicate($insert, ['session_key' => $sessionKey,'create_time' => date("Y-m-d H:i:s")]);
$newWechatId = UserWechatBind::insertDuplicate($insert, ['session_key' => $sessionKey, 'create_time' => date("Y-m-d H:i:s")]);
if (!$newWechatId) {
FileLog::error("wechatLogin:登陆创建用户失败", json_encode($params, JSON_UNESCAPED_UNICODE),'','jianghaiming@yidian-inc.com');
FileLog::error("wechatLogin:登陆创建用户失败--insert", json_encode($insert, JSON_UNESCAPED_UNICODE),'','jianghaiming@yidian-inc.com');
FileLog::error("wechatLogin:登陆创建用户失败", json_encode($params, JSON_UNESCAPED_UNICODE), '', 'jianghaiming@yidian-inc.com');
FileLog::error("wechatLogin:登陆创建用户失败--insert", json_encode($insert, JSON_UNESCAPED_UNICODE), '', 'jianghaiming@yidian-inc.com');
throw new UserException(['cus' => 2]);
}
$user['wechat_id'] = $newWechatId;
$user['openid'] = $response['openid'];
$user['session_key'] = $response['session_key'];
}else{
} else {
if (empty($user)) {
FileLog::error("wechatLogin:登陆创建用户失败-- 微信response", json_encode($response, JSON_UNESCAPED_UNICODE),'','jianghaiming@yidian-inc.com');
FileLog::error("wechatLogin:登陆创建用户失败-- 微信response", json_encode($response, JSON_UNESCAPED_UNICODE), '', 'jianghaiming@yidian-inc.com');
throw new UserException(['cus' => 2]);
}
if (empty($response)){
FileLog::error("wechatLogin:登陆创建用户失败-- 微信response 获取失败", json_encode($params, JSON_UNESCAPED_UNICODE),'','jianghaiming@yidian-inc.com');
if (empty($response)) {
FileLog::error("wechatLogin:登陆创建用户失败-- 微信response 获取失败", json_encode($params, JSON_UNESCAPED_UNICODE), '', 'jianghaiming@yidian-inc.com');
throw new UserException(['cus' => 2]);
}
$insert = [
'session_key' => !empty($response['session_key']) ? $response['session_key'] : '',
];
$newWechatId = UserWechatBind::save($insert,['openid' => $openid]);
$newWechatId = UserWechatBind::save($insert, ['openid' => $openid]);
}
$user['third_session'] = self::generate3rdSession($openid);
$redis->set($keyCode, json_encode($user),120);
return $user;
return $user;
}
/**
* 绑定手机号
* @param $params
* @return \Api\PhpUtils\Mysql\MysqlBase
* @throws UserException
* @throws \App\Exception\custom\CodeSpecialException
* @throws \App\Exception\custom\InterfaceException
*/
public static function bindPhone($params)
{
$openid = !empty($params['openid']) ? $params['openid'] : '';
$encryptedData = !empty($params['encryptedData']) ? $params['encryptedData'] : '';
$iv = !empty($params['iv']) ? $params['iv'] : '';
$iv = !empty($params['iv']) ? $params['iv'] : '';
$appid = \Yaf\Registry::get('config')->wechat->appid;
if (!$encryptedData) {
FileLog::error("bindPhone:encryptedData 为空", json_encode($params, JSON_UNESCAPED_UNICODE),'','jianghaiming@yidian-inc.com');
throw new UserException(['cus' => 3]);
......@@ -164,7 +183,6 @@ class UserService
}
$phoneNumber = strval($decryptData['phoneNumber']);
//判断是否已
$user = UserWechatBind::getRecordMaster(['phone' => $phoneNumber]);
if (!empty($user) && $openid != $user['openid']) {
......@@ -213,7 +231,7 @@ class UserService
public static function userWechatBind($params)
{
$data['wechat_id[>]'] = 0;
if (!empty($params['openid'])) {
......@@ -223,7 +241,11 @@ class UserService
if (!empty($params['user_id'])) {
$data['user_id'] = $params['user_id'];
}
if (!empty($params['phone'])) {
$data['phone'] = $params['phone'];
}
$userList = UserWechatBind::getRecords($data);
return $userList;
}
......
......@@ -6,8 +6,8 @@
"require": {
"php": "7.2.*",
"ext-json": "*",
"api/php_utils":"1.0.12",
"api/php_services":"1.0.9",
"api/php_utils":"1.0.17",
"api/php_services":"1.0.14",
"ext-openssl": "*"
},
"minimum-stability": "dev",
......
......@@ -4,15 +4,15 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "ca6dee79e7768d386ea8636e9f10a52d",
"content-hash": "6b8ea7dcd025a3916d9804461968836b",
"packages": [
{
"name": "api/php_services",
"version": "v1.0.9",
"version": "1.0.14",
"source": {
"type": "git",
"url": "https://git.yidian-inc.com:8021/bp/php_services.git",
"reference": "cd08caa8f11627220db0d5f13cfb99198a1e7076"
"reference": "f2ba54cfaff45ffa8c0c4864f3b4935e1fcb3cfa"
},
"require": {
"endroid/qr-code": "^3.9",
......@@ -26,15 +26,15 @@
}
},
"description": "bp api php_services",
"time": "2021-08-24T10:07:07+00:00"
"time": "2021-09-08T06:38:07+00:00"
},
{
"name": "api/php_utils",
"version": "v1.0.12",
"version": "v1.0.17",
"source": {
"type": "git",
"url": "https://git.yidian-inc.com:8021/bp/php_utils.git",
"reference": "bb58e98113fdd1a439828bb61cc716b0de0b6b0c"
"reference": "aa70ccdd545f3e421eaf717274954990f1805b87"
},
"require": {
"elasticsearch/elasticsearch": "~7.0",
......@@ -53,7 +53,7 @@
}
},
"description": "bp api php_utils",
"time": "2021-08-24T08:58:56+00:00"
"time": "2021-09-06T08:57:33+00:00"
},
{
"name": "bacon/bacon-qr-code",
......@@ -67,13 +67,7 @@
"type": "zip",
"url": "https://api.github.com/repos/Bacon/BaconQrCode/zipball/f73543ac4e1def05f1a70bcd1525c8a157a1ad09",
"reference": "f73543ac4e1def05f1a70bcd1525c8a157a1ad09",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"shasum": ""
},
"require": {
"dasprid/enum": "^1.0.3",
......@@ -126,13 +120,7 @@
"type": "zip",
"url": "https://api.github.com/repos/DASPRiD/Enum/zipball/5abf82f213618696dda8e3bf6f64dd042d8542b2",
"reference": "5abf82f213618696dda8e3bf6f64dd042d8542b2",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"shasum": ""
},
"require-dev": {
"phpunit/phpunit": "^7 | ^8 | ^9",
......@@ -179,13 +167,7 @@
"type": "zip",
"url": "https://api.github.com/repos/elastic/elasticsearch-php/zipball/8d08050fef9d89004702b1428b8c1f7f4f6162cf",
"reference": "8d08050fef9d89004702b1428b8c1f7f4f6162cf",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"shasum": ""
},
"require": {
"ext-json": ">=1.3.7",
......@@ -254,13 +236,7 @@
"type": "zip",
"url": "https://api.github.com/repos/endroid/qr-code/zipball/9cdd4f5d609bfc8811ca4a62b4d23eb16976242f",
"reference": "9cdd4f5d609bfc8811ca4a62b4d23eb16976242f",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"shasum": ""
},
"require": {
"bacon/bacon-qr-code": "^2.0",
......@@ -335,13 +311,7 @@
"type": "zip",
"url": "https://api.github.com/repos/ezimuel/guzzlestreams/zipball/abe3791d231167f14eb80d413420d1eab91163a8",
"reference": "abe3791d231167f14eb80d413420d1eab91163a8",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"shasum": ""
},
"require": {
"php": ">=5.4.0"
......@@ -395,13 +365,7 @@
"type": "zip",
"url": "https://api.github.com/repos/ezimuel/ringphp/zipball/0b78f89d8e0bb9e380046c31adfa40347e9f663b",
"reference": "0b78f89d8e0bb9e380046c31adfa40347e9f663b",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"shasum": ""
},
"require": {
"ezimuel/guzzlestreams": "^3.0.1",
......@@ -456,13 +420,7 @@
"type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/f4db5a78a5ea468d4831de7f0bf9d9415e348699",
"reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"shasum": ""
},
"require": {
"guzzlehttp/promises": "^1.0",
......@@ -525,19 +483,13 @@
"source": {
"type": "git",
"url": "https://github.com/guzzle/promises.git",
"reference": "8e7d04f1f6450fef59366c399cfad4b9383aa30d"
"reference": "c1dd809c8f51a477701052f4b9e5b4bb5c1061aa"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/promises/zipball/8e7d04f1f6450fef59366c399cfad4b9383aa30d",
"reference": "8e7d04f1f6450fef59366c399cfad4b9383aa30d",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"url": "https://api.github.com/repos/guzzle/promises/zipball/c1dd809c8f51a477701052f4b9e5b4bb5c1061aa",
"reference": "c1dd809c8f51a477701052f4b9e5b4bb5c1061aa",
"shasum": ""
},
"require": {
"php": ">=5.5"
......@@ -565,10 +517,25 @@
"MIT"
],
"authors": [
{
"name": "Graham Campbell",
"email": "hello@gjcampbell.co.uk",
"homepage": "https://github.com/GrahamCampbell"
},
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
},
{
"name": "Tobias Nyholm",
"email": "tobias.nyholm@gmail.com",
"homepage": "https://github.com/Nyholm"
},
{
"name": "Tobias Schultze",
"email": "webmaster@tubo-world.de",
"homepage": "https://github.com/Tobion"
}
],
"description": "Guzzle promises library",
......@@ -577,9 +544,23 @@
],
"support": {
"issues": "https://github.com/guzzle/promises/issues",
"source": "https://github.com/guzzle/promises/tree/1.4.1"
"source": "https://github.com/guzzle/promises/tree/master"
},
"time": "2021-03-07T09:25:29+00:00"
"funding": [
{
"url": "https://github.com/GrahamCampbell",
"type": "github"
},
{
"url": "https://github.com/Nyholm",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/guzzlehttp/promises",
"type": "tidelift"
}
],
"time": "2021-09-05T15:38:28+00:00"
},
{
"name": "guzzlehttp/psr7",
......@@ -587,19 +568,13 @@
"source": {
"type": "git",
"url": "https://github.com/guzzle/psr7.git",
"reference": "dc960a912984efb74d0a90222870c72c87f10c91"
"reference": "9d006741ba865a45adccfac45d8e1053086a5a3f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/dc960a912984efb74d0a90222870c72c87f10c91",
"reference": "dc960a912984efb74d0a90222870c72c87f10c91",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"url": "https://api.github.com/repos/guzzle/psr7/zipball/9d006741ba865a45adccfac45d8e1053086a5a3f",
"reference": "9d006741ba865a45adccfac45d8e1053086a5a3f",
"shasum": ""
},
"require": {
"php": ">=5.4.0",
......@@ -635,13 +610,34 @@
"MIT"
],
"authors": [
{
"name": "Graham Campbell",
"email": "hello@gjcampbell.co.uk",
"homepage": "https://github.com/GrahamCampbell"
},
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
},
{
"name": "George Mponos",
"email": "gmponos@gmail.com",
"homepage": "https://github.com/gmponos"
},
{
"name": "Tobias Nyholm",
"email": "tobias.nyholm@gmail.com",
"homepage": "https://github.com/Nyholm"
},
{
"name": "Márk Sági-Kazár",
"email": "mark.sagikazar@gmail.com",
"homepage": "https://github.com/sagikazarmark"
},
{
"name": "Tobias Schultze",
"email": "webmaster@tubo-world.de",
"homepage": "https://github.com/Tobion"
}
],
......@@ -660,7 +656,7 @@
"issues": "https://github.com/guzzle/psr7/issues",
"source": "https://github.com/guzzle/psr7/tree/1.x"
},
"time": "2021-04-26T09:17:50+00:00"
"time": "2021-09-05T19:11:18+00:00"
},
{
"name": "khanamiryan/qrcode-detector-decoder",
......@@ -674,13 +670,7 @@
"type": "zip",
"url": "https://api.github.com/repos/khanamiryan/php-qrcode-detector-decoder/zipball/04fdd58d86a387065f707dc6d3cc304c719910c1",
"reference": "04fdd58d86a387065f707dc6d3cc304c719910c1",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"shasum": ""
},
"require": {
"php": ">=5.6"
......@@ -735,13 +725,7 @@
"type": "zip",
"url": "https://api.github.com/repos/mongodb/mongo-php-library/zipball/18fca8cc8d0c2cc07f76605760d20632bb3dab96",
"reference": "18fca8cc8d0c2cc07f76605760d20632bb3dab96",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"shasum": ""
},
"require": {
"ext-hash": "*",
......@@ -805,13 +789,7 @@
"type": "zip",
"url": "https://api.github.com/repos/myclabs/php-enum/zipball/d178027d1e679832db9f38248fcc7200647dc2b7",
"reference": "d178027d1e679832db9f38248fcc7200647dc2b7",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"shasum": ""
},
"require": {
"ext-json": "*",
......@@ -871,13 +849,7 @@
"type": "zip",
"url": "https://api.github.com/repos/perftools/php-profiler/zipball/794c435f615ab9ca4347e386b4d8c6524fe9e3ae",
"reference": "794c435f615ab9ca4347e386b4d8c6524fe9e3ae",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"shasum": ""
},
"require": {
"ext-json": "*",
......@@ -939,13 +911,7 @@
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-message/zipball/efd67d1dc14a7ef4fc4e518e7dee91c271d524e4",
"reference": "efd67d1dc14a7ef4fc4e518e7dee91c271d524e4",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"shasum": ""
},
"require": {
"php": ">=5.3.0"
......@@ -999,13 +965,7 @@
"type": "zip",
"url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11",
"reference": "d49695b909c3b7628b6289db5479a1c204601f11",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"shasum": ""
},
"require": {
"php": ">=5.3.0"
......@@ -1055,13 +1015,7 @@
"type": "zip",
"url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822",
"reference": "120b605dfeb996808c31b6477290a714d356e822",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"shasum": ""
},
"require": {
"php": ">=5.6"
......@@ -1105,13 +1059,7 @@
"type": "zip",
"url": "https://api.github.com/repos/reactphp/promise/zipball/a9752a861e21c0fe0b380c9f9e55beddc0ed7d31",
"reference": "a9752a861e21c0fe0b380c9f9e55beddc0ed7d31",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"shasum": ""
},
"require": {
"php": ">=5.4.0"
......@@ -1171,13 +1119,7 @@
"type": "zip",
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/6f981ee24cf69ee7ce9736146d1c57c2780598a8",
"reference": "6f981ee24cf69ee7ce9736146d1c57c2780598a8",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"shasum": ""
},
"require": {
"php": ">=7.1"
......@@ -1245,13 +1187,7 @@
"type": "zip",
"url": "https://api.github.com/repos/symfony/options-resolver/zipball/f1b99f10ea04aa9d0aafddcd8ba3d65545403bab",
"reference": "f1b99f10ea04aa9d0aafddcd8ba3d65545403bab",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"shasum": ""
},
"require": {
"php": ">=7.2.5",
......@@ -1320,13 +1256,7 @@
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce",
"reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"shasum": ""
},
"require": {
"php": ">=7.1"
......@@ -1406,13 +1336,7 @@
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/16880ba9c5ebe3642d1995ab866db29270b36535",
"reference": "16880ba9c5ebe3642d1995ab866db29270b36535",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"shasum": ""
},
"require": {
"php": ">=7.1"
......@@ -1494,13 +1418,7 @@
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8590a5f561694770bdcd3f9b5c69dde6945028e8",
"reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"shasum": ""
},
"require": {
"php": ">=7.1"
......@@ -1585,13 +1503,7 @@
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9174a3d80210dca8daa7f31fec659150bbeabfc6",
"reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"shasum": ""
},
"require": {
"php": ">=7.1"
......@@ -1672,13 +1584,7 @@
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fba8933c384d6476ab14fb7b8526e5287ca7e010",
"reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"shasum": ""
},
"require": {
"php": ">=7.1"
......@@ -1758,13 +1664,7 @@
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/1100343ed1a92e3a38f9ae122fc0eb21602547be",
"reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"shasum": ""
},
"require": {
"php": ">=7.1"
......@@ -1848,13 +1748,7 @@
"type": "zip",
"url": "https://api.github.com/repos/symfony/property-access/zipball/7831b0331b786db39026d190faa4914f94adb212",
"reference": "7831b0331b786db39026d190faa4914f94adb212",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"shasum": ""
},
"require": {
"php": ">=7.2.5",
......@@ -1929,19 +1823,13 @@
"source": {
"type": "git",
"url": "https://github.com/symfony/property-info.git",
"reference": "3565216f9640b26b646855e39e7bfafc550c75db"
"reference": "903f3f3f6a360bc4739f8390e5031acc70d9cd9f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/property-info/zipball/3565216f9640b26b646855e39e7bfafc550c75db",
"reference": "3565216f9640b26b646855e39e7bfafc550c75db",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"url": "https://api.github.com/repos/symfony/property-info/zipball/903f3f3f6a360bc4739f8390e5031acc70d9cd9f",
"reference": "903f3f3f6a360bc4739f8390e5031acc70d9cd9f",
"shasum": ""
},
"require": {
"php": ">=7.2.5",
......@@ -2017,7 +1905,7 @@
"type": "tidelift"
}
],
"time": "2021-08-23T12:58:54+00:00"
"time": "2021-09-07T15:45:17+00:00"
},
{
"name": "symfony/string",
......@@ -2025,19 +1913,13 @@
"source": {
"type": "git",
"url": "https://github.com/symfony/string.git",
"reference": "2342deb63fb5f8c45c5c190656d9aa0377792143"
"reference": "fa2c5cc3f7dac23d87429652fe0daf28d65cbd5b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/string/zipball/2342deb63fb5f8c45c5c190656d9aa0377792143",
"reference": "2342deb63fb5f8c45c5c190656d9aa0377792143",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"url": "https://api.github.com/repos/symfony/string/zipball/fa2c5cc3f7dac23d87429652fe0daf28d65cbd5b",
"reference": "fa2c5cc3f7dac23d87429652fe0daf28d65cbd5b",
"shasum": ""
},
"require": {
"php": ">=7.2.5",
......@@ -2106,7 +1988,7 @@
"type": "tidelift"
}
],
"time": "2021-08-17T14:20:01+00:00"
"time": "2021-08-26T08:23:47+00:00"
}
],
"packages-dev": [],
......@@ -2121,5 +2003,5 @@
"ext-openssl": "*"
},
"platform-dev": [],
"plugin-api-version": "2.1.0"
"plugin-api-version": "2.0.0"
}
......@@ -11,6 +11,14 @@ idgen.partner = "bp"
idgen.key = "5cfdb867e96374c7883b31d6928cc4cb"
[prod : common]
colonel.wallet.transfer_service_id="21090614423333205002"
colonel.wallet.transfer_service_secret="4916927cf3305292f5a524db592dfa95"
[perf : common ]
colonel.wallet.transfer_service_id="21090614423333205002"
colonel.wallet.transfer_service_secret="4916927cf3305292f5a524db592dfa95"
[test: common ]
[dev : common ]
\ No newline at end of file
colonel.wallet.transfer_service_id="21090614423333205002"
colonel.wallet.transfer_service_secret="4916927cf3305292f5a524db592dfa95"
[dev : common ]
colonel.wallet.transfer_service_id="21090614322322205004"
colonel.wallet.transfer_service_secret="e24126c53d4507381ff800a6653611e4"
\ No newline at end of file
<?php
namespace Daemon;
use Api\PhpServices\Daemon\DaemonServiceInterface;
class Colonelorder implements DaemonServiceInterface
{
public function run()
{
//只在10:01执行逻辑
if(date('H') != 10 || date('i')!= 1) {
sleep(5);
return false;
}
\Yaf\Application::app()->bootstrap()->getDispatcher()->dispatch(new \Yaf\Request\Simple('', 'cli', 'colonelorder', 'index', []));
sleep(60);
}
}
\ No newline at end of file
<?php
namespace Daemon;
use Api\PhpServices\Daemon\DaemonServiceInterface;
use Api\PhpUtils\Log\FileLog;
use \App\Models\marketing\mysql\ColonelDistributorPayInfo;
use \App\Exception\custom\InterfaceException;
use Api\PhpUtils\Http\HttpUtil;
class Colonelwallet implements DaemonServiceInterface
{
public function run()
{
//只在10:01执行逻辑
if (date('H') != 10 || date('i') != 5) {
sleep(5);
return false;
}
\Yaf\Application::app()->bootstrap()->getDispatcher()->dispatch(new \Yaf\Request\Simple('', 'cli', 'colonelwallet', 'index', []));
}
}
\ No newline at end of file
#!/usr/bin/env bash
DIST_FILE_NAME="*.tar.gz"
PROJECT_DIR="api.go2yd.com"
START_SCRIPT="./start_env/start_job.sh"
SYNC_DATA_OPERATIONS="
tar zxf *.tar.gz -C start_env/api.go2yd.com/htdocs/Website
"
DEST_FILE_NAME=""
DEST_FILE_PATH=""
BASE_IMAGE="docker2.yidian.com:5000/centos7/php72_without_nginx:20210621"
MAINTAINER="mengweifu \"mengweifu@yidian-inc.com\""
HOME_DIR="/home/services"
LOG_DIRS="
${HOME_DIR}/${PROJECT_DIR}/logs
"
DATA_DIRS="
"
type=command
command=docker run --rm -e YIDIAN_LOCAL_IP=10.138.0.27 -e YIDIAN_LOCAL_PORT= -e ORIGIN_SERVICE_PORT= -e LANG=en_US.UTF-8 -e TZ=Asia/Shanghai --net=bridge -h "`hostname`" --cap-add SYS_PTRACE --privileged docker2.yidian.com:5000/publish/bp-goods-azkaban-test-107-image /bin/bash -c "sysctl -w net.core.somaxconn=65535 && cd /home/services && sh start_job.sh test Colonelorder index a=3"
\ No newline at end of file
type=command
command=docker run --rm -e YIDIAN_LOCAL_IP=10.138.0.27 -e YIDIAN_LOCAL_PORT= -e ORIGIN_SERVICE_PORT= -e LANG=en_US.UTF-8 -e TZ=Asia/Shanghai --net=bridge -h "`hostname`" --cap-add SYS_PTRACE --privileged docker2.yidian.com:5000/publish/bp-goods-azkaban-test-107-image /bin/bash -c "sysctl -w net.core.somaxconn=65535 && cd /home/services && sh start_job.sh test Colonelwallet index a=3"
dependencies=run-colonel-order
\ No newline at end of file
type=command
command=bash docker run --rm -e LANG=en_US.UTF-8 -e TZ=Asia/Shanghai --net=bridge -h "`hostname`" --cap-add SYS_PTRACE --privileged docker2.yidian.com:5000/publish/bp-goods-azkaban-test-10-image /bin/bash -c "cd /home/services && sh start_job.sh test goodstoes index a=3&b=4"
......@@ -1891,6 +1891,7 @@ opcache.huge_code_pages=1
apc.shm_size=1024M
apc.slam_defense=1
apc.serializer=igbinary
apc.enable_cli=1
[memcached]
memcached.sess_connect_timeout=1000
......
#!/bin/bash
#
#set -xeuo pipefail # 参考: https://mp.weixin.qq.com/s/VmM_U4RefRBHwIw8NegC8Q
# 运行环境env
if [[ X"$1" == X"" ]]; then
echo "env cannot be empty"
exit 1
fi
# 任务名称
if [[ X"$2" == X"" ]]; then
echo "controller name cannot be empty"
exit 1
fi
# method名称
if [[ X"$3" == X"" ]]; then
echo "method name cannot be empty"
exit 1
fi
environment=${1}
#php.ini要根据环境去修改
if [[ X"${environment}" == X"prod" || X"${environment}" == X"prod_internal" ]];then
sed -i "s#yaf.environ=dev#yaf.environ=prod#g" ini/php.ini
elif [[ X"${environment}" == X"perf" || X"${environment}" == X"perf_internal" ]];then
sed -i "s#yaf.environ=dev#yaf.environ=perf#g" ini/php.ini
elif [[ X"${environment}" == X"test" || X"${environment}" == X"test_internal" ]];then
sed -i "s#yaf.environ=dev#yaf.environ=test#g" ini/php.ini
fi
\cp -f ini/php.ini /etc/php.ini
rsyslogd >/dev/null 2>&1
if [[ -e "/usr/share/zoneinfo/Asia/Shanghai" ]]; then
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
fi
# fix dir permissions
chmod -R 755 /home/services/api.go2yd.com/logs
sysctl -w net.core.somaxconn=65535
php api.go2yd.com/htdocs/Website/public/job.php "$2" "$3" "$4"
ret=$?
if [ $ret -ne 0 ]; then
echo "Build failed"
exit $ret
else
echo "Build success"
fi
exit 0
\ No newline at end of file
......@@ -35,6 +35,9 @@ if ($param) {
$_SERVER['SERVER_NAME'] = 'daemon.goods';
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
if (empty($_SERVER['SERVER_ADDR'])) {
$_SERVER['SERVER_ADDR'] = 'azkaban-127.0.0.1';
}
$application->bootstrap()->getDispatcher()->dispatch(new Yaf\Request\Simple("", $module, $controller, $method, $param));
......
<?php
date_default_timezone_set("PRC");
ini_set("display_errors", "On");//打开错误提示
ini_set("error_reporting", E_ALL);//显示所有错误
/*
* cli入口脚本
* cli 配置文件:conf/cli.ini
* cli bootstrap:application/BootstrapCli.php ( 在cli.ini中配置
* 默认模块:modules/job
* 脚本位置:modules/job/controllers/xxx.php
* 调用方式:php job.php controller action "a=1&b=2"
* 测试脚本:php job.php test index "a=1&b=2"
*/
if (!substr(php_sapi_name(), 0, 3) == 'cli') {
die;
}
define('ROOT_PATH', realpath(__DIR__ . '/../'));
define('APPLICATION_PATH', realpath(__DIR__ . '/../'));
define('APP_START', microtime(true));
require APPLICATION_PATH . '/vendor/autoload.php';
require APPLICATION_PATH . '/application/library/helper.php';
$application = new Yaf\Application(APPLICATION_PATH . "/conf/cli.ini");
/**
* 获取模块/控制器/方法
*/
$module = "job";
$controller = $argv[1] ?? "";
$method = $argv[2] ?? "";
$param = $argv[3] ?? [];
if ($param) {
$param = convertUrlQuery($param);
}
$_SERVER['SERVER_NAME'] = 'job.goods';
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
if (empty($_SERVER['SERVER_ADDR'])) {
$_SERVER['SERVER_ADDR'] = 'azkaban-127.0.0.1';
}
$application->bootstrap()->getDispatcher()->dispatch(new Yaf\Request\Simple("", $module, $controller, $method, $param));
function convertUrlQuery($query)
{
$queryParts = explode('&', $query);
$params = array();
foreach ($queryParts as $param) {
$item = explode('=', $param);
$params[$item[0]] = $item[1];
}
return $params;
}
\ No newline at end of file
......@@ -6,6 +6,7 @@ use Api\PhpUtils\Cache\ApcuUtil;
use Api\PhpUtils\Log\DaemonLog;
use Api\PhpUtils\Message\Email;
use Yaf\Application;
use App\Exception\ExceptionErrorCatch;
class Daemon
{
......@@ -266,7 +267,7 @@ class Daemon
ini_set('date.timezone','Asia/Shanghai');
ini_set("memory_limit", '2048M');
error_reporting(E_ALL);
set_error_handler([ExceptionErrorCatch::class, 'appError'], E_ALL & ~E_DEPRECATED);
//日志存储到 php-error.log
/*
//创建任务日志文件
......
......@@ -37,8 +37,17 @@ class JwUser
}
$params = ["mobilePhone" => $params['mobile']];
//$user_info = (new TimeOut())->runGet($url, $params);
$begin = microtime(true);
$user_info = (new Request())->get($url, $params);
$end = microtime(true);
$total_time = round(($end - $begin), 4) * 1000;
if (!empty($user_info['response'])) {
$code = $user_info['response']['code'];
} else {
$code = -1;
}
$env = \Yaf\Application::app()->environ() ?? "test";
MonUtil::proxyMon($url, $code, 'jw_user_'.$env, $total_time);
FileLog::info('jw_user_getUserInfo', json_encode($user_info));
if (!$user_info) {
throw new CodeSpecialException("timeout");
......@@ -61,7 +70,6 @@ class JwUser
}
$params = ["userId" => $params['user_id']];
//$user_info = (new TimeOut())->runPost($url, $params);
$begin = microtime(true);
$user_info = (new Request())->post($url, $params);
$end = microtime(true);
......@@ -71,7 +79,9 @@ class JwUser
} else {
$code = -1;
}
MonUtil::proxyMon($url, $code, 'jw_user', $total_time);
$env = \Yaf\Application::app()->environ() ?? "test";
MonUtil::proxyMon($url, $code, 'jw_user_'.$env, $total_time);
FileLog::info('jw_user_getUserByUserId', json_encode($user_info));
if (!$user_info) {
throw new CodeSpecialException("timeout");
......@@ -91,8 +101,17 @@ class JwUser
}
$params = ["userIds" => $params['user_id']];
//$user_info = (new TimeOut())->runPost($url, $params);
$user_info = (new Request())->post($url, $params, 0, '', '', 0, true, 'jw_user');
$begin = microtime(true);
$user_info = (new Request())->post($url, $params);
$end = microtime(true);
$total_time = round(($end - $begin), 4) * 1000;
if (!empty($user_info['response'])) {
$code = $user_info['response']['code'];
} else {
$code = -1;
}
$env = \Yaf\Application::app()->environ() ?? "test";
MonUtil::proxyMon($url, $code, 'jw_user_'.$env, $total_time);
FileLog::info('jw_user_getUserList', json_encode($user_info));
if (!$user_info) {
throw new CodeSpecialException("timeout");
......@@ -139,7 +158,17 @@ class JwUser
throw new CodeSpecialException("failed");
}
//$pushToken = (new TimeOut())->runPost($url, $params);
$pushToken = (new Request())->post($url, $params, 0, '', '', 0, true, 'jw_user');
$begin = microtime(true);
$pushToken = (new Request())->post($url, $params);
$end = microtime(true);
$total_time = round(($end - $begin), 4) * 1000;
if (!empty($pushToken['response'])) {
$code = $pushToken['response']['code'];
} else {
$code = -1;
}
$env = \Yaf\Application::app()->environ() ?? "test";
MonUtil::proxyMon($url, $code, 'jw_user_'.$env, $total_time);
FileLog::info('jw_user_savePushToken', json_encode($pushToken));
if (!$pushToken) {
throw new CodeSpecialException("timeout");
......@@ -163,8 +192,17 @@ class JwUser
}
$params = ["userIds" => $params['user_id']];
//$list = (new TimeOut())->runPost($url, $params);
$list = (new Request())->post($url, $params, 0, '', '', 0, true, 'jw_user');
$begin = microtime(true);
$list = (new Request())->post($url, $params);
$end = microtime(true);
$total_time = round(($end - $begin), 4) * 1000;
if (!empty($list['response'])) {
$code = $list['response']['code'];
} else {
$code = -1;
}
$env = \Yaf\Application::app()->environ() ?? "test";
MonUtil::proxyMon($url, $code, 'jw_user_'.$env, $total_time);
FileLog::info('jw_user_getUserListWithDynamic', json_encode($list));
if (!$list) {
throw new CodeSpecialException("timeout");
......@@ -188,8 +226,17 @@ class JwUser
}
$params = ["userId" => $params['user_id']];
//$list = (new TimeOut())->runPost($url, $params);
$list = (new Request())->post($url, $params, 0, '', '', 0, true, 'jw_user');
$begin = microtime(true);
$list = (new Request())->post($url, $params);
$end = microtime(true);
$total_time = round(($end - $begin), 4) * 1000;
if (!empty($list['response'])) {
$code = $list['response']['code'];
} else {
$code = -1;
}
$env = \Yaf\Application::app()->environ() ?? "test";
MonUtil::proxyMon($url, $code, 'jw_user_'.$env, $total_time);
FileLog::info('jw_user_getUserDigg', json_encode($list));
if (!$list) {
throw new CodeSpecialException("timeout");
......@@ -206,8 +253,17 @@ class JwUser
if (!$url) {
throw new CodeSpecialException("failed");
}
//$ret = (new TimeOut())->runPost($url, $params);
$ret = (new Request())->post($url, $params, 0, '', '', 0, true, 'jw_user');
$begin = microtime(true);
$ret = (new Request())->post($url, $params);
$end = microtime(true);
$total_time = round(($end - $begin), 4) * 1000;
if (!empty($ret['response'])) {
$code = $ret['response']['code'];
} else {
$code = -1;
}
$env = \Yaf\Application::app()->environ() ?? "test";
MonUtil::proxyMon($url, $code, 'jw_user_'.$env, $total_time);
FileLog::info('jw_user_saveUpdateLife', json_encode($ret));
if (!$ret) {
throw new CodeSpecialException("timeout");
......@@ -224,8 +280,17 @@ class JwUser
if (!$url) {
throw new CodeSpecialException("failed");
}
//$ret = (new TimeOut())->runPost($url, $params);
$ret = (new Request())->post($url, $params, 0, '', '', 0, true, 'jw_user');
$begin = microtime(true);
$ret = (new Request())->post($url, $params);
$end = microtime(true);
$total_time = round(($end - $begin), 4) * 1000;
if (!empty($ret['response'])) {
$code = $ret['response']['code'];
} else {
$code = -1;
}
$env = \Yaf\Application::app()->environ() ?? "test";
MonUtil::proxyMon($url, $code, 'jw_user_'.$env, $total_time);
FileLog::info('getWechatOpenid', json_encode($ret));
if (!$ret) {
throw new CodeSpecialException("timeout");
......@@ -243,8 +308,17 @@ class JwUser
if (!$url) {
throw new CodeSpecialException("failed");
}
//$ret = (new TimeOut())->runPost($url, $params);
$ret = (new Request())->post($url, $params, 0, '', '', 0, true, 'jw_user');
$begin = microtime(true);
$ret = (new Request())->post($url, $params);
$end = microtime(true);
$total_time = round(($end - $begin), 4) * 1000;
if (!empty($ret['response'])) {
$code = $ret['response']['code'];
} else {
$code = -1;
}
$env = \Yaf\Application::app()->environ() ?? "test";
MonUtil::proxyMon($url, $code, 'jw_user_'.$env, $total_time);
FileLog::info('getWechatOpenid', json_encode($ret));
if (!$ret) {
throw new CodeSpecialException("timeout");
......
......@@ -77,6 +77,23 @@ class FeiPrinter extends \Api\PhpServices\Printer\Printer
return HttpUtil::post(self::API, http_build_query($param));
}
private function _printContent(string $printerId,string $content): string
{
$res = $this->request(self::API_PRINT, [
'sn' => $printerId,
'content' => $content,
'times' => 1,// 打印联数
]);
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("接口调用异常");
}
/**
* @inheritDoc
* @throws \Exception
......@@ -139,20 +156,17 @@ class FeiPrinter extends \Api\PhpServices\Printer\Printer
$formattedContent .= "$formattedRow<BR>";
}
$first = false;
}
$res = $this->request(self::API_PRINT, [
'sn' => $printerId,
'content' => $formattedContent,
'times' => 1,// 打印联数
]);
if ($res['code'] == 0 && isset($res['response'])) {
if ($res['response']['ret'] == 0) {
return $res['response']['data'];
if (strlen($formattedContent) > 4000) {
$return = self::_printContent($printerId, $formattedContent);
$formattedContent = "";
}
throw new \Exception($res['response']['msg']);
}
throw new \Exception("接口调用异常");
if (!empty($formattedContent))
$return = self::_printContent($printerId, $formattedContent);
return $return;
}
/**
......
......@@ -43,6 +43,7 @@ class WechatBind
if ((strtotime($userInfo['create_time']) + $timeInterval) > time()) {
return true;
}
return false;
}
// 没有查询到对应的openid数据
FileLog::error("调用isNewWechatUser方法未获取到数据:", json_encode(['openid' => $openid, 'timeInterval' => $timeInterval, 'res' => $res]));
......
......@@ -61,7 +61,7 @@ class HttpUtil
{
// 增加traceId
if(is_array($headers)) {
$headers['X-TRACE-ID'] = Tracer::getTraceId();
$headers[] = 'X-TRACE-ID: ' . Tracer::getTraceId();
}
$url = $url ."?". http_build_query($params);
return self::curl($url, $timeout, $retries, $headers, [], $proxy, 'GET', $curl_opts);
......@@ -97,7 +97,7 @@ class HttpUtil
{
// 增加traceId
if(is_array($headers)) {
$headers['X-TRACE-ID'] = Tracer::getTraceId();
$headers[] = 'X-TRACE-ID: ' . Tracer::getTraceId();
}
return self::curl($url, $timeout, $retries, $headers, $post, $proxy, 'POST', $curl_opts);
}
......
......@@ -8,6 +8,7 @@ use Api\PhpUtils\Message\Email;
class FileLog
{
static private $log = true;
const PREFIX_FILELOG_ERROR = 'flerr:';
/**
* 用于记录info级别的错误
......@@ -18,6 +19,10 @@ class FileLog
*/
public static function info($signature, $detail_info = '', $with_access_log = false)
{
if(self::$log == false) {
return true;
}
$traceId = Tracer::getTraceId();
$log = 'PHP User_info: [' . $signature . '] [traceId:'. $traceId .'] [detail info:] ' . $detail_info;
if ($with_access_log) {
......@@ -26,6 +31,10 @@ class FileLog
error_log($log);
}
public static function closeInfo(bool $flag) {
self::$log = $flag;
}
/**
* 用于记录waring级别的错误,在日志分析时此级别日志会使用signature进行聚合
* 会记录请求上下文,不会发生报警邮件
......@@ -69,6 +78,7 @@ class FileLog
}
$subject = 'App api #' . $signature . '# ' . $_SERVER['SERVER_NAME'] . ' (' . $_SERVER['SERVER_ADDR'] . ') Alert Message';
$body = 'Error: ' . $signature . "\n\n";
$body .= 'traceId: ' . $traceId . "\n\n";
$body .= 'Detail info: ' . $detail_info . "\n\n";
$body .= 'Exception info: ' . $exception_info . "\n\n";
$body .= 'Request info: ' . self::accessLog() . "\n\n";
......
<?php
namespace Api\PhpUtils\Log;
/**
* @method JobLog info($signature, $detail_info = '', $with_access_log = false)
* @method JobLog waring($signature, $detail_info = '', $exception = null)
* @method JobLog error($signature, $detail_info = '', $exception = null, $mail_to = '')
*/
class JobLog
{
protected static $instance = null;
public $log = null;
protected function __construct()
{
}
protected function __clone()
{
}
public static function getInstance(): ?JobLog
{
if (is_null(self::$instance)) {
self::$instance = new static();
}
return self::$instance;
}
public function __call($name, $arguments)
{
$this->setLog($arguments);
if (in_array($name, get_class_methods(FileLog::class))) {
call_user_func_array([FileLog::class, $name], $arguments);
}
return $this;
}
private function setLog($arguments)
{
if (!empty($arguments[0]) && !empty($arguments[1])) {
$this->log = date('Y-m-d H:i:s') . ";$arguments[0]:$arguments[1]" . PHP_EOL;
}
}
public function output()
{
echo $this->log;
}
}
......@@ -338,7 +338,7 @@ class ClassLoader
* Loads the given class or interface.
*
* @param string $class The name of the class
* @return true|null True if loaded, null otherwise
* @return bool|null True if loaded, null otherwise
*/
public function loadClass($class)
{
......@@ -347,8 +347,6 @@ class ClassLoader
return true;
}
return null;
}
/**
......
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer;
use Composer\Autoload\ClassLoader;
use Composer\Semver\VersionParser;
/**
* This class is copied in every Composer installed project and available to all
*
* See also https://getcomposer.org/doc/07-runtime.md#installed-versions
*
* To require it's presence, you can require `composer-runtime-api ^2.0`
*/
class InstalledVersions
{
private static $installed;
private static $canGetVendors;
private static $installedByVendor = array();
/**
* Returns a list of all package names which are present, either by being installed, replaced or provided
*
* @return string[]
* @psalm-return list<string>
*/
public static function getInstalledPackages()
{
$packages = array();
foreach (self::getInstalled() as $installed) {
$packages[] = array_keys($installed['versions']);
}
if (1 === \count($packages)) {
return $packages[0];
}
return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
}
/**
* Returns a list of all package names with a specific type e.g. 'library'
*
* @param string $type
* @return string[]
* @psalm-return list<string>
*/
public static function getInstalledPackagesByType($type)
{
$packagesByType = array();
foreach (self::getInstalled() as $installed) {
foreach ($installed['versions'] as $name => $package) {
if (isset($package['type']) && $package['type'] === $type) {
$packagesByType[] = $name;
}
}
}
return $packagesByType;
}
/**
* Checks whether the given package is installed
*
* This also returns true if the package name is provided or replaced by another package
*
* @param string $packageName
* @param bool $includeDevRequirements
* @return bool
*/
public static function isInstalled($packageName, $includeDevRequirements = true)
{
foreach (self::getInstalled() as $installed) {
if (isset($installed['versions'][$packageName])) {
return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
}
}
return false;
}
/**
* Checks whether the given package satisfies a version constraint
*
* e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
*
* Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')
*
* @param VersionParser $parser Install composer/semver to have access to this class and functionality
* @param string $packageName
* @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package
* @return bool
*/
public static function satisfies(VersionParser $parser, $packageName, $constraint)
{
$constraint = $parser->parseConstraints($constraint);
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
return $provided->matches($constraint);
}
/**
* Returns a version constraint representing all the range(s) which are installed for a given package
*
* It is easier to use this via isInstalled() with the $constraint argument if you need to check
* whether a given version of a package is installed, and not just whether it exists
*
* @param string $packageName
* @return string Version constraint usable with composer/semver
*/
public static function getVersionRanges($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
$ranges = array();
if (isset($installed['versions'][$packageName]['pretty_version'])) {
$ranges[] = $installed['versions'][$packageName]['pretty_version'];
}
if (array_key_exists('aliases', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
}
if (array_key_exists('replaced', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
}
if (array_key_exists('provided', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
}
return implode(' || ', $ranges);
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
*/
public static function getVersion($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
if (!isset($installed['versions'][$packageName]['version'])) {
return null;
}
return $installed['versions'][$packageName]['version'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
*/
public static function getPrettyVersion($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
if (!isset($installed['versions'][$packageName]['pretty_version'])) {
return null;
}
return $installed['versions'][$packageName]['pretty_version'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
*/
public static function getReference($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
if (!isset($installed['versions'][$packageName]['reference'])) {
return null;
}
return $installed['versions'][$packageName]['reference'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path.
*/
public static function getInstallPath($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @return array
* @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}
*/
public static function getRootPackage()
{
$installed = self::getInstalled();
return $installed[0]['root'];
}
/**
* Returns the raw installed.php data for custom implementations
*
* @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
* @return array[]
* @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string}>}
*/
public static function getRawData()
{
@trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
if (null === self::$installed) {
// only require the installed.php file if this file is loaded from its dumped location,
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
if (substr(__DIR__, -8, 1) !== 'C') {
self::$installed = include __DIR__ . '/installed.php';
} else {
self::$installed = array();
}
}
return self::$installed;
}
/**
* Returns the raw data of all installed.php which are currently loaded for custom implementations
*
* @return array[]
* @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string}>}>
*/
public static function getAllRawData()
{
return self::getInstalled();
}
/**
* Lets you reload the static array from another file
*
* This is only useful for complex integrations in which a project needs to use
* this class but then also needs to execute another project's autoloader in process,
* and wants to ensure both projects have access to their version of installed.php.
*
* A typical case would be PHPUnit, where it would need to make sure it reads all
* the data it needs from this class, then call reload() with
* `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
* the project in which it runs can then also use this class safely, without
* interference between PHPUnit's dependencies and the project's dependencies.
*
* @param array[] $data A vendor/composer/installed.php data set
* @return void
*
* @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string}>} $data
*/
public static function reload($data)
{
self::$installed = $data;
self::$installedByVendor = array();
}
/**
* @return array[]
* @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string}>}>
*/
private static function getInstalled()
{
if (null === self::$canGetVendors) {
self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
}
$installed = array();
if (self::$canGetVendors) {
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
if (isset(self::$installedByVendor[$vendorDir])) {
$installed[] = self::$installedByVendor[$vendorDir];
} elseif (is_file($vendorDir.'/composer/installed.php')) {
$installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
self::$installed = $installed[count($installed) - 1];
}
}
}
}
if (null === self::$installed) {
// only require the installed.php file if this file is loaded from its dumped location,
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
if (substr(__DIR__, -8, 1) !== 'C') {
self::$installed = require __DIR__ . '/installed.php';
} else {
self::$installed = array();
}
}
$installed[] = self::$installed;
return $installed;
}
private static $installed = array (
'root' =>
array (
'pretty_version' => 'dev-develop',
'version' => 'dev-develop',
'aliases' =>
array (
),
'reference' => '8f346c81d3f2e7e81c7870acbece3051b1016b7e',
'name' => 'yidian/yaf_demo',
),
'versions' =>
array (
'api/php_services' =>
array (
'pretty_version' => '1.0.14',
'version' => '1.0.14.0',
'aliases' =>
array (
),
'reference' => 'f2ba54cfaff45ffa8c0c4864f3b4935e1fcb3cfa',
),
'api/php_utils' =>
array (
'pretty_version' => 'v1.0.17',
'version' => '1.0.17.0',
'aliases' =>
array (
),
'reference' => 'aa70ccdd545f3e421eaf717274954990f1805b87',
),
'bacon/bacon-qr-code' =>
array (
'pretty_version' => '2.0.4',
'version' => '2.0.4.0',
'aliases' =>
array (
),
'reference' => 'f73543ac4e1def05f1a70bcd1525c8a157a1ad09',
),
'dasprid/enum' =>
array (
'pretty_version' => '1.0.3',
'version' => '1.0.3.0',
'aliases' =>
array (
),
'reference' => '5abf82f213618696dda8e3bf6f64dd042d8542b2',
),
'elasticsearch/elasticsearch' =>
array (
'pretty_version' => '7.11.x-dev',
'version' => '7.11.9999999.9999999-dev',
'aliases' =>
array (
),
'reference' => '8d08050fef9d89004702b1428b8c1f7f4f6162cf',
),
'endroid/qr-code' =>
array (
'pretty_version' => '3.9.6',
'version' => '3.9.6.0',
'aliases' =>
array (
),
'reference' => '9cdd4f5d609bfc8811ca4a62b4d23eb16976242f',
),
'ezimuel/guzzlestreams' =>
array (
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'aliases' =>
array (
0 => '3.0.x-dev',
),
'reference' => 'abe3791d231167f14eb80d413420d1eab91163a8',
),
'ezimuel/ringphp' =>
array (
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'aliases' =>
array (
0 => '1.1.x-dev',
),
'reference' => '0b78f89d8e0bb9e380046c31adfa40347e9f663b',
),
'guzzlehttp/guzzle' =>
array (
'pretty_version' => '6.3.0',
'version' => '6.3.0.0',
'aliases' =>
array (
),
'reference' => 'f4db5a78a5ea468d4831de7f0bf9d9415e348699',
),
'guzzlehttp/promises' =>
array (
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'aliases' =>
array (
0 => '1.4.x-dev',
),
'reference' => 'c1dd809c8f51a477701052f4b9e5b4bb5c1061aa',
),
'guzzlehttp/psr7' =>
array (
'pretty_version' => '1.x-dev',
'version' => '1.9999999.9999999.9999999-dev',
'aliases' =>
array (
),
'reference' => '9d006741ba865a45adccfac45d8e1053086a5a3f',
),
'khanamiryan/qrcode-detector-decoder' =>
array (
'pretty_version' => '1.0.5.2',
'version' => '1.0.5.2',
'aliases' =>
array (
),
'reference' => '04fdd58d86a387065f707dc6d3cc304c719910c1',
),
'mongodb/mongodb' =>
array (
'pretty_version' => '1.4.3',
'version' => '1.4.3.0',
'aliases' =>
array (
),
'reference' => '18fca8cc8d0c2cc07f76605760d20632bb3dab96',
),
'myclabs/php-enum' =>
array (
'pretty_version' => '1.7.7',
'version' => '1.7.7.0',
'aliases' =>
array (
),
'reference' => 'd178027d1e679832db9f38248fcc7200647dc2b7',
),
'perftools/php-profiler' =>
array (
'pretty_version' => '0.18.0',
'version' => '0.18.0.0',
'aliases' =>
array (
),
'reference' => '794c435f615ab9ca4347e386b4d8c6524fe9e3ae',
),
'psr/http-message' =>
array (
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'aliases' =>
array (
0 => '1.0.x-dev',
),
'reference' => 'efd67d1dc14a7ef4fc4e518e7dee91c271d524e4',
),
'psr/http-message-implementation' =>
array (
'provided' =>
array (
0 => '1.0',
),
),
'psr/log' =>
array (
'pretty_version' => '1.1.4',
'version' => '1.1.4.0',
'aliases' =>
array (
),
'reference' => 'd49695b909c3b7628b6289db5479a1c204601f11',
),
'ralouphie/getallheaders' =>
array (
'pretty_version' => '3.0.3',
'version' => '3.0.3.0',
'aliases' =>
array (
),
'reference' => '120b605dfeb996808c31b6477290a714d356e822',
),
'react/promise' =>
array (
'pretty_version' => '2.x-dev',
'version' => '2.9999999.9999999.9999999-dev',
'aliases' =>
array (
),
'reference' => 'a9752a861e21c0fe0b380c9f9e55beddc0ed7d31',
),
'symfony/deprecation-contracts' =>
array (
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'aliases' =>
array (
0 => '2.5.x-dev',
),
'reference' => '6f981ee24cf69ee7ce9736146d1c57c2780598a8',
),
'symfony/options-resolver' =>
array (
'pretty_version' => '5.4.x-dev',
'version' => '5.4.9999999.9999999-dev',
'aliases' =>
array (
),
'reference' => 'f1b99f10ea04aa9d0aafddcd8ba3d65545403bab',
),
'symfony/polyfill-ctype' =>
array (
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'aliases' =>
array (
0 => '1.23.x-dev',
),
'reference' => '46cd95797e9df938fdd2b03693b5fca5e64b01ce',
),
'symfony/polyfill-intl-grapheme' =>
array (
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'aliases' =>
array (
0 => '1.23.x-dev',
),
'reference' => '16880ba9c5ebe3642d1995ab866db29270b36535',
),
'symfony/polyfill-intl-normalizer' =>
array (
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'aliases' =>
array (
0 => '1.23.x-dev',
),
'reference' => '8590a5f561694770bdcd3f9b5c69dde6945028e8',
),
'symfony/polyfill-mbstring' =>
array (
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'aliases' =>
array (
0 => '1.23.x-dev',
),
'reference' => '9174a3d80210dca8daa7f31fec659150bbeabfc6',
),
'symfony/polyfill-php73' =>
array (
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'aliases' =>
array (
0 => '1.23.x-dev',
),
'reference' => 'fba8933c384d6476ab14fb7b8526e5287ca7e010',
),
'symfony/polyfill-php80' =>
array (
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'aliases' =>
array (
0 => '1.23.x-dev',
),
'reference' => '1100343ed1a92e3a38f9ae122fc0eb21602547be',
),
'symfony/property-access' =>
array (
'pretty_version' => '5.4.x-dev',
'version' => '5.4.9999999.9999999-dev',
'aliases' =>
array (
),
'reference' => '7831b0331b786db39026d190faa4914f94adb212',
),
'symfony/property-info' =>
array (
'pretty_version' => '5.4.x-dev',
'version' => '5.4.9999999.9999999-dev',
'aliases' =>
array (
),
'reference' => '903f3f3f6a360bc4739f8390e5031acc70d9cd9f',
),
'symfony/string' =>
array (
'pretty_version' => '5.4.x-dev',
'version' => '5.4.9999999.9999999-dev',
'aliases' =>
array (
),
'reference' => 'fa2c5cc3f7dac23d87429652fe0daf28d65cbd5b',
),
'yidian/yaf_demo' =>
array (
'pretty_version' => 'dev-develop',
'version' => 'dev-develop',
'aliases' =>
array (
),
'reference' => '8f346c81d3f2e7e81c7870acbece3051b1016b7e',
),
),
);
private static $canGetVendors;
private static $installedByVendor = array();
public static function getInstalledPackages()
{
$packages = array();
foreach (self::getInstalled() as $installed) {
$packages[] = array_keys($installed['versions']);
}
if (1 === \count($packages)) {
return $packages[0];
}
return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
}
public static function isInstalled($packageName)
{
foreach (self::getInstalled() as $installed) {
if (isset($installed['versions'][$packageName])) {
return true;
}
}
return false;
}
public static function satisfies(VersionParser $parser, $packageName, $constraint)
{
$constraint = $parser->parseConstraints($constraint);
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
return $provided->matches($constraint);
}
public static function getVersionRanges($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
$ranges = array();
if (isset($installed['versions'][$packageName]['pretty_version'])) {
$ranges[] = $installed['versions'][$packageName]['pretty_version'];
}
if (array_key_exists('aliases', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
}
if (array_key_exists('replaced', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
}
if (array_key_exists('provided', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
}
return implode(' || ', $ranges);
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
public static function getVersion($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
if (!isset($installed['versions'][$packageName]['version'])) {
return null;
}
return $installed['versions'][$packageName]['version'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
public static function getPrettyVersion($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
if (!isset($installed['versions'][$packageName]['pretty_version'])) {
return null;
}
return $installed['versions'][$packageName]['pretty_version'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
public static function getReference($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
if (!isset($installed['versions'][$packageName]['reference'])) {
return null;
}
return $installed['versions'][$packageName]['reference'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
public static function getRootPackage()
{
$installed = self::getInstalled();
return $installed[0]['root'];
}
public static function getRawData()
{
return self::$installed;
}
public static function reload($data)
{
self::$installed = $data;
self::$installedByVendor = array();
}
private static function getInstalled()
{
if (null === self::$canGetVendors) {
self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
}
$installed = array();
if (self::$canGetVendors) {
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
if (isset(self::$installedByVendor[$vendorDir])) {
$installed[] = self::$installedByVendor[$vendorDir];
} elseif (is_file($vendorDir.'/composer/installed.php')) {
$installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
}
}
}
$installed[] = self::$installed;
return $installed;
}
}
......@@ -67,6 +67,7 @@ return array(
'Api\\PhpUtils\\Lock\\FrequencyLockUtil' => $vendorDir . '/api/php_utils/src/Lock/FrequencyLockUtil.php',
'Api\\PhpUtils\\Log\\DaemonLog' => $vendorDir . '/api/php_utils/src/Log/DaemonLog.php',
'Api\\PhpUtils\\Log\\FileLog' => $vendorDir . '/api/php_utils/src/Log/FileLog.php',
'Api\\PhpUtils\\Log\\JobLog' => $vendorDir . '/api/php_utils/src/Log/JobLog.php',
'Api\\PhpUtils\\Log\\Tracer' => $vendorDir . '/api/php_utils/src/Log/Tracer.php',
'Api\\PhpUtils\\Message\\Email' => $vendorDir . '/api/php_utils/src/Message/Email.php',
'Api\\PhpUtils\\Mon\\MonUtil' => $vendorDir . '/api/php_utils/src/Mon/MonUtil.php',
......@@ -83,6 +84,7 @@ return array(
'Api\\PhpUtils\\Validate\\ValidateRule' => $vendorDir . '/api/php_utils/src/Validate/ValidateRule.php',
'App\\Base\\Base' => $baseDir . '/application/modules/Base/Base.php',
'App\\Base\\Cli' => $baseDir . '/application/modules/Base/Cli.php',
'App\\Base\\Job' => $baseDir . '/application/modules/Base/Job.php',
'App\\Exception\\BaseException' => $baseDir . '/application/exception/BaseException.php',
'App\\Exception\\ErrorHandler' => $baseDir . '/application/exception/ErrorHandler.php',
'App\\Exception\\ExceptionErrorCatch' => $baseDir . '/application/exception/ExceptionErrorCatch.php',
......@@ -119,6 +121,12 @@ return array(
'App\\Models\\goods\\mysql\\PindanGoodsSnapshot' => $baseDir . '/application/models/goods/mysql/PindanGoodsSnapshot.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\\marketing\\mysql\\ColonelDistributorColonel' => $baseDir . '/application/models/marketing/mysql/ColonelDistributorColonel.php',
'App\\Models\\marketing\\mysql\\ColonelDistributorColonelApply' => $baseDir . '/application/models/marketing/mysql/ColonelDistributorColonelApply.php',
'App\\Models\\marketing\\mysql\\ColonelDistributorConfig' => $baseDir . '/application/models/marketing/mysql/ColonelDistributorConfig.php',
'App\\Models\\marketing\\mysql\\ColonelDistributorInviteOrder' => $baseDir . '/application/models/marketing/mysql/ColonelDistributorInviteOrder.php',
'App\\Models\\marketing\\mysql\\ColonelDistributorInviteOrderNum' => $baseDir . '/application/models/marketing/mysql/ColonelDistributorInviteOrderNum.php',
'App\\Models\\marketing\\mysql\\ColonelDistributorPayInfo' => $baseDir . '/application/models/marketing/mysql/ColonelDistributorPayInfo.php',
'App\\Models\\marketing\\mysql\\Distributor' => $baseDir . '/application/models/marketing/mysql/Distributor.php',
'App\\Models\\marketing\\mysql\\DistributorAuditRecord' => $baseDir . '/application/models/marketing/mysql/DistributorAuditRecord.php',
'App\\Models\\marketing\\mysql\\Marketing' => $baseDir . '/application/models/marketing/mysql/Marketing.php',
......@@ -142,11 +150,14 @@ return array(
'App\\Services\\goods\\GoodsSnapshotsService' => $baseDir . '/application/services/goods/GoodsSnapshotsService.php',
'App\\Services\\goods\\MarketingPindanGoodsService' => $baseDir . '/application/services/goods/MarketingPindanGoodsService.php',
'App\\Services\\goods\\OtaService' => $baseDir . '/application/services/goods/OtaService.php',
'App\\Services\\marketing\\ColonelService' => $baseDir . '/application/services/marketing/ColonelService.php',
'App\\Services\\marketing\\DistributionService' => $baseDir . '/application/services/marketing/DistributionService.php',
'App\\Services\\marketing\\DistributorService' => $baseDir . '/application/services/marketing/DistributorService.php',
'App\\Services\\marketing\\MarketingForOrderService' => $baseDir . '/application/services/marketing/MarketingForOrderService.php',
'App\\Services\\marketing\\MarketingGoodsService' => $baseDir . '/application/services/marketing/MarketingGoodsService.php',
'App\\Services\\marketing\\MarketingService' => $baseDir . '/application/services/marketing/MarketingService.php',
'App\\Services\\marketing\\PindanActivityColonelConfigService' => $baseDir . '/application/services/marketing/PindanActivityColonelConfigService.php',
'App\\Services\\marketing\\PindanActivityInviteOrderService' => $baseDir . '/application/services/marketing/PindanActivityInviteOrderService.php',
'App\\Services\\marketing\\TakePlaceService' => $baseDir . '/application/services/marketing/TakePlaceService.php',
'App\\Services\\shop\\ShopService' => $baseDir . '/application/services/shop/ShopService.php',
'App\\Services\\tcc\\Tcc2Service' => $baseDir . '/application/services/tcc/Tcc2Service.php',
......@@ -226,6 +237,8 @@ return array(
'DASPRiD\\Enum\\Exception\\SerializeNotSupportedException' => $vendorDir . '/dasprid/enum/src/Exception/SerializeNotSupportedException.php',
'DASPRiD\\Enum\\Exception\\UnserializeNotSupportedException' => $vendorDir . '/dasprid/enum/src/Exception/UnserializeNotSupportedException.php',
'DASPRiD\\Enum\\NullValue' => $vendorDir . '/dasprid/enum/src/NullValue.php',
'Daemon\\Colonelorder' => $baseDir . '/daemon/Colonelorder.php',
'Daemon\\Colonelwallet' => $baseDir . '/daemon/Colonelwallet.php',
'Daemon\\Goods' => $baseDir . '/daemon/Goods.php',
'Daemon\\Marketing' => $baseDir . '/daemon/Marketing.php',
'Daemon\\Pindan' => $baseDir . '/daemon/Pindan.php',
......
......@@ -8,18 +8,18 @@ $baseDir = dirname($vendorDir);
return array(
'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php',
'6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.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',
'8825ede83f2f289127722d4e842cf7e8' => $vendorDir . '/symfony/polyfill-intl-grapheme/bootstrap.php',
'e69f7f6ee287b969198c3c9d6777bd38' => $vendorDir . '/symfony/polyfill-intl-normalizer/bootstrap.php',
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
'b6b991a57620e2fb6b2f66f03fe9ddc2' => $vendorDir . '/symfony/string/Resources/functions.php',
'0d59ee240a4cd96ddbb4ff164fccea4d' => $vendorDir . '/symfony/polyfill-php73/bootstrap.php',
'7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php',
'ad155f8f1cf0d418fe49e248db8c661b' => $vendorDir . '/react/promise/src/functions_include.php',
'0d59ee240a4cd96ddbb4ff164fccea4d' => $vendorDir . '/symfony/polyfill-php73/bootstrap.php',
'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php',
'a9ed0d27b5a698798a89181429f162c5' => $vendorDir . '/khanamiryan/qrcode-detector-decoder/lib/Common/customFunctions.php',
'a0edc8309cc5e1d60e3047b5df6b7052' => $vendorDir . '/guzzlehttp/psr7/src/functions_include.php',
'a9ed0d27b5a698798a89181429f162c5' => $vendorDir . '/khanamiryan/qrcode-detector-decoder/lib/Common/customFunctions.php',
'8592c7b0947d8a0965a9e8c3d16f9c24' => $vendorDir . '/elasticsearch/elasticsearch/src/autoload.php',
'37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php',
'3a37ebac017bc098e9a86b35401e7a68' => $vendorDir . '/mongodb/mongodb/src/functions.php',
'8592c7b0947d8a0965a9e8c3d16f9c24' => $vendorDir . '/elasticsearch/elasticsearch/src/autoload.php',
);
......@@ -9,20 +9,20 @@ class ComposerStaticInit14d712e6ba9ca61e9e636d6cf65f43bf
public static $files = array (
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
'6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.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',
'8825ede83f2f289127722d4e842cf7e8' => __DIR__ . '/..' . '/symfony/polyfill-intl-grapheme/bootstrap.php',
'e69f7f6ee287b969198c3c9d6777bd38' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/bootstrap.php',
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
'b6b991a57620e2fb6b2f66f03fe9ddc2' => __DIR__ . '/..' . '/symfony/string/Resources/functions.php',
'0d59ee240a4cd96ddbb4ff164fccea4d' => __DIR__ . '/..' . '/symfony/polyfill-php73/bootstrap.php',
'7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php',
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
'0d59ee240a4cd96ddbb4ff164fccea4d' => __DIR__ . '/..' . '/symfony/polyfill-php73/bootstrap.php',
'c964ee0ededf28c96ebd9db5099ef910' => __DIR__ . '/..' . '/guzzlehttp/promises/src/functions_include.php',
'a9ed0d27b5a698798a89181429f162c5' => __DIR__ . '/..' . '/khanamiryan/qrcode-detector-decoder/lib/Common/customFunctions.php',
'a0edc8309cc5e1d60e3047b5df6b7052' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/functions_include.php',
'a9ed0d27b5a698798a89181429f162c5' => __DIR__ . '/..' . '/khanamiryan/qrcode-detector-decoder/lib/Common/customFunctions.php',
'8592c7b0947d8a0965a9e8c3d16f9c24' => __DIR__ . '/..' . '/elasticsearch/elasticsearch/src/autoload.php',
'37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php',
'3a37ebac017bc098e9a86b35401e7a68' => __DIR__ . '/..' . '/mongodb/mongodb/src/functions.php',
'8592c7b0947d8a0965a9e8c3d16f9c24' => __DIR__ . '/..' . '/elasticsearch/elasticsearch/src/autoload.php',
);
public static $prefixLengthsPsr4 = array (
......@@ -296,6 +296,7 @@ class ComposerStaticInit14d712e6ba9ca61e9e636d6cf65f43bf
'Api\\PhpUtils\\Lock\\FrequencyLockUtil' => __DIR__ . '/..' . '/api/php_utils/src/Lock/FrequencyLockUtil.php',
'Api\\PhpUtils\\Log\\DaemonLog' => __DIR__ . '/..' . '/api/php_utils/src/Log/DaemonLog.php',
'Api\\PhpUtils\\Log\\FileLog' => __DIR__ . '/..' . '/api/php_utils/src/Log/FileLog.php',
'Api\\PhpUtils\\Log\\JobLog' => __DIR__ . '/..' . '/api/php_utils/src/Log/JobLog.php',
'Api\\PhpUtils\\Log\\Tracer' => __DIR__ . '/..' . '/api/php_utils/src/Log/Tracer.php',
'Api\\PhpUtils\\Message\\Email' => __DIR__ . '/..' . '/api/php_utils/src/Message/Email.php',
'Api\\PhpUtils\\Mon\\MonUtil' => __DIR__ . '/..' . '/api/php_utils/src/Mon/MonUtil.php',
......@@ -312,6 +313,7 @@ class ComposerStaticInit14d712e6ba9ca61e9e636d6cf65f43bf
'Api\\PhpUtils\\Validate\\ValidateRule' => __DIR__ . '/..' . '/api/php_utils/src/Validate/ValidateRule.php',
'App\\Base\\Base' => __DIR__ . '/../..' . '/application/modules/Base/Base.php',
'App\\Base\\Cli' => __DIR__ . '/../..' . '/application/modules/Base/Cli.php',
'App\\Base\\Job' => __DIR__ . '/../..' . '/application/modules/Base/Job.php',
'App\\Exception\\BaseException' => __DIR__ . '/../..' . '/application/exception/BaseException.php',
'App\\Exception\\ErrorHandler' => __DIR__ . '/../..' . '/application/exception/ErrorHandler.php',
'App\\Exception\\ExceptionErrorCatch' => __DIR__ . '/../..' . '/application/exception/ExceptionErrorCatch.php',
......@@ -348,6 +350,12 @@ class ComposerStaticInit14d712e6ba9ca61e9e636d6cf65f43bf
'App\\Models\\goods\\mysql\\PindanGoodsSnapshot' => __DIR__ . '/../..' . '/application/models/goods/mysql/PindanGoodsSnapshot.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\\marketing\\mysql\\ColonelDistributorColonel' => __DIR__ . '/../..' . '/application/models/marketing/mysql/ColonelDistributorColonel.php',
'App\\Models\\marketing\\mysql\\ColonelDistributorColonelApply' => __DIR__ . '/../..' . '/application/models/marketing/mysql/ColonelDistributorColonelApply.php',
'App\\Models\\marketing\\mysql\\ColonelDistributorConfig' => __DIR__ . '/../..' . '/application/models/marketing/mysql/ColonelDistributorConfig.php',
'App\\Models\\marketing\\mysql\\ColonelDistributorInviteOrder' => __DIR__ . '/../..' . '/application/models/marketing/mysql/ColonelDistributorInviteOrder.php',
'App\\Models\\marketing\\mysql\\ColonelDistributorInviteOrderNum' => __DIR__ . '/../..' . '/application/models/marketing/mysql/ColonelDistributorInviteOrderNum.php',
'App\\Models\\marketing\\mysql\\ColonelDistributorPayInfo' => __DIR__ . '/../..' . '/application/models/marketing/mysql/ColonelDistributorPayInfo.php',
'App\\Models\\marketing\\mysql\\Distributor' => __DIR__ . '/../..' . '/application/models/marketing/mysql/Distributor.php',
'App\\Models\\marketing\\mysql\\DistributorAuditRecord' => __DIR__ . '/../..' . '/application/models/marketing/mysql/DistributorAuditRecord.php',
'App\\Models\\marketing\\mysql\\Marketing' => __DIR__ . '/../..' . '/application/models/marketing/mysql/Marketing.php',
......@@ -371,11 +379,14 @@ class ComposerStaticInit14d712e6ba9ca61e9e636d6cf65f43bf
'App\\Services\\goods\\GoodsSnapshotsService' => __DIR__ . '/../..' . '/application/services/goods/GoodsSnapshotsService.php',
'App\\Services\\goods\\MarketingPindanGoodsService' => __DIR__ . '/../..' . '/application/services/goods/MarketingPindanGoodsService.php',
'App\\Services\\goods\\OtaService' => __DIR__ . '/../..' . '/application/services/goods/OtaService.php',
'App\\Services\\marketing\\ColonelService' => __DIR__ . '/../..' . '/application/services/marketing/ColonelService.php',
'App\\Services\\marketing\\DistributionService' => __DIR__ . '/../..' . '/application/services/marketing/DistributionService.php',
'App\\Services\\marketing\\DistributorService' => __DIR__ . '/../..' . '/application/services/marketing/DistributorService.php',
'App\\Services\\marketing\\MarketingForOrderService' => __DIR__ . '/../..' . '/application/services/marketing/MarketingForOrderService.php',
'App\\Services\\marketing\\MarketingGoodsService' => __DIR__ . '/../..' . '/application/services/marketing/MarketingGoodsService.php',
'App\\Services\\marketing\\MarketingService' => __DIR__ . '/../..' . '/application/services/marketing/MarketingService.php',
'App\\Services\\marketing\\PindanActivityColonelConfigService' => __DIR__ . '/../..' . '/application/services/marketing/PindanActivityColonelConfigService.php',
'App\\Services\\marketing\\PindanActivityInviteOrderService' => __DIR__ . '/../..' . '/application/services/marketing/PindanActivityInviteOrderService.php',
'App\\Services\\marketing\\TakePlaceService' => __DIR__ . '/../..' . '/application/services/marketing/TakePlaceService.php',
'App\\Services\\shop\\ShopService' => __DIR__ . '/../..' . '/application/services/shop/ShopService.php',
'App\\Services\\tcc\\Tcc2Service' => __DIR__ . '/../..' . '/application/services/tcc/Tcc2Service.php',
......@@ -455,6 +466,8 @@ class ComposerStaticInit14d712e6ba9ca61e9e636d6cf65f43bf
'DASPRiD\\Enum\\Exception\\SerializeNotSupportedException' => __DIR__ . '/..' . '/dasprid/enum/src/Exception/SerializeNotSupportedException.php',
'DASPRiD\\Enum\\Exception\\UnserializeNotSupportedException' => __DIR__ . '/..' . '/dasprid/enum/src/Exception/UnserializeNotSupportedException.php',
'DASPRiD\\Enum\\NullValue' => __DIR__ . '/..' . '/dasprid/enum/src/NullValue.php',
'Daemon\\Colonelorder' => __DIR__ . '/../..' . '/daemon/Colonelorder.php',
'Daemon\\Colonelwallet' => __DIR__ . '/../..' . '/daemon/Colonelwallet.php',
'Daemon\\Goods' => __DIR__ . '/../..' . '/daemon/Goods.php',
'Daemon\\Marketing' => __DIR__ . '/../..' . '/daemon/Marketing.php',
'Daemon\\Pindan' => __DIR__ . '/../..' . '/daemon/Pindan.php',
......
......@@ -2,19 +2,19 @@
"packages": [
{
"name": "api/php_services",
"version": "v1.0.9",
"version_normalized": "1.0.9.0",
"version": "1.0.14",
"version_normalized": "1.0.14.0",
"source": {
"type": "git",
"url": "https://git.yidian-inc.com:8021/bp/php_services.git",
"reference": "cd08caa8f11627220db0d5f13cfb99198a1e7076"
"reference": "f2ba54cfaff45ffa8c0c4864f3b4935e1fcb3cfa"
},
"require": {
"endroid/qr-code": "^3.9",
"perftools/php-profiler": "^0.18.0",
"php": "7.2.*"
},
"time": "2021-08-24T10:07:07+00:00",
"time": "2021-09-08T06:38:07+00:00",
"type": "library",
"installation-source": "source",
"autoload": {
......@@ -27,12 +27,12 @@
},
{
"name": "api/php_utils",
"version": "v1.0.12",
"version_normalized": "1.0.12.0",
"version": "v1.0.17",
"version_normalized": "1.0.17.0",
"source": {
"type": "git",
"url": "https://git.yidian-inc.com:8021/bp/php_utils.git",
"reference": "bb58e98113fdd1a439828bb61cc716b0de0b6b0c"
"reference": "aa70ccdd545f3e421eaf717274954990f1805b87"
},
"require": {
"elasticsearch/elasticsearch": "~7.0",
......@@ -44,7 +44,7 @@
"mongodb/mongodb": "1.4.3",
"php": "7.2.*"
},
"time": "2021-08-24T08:58:56+00:00",
"time": "2021-09-06T08:57:33+00:00",
"type": "library",
"installation-source": "source",
"autoload": {
......@@ -547,19 +547,13 @@
"source": {
"type": "git",
"url": "https://github.com/guzzle/promises.git",
"reference": "8e7d04f1f6450fef59366c399cfad4b9383aa30d"
"reference": "c1dd809c8f51a477701052f4b9e5b4bb5c1061aa"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/promises/zipball/8e7d04f1f6450fef59366c399cfad4b9383aa30d",
"reference": "8e7d04f1f6450fef59366c399cfad4b9383aa30d",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"url": "https://api.github.com/repos/guzzle/promises/zipball/c1dd809c8f51a477701052f4b9e5b4bb5c1061aa",
"reference": "c1dd809c8f51a477701052f4b9e5b4bb5c1061aa",
"shasum": ""
},
"require": {
"php": ">=5.5"
......@@ -567,7 +561,7 @@
"require-dev": {
"symfony/phpunit-bridge": "^4.4 || ^5.1"
},
"time": "2021-03-07T09:25:29+00:00",
"time": "2021-09-05T15:38:28+00:00",
"default-branch": true,
"type": "library",
"extra": {
......@@ -589,10 +583,25 @@
"MIT"
],
"authors": [
{
"name": "Graham Campbell",
"email": "hello@gjcampbell.co.uk",
"homepage": "https://github.com/GrahamCampbell"
},
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
},
{
"name": "Tobias Nyholm",
"email": "tobias.nyholm@gmail.com",
"homepage": "https://github.com/Nyholm"
},
{
"name": "Tobias Schultze",
"email": "webmaster@tubo-world.de",
"homepage": "https://github.com/Tobion"
}
],
"description": "Guzzle promises library",
......@@ -601,8 +610,22 @@
],
"support": {
"issues": "https://github.com/guzzle/promises/issues",
"source": "https://github.com/guzzle/promises/tree/1.4.1"
"source": "https://github.com/guzzle/promises/tree/master"
},
"funding": [
{
"url": "https://github.com/GrahamCampbell",
"type": "github"
},
{
"url": "https://github.com/Nyholm",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/guzzlehttp/promises",
"type": "tidelift"
}
],
"install-path": "../guzzlehttp/promises"
},
{
......@@ -612,19 +635,13 @@
"source": {
"type": "git",
"url": "https://github.com/guzzle/psr7.git",
"reference": "dc960a912984efb74d0a90222870c72c87f10c91"
"reference": "9d006741ba865a45adccfac45d8e1053086a5a3f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/dc960a912984efb74d0a90222870c72c87f10c91",
"reference": "dc960a912984efb74d0a90222870c72c87f10c91",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"url": "https://api.github.com/repos/guzzle/psr7/zipball/9d006741ba865a45adccfac45d8e1053086a5a3f",
"reference": "9d006741ba865a45adccfac45d8e1053086a5a3f",
"shasum": ""
},
"require": {
"php": ">=5.4.0",
......@@ -641,7 +658,7 @@
"suggest": {
"laminas/laminas-httphandlerrunner": "Emit PSR-7 responses"
},
"time": "2021-04-26T09:17:50+00:00",
"time": "2021-09-05T19:11:18+00:00",
"type": "library",
"extra": {
"branch-alias": {
......@@ -662,13 +679,34 @@
"MIT"
],
"authors": [
{
"name": "Graham Campbell",
"email": "hello@gjcampbell.co.uk",
"homepage": "https://github.com/GrahamCampbell"
},
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
},
{
"name": "George Mponos",
"email": "gmponos@gmail.com",
"homepage": "https://github.com/gmponos"
},
{
"name": "Tobias Nyholm",
"email": "tobias.nyholm@gmail.com",
"homepage": "https://github.com/Nyholm"
},
{
"name": "Márk Sági-Kazár",
"email": "mark.sagikazar@gmail.com",
"homepage": "https://github.com/sagikazarmark"
},
{
"name": "Tobias Schultze",
"email": "webmaster@tubo-world.de",
"homepage": "https://github.com/Tobion"
}
],
......@@ -2008,19 +2046,13 @@
"source": {
"type": "git",
"url": "https://github.com/symfony/property-info.git",
"reference": "3565216f9640b26b646855e39e7bfafc550c75db"
"reference": "903f3f3f6a360bc4739f8390e5031acc70d9cd9f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/property-info/zipball/3565216f9640b26b646855e39e7bfafc550c75db",
"reference": "3565216f9640b26b646855e39e7bfafc550c75db",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"url": "https://api.github.com/repos/symfony/property-info/zipball/903f3f3f6a360bc4739f8390e5031acc70d9cd9f",
"reference": "903f3f3f6a360bc4739f8390e5031acc70d9cd9f",
"shasum": ""
},
"require": {
"php": ">=7.2.5",
......@@ -2046,7 +2078,7 @@
"symfony/doctrine-bridge": "To use Doctrine metadata",
"symfony/serializer": "To use Serializer metadata"
},
"time": "2021-08-23T12:58:54+00:00",
"time": "2021-09-07T15:45:17+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
......@@ -2107,19 +2139,13 @@
"source": {
"type": "git",
"url": "https://github.com/symfony/string.git",
"reference": "2342deb63fb5f8c45c5c190656d9aa0377792143"
"reference": "fa2c5cc3f7dac23d87429652fe0daf28d65cbd5b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/string/zipball/2342deb63fb5f8c45c5c190656d9aa0377792143",
"reference": "2342deb63fb5f8c45c5c190656d9aa0377792143",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"url": "https://api.github.com/repos/symfony/string/zipball/fa2c5cc3f7dac23d87429652fe0daf28d65cbd5b",
"reference": "fa2c5cc3f7dac23d87429652fe0daf28d65cbd5b",
"shasum": ""
},
"require": {
"php": ">=7.2.5",
......@@ -2135,7 +2161,7 @@
"symfony/translation-contracts": "^1.1|^2",
"symfony/var-exporter": "^4.4|^5.0|^6.0"
},
"time": "2021-08-17T14:20:01+00:00",
"time": "2021-08-26T08:23:47+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
......
<?php return array(
'root' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => '831ef95de225db85543c355ed675b00ff61030cd',
'name' => 'yidian/yaf_demo',
'dev' => true,
),
'versions' => array(
'api/php_services' => array(
'pretty_version' => 'v1.0.9',
'version' => '1.0.9.0',
'type' => 'library',
'install_path' => __DIR__ . '/../api/php_services',
'aliases' => array(),
'reference' => 'cd08caa8f11627220db0d5f13cfb99198a1e7076',
'dev_requirement' => false,
),
'api/php_utils' => array(
'pretty_version' => 'v1.0.12',
'version' => '1.0.12.0',
'type' => 'library',
'install_path' => __DIR__ . '/../api/php_utils',
'aliases' => array(),
'reference' => 'bb58e98113fdd1a439828bb61cc716b0de0b6b0c',
'dev_requirement' => false,
),
'bacon/bacon-qr-code' => array(
'pretty_version' => '2.0.4',
'version' => '2.0.4.0',
'type' => 'library',
'install_path' => __DIR__ . '/../bacon/bacon-qr-code',
'aliases' => array(),
'reference' => 'f73543ac4e1def05f1a70bcd1525c8a157a1ad09',
'dev_requirement' => false,
),
'dasprid/enum' => array(
'pretty_version' => '1.0.3',
'version' => '1.0.3.0',
'type' => 'library',
'install_path' => __DIR__ . '/../dasprid/enum',
'aliases' => array(),
'reference' => '5abf82f213618696dda8e3bf6f64dd042d8542b2',
'dev_requirement' => false,
),
'elasticsearch/elasticsearch' => array(
'pretty_version' => '7.11.x-dev',
'version' => '7.11.9999999.9999999-dev',
'type' => 'library',
'install_path' => __DIR__ . '/../elasticsearch/elasticsearch',
'aliases' => array(),
'reference' => '8d08050fef9d89004702b1428b8c1f7f4f6162cf',
'dev_requirement' => false,
),
'endroid/qr-code' => array(
'pretty_version' => '3.9.6',
'version' => '3.9.6.0',
'type' => 'library',
'install_path' => __DIR__ . '/../endroid/qr-code',
'aliases' => array(),
'reference' => '9cdd4f5d609bfc8811ca4a62b4d23eb16976242f',
'dev_requirement' => false,
),
'ezimuel/guzzlestreams' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'type' => 'library',
'install_path' => __DIR__ . '/../ezimuel/guzzlestreams',
'aliases' => array(
0 => '3.0.x-dev',
),
'reference' => 'abe3791d231167f14eb80d413420d1eab91163a8',
'dev_requirement' => false,
),
'ezimuel/ringphp' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'type' => 'library',
'install_path' => __DIR__ . '/../ezimuel/ringphp',
'aliases' => array(
0 => '1.1.x-dev',
),
'reference' => '0b78f89d8e0bb9e380046c31adfa40347e9f663b',
'dev_requirement' => false,
),
'guzzlehttp/guzzle' => array(
'pretty_version' => '6.3.0',
'version' => '6.3.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../guzzlehttp/guzzle',
'aliases' => array(),
'reference' => 'f4db5a78a5ea468d4831de7f0bf9d9415e348699',
'dev_requirement' => false,
),
'guzzlehttp/promises' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'type' => 'library',
'install_path' => __DIR__ . '/../guzzlehttp/promises',
'aliases' => array(
0 => '1.4.x-dev',
),
'reference' => '8e7d04f1f6450fef59366c399cfad4b9383aa30d',
'dev_requirement' => false,
),
'guzzlehttp/psr7' => array(
'pretty_version' => '1.x-dev',
'version' => '1.9999999.9999999.9999999-dev',
'type' => 'library',
'install_path' => __DIR__ . '/../guzzlehttp/psr7',
'aliases' => array(),
'reference' => 'dc960a912984efb74d0a90222870c72c87f10c91',
'dev_requirement' => false,
),
'khanamiryan/qrcode-detector-decoder' => array(
'pretty_version' => '1.0.5.2',
'version' => '1.0.5.2',
'type' => 'library',
'install_path' => __DIR__ . '/../khanamiryan/qrcode-detector-decoder',
'aliases' => array(),
'reference' => '04fdd58d86a387065f707dc6d3cc304c719910c1',
'dev_requirement' => false,
),
'mongodb/mongodb' => array(
'pretty_version' => '1.4.3',
'version' => '1.4.3.0',
'type' => 'library',
'install_path' => __DIR__ . '/../mongodb/mongodb',
'aliases' => array(),
'reference' => '18fca8cc8d0c2cc07f76605760d20632bb3dab96',
'dev_requirement' => false,
),
'myclabs/php-enum' => array(
'pretty_version' => '1.7.7',
'version' => '1.7.7.0',
'type' => 'library',
'install_path' => __DIR__ . '/../myclabs/php-enum',
'aliases' => array(),
'reference' => 'd178027d1e679832db9f38248fcc7200647dc2b7',
'dev_requirement' => false,
),
'perftools/php-profiler' => array(
'pretty_version' => '0.18.0',
'version' => '0.18.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../perftools/php-profiler',
'aliases' => array(),
'reference' => '794c435f615ab9ca4347e386b4d8c6524fe9e3ae',
'dev_requirement' => false,
),
'psr/http-message' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'type' => 'library',
'install_path' => __DIR__ . '/../psr/http-message',
'aliases' => array(
0 => '1.0.x-dev',
),
'reference' => 'efd67d1dc14a7ef4fc4e518e7dee91c271d524e4',
'dev_requirement' => false,
),
'psr/http-message-implementation' => array(
'dev_requirement' => false,
'provided' => array(
0 => '1.0',
),
),
'psr/log' => array(
'pretty_version' => '1.1.4',
'version' => '1.1.4.0',
'type' => 'library',
'install_path' => __DIR__ . '/../psr/log',
'aliases' => array(),
'reference' => 'd49695b909c3b7628b6289db5479a1c204601f11',
'dev_requirement' => false,
),
'ralouphie/getallheaders' => array(
'pretty_version' => '3.0.3',
'version' => '3.0.3.0',
'type' => 'library',
'install_path' => __DIR__ . '/../ralouphie/getallheaders',
'aliases' => array(),
'reference' => '120b605dfeb996808c31b6477290a714d356e822',
'dev_requirement' => false,
),
'react/promise' => array(
'pretty_version' => '2.x-dev',
'version' => '2.9999999.9999999.9999999-dev',
'type' => 'library',
'install_path' => __DIR__ . '/../react/promise',
'aliases' => array(),
'reference' => 'a9752a861e21c0fe0b380c9f9e55beddc0ed7d31',
'dev_requirement' => false,
),
'symfony/deprecation-contracts' => array(
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/deprecation-contracts',
'aliases' => array(
0 => '2.5.x-dev',
),
'reference' => '6f981ee24cf69ee7ce9736146d1c57c2780598a8',
'dev_requirement' => false,
),
'symfony/options-resolver' => array(
'pretty_version' => '5.4.x-dev',
'version' => '5.4.9999999.9999999-dev',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/options-resolver',
'aliases' => array(),
'reference' => 'f1b99f10ea04aa9d0aafddcd8ba3d65545403bab',
'dev_requirement' => false,
),
'symfony/polyfill-ctype' => array(
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-ctype',
'aliases' => array(
0 => '1.23.x-dev',
),
'reference' => '46cd95797e9df938fdd2b03693b5fca5e64b01ce',
'dev_requirement' => false,
),
'symfony/polyfill-intl-grapheme' => array(
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-intl-grapheme',
'aliases' => array(
0 => '1.23.x-dev',
),
'reference' => '16880ba9c5ebe3642d1995ab866db29270b36535',
'dev_requirement' => false,
),
'symfony/polyfill-intl-normalizer' => array(
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-intl-normalizer',
'aliases' => array(
0 => '1.23.x-dev',
),
'reference' => '8590a5f561694770bdcd3f9b5c69dde6945028e8',
'dev_requirement' => false,
),
'symfony/polyfill-mbstring' => array(
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-mbstring',
'aliases' => array(
0 => '1.23.x-dev',
),
'reference' => '9174a3d80210dca8daa7f31fec659150bbeabfc6',
'dev_requirement' => false,
),
'symfony/polyfill-php73' => array(
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-php73',
'aliases' => array(
0 => '1.23.x-dev',
),
'reference' => 'fba8933c384d6476ab14fb7b8526e5287ca7e010',
'dev_requirement' => false,
),
'symfony/polyfill-php80' => array(
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-php80',
'aliases' => array(
0 => '1.23.x-dev',
),
'reference' => '1100343ed1a92e3a38f9ae122fc0eb21602547be',
'dev_requirement' => false,
),
'symfony/property-access' => array(
'pretty_version' => '5.4.x-dev',
'version' => '5.4.9999999.9999999-dev',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/property-access',
'aliases' => array(),
'reference' => '7831b0331b786db39026d190faa4914f94adb212',
'dev_requirement' => false,
),
'symfony/property-info' => array(
'pretty_version' => '5.4.x-dev',
'version' => '5.4.9999999.9999999-dev',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/property-info',
'aliases' => array(),
'reference' => '3565216f9640b26b646855e39e7bfafc550c75db',
'dev_requirement' => false,
),
'symfony/string' => array(
'pretty_version' => '5.4.x-dev',
'version' => '5.4.9999999.9999999-dev',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/string',
'aliases' => array(),
'reference' => '2342deb63fb5f8c45c5c190656d9aa0377792143',
'dev_requirement' => false,
),
'yidian/yaf_demo' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => '831ef95de225db85543c355ed675b00ff61030cd',
'dev_requirement' => false,
),
<?php return array (
'root' =>
array (
'pretty_version' => 'dev-develop',
'version' => 'dev-develop',
'aliases' =>
array (
),
'reference' => '8f346c81d3f2e7e81c7870acbece3051b1016b7e',
'name' => 'yidian/yaf_demo',
),
'versions' =>
array (
'api/php_services' =>
array (
'pretty_version' => '1.0.14',
'version' => '1.0.14.0',
'aliases' =>
array (
),
'reference' => 'f2ba54cfaff45ffa8c0c4864f3b4935e1fcb3cfa',
),
'api/php_utils' =>
array (
'pretty_version' => 'v1.0.17',
'version' => '1.0.17.0',
'aliases' =>
array (
),
'reference' => 'aa70ccdd545f3e421eaf717274954990f1805b87',
),
'bacon/bacon-qr-code' =>
array (
'pretty_version' => '2.0.4',
'version' => '2.0.4.0',
'aliases' =>
array (
),
'reference' => 'f73543ac4e1def05f1a70bcd1525c8a157a1ad09',
),
'dasprid/enum' =>
array (
'pretty_version' => '1.0.3',
'version' => '1.0.3.0',
'aliases' =>
array (
),
'reference' => '5abf82f213618696dda8e3bf6f64dd042d8542b2',
),
'elasticsearch/elasticsearch' =>
array (
'pretty_version' => '7.11.x-dev',
'version' => '7.11.9999999.9999999-dev',
'aliases' =>
array (
),
'reference' => '8d08050fef9d89004702b1428b8c1f7f4f6162cf',
),
'endroid/qr-code' =>
array (
'pretty_version' => '3.9.6',
'version' => '3.9.6.0',
'aliases' =>
array (
),
'reference' => '9cdd4f5d609bfc8811ca4a62b4d23eb16976242f',
),
'ezimuel/guzzlestreams' =>
array (
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'aliases' =>
array (
0 => '3.0.x-dev',
),
'reference' => 'abe3791d231167f14eb80d413420d1eab91163a8',
),
'ezimuel/ringphp' =>
array (
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'aliases' =>
array (
0 => '1.1.x-dev',
),
'reference' => '0b78f89d8e0bb9e380046c31adfa40347e9f663b',
),
'guzzlehttp/guzzle' =>
array (
'pretty_version' => '6.3.0',
'version' => '6.3.0.0',
'aliases' =>
array (
),
'reference' => 'f4db5a78a5ea468d4831de7f0bf9d9415e348699',
),
'guzzlehttp/promises' =>
array (
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'aliases' =>
array (
0 => '1.4.x-dev',
),
'reference' => 'c1dd809c8f51a477701052f4b9e5b4bb5c1061aa',
),
'guzzlehttp/psr7' =>
array (
'pretty_version' => '1.x-dev',
'version' => '1.9999999.9999999.9999999-dev',
'aliases' =>
array (
),
'reference' => '9d006741ba865a45adccfac45d8e1053086a5a3f',
),
'khanamiryan/qrcode-detector-decoder' =>
array (
'pretty_version' => '1.0.5.2',
'version' => '1.0.5.2',
'aliases' =>
array (
),
'reference' => '04fdd58d86a387065f707dc6d3cc304c719910c1',
),
'mongodb/mongodb' =>
array (
'pretty_version' => '1.4.3',
'version' => '1.4.3.0',
'aliases' =>
array (
),
'reference' => '18fca8cc8d0c2cc07f76605760d20632bb3dab96',
),
'myclabs/php-enum' =>
array (
'pretty_version' => '1.7.7',
'version' => '1.7.7.0',
'aliases' =>
array (
),
'reference' => 'd178027d1e679832db9f38248fcc7200647dc2b7',
),
'perftools/php-profiler' =>
array (
'pretty_version' => '0.18.0',
'version' => '0.18.0.0',
'aliases' =>
array (
),
'reference' => '794c435f615ab9ca4347e386b4d8c6524fe9e3ae',
),
'psr/http-message' =>
array (
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'aliases' =>
array (
0 => '1.0.x-dev',
),
'reference' => 'efd67d1dc14a7ef4fc4e518e7dee91c271d524e4',
),
'psr/http-message-implementation' =>
array (
'provided' =>
array (
0 => '1.0',
),
),
'psr/log' =>
array (
'pretty_version' => '1.1.4',
'version' => '1.1.4.0',
'aliases' =>
array (
),
'reference' => 'd49695b909c3b7628b6289db5479a1c204601f11',
),
'ralouphie/getallheaders' =>
array (
'pretty_version' => '3.0.3',
'version' => '3.0.3.0',
'aliases' =>
array (
),
'reference' => '120b605dfeb996808c31b6477290a714d356e822',
),
'react/promise' =>
array (
'pretty_version' => '2.x-dev',
'version' => '2.9999999.9999999.9999999-dev',
'aliases' =>
array (
),
'reference' => 'a9752a861e21c0fe0b380c9f9e55beddc0ed7d31',
),
'symfony/deprecation-contracts' =>
array (
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'aliases' =>
array (
0 => '2.5.x-dev',
),
'reference' => '6f981ee24cf69ee7ce9736146d1c57c2780598a8',
),
'symfony/options-resolver' =>
array (
'pretty_version' => '5.4.x-dev',
'version' => '5.4.9999999.9999999-dev',
'aliases' =>
array (
),
'reference' => 'f1b99f10ea04aa9d0aafddcd8ba3d65545403bab',
),
'symfony/polyfill-ctype' =>
array (
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'aliases' =>
array (
0 => '1.23.x-dev',
),
'reference' => '46cd95797e9df938fdd2b03693b5fca5e64b01ce',
),
'symfony/polyfill-intl-grapheme' =>
array (
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'aliases' =>
array (
0 => '1.23.x-dev',
),
'reference' => '16880ba9c5ebe3642d1995ab866db29270b36535',
),
'symfony/polyfill-intl-normalizer' =>
array (
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'aliases' =>
array (
0 => '1.23.x-dev',
),
'reference' => '8590a5f561694770bdcd3f9b5c69dde6945028e8',
),
'symfony/polyfill-mbstring' =>
array (
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'aliases' =>
array (
0 => '1.23.x-dev',
),
'reference' => '9174a3d80210dca8daa7f31fec659150bbeabfc6',
),
'symfony/polyfill-php73' =>
array (
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'aliases' =>
array (
0 => '1.23.x-dev',
),
'reference' => 'fba8933c384d6476ab14fb7b8526e5287ca7e010',
),
'symfony/polyfill-php80' =>
array (
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'aliases' =>
array (
0 => '1.23.x-dev',
),
'reference' => '1100343ed1a92e3a38f9ae122fc0eb21602547be',
),
'symfony/property-access' =>
array (
'pretty_version' => '5.4.x-dev',
'version' => '5.4.9999999.9999999-dev',
'aliases' =>
array (
),
'reference' => '7831b0331b786db39026d190faa4914f94adb212',
),
'symfony/property-info' =>
array (
'pretty_version' => '5.4.x-dev',
'version' => '5.4.9999999.9999999-dev',
'aliases' =>
array (
),
'reference' => '903f3f3f6a360bc4739f8390e5031acc70d9cd9f',
),
'symfony/string' =>
array (
'pretty_version' => '5.4.x-dev',
'version' => '5.4.9999999.9999999-dev',
'aliases' =>
array (
),
'reference' => 'fa2c5cc3f7dac23d87429652fe0daf28d65cbd5b',
),
'yidian/yaf_demo' =>
array (
'pretty_version' => 'dev-develop',
'version' => 'dev-develop',
'aliases' =>
array (
),
'reference' => '8f346c81d3f2e7e81c7870acbece3051b1016b7e',
),
),
);
Copyright (c) 2015-2016 Michael Dowling, https://github.com/mtdowling <mtdowling@gmail.com>
The MIT License (MIT)
Copyright (c) 2015 Michael Dowling <mtdowling@gmail.com>
Copyright (c) 2015 Graham Campbell <hello@gjcampbell.co.uk>
Copyright (c) 2017 Tobias Schultze <webmaster@tubo-world.de>
Copyright (c) 2020 Tobias Nyholm <tobias.nyholm@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
......
......@@ -530,3 +530,18 @@ A static API was first introduced in 1.4.0, in order to mitigate problems with f
| `is_rejected` | `Is::rejected` |
| `is_settled` | `Is::settled` |
| `coroutine` | `Coroutine::of` |
## Security
If you discover a security vulnerability within this package, please send an email to security@tidelift.com. All security vulnerabilities will be promptly addressed. Please do not disclose security-related issues publicly until a fix has been announced. Please see [Security Policy](https://github.com/guzzle/promises/security/policy) for more information.
## License
Guzzle is made available under the MIT License (MIT). Please see [License File](LICENSE) for more information.
## For Enterprise
Available as part of the Tidelift Subscription
The maintainers of Guzzle and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/packagist-guzzlehttp-promises?utm_source=packagist-guzzlehttp-promises&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
......@@ -4,10 +4,25 @@
"keywords": ["promise"],
"license": "MIT",
"authors": [
{
"name": "Graham Campbell",
"email": "hello@gjcampbell.co.uk",
"homepage": "https://github.com/GrahamCampbell"
},
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
},
{
"name": "Tobias Nyholm",
"email": "tobias.nyholm@gmail.com",
"homepage": "https://github.com/Nyholm"
},
{
"name": "Tobias Schultze",
"email": "webmaster@tubo-world.de",
"homepage": "https://github.com/Tobion"
}
],
"require": {
......@@ -35,5 +50,9 @@
"branch-alias": {
"dev-master": "1.4-dev"
}
},
"config": {
"preferred-install": "dist",
"sort-packages": true
}
}
github: [Nyholm, GrahamCampbell]
tidelift: "packagist/guzzlehttp/psr7"
daysUntilStale: 120
daysUntilClose: 14
exemptLabels:
- lifecycle/keep-open
- lifecycle/ready-for-merge
# Label to use when marking an issue as stale
staleLabel: lifecycle/stale
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed after 2 weeks if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
name: BC Check
on:
pull_request:
jobs:
roave-bc-check:
name: Roave BC Check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Roave BC Check
uses: docker://nyholm/roave-bc-check-ga
......@@ -10,7 +10,7 @@ jobs:
strategy:
max-parallel: 10
matrix:
php: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4']
php: ['5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
steps:
- name: Set up PHP
......@@ -23,8 +23,12 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2
- name: Mimic PHP 8.0
run: composer config platform.php 8.0.999
if: matrix.php > 8
- name: Install dependencies
run: composer update --no-interaction --no-progress --prefer-dist
run: composer update --no-interaction --no-progress
- name: Run tests
run: make test
......@@ -26,7 +26,7 @@ jobs:
- name: Download dependencies
uses: ramsey/composer-install@v1
with:
composer-options: --no-interaction --prefer-dist --optimize-autoloader
composer-options: --no-interaction --optimize-autoloader
- name: Start server
run: php -S 127.0.0.1:10002 tests/Integration/server.php &
......
Copyright (c) 2015 Michael Dowling, https://github.com/mtdowling <mtdowling@gmail.com>
The MIT License (MIT)
Copyright (c) 2015 Michael Dowling <mtdowling@gmail.com>
Copyright (c) 2015 Márk Sági-Kazár <mark.sagikazar@gmail.com>
Copyright (c) 2015 Graham Campbell <hello@gjcampbell.co.uk>
Copyright (c) 2016 Tobias Schultze <webmaster@tubo-world.de>
Copyright (c) 2016 George Mponos <gmponos@gmail.com>
Copyright (c) 2018 Tobias Nyholm <tobias.nyholm@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
......
......@@ -807,3 +807,18 @@ Whether two URIs can be considered equivalent. Both URIs are normalized automati
`$normalizations` bitmask. The method also accepts relative URI references and returns true when they are equivalent.
This of course assumes they will be resolved against the same base URI. If this is not the case, determination of
equivalence or difference of relative references does not mean anything.
## Security
If you discover a security vulnerability within this package, please send an email to security@tidelift.com. All security vulnerabilities will be promptly addressed. Please do not disclose security-related issues publicly until a fix has been announced. Please see [Security Policy](https://github.com/guzzle/psr7/security/policy) for more information.
## License
Guzzle is made available under the MIT License (MIT). Please see [License File](LICENSE) for more information.
## For Enterprise
Available as part of the Tidelift Subscription
The maintainers of Guzzle and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/packagist-guzzlehttp-psr7?utm_source=packagist-guzzlehttp-psr7&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
{
"name": "guzzlehttp/psr7",
"type": "library",
"description": "PSR-7 message implementation that also provides common utility methods",
"keywords": ["request", "response", "message", "stream", "http", "uri", "url", "psr-7"],
"license": "MIT",
"authors": [
{
"name": "Graham Campbell",
"email": "hello@gjcampbell.co.uk",
"homepage": "https://github.com/GrahamCampbell"
},
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
},
{
"name": "George Mponos",
"email": "gmponos@gmail.com",
"homepage": "https://github.com/gmponos"
},
{
"name": "Tobias Nyholm",
"email": "tobias.nyholm@gmail.com",
"homepage": "https://github.com/Nyholm"
},
{
"name": "Márk Sági-Kazár",
"email": "mark.sagikazar@gmail.com",
"homepage": "https://github.com/sagikazarmark"
},
{
"name": "Tobias Schultze",
"email": "webmaster@tubo-world.de",
"homepage": "https://github.com/Tobion"
}
],
......@@ -45,5 +65,9 @@
"branch-alias": {
"dev-master": "1.7-dev"
}
},
"config": {
"preferred-install": "dist",
"sort-packages": true
}
}
......@@ -10,7 +10,7 @@ CHANGELOG
5.2.0
-----
* deprecated the `enable_magic_call_extraction` context option in `ReflectionExtractor::getWriteInfo()` and `ReflectionExtractor::getReadInfo()`. in favor of `enable_magic_methods_extraction`
* deprecated the `enable_magic_call_extraction` context option in `ReflectionExtractor::getWriteInfo()` and `ReflectionExtractor::getReadInfo()` in favor of `enable_magic_methods_extraction`
5.1.0
-----
......
......@@ -552,8 +552,8 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp
$types = [];
$nullable = $reflectionType->allowsNull();
foreach ($reflectionType instanceof \ReflectionUnionType ? $reflectionType->getTypes() : [$reflectionType] as $type) {
$phpTypeOrClass = $reflectionType instanceof \ReflectionNamedType ? $reflectionType->getName() : (string) $type;
foreach (($reflectionType instanceof \ReflectionUnionType || $reflectionType instanceof \ReflectionIntersectionType) ? $reflectionType->getTypes() : [$reflectionType] as $type) {
$phpTypeOrClass = $type->getName();
if ('null' === $phpTypeOrClass || 'mixed' === $phpTypeOrClass || 'never' === $phpTypeOrClass) {
continue;
}
......
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