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 ...@@ -22,26 +22,33 @@ class BaseException extends \Exception
*/ */
public function __construct($params = []) public function __construct($params = [])
{ {
if (!is_array($params)) { if (empty($params)) {
return; return;
} }
if (!is_array($params)) {
return $this->setCusMsg($params);
}
$this->code = $params['code'] ?? Registry::get('config')->exception->user->code; $this->code = $params['code'] ?? Registry::get('config')->exception->user->code;
$this->msg = $params['msg'] ?? Registry::get('config')->exception->user->msg; $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) { if (isset($params['cus']) && $this->cus && isset($this->cus[intval($params['cus'])]) && $this->base_code) {
return $this->setCusMsg($params['cus'],$params['data']??'');
}
}
//每个服务都有自己的codePrefix public function setCusMsg($cus,$data = '')
$appid = \Yaf\Application::app()->getConfig()->get("appid"); {
$codePrefix = \Yaconf::get('bizcode.prefix.' . $appid); //每个服务都有自己的codePrefix
$codePrefix = intval($codePrefix); $appid = \Yaf\Application::app()->getConfig()->get("appid");
$codePrefix = \Yaconf::get('bizcode.prefix.' . $appid);
$codePrefix = intval($codePrefix);
$cus_code = intval($params['cus']); $cus_code = intval($cus);
$base_code = intval($this->base_code); $base_code = intval($this->base_code);
$this->code = $codePrefix + $base_code + $cus_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->msg = !empty($data) ? vsprintf($this->cus[$cus_code],$data) : $this->cus[$cus_code];
}
} }
public function __get($name): bool public function __get($name): bool
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
namespace App\Exception\custom; namespace App\Exception\custom;
use App\Exception\BaseException; use App\Exception\BaseException;
class MarketingException extends BaseException class MarketingException extends BaseException
...@@ -13,6 +12,20 @@ class MarketingException extends BaseException ...@@ -13,6 +12,20 @@ class MarketingException extends BaseException
const LIFE_ACCOUNT_NO_EXIST = 16; const LIFE_ACCOUNT_NO_EXIST = 16;
const RELATION_ALREADY_EXIST = 17; const RELATION_ALREADY_EXIST = 17;
const TAKE_PLACE_NOT_EXIST = 20; 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 = [ protected $cus = [
0 => '活动名称不能为空', 0 => '活动名称不能为空',
...@@ -38,6 +51,21 @@ class MarketingException extends BaseException ...@@ -38,6 +51,21 @@ class MarketingException extends BaseException
self::TAKE_PLACE_NOT_EXIST => '自提点不存在', self::TAKE_PLACE_NOT_EXIST => '自提点不存在',
21 => "活动开始时间不能大于或者等于结束时间", 21 => "活动开始时间不能大于或者等于结束时间",
22 => "自提点不能为空", 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 => '分润金额+手续费不能大于售价金额', 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 ...@@ -41,7 +41,7 @@ class BaseValidate extends Validate
protected function isMobile($value) 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); $result = preg_match($rule, $value);
if ($result) { if ($result) {
return true; return true;
...@@ -49,4 +49,19 @@ class BaseValidate extends Validate ...@@ -49,4 +49,19 @@ class BaseValidate extends Validate
return false; 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 ...@@ -22,4 +22,9 @@ class MarketingOnlineStatusValidate extends BaseValidate
"marketing_type" => "marketing_type 不能为空", "marketing_type" => "marketing_type 不能为空",
"online_status" => "online_status 不能为空", "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 ...@@ -14,6 +14,8 @@ class Marketing extends MysqlBase
const MARKETING_TYPE_TUANGOU = 2; const MARKETING_TYPE_TUANGOU = 2;
const MARKETING_TYPE_MIAOSHA = 3; const MARKETING_TYPE_MIAOSHA = 3;
const MARKETING_TYPE_PINDAN = 4; const MARKETING_TYPE_PINDAN = 4;
const MARKETING_TYPE_LIEBIAN = 5;
const MARKETING_TYPE_TUANZHANG = 6;
const ONLINE_STATUS_QIDONG = 1; const ONLINE_STATUS_QIDONG = 1;
const ONLINE_STATUS_GUANBI = 2; const ONLINE_STATUS_GUANBI = 2;
...@@ -125,6 +127,24 @@ class Marketing extends MysqlBase ...@@ -125,6 +127,24 @@ class Marketing extends MysqlBase
$data['online_status'] = $where['online_status']; $data['online_status'] = $where['online_status'];
} }
if (!empty($where['marketing_type'])) {
$data['marketing_type'] = $where['marketing_type'];
}
return $data; 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 ...@@ -13,6 +13,7 @@ class MarketingPindan extends MysqlBase
const ACTIVITY_STATUS_NO_START = 1; const ACTIVITY_STATUS_NO_START = 1;
const ACTIVITY_STATUS_IN_PROGRESS = 2; const ACTIVITY_STATUS_IN_PROGRESS = 2;
const ACTIVITY_STATUS_FINISHED = 3; const ACTIVITY_STATUS_FINISHED = 3;
const ACTIVITY_STATUS_START_TODAY = 4;//今日上新
public static function getRecord($where, $colums = []) public static function getRecord($where, $colums = [])
{ {
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
namespace App\Models\marketing\mysql; namespace App\Models\marketing\mysql;
use Api\PhpUtils\Mysql\MysqlBase; use Api\PhpUtils\Mysql\MysqlBase;
use App\Services\marketing\MarketingService;
/** /**
* 自提点 * 自提点
...@@ -25,7 +26,7 @@ class TakePlace extends MysqlBase ...@@ -25,7 +26,7 @@ class TakePlace extends MysqlBase
*/ */
public static function searchList($params) public static function searchList($params)
{ {
$lifeAccountId = $params['life_account_id'] ?? 0; $lifeAccountId = $params['life_account_id'] ?? MarketingService::getPublicLifeAccountId();
$keywords = $params['keywords'] ?? ''; $keywords = $params['keywords'] ?? '';
$offset = $params['offset'] ?? 0; $offset = $params['offset'] ?? 0;
$limit = $params['limit'] ?? 20; $limit = $params['limit'] ?? 20;
...@@ -53,4 +54,20 @@ class TakePlace extends MysqlBase ...@@ -53,4 +54,20 @@ class TakePlace extends MysqlBase
return $res; 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
This diff is collapsed.
<?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 ...@@ -155,4 +155,25 @@ class MarketingController extends Base
$this->success(); $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; ...@@ -11,6 +11,8 @@ use Api\PhpServices\Sensitive\Sensitive;
use Api\PhpUtils\Common\BaseConvert; use Api\PhpUtils\Common\BaseConvert;
use Api\PhpUtils\Common\GoodsSkuId; use Api\PhpUtils\Common\GoodsSkuId;
use Api\PhpUtils\Http\HttpUtil; use Api\PhpUtils\Http\HttpUtil;
use Api\PhpUtils\Lock\FrequencyLockUtil;
use Api\PhpUtils\Log\FileLog;
use App\Exception\custom\GoodsException; use App\Exception\custom\GoodsException;
use App\Models\goods\mysql\Category; use App\Models\goods\mysql\Category;
use App\Models\goods\mysql\GoodsOperationRecord; use App\Models\goods\mysql\GoodsOperationRecord;
...@@ -498,11 +500,13 @@ class MarketingPindanGoodsService ...@@ -498,11 +500,13 @@ class MarketingPindanGoodsService
]); ]);
$row = PindanGoodsSku::save([ $row = PindanGoodsSku::save([
"total_amount_sold" => $sku["total_amount_sold"] - $params["num"], "total_amount_sold[-]" => $params["num"],
"total_amount_order" => $sku["total_amount_order"] - $params["num"], "total_amount_order[-]" => $params["num"],
"inventory_rest" => $sku["inventory_rest"] + $params["num"], "inventory_rest[+]" => $params["num"],
], ["goods_sku_id" => $sku["goods_sku_id"], "total_amount_sold[>=]" => $params["num"], "total_amount_order[>=]" => $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){ if ($row < 1){
PindanGoodsSku::rollback(); PindanGoodsSku::rollback();
GoodsRefundRecord::save([ GoodsRefundRecord::save([
......
This diff is collapsed.
...@@ -82,8 +82,11 @@ class MarketingGoodsService ...@@ -82,8 +82,11 @@ class MarketingGoodsService
$goodsSkuId = array_column($data, 'goods_sku_id'); $goodsSkuId = array_column($data, 'goods_sku_id');
} }
$goodsSkuList = GoodsSku::getRecordMaster(['goods_sku_id' => $goodsSkuId]); $goodsSkuList = [];
$goodsSkuList = !empty($goodsSkuList) ? array_column($goodsSkuList,null,'goods_sku_id') : []; if (!empty($goodsSkuId)) {
$goodsSkuList = GoodsSku::getRecordMaster(['goods_sku_id' => $goodsSkuId]);
$goodsSkuList = !empty($goodsSkuList) ? array_column($goodsSkuList,null,'goods_sku_id') : [];
}
$lastData = end($data); $lastData = end($data);
$lastId = !empty($lastData['id']) ? $lastData['id'] : ''; $lastId = !empty($lastData['id']) ? $lastData['id'] : '';
...@@ -92,8 +95,11 @@ class MarketingGoodsService ...@@ -92,8 +95,11 @@ class MarketingGoodsService
$shopId[$key] = !empty($goodsSkuList[$value['goods_sku_id']]['shop_id']) ? $goodsSkuList[$value['goods_sku_id']]['shop_id'] : ''; $shopId[$key] = !empty($goodsSkuList[$value['goods_sku_id']]['shop_id']) ? $goodsSkuList[$value['goods_sku_id']]['shop_id'] : '';
} }
$subShopList = SubShop::getRecordMaster(['shop_id' => $shopId]); $subShopList = [];
$subShopList = !empty($subShopList) ? array_column($subShopList,null,'shop_id') : []; 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') : []; $marketingList = !empty($marketingList) ? array_column($marketingList,null,'marketing_id') : [];
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
namespace App\Services\marketing; namespace App\Services\marketing;
use Api\PhpServices\Ksy\Ks3Api; use Api\PhpServices\Ksy\Ks3Api;
use Api\PhpUtils\Http\Request;
use Api\PhpUtils\Http\HttpUtil; use Api\PhpUtils\Http\HttpUtil;
use App\Exception\custom\InterfaceException; use App\Exception\custom\InterfaceException;
use App\Models\goods\mysql\Ota; use App\Models\goods\mysql\Ota;
...@@ -147,6 +148,49 @@ class MarketingService ...@@ -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 * @param $params
...@@ -231,6 +275,17 @@ class MarketingService ...@@ -231,6 +275,17 @@ class MarketingService
$params['page'] = !empty($params['page']) ? $params['page'] : 1; $params['page'] = !empty($params['page']) ? $params['page'] : 1;
$limit = !empty($params['page_size']) ? $params['page_size'] : 20; $limit = !empty($params['page_size']) ? $params['page_size'] : 20;
$page = ($params['page'] - 1) * $limit; $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; $where["marketing_type"] = Marketing::MARKETING_TYPE_PINDAN;
if (!empty($params['marketing_name'])) { if (!empty($params['marketing_name'])) {
...@@ -248,16 +303,20 @@ class MarketingService ...@@ -248,16 +303,20 @@ class MarketingService
$where["end_time[>=]"] = $now; $where["end_time[>=]"] = $now;
} elseif ($params["activity_status"] == MarketingPindan::ACTIVITY_STATUS_FINISHED) { } elseif ($params["activity_status"] == MarketingPindan::ACTIVITY_STATUS_FINISHED) {
$where["end_time[<]"] = $now; $where["end_time[<]"] = $now;
} //七日内结束的活动
if (!empty($params['from']) && $params['from'] == 1) {
if (!empty($params['from'])) { $beforeSevenDay = date("Y-m-d H:i:s", strtotime("-7 day"));
$beforeSevenDay = date("Y-m-d H:i:s", strtotime("-7 day")); $where["end_time[>]"] = $beforeSevenDay;
$where["start_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['life_account_id'] = self::getPublicLifeAccountId();
$where['ORDER'] = ["update_time" => "DESC"]; $where['ORDER'] = [$sortField => $sortType];
$where['LIMIT'] = [$page, $limit]; $where['LIMIT'] = [$page, $limit];
$list = Marketing::select(["marketing_id", "marketing_name", "start_time", "end_time", $list = Marketing::select(["marketing_id", "marketing_name", "start_time", "end_time",
"online_status", "update_time", "create_time"] "online_status", "update_time", "create_time"]
...@@ -270,7 +329,11 @@ class MarketingService ...@@ -270,7 +329,11 @@ class MarketingService
$marketingIds[] = $value["marketing_id"]; $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", $marketingPindanData = MarketingPindan::select(["marketing_id", "publish_life_account_id",
"min_price", "max_price", "pindan_desc","participate_number", "pindan_pic"] "min_price", "max_price", "pindan_desc","participate_number", "pindan_pic"]
...@@ -290,11 +353,6 @@ class MarketingService ...@@ -290,11 +353,6 @@ class MarketingService
$lists[$key]["online_status_desc"] = Marketing::$onlineStatusDesc[$value["online_status"]]; $lists[$key]["online_status_desc"] = Marketing::$onlineStatusDesc[$value["online_status"]];
if (!empty($priceData[$value["marketing_id"]])) { if (!empty($priceData[$value["marketing_id"]])) {
$currentLifeAccountId = $priceData[$value["marketing_id"]]["publish_life_account_id"]; $currentLifeAccountId = $priceData[$value["marketing_id"]]["publish_life_account_id"];
//小程序前端过滤掉线上测试生活号发布的活动
//TODO::预发环境要调整这里
if ($params['from'] == 1 && $currentLifeAccountId == self::ONLINE_LIFE_ACCOUNT_ID_TEST) {
continue;
}
$lists[$key]["publish_life_account_id"] = $currentLifeAccountId; $lists[$key]["publish_life_account_id"] = $currentLifeAccountId;
if (!empty($lifeAccountList[$currentLifeAccountId])) { if (!empty($lifeAccountList[$currentLifeAccountId])) {
...@@ -866,6 +924,24 @@ class MarketingService ...@@ -866,6 +924,24 @@ class MarketingService
Marketing::updateRecord($marketingParams, ["marketing_id" => $marketingId, "marketing_type" => $marketingType]); 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 * @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
...@@ -54,7 +54,8 @@ class TakePlaceService ...@@ -54,7 +54,8 @@ class TakePlaceService
public static function add($params) public static function add($params)
{ {
//验证life_account_id //验证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'); $url = config('interface', 'merchant.lifeaccount.get_life_account_by_id');
$lifeAccountRes = (new Request())->get($url, ["life_account_id" => $params["life_account_id"]]); $lifeAccountRes = (new Request())->get($url, ["life_account_id" => $params["life_account_id"]]);
...@@ -63,9 +64,9 @@ class TakePlaceService ...@@ -63,9 +64,9 @@ class TakePlaceService
} }
} }
$lifeAccountId = MarketingService::getPublicLifeAccountId();
$data['life_account_id'] = $params['life_account_id'] ?? $lifeAccountId; $data['life_account_id'] = $params['life_account_id'] ?? $lifeAccountId;
$data['take_place_name'] = $params['name']; $data['take_place_name'] = $params['name'];
$data['take_place_pic'] = $params['take_place_pic'] ?? '';
$data['longitude'] = $params['longitude']; $data['longitude'] = $params['longitude'];
$data['latitude'] = $params['latitude']; $data['latitude'] = $params['latitude'];
$data['location'] = $params['location']; $data['location'] = $params['location'];
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
namespace App\Services\tcc; namespace App\Services\tcc;
use Api\PhpUtils\Common\GoodsSkuId; use Api\PhpUtils\Common\GoodsSkuId;
use Api\PhpUtils\Log\FileLog;
use App\Exception\custom\GoodsException; use App\Exception\custom\GoodsException;
use App\Models\goods\mysql\GoodsSku; use App\Models\goods\mysql\GoodsSku;
use App\Models\goods\mysql\PindanGoodsSku; use App\Models\goods\mysql\PindanGoodsSku;
...@@ -491,7 +492,7 @@ class Tcc2Service ...@@ -491,7 +492,7 @@ class Tcc2Service
} }
} }
} }
FileLog::info('goods_cancel_confirm_tcc', 'json decode error raw:' . $keys);
if ($isPindan) { if ($isPindan) {
return self::pindanCancelConfirm($goodsInfoList); return self::pindanCancelConfirm($goodsInfoList);
} else { } else {
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
namespace App\Services\user; namespace App\Services\user;
use Api\PhpUtils\Mon\MonUtil;
use App\Models\user\mysql\UserWechatBind; use App\Models\user\mysql\UserWechatBind;
use Api\PhpUtils\Http\Request; use Api\PhpUtils\Http\Request;
use App\Services\user\Weixin\WxBizDataCrypt;; use App\Services\user\Weixin\WxBizDataCrypt;;
...@@ -27,8 +28,10 @@ class UserService ...@@ -27,8 +28,10 @@ class UserService
{ {
$code = !empty($params['code']) ? $params['code'] : '';//小程序授权code $code = !empty($params['code']) ? $params['code'] : '';//小程序授权code
$openid = !empty($params['openid']) ? $params['openid'] : '';//小程序授权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)) { 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]); throw new UserException(['cus' => 0]);
} }
...@@ -49,30 +52,37 @@ class UserService ...@@ -49,30 +52,37 @@ class UserService
//需要授权微信 //需要授权微信
//if (empty($openid)) { //if (empty($openid)) {
$appid = \Yaf\Registry::get('config')->wechat->appid; $appid = \Yaf\Registry::get('config')->wechat->appid;
$secret = \Yaf\Registry::get('config')->wechat->secret; $secret = \Yaf\Registry::get('config')->wechat->secret;
$grant_type = 'authorization_code'; $grant_type = 'authorization_code';
$loginUrl = 'https://api.weixin.qq.com/sns/jscode2session'; $loginUrl = 'https://api.weixin.qq.com/sns/jscode2session';
//请求接口,获取用户openid //请求接口,获取用户openid
$params = [ $params = [
'appid' => $appid, 'appid' => $appid,
'secret' => $secret, 'secret' => $secret,
'js_code' => $code, 'js_code' => $code,
'grant_type' => $grant_type, 'grant_type' => $grant_type,
]; ];
$response = (new Request())->post($loginUrl, $params); $begin = microtime(true);
$response = (new Request())->post($loginUrl, $params);
if ($response['code'] == 0) { $end = microtime(true);
$response = $response['response']; $totalTime = round(($end - $begin), 4) * 1000;
} if ($response['code'] == 0) {
$response = $response['response'];
}
if (empty($response) || array_key_exists('errcode', $response)) { //mon打点
//throw new \Exception('获取openid失败:' . $response['errcode']); $env = \Yaf\Application::app()->environ() ?? "dev";
FileLog::error("wechatLogin:获取openid失败", json_encode($params, JSON_UNESCAPED_UNICODE),'','jianghaiming@yidian-inc.com'); MonUtil::proxyMon($loginUrl, $response['code'], 'weixin_'.$env, $totalTime);
throw new UserException(['cus' => 1]);
} if (empty($response) || array_key_exists('errcode', $response)) {
//检查系统是已注册 //throw new \Exception('获取openid失败:' . $response['errcode']);
$openid = !empty($response['openid']) ? $response['openid'] : ''; 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 ...@@ -83,51 +93,60 @@ class UserService
'openid' => !empty($response['openid']) ? $response['openid'] : '', 'openid' => !empty($response['openid']) ? $response['openid'] : '',
'union_id' => !empty($response['unionid']) ? $response['unionid'] : '', 'union_id' => !empty($response['unionid']) ? $response['unionid'] : '',
'session_key' => !empty($response['session_key']) ? $response['session_key'] : '', //默认7200有效期 '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") 'create_time' => date("Y-m-d H:i:s")
]; ];
$sessionKey = !empty($response['session_key']) ? $response['session_key'] : ''; $sessionKey = !empty($response['session_key']) ? $response['session_key'] : '';
//$newWechatId = UserWechatBind::save($insert); //$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) { if (!$newWechatId) {
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');
FileLog::error("wechatLogin:登陆创建用户失败--insert", json_encode($insert, 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]); throw new UserException(['cus' => 2]);
} }
$user['wechat_id'] = $newWechatId; $user['wechat_id'] = $newWechatId;
$user['openid'] = $response['openid']; $user['openid'] = $response['openid'];
$user['session_key'] = $response['session_key']; $user['session_key'] = $response['session_key'];
}else{ } else {
if (empty($user)) { 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]); throw new UserException(['cus' => 2]);
} }
if (empty($response)){ if (empty($response)) {
FileLog::error("wechatLogin:登陆创建用户失败-- 微信response 获取失败", json_encode($params, JSON_UNESCAPED_UNICODE),'','jianghaiming@yidian-inc.com'); FileLog::error("wechatLogin:登陆创建用户失败-- 微信response 获取失败", json_encode($params, JSON_UNESCAPED_UNICODE), '', 'jianghaiming@yidian-inc.com');
throw new UserException(['cus' => 2]); throw new UserException(['cus' => 2]);
} }
$insert = [ $insert = [
'session_key' => !empty($response['session_key']) ? $response['session_key'] : '', '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); $user['third_session'] = self::generate3rdSession($openid);
$redis->set($keyCode, json_encode($user),120); $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) public static function bindPhone($params)
{ {
$openid = !empty($params['openid']) ? $params['openid'] : ''; $openid = !empty($params['openid']) ? $params['openid'] : '';
$encryptedData = !empty($params['encryptedData']) ? $params['encryptedData'] : ''; $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; $appid = \Yaf\Registry::get('config')->wechat->appid;
if (!$encryptedData) { if (!$encryptedData) {
FileLog::error("bindPhone:encryptedData 为空", json_encode($params, JSON_UNESCAPED_UNICODE),'','jianghaiming@yidian-inc.com'); FileLog::error("bindPhone:encryptedData 为空", json_encode($params, JSON_UNESCAPED_UNICODE),'','jianghaiming@yidian-inc.com');
throw new UserException(['cus' => 3]); throw new UserException(['cus' => 3]);
...@@ -164,7 +183,6 @@ class UserService ...@@ -164,7 +183,6 @@ class UserService
} }
$phoneNumber = strval($decryptData['phoneNumber']); $phoneNumber = strval($decryptData['phoneNumber']);
//判断是否已 //判断是否已
$user = UserWechatBind::getRecordMaster(['phone' => $phoneNumber]); $user = UserWechatBind::getRecordMaster(['phone' => $phoneNumber]);
if (!empty($user) && $openid != $user['openid']) { if (!empty($user) && $openid != $user['openid']) {
...@@ -213,7 +231,7 @@ class UserService ...@@ -213,7 +231,7 @@ class UserService
public static function userWechatBind($params) public static function userWechatBind($params)
{ {
$data['wechat_id[>]'] = 0; $data['wechat_id[>]'] = 0;
if (!empty($params['openid'])) { if (!empty($params['openid'])) {
...@@ -223,7 +241,11 @@ class UserService ...@@ -223,7 +241,11 @@ class UserService
if (!empty($params['user_id'])) { if (!empty($params['user_id'])) {
$data['user_id'] = $params['user_id']; $data['user_id'] = $params['user_id'];
} }
if (!empty($params['phone'])) {
$data['phone'] = $params['phone'];
}
$userList = UserWechatBind::getRecords($data); $userList = UserWechatBind::getRecords($data);
return $userList; return $userList;
} }
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
"require": { "require": {
"php": "7.2.*", "php": "7.2.*",
"ext-json": "*", "ext-json": "*",
"api/php_utils":"1.0.12", "api/php_utils":"1.0.17",
"api/php_services":"1.0.9", "api/php_services":"1.0.14",
"ext-openssl": "*" "ext-openssl": "*"
}, },
"minimum-stability": "dev", "minimum-stability": "dev",
......
This diff is collapsed.
...@@ -11,6 +11,14 @@ idgen.partner = "bp" ...@@ -11,6 +11,14 @@ idgen.partner = "bp"
idgen.key = "5cfdb867e96374c7883b31d6928cc4cb" idgen.key = "5cfdb867e96374c7883b31d6928cc4cb"
[prod : common] [prod : common]
colonel.wallet.transfer_service_id="21090614423333205002"
colonel.wallet.transfer_service_secret="4916927cf3305292f5a524db592dfa95"
[perf : common ] [perf : common ]
colonel.wallet.transfer_service_id="21090614423333205002"
colonel.wallet.transfer_service_secret="4916927cf3305292f5a524db592dfa95"
[test: common ] [test: common ]
[dev : common ] colonel.wallet.transfer_service_id="21090614423333205002"
\ No newline at end of file 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 ...@@ -1891,6 +1891,7 @@ opcache.huge_code_pages=1
apc.shm_size=1024M apc.shm_size=1024M
apc.slam_defense=1 apc.slam_defense=1
apc.serializer=igbinary apc.serializer=igbinary
apc.enable_cli=1
[memcached] [memcached]
memcached.sess_connect_timeout=1000 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) { ...@@ -35,6 +35,9 @@ if ($param) {
$_SERVER['SERVER_NAME'] = 'daemon.goods'; $_SERVER['SERVER_NAME'] = 'daemon.goods';
$_SERVER['REMOTE_ADDR'] = '127.0.0.1'; $_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)); $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; ...@@ -6,6 +6,7 @@ use Api\PhpUtils\Cache\ApcuUtil;
use Api\PhpUtils\Log\DaemonLog; use Api\PhpUtils\Log\DaemonLog;
use Api\PhpUtils\Message\Email; use Api\PhpUtils\Message\Email;
use Yaf\Application; use Yaf\Application;
use App\Exception\ExceptionErrorCatch;
class Daemon class Daemon
{ {
...@@ -266,7 +267,7 @@ class Daemon ...@@ -266,7 +267,7 @@ class Daemon
ini_set('date.timezone','Asia/Shanghai'); ini_set('date.timezone','Asia/Shanghai');
ini_set("memory_limit", '2048M'); ini_set("memory_limit", '2048M');
error_reporting(E_ALL); error_reporting(E_ALL);
set_error_handler([ExceptionErrorCatch::class, 'appError'], E_ALL & ~E_DEPRECATED);
//日志存储到 php-error.log //日志存储到 php-error.log
/* /*
//创建任务日志文件 //创建任务日志文件
......
...@@ -37,8 +37,17 @@ class JwUser ...@@ -37,8 +37,17 @@ class JwUser
} }
$params = ["mobilePhone" => $params['mobile']]; $params = ["mobilePhone" => $params['mobile']];
//$user_info = (new TimeOut())->runGet($url, $params); $begin = microtime(true);
$user_info = (new Request())->get($url, $params); $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)); FileLog::info('jw_user_getUserInfo', json_encode($user_info));
if (!$user_info) { if (!$user_info) {
throw new CodeSpecialException("timeout"); throw new CodeSpecialException("timeout");
...@@ -61,7 +70,6 @@ class JwUser ...@@ -61,7 +70,6 @@ class JwUser
} }
$params = ["userId" => $params['user_id']]; $params = ["userId" => $params['user_id']];
//$user_info = (new TimeOut())->runPost($url, $params);
$begin = microtime(true); $begin = microtime(true);
$user_info = (new Request())->post($url, $params); $user_info = (new Request())->post($url, $params);
$end = microtime(true); $end = microtime(true);
...@@ -71,7 +79,9 @@ class JwUser ...@@ -71,7 +79,9 @@ class JwUser
} else { } else {
$code = -1; $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)); FileLog::info('jw_user_getUserByUserId', json_encode($user_info));
if (!$user_info) { if (!$user_info) {
throw new CodeSpecialException("timeout"); throw new CodeSpecialException("timeout");
...@@ -91,8 +101,17 @@ class JwUser ...@@ -91,8 +101,17 @@ class JwUser
} }
$params = ["userIds" => $params['user_id']]; $params = ["userIds" => $params['user_id']];
//$user_info = (new TimeOut())->runPost($url, $params); $begin = microtime(true);
$user_info = (new Request())->post($url, $params, 0, '', '', 0, true, 'jw_user'); $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)); FileLog::info('jw_user_getUserList', json_encode($user_info));
if (!$user_info) { if (!$user_info) {
throw new CodeSpecialException("timeout"); throw new CodeSpecialException("timeout");
...@@ -139,7 +158,17 @@ class JwUser ...@@ -139,7 +158,17 @@ class JwUser
throw new CodeSpecialException("failed"); throw new CodeSpecialException("failed");
} }
//$pushToken = (new TimeOut())->runPost($url, $params); //$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)); FileLog::info('jw_user_savePushToken', json_encode($pushToken));
if (!$pushToken) { if (!$pushToken) {
throw new CodeSpecialException("timeout"); throw new CodeSpecialException("timeout");
...@@ -163,8 +192,17 @@ class JwUser ...@@ -163,8 +192,17 @@ class JwUser
} }
$params = ["userIds" => $params['user_id']]; $params = ["userIds" => $params['user_id']];
//$list = (new TimeOut())->runPost($url, $params); $begin = microtime(true);
$list = (new Request())->post($url, $params, 0, '', '', 0, true, 'jw_user'); $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)); FileLog::info('jw_user_getUserListWithDynamic', json_encode($list));
if (!$list) { if (!$list) {
throw new CodeSpecialException("timeout"); throw new CodeSpecialException("timeout");
...@@ -188,8 +226,17 @@ class JwUser ...@@ -188,8 +226,17 @@ class JwUser
} }
$params = ["userId" => $params['user_id']]; $params = ["userId" => $params['user_id']];
//$list = (new TimeOut())->runPost($url, $params); $begin = microtime(true);
$list = (new Request())->post($url, $params, 0, '', '', 0, true, 'jw_user'); $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)); FileLog::info('jw_user_getUserDigg', json_encode($list));
if (!$list) { if (!$list) {
throw new CodeSpecialException("timeout"); throw new CodeSpecialException("timeout");
...@@ -206,8 +253,17 @@ class JwUser ...@@ -206,8 +253,17 @@ class JwUser
if (!$url) { if (!$url) {
throw new CodeSpecialException("failed"); throw new CodeSpecialException("failed");
} }
//$ret = (new TimeOut())->runPost($url, $params); $begin = microtime(true);
$ret = (new Request())->post($url, $params, 0, '', '', 0, true, 'jw_user'); $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)); FileLog::info('jw_user_saveUpdateLife', json_encode($ret));
if (!$ret) { if (!$ret) {
throw new CodeSpecialException("timeout"); throw new CodeSpecialException("timeout");
...@@ -224,8 +280,17 @@ class JwUser ...@@ -224,8 +280,17 @@ class JwUser
if (!$url) { if (!$url) {
throw new CodeSpecialException("failed"); throw new CodeSpecialException("failed");
} }
//$ret = (new TimeOut())->runPost($url, $params); $begin = microtime(true);
$ret = (new Request())->post($url, $params, 0, '', '', 0, true, 'jw_user'); $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)); FileLog::info('getWechatOpenid', json_encode($ret));
if (!$ret) { if (!$ret) {
throw new CodeSpecialException("timeout"); throw new CodeSpecialException("timeout");
...@@ -243,8 +308,17 @@ class JwUser ...@@ -243,8 +308,17 @@ class JwUser
if (!$url) { if (!$url) {
throw new CodeSpecialException("failed"); throw new CodeSpecialException("failed");
} }
//$ret = (new TimeOut())->runPost($url, $params); $begin = microtime(true);
$ret = (new Request())->post($url, $params, 0, '', '', 0, true, 'jw_user'); $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)); FileLog::info('getWechatOpenid', json_encode($ret));
if (!$ret) { if (!$ret) {
throw new CodeSpecialException("timeout"); throw new CodeSpecialException("timeout");
......
...@@ -77,6 +77,23 @@ class FeiPrinter extends \Api\PhpServices\Printer\Printer ...@@ -77,6 +77,23 @@ class FeiPrinter extends \Api\PhpServices\Printer\Printer
return HttpUtil::post(self::API, http_build_query($param)); 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 * @inheritDoc
* @throws \Exception * @throws \Exception
...@@ -139,20 +156,17 @@ class FeiPrinter extends \Api\PhpServices\Printer\Printer ...@@ -139,20 +156,17 @@ class FeiPrinter extends \Api\PhpServices\Printer\Printer
$formattedContent .= "$formattedRow<BR>"; $formattedContent .= "$formattedRow<BR>";
} }
$first = false; $first = false;
}
$res = $this->request(self::API_PRINT, [ if (strlen($formattedContent) > 4000) {
'sn' => $printerId, $return = self::_printContent($printerId, $formattedContent);
'content' => $formattedContent, $formattedContent = "";
'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("接口调用异常");
if (!empty($formattedContent))
$return = self::_printContent($printerId, $formattedContent);
return $return;
} }
/** /**
......
...@@ -43,6 +43,7 @@ class WechatBind ...@@ -43,6 +43,7 @@ class WechatBind
if ((strtotime($userInfo['create_time']) + $timeInterval) > time()) { if ((strtotime($userInfo['create_time']) + $timeInterval) > time()) {
return true; return true;
} }
return false;
} }
// 没有查询到对应的openid数据 // 没有查询到对应的openid数据
FileLog::error("调用isNewWechatUser方法未获取到数据:", json_encode(['openid' => $openid, 'timeInterval' => $timeInterval, 'res' => $res])); FileLog::error("调用isNewWechatUser方法未获取到数据:", json_encode(['openid' => $openid, 'timeInterval' => $timeInterval, 'res' => $res]));
......
...@@ -61,7 +61,7 @@ class HttpUtil ...@@ -61,7 +61,7 @@ class HttpUtil
{ {
// 增加traceId // 增加traceId
if(is_array($headers)) { if(is_array($headers)) {
$headers['X-TRACE-ID'] = Tracer::getTraceId(); $headers[] = 'X-TRACE-ID: ' . Tracer::getTraceId();
} }
$url = $url ."?". http_build_query($params); $url = $url ."?". http_build_query($params);
return self::curl($url, $timeout, $retries, $headers, [], $proxy, 'GET', $curl_opts); return self::curl($url, $timeout, $retries, $headers, [], $proxy, 'GET', $curl_opts);
...@@ -97,7 +97,7 @@ class HttpUtil ...@@ -97,7 +97,7 @@ class HttpUtil
{ {
// 增加traceId // 增加traceId
if(is_array($headers)) { 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); return self::curl($url, $timeout, $retries, $headers, $post, $proxy, 'POST', $curl_opts);
} }
......
...@@ -8,6 +8,7 @@ use Api\PhpUtils\Message\Email; ...@@ -8,6 +8,7 @@ use Api\PhpUtils\Message\Email;
class FileLog class FileLog
{ {
static private $log = true;
const PREFIX_FILELOG_ERROR = 'flerr:'; const PREFIX_FILELOG_ERROR = 'flerr:';
/** /**
* 用于记录info级别的错误 * 用于记录info级别的错误
...@@ -18,6 +19,10 @@ class FileLog ...@@ -18,6 +19,10 @@ class FileLog
*/ */
public static function info($signature, $detail_info = '', $with_access_log = false) public static function info($signature, $detail_info = '', $with_access_log = false)
{ {
if(self::$log == false) {
return true;
}
$traceId = Tracer::getTraceId(); $traceId = Tracer::getTraceId();
$log = 'PHP User_info: [' . $signature . '] [traceId:'. $traceId .'] [detail info:] ' . $detail_info; $log = 'PHP User_info: [' . $signature . '] [traceId:'. $traceId .'] [detail info:] ' . $detail_info;
if ($with_access_log) { if ($with_access_log) {
...@@ -26,6 +31,10 @@ class FileLog ...@@ -26,6 +31,10 @@ class FileLog
error_log($log); error_log($log);
} }
public static function closeInfo(bool $flag) {
self::$log = $flag;
}
/** /**
* 用于记录waring级别的错误,在日志分析时此级别日志会使用signature进行聚合 * 用于记录waring级别的错误,在日志分析时此级别日志会使用signature进行聚合
* 会记录请求上下文,不会发生报警邮件 * 会记录请求上下文,不会发生报警邮件
...@@ -69,6 +78,7 @@ class FileLog ...@@ -69,6 +78,7 @@ class FileLog
} }
$subject = 'App api #' . $signature . '# ' . $_SERVER['SERVER_NAME'] . ' (' . $_SERVER['SERVER_ADDR'] . ') Alert Message'; $subject = 'App api #' . $signature . '# ' . $_SERVER['SERVER_NAME'] . ' (' . $_SERVER['SERVER_ADDR'] . ') Alert Message';
$body = 'Error: ' . $signature . "\n\n"; $body = 'Error: ' . $signature . "\n\n";
$body .= 'traceId: ' . $traceId . "\n\n";
$body .= 'Detail info: ' . $detail_info . "\n\n"; $body .= 'Detail info: ' . $detail_info . "\n\n";
$body .= 'Exception info: ' . $exception_info . "\n\n"; $body .= 'Exception info: ' . $exception_info . "\n\n";
$body .= 'Request info: ' . self::accessLog() . "\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 ...@@ -338,7 +338,7 @@ class ClassLoader
* Loads the given class or interface. * Loads the given class or interface.
* *
* @param string $class The name of the class * @param string $class The name of the class
* @return true|null True if loaded, null otherwise * @return bool|null True if loaded, null otherwise
*/ */
public function loadClass($class) public function loadClass($class)
{ {
...@@ -347,8 +347,6 @@ class ClassLoader ...@@ -347,8 +347,6 @@ class ClassLoader
return true; return true;
} }
return null;
} }
/** /**
......
This diff is collapsed.
...@@ -67,6 +67,7 @@ return array( ...@@ -67,6 +67,7 @@ return array(
'Api\\PhpUtils\\Lock\\FrequencyLockUtil' => $vendorDir . '/api/php_utils/src/Lock/FrequencyLockUtil.php', '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\\DaemonLog' => $vendorDir . '/api/php_utils/src/Log/DaemonLog.php',
'Api\\PhpUtils\\Log\\FileLog' => $vendorDir . '/api/php_utils/src/Log/FileLog.php', 'Api\\PhpUtils\\Log\\FileLog' => $vendorDir . '/api/php_utils/src/Log/FileLog.php',
'Api\\PhpUtils\\Log\\JobLog' => $vendorDir . '/api/php_utils/src/Log/JobLog.php',
'Api\\PhpUtils\\Log\\Tracer' => $vendorDir . '/api/php_utils/src/Log/Tracer.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\\Message\\Email' => $vendorDir . '/api/php_utils/src/Message/Email.php',
'Api\\PhpUtils\\Mon\\MonUtil' => $vendorDir . '/api/php_utils/src/Mon/MonUtil.php', 'Api\\PhpUtils\\Mon\\MonUtil' => $vendorDir . '/api/php_utils/src/Mon/MonUtil.php',
...@@ -83,6 +84,7 @@ return array( ...@@ -83,6 +84,7 @@ return array(
'Api\\PhpUtils\\Validate\\ValidateRule' => $vendorDir . '/api/php_utils/src/Validate/ValidateRule.php', 'Api\\PhpUtils\\Validate\\ValidateRule' => $vendorDir . '/api/php_utils/src/Validate/ValidateRule.php',
'App\\Base\\Base' => $baseDir . '/application/modules/Base/Base.php', 'App\\Base\\Base' => $baseDir . '/application/modules/Base/Base.php',
'App\\Base\\Cli' => $baseDir . '/application/modules/Base/Cli.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\\BaseException' => $baseDir . '/application/exception/BaseException.php',
'App\\Exception\\ErrorHandler' => $baseDir . '/application/exception/ErrorHandler.php', 'App\\Exception\\ErrorHandler' => $baseDir . '/application/exception/ErrorHandler.php',
'App\\Exception\\ExceptionErrorCatch' => $baseDir . '/application/exception/ExceptionErrorCatch.php', 'App\\Exception\\ExceptionErrorCatch' => $baseDir . '/application/exception/ExceptionErrorCatch.php',
...@@ -119,6 +121,12 @@ return array( ...@@ -119,6 +121,12 @@ return array(
'App\\Models\\goods\\mysql\\PindanGoodsSnapshot' => $baseDir . '/application/models/goods/mysql/PindanGoodsSnapshot.php', '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\\Shop' => $baseDir . '/application/models/goods/mysql/Shop.php',
'App\\Models\\goods\\mysql\\Tcc' => $baseDir . '/application/models/goods/mysql/Tcc.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\\Distributor' => $baseDir . '/application/models/marketing/mysql/Distributor.php',
'App\\Models\\marketing\\mysql\\DistributorAuditRecord' => $baseDir . '/application/models/marketing/mysql/DistributorAuditRecord.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', 'App\\Models\\marketing\\mysql\\Marketing' => $baseDir . '/application/models/marketing/mysql/Marketing.php',
...@@ -142,11 +150,14 @@ return array( ...@@ -142,11 +150,14 @@ return array(
'App\\Services\\goods\\GoodsSnapshotsService' => $baseDir . '/application/services/goods/GoodsSnapshotsService.php', 'App\\Services\\goods\\GoodsSnapshotsService' => $baseDir . '/application/services/goods/GoodsSnapshotsService.php',
'App\\Services\\goods\\MarketingPindanGoodsService' => $baseDir . '/application/services/goods/MarketingPindanGoodsService.php', 'App\\Services\\goods\\MarketingPindanGoodsService' => $baseDir . '/application/services/goods/MarketingPindanGoodsService.php',
'App\\Services\\goods\\OtaService' => $baseDir . '/application/services/goods/OtaService.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\\DistributionService' => $baseDir . '/application/services/marketing/DistributionService.php',
'App\\Services\\marketing\\DistributorService' => $baseDir . '/application/services/marketing/DistributorService.php', 'App\\Services\\marketing\\DistributorService' => $baseDir . '/application/services/marketing/DistributorService.php',
'App\\Services\\marketing\\MarketingForOrderService' => $baseDir . '/application/services/marketing/MarketingForOrderService.php', 'App\\Services\\marketing\\MarketingForOrderService' => $baseDir . '/application/services/marketing/MarketingForOrderService.php',
'App\\Services\\marketing\\MarketingGoodsService' => $baseDir . '/application/services/marketing/MarketingGoodsService.php', 'App\\Services\\marketing\\MarketingGoodsService' => $baseDir . '/application/services/marketing/MarketingGoodsService.php',
'App\\Services\\marketing\\MarketingService' => $baseDir . '/application/services/marketing/MarketingService.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\\marketing\\TakePlaceService' => $baseDir . '/application/services/marketing/TakePlaceService.php',
'App\\Services\\shop\\ShopService' => $baseDir . '/application/services/shop/ShopService.php', 'App\\Services\\shop\\ShopService' => $baseDir . '/application/services/shop/ShopService.php',
'App\\Services\\tcc\\Tcc2Service' => $baseDir . '/application/services/tcc/Tcc2Service.php', 'App\\Services\\tcc\\Tcc2Service' => $baseDir . '/application/services/tcc/Tcc2Service.php',
...@@ -226,6 +237,8 @@ return array( ...@@ -226,6 +237,8 @@ return array(
'DASPRiD\\Enum\\Exception\\SerializeNotSupportedException' => $vendorDir . '/dasprid/enum/src/Exception/SerializeNotSupportedException.php', 'DASPRiD\\Enum\\Exception\\SerializeNotSupportedException' => $vendorDir . '/dasprid/enum/src/Exception/SerializeNotSupportedException.php',
'DASPRiD\\Enum\\Exception\\UnserializeNotSupportedException' => $vendorDir . '/dasprid/enum/src/Exception/UnserializeNotSupportedException.php', 'DASPRiD\\Enum\\Exception\\UnserializeNotSupportedException' => $vendorDir . '/dasprid/enum/src/Exception/UnserializeNotSupportedException.php',
'DASPRiD\\Enum\\NullValue' => $vendorDir . '/dasprid/enum/src/NullValue.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\\Goods' => $baseDir . '/daemon/Goods.php',
'Daemon\\Marketing' => $baseDir . '/daemon/Marketing.php', 'Daemon\\Marketing' => $baseDir . '/daemon/Marketing.php',
'Daemon\\Pindan' => $baseDir . '/daemon/Pindan.php', 'Daemon\\Pindan' => $baseDir . '/daemon/Pindan.php',
......
...@@ -8,18 +8,18 @@ $baseDir = dirname($vendorDir); ...@@ -8,18 +8,18 @@ $baseDir = dirname($vendorDir);
return array( return array(
'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php', 'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php',
'6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php', '6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php',
'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', '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', 'b6b991a57620e2fb6b2f66f03fe9ddc2' => $vendorDir . '/symfony/string/Resources/functions.php',
'0d59ee240a4cd96ddbb4ff164fccea4d' => $vendorDir . '/symfony/polyfill-php73/bootstrap.php',
'7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php', '7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php',
'ad155f8f1cf0d418fe49e248db8c661b' => $vendorDir . '/react/promise/src/functions_include.php', 'ad155f8f1cf0d418fe49e248db8c661b' => $vendorDir . '/react/promise/src/functions_include.php',
'0d59ee240a4cd96ddbb4ff164fccea4d' => $vendorDir . '/symfony/polyfill-php73/bootstrap.php',
'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php', 'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php',
'a9ed0d27b5a698798a89181429f162c5' => $vendorDir . '/khanamiryan/qrcode-detector-decoder/lib/Common/customFunctions.php',
'a0edc8309cc5e1d60e3047b5df6b7052' => $vendorDir . '/guzzlehttp/psr7/src/functions_include.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', '37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php',
'3a37ebac017bc098e9a86b35401e7a68' => $vendorDir . '/mongodb/mongodb/src/functions.php', '3a37ebac017bc098e9a86b35401e7a68' => $vendorDir . '/mongodb/mongodb/src/functions.php',
'8592c7b0947d8a0965a9e8c3d16f9c24' => $vendorDir . '/elasticsearch/elasticsearch/src/autoload.php',
); );
...@@ -9,20 +9,20 @@ class ComposerStaticInit14d712e6ba9ca61e9e636d6cf65f43bf ...@@ -9,20 +9,20 @@ class ComposerStaticInit14d712e6ba9ca61e9e636d6cf65f43bf
public static $files = array ( public static $files = array (
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php', 'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
'6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php', '6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php',
'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', '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', 'b6b991a57620e2fb6b2f66f03fe9ddc2' => __DIR__ . '/..' . '/symfony/string/Resources/functions.php',
'0d59ee240a4cd96ddbb4ff164fccea4d' => __DIR__ . '/..' . '/symfony/polyfill-php73/bootstrap.php',
'7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php', '7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php',
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php', 'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
'0d59ee240a4cd96ddbb4ff164fccea4d' => __DIR__ . '/..' . '/symfony/polyfill-php73/bootstrap.php',
'c964ee0ededf28c96ebd9db5099ef910' => __DIR__ . '/..' . '/guzzlehttp/promises/src/functions_include.php', 'c964ee0ededf28c96ebd9db5099ef910' => __DIR__ . '/..' . '/guzzlehttp/promises/src/functions_include.php',
'a9ed0d27b5a698798a89181429f162c5' => __DIR__ . '/..' . '/khanamiryan/qrcode-detector-decoder/lib/Common/customFunctions.php',
'a0edc8309cc5e1d60e3047b5df6b7052' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/functions_include.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', '37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php',
'3a37ebac017bc098e9a86b35401e7a68' => __DIR__ . '/..' . '/mongodb/mongodb/src/functions.php', '3a37ebac017bc098e9a86b35401e7a68' => __DIR__ . '/..' . '/mongodb/mongodb/src/functions.php',
'8592c7b0947d8a0965a9e8c3d16f9c24' => __DIR__ . '/..' . '/elasticsearch/elasticsearch/src/autoload.php',
); );
public static $prefixLengthsPsr4 = array ( public static $prefixLengthsPsr4 = array (
...@@ -296,6 +296,7 @@ class ComposerStaticInit14d712e6ba9ca61e9e636d6cf65f43bf ...@@ -296,6 +296,7 @@ class ComposerStaticInit14d712e6ba9ca61e9e636d6cf65f43bf
'Api\\PhpUtils\\Lock\\FrequencyLockUtil' => __DIR__ . '/..' . '/api/php_utils/src/Lock/FrequencyLockUtil.php', '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\\DaemonLog' => __DIR__ . '/..' . '/api/php_utils/src/Log/DaemonLog.php',
'Api\\PhpUtils\\Log\\FileLog' => __DIR__ . '/..' . '/api/php_utils/src/Log/FileLog.php', 'Api\\PhpUtils\\Log\\FileLog' => __DIR__ . '/..' . '/api/php_utils/src/Log/FileLog.php',
'Api\\PhpUtils\\Log\\JobLog' => __DIR__ . '/..' . '/api/php_utils/src/Log/JobLog.php',
'Api\\PhpUtils\\Log\\Tracer' => __DIR__ . '/..' . '/api/php_utils/src/Log/Tracer.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\\Message\\Email' => __DIR__ . '/..' . '/api/php_utils/src/Message/Email.php',
'Api\\PhpUtils\\Mon\\MonUtil' => __DIR__ . '/..' . '/api/php_utils/src/Mon/MonUtil.php', 'Api\\PhpUtils\\Mon\\MonUtil' => __DIR__ . '/..' . '/api/php_utils/src/Mon/MonUtil.php',
...@@ -312,6 +313,7 @@ class ComposerStaticInit14d712e6ba9ca61e9e636d6cf65f43bf ...@@ -312,6 +313,7 @@ class ComposerStaticInit14d712e6ba9ca61e9e636d6cf65f43bf
'Api\\PhpUtils\\Validate\\ValidateRule' => __DIR__ . '/..' . '/api/php_utils/src/Validate/ValidateRule.php', 'Api\\PhpUtils\\Validate\\ValidateRule' => __DIR__ . '/..' . '/api/php_utils/src/Validate/ValidateRule.php',
'App\\Base\\Base' => __DIR__ . '/../..' . '/application/modules/Base/Base.php', 'App\\Base\\Base' => __DIR__ . '/../..' . '/application/modules/Base/Base.php',
'App\\Base\\Cli' => __DIR__ . '/../..' . '/application/modules/Base/Cli.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\\BaseException' => __DIR__ . '/../..' . '/application/exception/BaseException.php',
'App\\Exception\\ErrorHandler' => __DIR__ . '/../..' . '/application/exception/ErrorHandler.php', 'App\\Exception\\ErrorHandler' => __DIR__ . '/../..' . '/application/exception/ErrorHandler.php',
'App\\Exception\\ExceptionErrorCatch' => __DIR__ . '/../..' . '/application/exception/ExceptionErrorCatch.php', 'App\\Exception\\ExceptionErrorCatch' => __DIR__ . '/../..' . '/application/exception/ExceptionErrorCatch.php',
...@@ -348,6 +350,12 @@ class ComposerStaticInit14d712e6ba9ca61e9e636d6cf65f43bf ...@@ -348,6 +350,12 @@ class ComposerStaticInit14d712e6ba9ca61e9e636d6cf65f43bf
'App\\Models\\goods\\mysql\\PindanGoodsSnapshot' => __DIR__ . '/../..' . '/application/models/goods/mysql/PindanGoodsSnapshot.php', '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\\Shop' => __DIR__ . '/../..' . '/application/models/goods/mysql/Shop.php',
'App\\Models\\goods\\mysql\\Tcc' => __DIR__ . '/../..' . '/application/models/goods/mysql/Tcc.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\\Distributor' => __DIR__ . '/../..' . '/application/models/marketing/mysql/Distributor.php',
'App\\Models\\marketing\\mysql\\DistributorAuditRecord' => __DIR__ . '/../..' . '/application/models/marketing/mysql/DistributorAuditRecord.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', 'App\\Models\\marketing\\mysql\\Marketing' => __DIR__ . '/../..' . '/application/models/marketing/mysql/Marketing.php',
...@@ -371,11 +379,14 @@ class ComposerStaticInit14d712e6ba9ca61e9e636d6cf65f43bf ...@@ -371,11 +379,14 @@ class ComposerStaticInit14d712e6ba9ca61e9e636d6cf65f43bf
'App\\Services\\goods\\GoodsSnapshotsService' => __DIR__ . '/../..' . '/application/services/goods/GoodsSnapshotsService.php', 'App\\Services\\goods\\GoodsSnapshotsService' => __DIR__ . '/../..' . '/application/services/goods/GoodsSnapshotsService.php',
'App\\Services\\goods\\MarketingPindanGoodsService' => __DIR__ . '/../..' . '/application/services/goods/MarketingPindanGoodsService.php', 'App\\Services\\goods\\MarketingPindanGoodsService' => __DIR__ . '/../..' . '/application/services/goods/MarketingPindanGoodsService.php',
'App\\Services\\goods\\OtaService' => __DIR__ . '/../..' . '/application/services/goods/OtaService.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\\DistributionService' => __DIR__ . '/../..' . '/application/services/marketing/DistributionService.php',
'App\\Services\\marketing\\DistributorService' => __DIR__ . '/../..' . '/application/services/marketing/DistributorService.php', 'App\\Services\\marketing\\DistributorService' => __DIR__ . '/../..' . '/application/services/marketing/DistributorService.php',
'App\\Services\\marketing\\MarketingForOrderService' => __DIR__ . '/../..' . '/application/services/marketing/MarketingForOrderService.php', 'App\\Services\\marketing\\MarketingForOrderService' => __DIR__ . '/../..' . '/application/services/marketing/MarketingForOrderService.php',
'App\\Services\\marketing\\MarketingGoodsService' => __DIR__ . '/../..' . '/application/services/marketing/MarketingGoodsService.php', 'App\\Services\\marketing\\MarketingGoodsService' => __DIR__ . '/../..' . '/application/services/marketing/MarketingGoodsService.php',
'App\\Services\\marketing\\MarketingService' => __DIR__ . '/../..' . '/application/services/marketing/MarketingService.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\\marketing\\TakePlaceService' => __DIR__ . '/../..' . '/application/services/marketing/TakePlaceService.php',
'App\\Services\\shop\\ShopService' => __DIR__ . '/../..' . '/application/services/shop/ShopService.php', 'App\\Services\\shop\\ShopService' => __DIR__ . '/../..' . '/application/services/shop/ShopService.php',
'App\\Services\\tcc\\Tcc2Service' => __DIR__ . '/../..' . '/application/services/tcc/Tcc2Service.php', 'App\\Services\\tcc\\Tcc2Service' => __DIR__ . '/../..' . '/application/services/tcc/Tcc2Service.php',
...@@ -455,6 +466,8 @@ class ComposerStaticInit14d712e6ba9ca61e9e636d6cf65f43bf ...@@ -455,6 +466,8 @@ class ComposerStaticInit14d712e6ba9ca61e9e636d6cf65f43bf
'DASPRiD\\Enum\\Exception\\SerializeNotSupportedException' => __DIR__ . '/..' . '/dasprid/enum/src/Exception/SerializeNotSupportedException.php', 'DASPRiD\\Enum\\Exception\\SerializeNotSupportedException' => __DIR__ . '/..' . '/dasprid/enum/src/Exception/SerializeNotSupportedException.php',
'DASPRiD\\Enum\\Exception\\UnserializeNotSupportedException' => __DIR__ . '/..' . '/dasprid/enum/src/Exception/UnserializeNotSupportedException.php', 'DASPRiD\\Enum\\Exception\\UnserializeNotSupportedException' => __DIR__ . '/..' . '/dasprid/enum/src/Exception/UnserializeNotSupportedException.php',
'DASPRiD\\Enum\\NullValue' => __DIR__ . '/..' . '/dasprid/enum/src/NullValue.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\\Goods' => __DIR__ . '/../..' . '/daemon/Goods.php',
'Daemon\\Marketing' => __DIR__ . '/../..' . '/daemon/Marketing.php', 'Daemon\\Marketing' => __DIR__ . '/../..' . '/daemon/Marketing.php',
'Daemon\\Pindan' => __DIR__ . '/../..' . '/daemon/Pindan.php', 'Daemon\\Pindan' => __DIR__ . '/../..' . '/daemon/Pindan.php',
......
This diff is collapsed.
This diff is collapsed.
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 Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal 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 ...@@ -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_rejected` | `Is::rejected` |
| `is_settled` | `Is::settled` | | `is_settled` | `Is::settled` |
| `coroutine` | `Coroutine::of` | | `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 @@ ...@@ -4,10 +4,25 @@
"keywords": ["promise"], "keywords": ["promise"],
"license": "MIT", "license": "MIT",
"authors": [ "authors": [
{
"name": "Graham Campbell",
"email": "hello@gjcampbell.co.uk",
"homepage": "https://github.com/GrahamCampbell"
},
{ {
"name": "Michael Dowling", "name": "Michael Dowling",
"email": "mtdowling@gmail.com", "email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling" "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": { "require": {
...@@ -35,5 +50,9 @@ ...@@ -35,5 +50,9 @@
"branch-alias": { "branch-alias": {
"dev-master": "1.4-dev" "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: ...@@ -10,7 +10,7 @@ jobs:
strategy: strategy:
max-parallel: 10 max-parallel: 10
matrix: 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: steps:
- name: Set up PHP - name: Set up PHP
...@@ -23,8 +23,12 @@ jobs: ...@@ -23,8 +23,12 @@ jobs:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Mimic PHP 8.0
run: composer config platform.php 8.0.999
if: matrix.php > 8
- name: Install dependencies - name: Install dependencies
run: composer update --no-interaction --no-progress --prefer-dist run: composer update --no-interaction --no-progress
- name: Run tests - name: Run tests
run: make test run: make test
...@@ -26,7 +26,7 @@ jobs: ...@@ -26,7 +26,7 @@ jobs:
- name: Download dependencies - name: Download dependencies
uses: ramsey/composer-install@v1 uses: ramsey/composer-install@v1
with: with:
composer-options: --no-interaction --prefer-dist --optimize-autoloader composer-options: --no-interaction --optimize-autoloader
- name: Start server - name: Start server
run: php -S 127.0.0.1:10002 tests/Integration/server.php & 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 Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal 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 ...@@ -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. `$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 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. 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", "name": "guzzlehttp/psr7",
"type": "library",
"description": "PSR-7 message implementation that also provides common utility methods", "description": "PSR-7 message implementation that also provides common utility methods",
"keywords": ["request", "response", "message", "stream", "http", "uri", "url", "psr-7"], "keywords": ["request", "response", "message", "stream", "http", "uri", "url", "psr-7"],
"license": "MIT", "license": "MIT",
"authors": [ "authors": [
{
"name": "Graham Campbell",
"email": "hello@gjcampbell.co.uk",
"homepage": "https://github.com/GrahamCampbell"
},
{ {
"name": "Michael Dowling", "name": "Michael Dowling",
"email": "mtdowling@gmail.com", "email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling" "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", "name": "Tobias Schultze",
"email": "webmaster@tubo-world.de",
"homepage": "https://github.com/Tobion" "homepage": "https://github.com/Tobion"
} }
], ],
...@@ -45,5 +65,9 @@ ...@@ -45,5 +65,9 @@
"branch-alias": { "branch-alias": {
"dev-master": "1.7-dev" "dev-master": "1.7-dev"
} }
},
"config": {
"preferred-install": "dist",
"sort-packages": true
} }
} }
...@@ -10,7 +10,7 @@ CHANGELOG ...@@ -10,7 +10,7 @@ CHANGELOG
5.2.0 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 5.1.0
----- -----
......
...@@ -552,8 +552,8 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp ...@@ -552,8 +552,8 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp
$types = []; $types = [];
$nullable = $reflectionType->allowsNull(); $nullable = $reflectionType->allowsNull();
foreach ($reflectionType instanceof \ReflectionUnionType ? $reflectionType->getTypes() : [$reflectionType] as $type) { foreach (($reflectionType instanceof \ReflectionUnionType || $reflectionType instanceof \ReflectionIntersectionType) ? $reflectionType->getTypes() : [$reflectionType] as $type) {
$phpTypeOrClass = $reflectionType instanceof \ReflectionNamedType ? $reflectionType->getName() : (string) $type; $phpTypeOrClass = $type->getName();
if ('null' === $phpTypeOrClass || 'mixed' === $phpTypeOrClass || 'never' === $phpTypeOrClass) { if ('null' === $phpTypeOrClass || 'mixed' === $phpTypeOrClass || 'never' === $phpTypeOrClass) {
continue; 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