Commit 17fb594a authored by mengweifu's avatar mengweifu

update: merge master

parents 2af24ef5 bcd65f3a
...@@ -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']??'');
}
}
public function setCusMsg($cus,$data = '')
{
//每个服务都有自己的codePrefix //每个服务都有自己的codePrefix
$appid = \Yaf\Application::app()->getConfig()->get("appid"); $appid = \Yaf\Application::app()->getConfig()->get("appid");
$codePrefix = \Yaconf::get('bizcode.prefix.' . $appid); $codePrefix = \Yaconf::get('bizcode.prefix.' . $appid);
$codePrefix = intval($codePrefix); $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 => '当前日期的配置不能修改',
]; ];
} }
...@@ -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
...@@ -339,4 +339,14 @@ class GoodsController extends Base ...@@ -339,4 +339,14 @@ class GoodsController extends Base
$res = GoodsService::getOtaInfoByGoodsSkuIds($this->params); $res = GoodsService::getOtaInfoByGoodsSkuIds($this->params);
$this->success(["result" => $res]); $this->success(["result" => $res]);
} }
/**
* 拼单商品快照批量获取
* @throws Exception
*/
public function goods_snapshotsAction()
{
$res = GoodsSnapshotsService::goodsSnapshots($this->params);
$this->success(["result" => $res]);
}
} }
\ 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]);
}
}
...@@ -7,6 +7,8 @@ use App\Services\marketing\MarketingGoodsService; ...@@ -7,6 +7,8 @@ use App\Services\marketing\MarketingGoodsService;
use \Validate\MarketingGoodsRateValidate; use \Validate\MarketingGoodsRateValidate;
use \Validate\MarketingOnlineStatusValidate; use \Validate\MarketingOnlineStatusValidate;
use \Validate\MarketingInfoValidate; use \Validate\MarketingInfoValidate;
use App\Models\marketing\mysql\Marketing;
use App\Models\marketing\mysql\MarketingPindan;
class MarketingController extends Base class MarketingController extends Base
{ {
...@@ -155,4 +157,88 @@ class MarketingController extends Base ...@@ -155,4 +157,88 @@ class MarketingController extends Base
$this->success(); $this->success();
} }
/**
* app内团餐活动列表
* @throws \App\Exception\custom\InterfaceException
*/
public function tuancan_listAction()
{
$this->params['marketing_type'] = Marketing::MARKETING_TYPE_PINDAN;//1分销 2团购 3秒杀 4团餐
$this->params['online_status'] = Marketing::ONLINE_STATUS_QIDONG;//状态 , 1启用,2关闭,3 到期
$this->params['from'] = 1;//1 小程序前台 默认0 后台
//正在进行中的 按结束时间正序
$this->params['sort_field'] = 'end_time';
$this->params['sort_type'] = 'asc';
$this->params['need_buy_num'] = false;
$this->params['activity_status'] = MarketingPindan::ACTIVITY_STATUS_IN_PROGRESS;//1 未开始,2进行中,3已结束
$list['doing'] = MarketingService::marketingList($this->params)['result'];
$list['doing'] = $list['doing'] ? array_column($list['doing'], null, 'marketing_id') : [];
$marketingIdsDoing = array_keys($list['doing']);
//当天即将开始的 按开始时间正序
$this->params['page'] = 1;
$this->params['sort_field'] = 'start_time';
$this->params['sort_type'] = 'asc';
$this->params['need_buy_num'] = false;
$this->params['activity_status'] = MarketingPindan::ACTIVITY_STATUS_START_TODAY;//1 未开始,2进行中,3已结束, 4当日上新(即将开始)
$list['prepare'] = MarketingService::marketingList($this->params)['result'];
$list['prepare'] = $list['prepare'] ? array_column((array)$list['prepare'], null, 'marketing_id') : [];
$marketingIdsPrepare = array_keys($list['prepare']);
//已结束的 按结束时间倒序
$this->params['page'] = 1;
$this->params['page_size'] = 10;
$this->params['sort_field'] = 'end_time';
$this->params['sort_type'] = 'desc';
$this->params['need_buy_num'] = false;
$this->params['online_status'] = [Marketing::ONLINE_STATUS_QIDONG, Marketing::ONLINE_STATUS_GUANBI, Marketing::ONLINE_STATUS_DAOQI];//状态 , 1启用,2关闭,3 到期
$this->params['activity_status'] = MarketingPindan::ACTIVITY_STATUS_FINISHED;//1 未开始,2进行中,3已结束, 4当日上新(即将开始)
$list['end'] = MarketingService::marketingList($this->params)['result'];
$list['end'] = $list['end'] ? array_column($list['end'], null, 'marketing_id') : [];
$marketingIdsEnd = array_keys($list['end']);
$marketingIds = array_merge($marketingIdsDoing, $marketingIdsPrepare, $marketingIdsEnd);
//获取活动的sku列表
$skuList = MarketingService::getGoodsSkuListByMarketingIds($marketingIds);
//获取活动支付用户列表
$orderUser = MarketingService::getMarketingOrderUser(['marketing_id' => $marketingIds]);
//获取活动支付用户数
$buyNum = MarketingService::getHaveBuyGoodsUserCount(['marketing_id' => $marketingIds]);
//组合sku和order信息
foreach ($list as &$listPart) {
foreach ($listPart as $marketingId => &$value) {
$value['sku_list'] = $skuList[$marketingId] ?? [];
$value['order_user'] = $orderUser[$marketingId] ?? [];
$value['participate_number'] = $buyNum[$marketingId] ?? 0;
}
unset($value);
$listPart = array_values($listPart);
}
unset($listPart);
$list['life_account_id'] = MarketingService::getPublicLifeAccountId();
$this->success(['result' => $list]);
}
/**
* 切换活动状态
* @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
<?php
namespace App\Services\common;
use Api\PhpUtils\Kafka\KafkaUtil;
use Api\PhpUtils\Log\FileLog;
class KafkaService
{
/**
* marketing 广播
*/
public static function productMarketingUpdate(array $marketingInfo) : void
{
$msg = json_encode([
'marketingInfo' => $marketingInfo,
'time' => time(),
], JSON_FORCE_OBJECT);
$serverName = 'goods.publish';
$kafka = KafkaUtil::getInstance($serverName);
if ($kafka->produce($msg, $marketingInfo['activityId'])) {
FileLog::info(sprintf('kafka produce success serverName %s msg = %s', $serverName, $msg));
}
else {
FileLog::error(sprintf('kafka produce failure serverName %s msg = %s', $serverName, $msg));
}
}
}
\ No newline at end of file
...@@ -272,7 +272,9 @@ class GoodsService ...@@ -272,7 +272,9 @@ class GoodsService
$skuParams['online_status'] = 0; $skuParams['online_status'] = 0;
break; break;
default: default:
# code... $skuParams['online_type'] = 1;
$skuParams['online_status'] = 0;
$skuParams['online_start_time'] = date("Y-m-d H:i:s");
break; break;
} }
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
namespace App\Services\goods; namespace App\Services\goods;
use Api\PhpUtils\Common\GoodsSkuId;
use App\Models\goods\mysql\GoodsSnapshot;
use App\Models\goods\mysql\PindanGoodsSnapshot; use App\Models\goods\mysql\PindanGoodsSnapshot;
class GoodsSnapshotsService class GoodsSnapshotsService
...@@ -32,4 +34,42 @@ class GoodsSnapshotsService ...@@ -32,4 +34,42 @@ class GoodsSnapshotsService
} }
return $pindanGoodsSnapshot; return $pindanGoodsSnapshot;
} }
/**
* 批量支持商品
* @param $params
* @return array
*/
public static function goodsSnapshots($params)
{
$str = empty($params["snapshots_str"]) ? "" : $params["snapshots_str"];
$snapshot = [];
if (!empty($str)) {
$paramsArr = json_decode($str, true);
if (!empty($paramsArr)) {
foreach ($paramsArr as $param) {
if (isset($param["goods_sku_id"]) || isset($param["goods_version"])) {
$goodsSkuIdParams = GoodsSkuId::getGoodsSkuIdParams($param["goods_sku_id"]);
$key = $param["goods_sku_id"]."_".$param["goods_version"];
if ($goodsSkuIdParams["table_tag"] == GoodsSkuId::TABLE_TAG_PINDAN) {
$snapshot[$key] = PindanGoodsSnapshot::getRecord([
"goods_sku_id" => $param["goods_sku_id"],
"goods_version" => $param["goods_version"]
]);
} else {
$snapshot[$key] = GoodsSnapshot::getRecord([
"goods_sku_id" => $param["goods_sku_id"],
"goods_version" => $param["goods_version"]
]);
}
if (!empty($snapshot[$key]["desc_pic_url"])) {
$ksyun = GoodsService::getUrlList($snapshot[$key]["desc_pic_url"]);
$snapshot[$key]["desc_pic_url_list"] = $ksyun;
}
}
}
}
}
return $snapshot;
}
} }
\ 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 = [];
if (!empty($goodsSkuId)) {
$goodsSkuList = GoodsSku::getRecordMaster(['goods_sku_id' => $goodsSkuId]); $goodsSkuList = GoodsSku::getRecordMaster(['goods_sku_id' => $goodsSkuId]);
$goodsSkuList = !empty($goodsSkuList) ? array_column($goodsSkuList,null,'goods_sku_id') : []; $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 = [];
if (!empty($shopId)) {
$subShopList = SubShop::getRecordMaster(['shop_id' => $shopId]); $subShopList = SubShop::getRecordMaster(['shop_id' => $shopId]);
$subShopList = !empty($subShopList) ? array_column($subShopList,null,'shop_id') : []; $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') : [];
......
<?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]);
} }
...@@ -60,15 +63,22 @@ class UserService ...@@ -60,15 +63,22 @@ class UserService
'js_code' => $code, 'js_code' => $code,
'grant_type' => $grant_type, 'grant_type' => $grant_type,
]; ];
$begin = microtime(true);
$response = (new Request())->post($loginUrl, $params); $response = (new Request())->post($loginUrl, $params);
$end = microtime(true);
$totalTime = round(($end - $begin), 4) * 1000;
if ($response['code'] == 0) { if ($response['code'] == 0) {
$response = $response['response']; $response = $response['response'];
} }
//mon打点
$env = \Yaf\Application::app()->environ() ?? "dev";
MonUtil::proxyMon($loginUrl, $response['code'], 'weixin_'.$env, $totalTime);
if (empty($response) || array_key_exists('errcode', $response)) { if (empty($response) || array_key_exists('errcode', $response)) {
//throw new \Exception('获取openid失败:' . $response['errcode']); //throw new \Exception('获取openid失败:' . $response['errcode']);
FileLog::error("wechatLogin:获取openid失败", json_encode($params, JSON_UNESCAPED_UNICODE),'','jianghaiming@yidian-inc.com'); FileLog::error("wechatLogin:获取openid失败", json_encode($params, JSON_UNESCAPED_UNICODE), '', 'jianghaiming@yidian-inc.com');
throw new UserException(['cus' => 1]); throw new UserException(['cus' => 1]);
} }
//检查系统是已注册 //检查系统是已注册
...@@ -83,46 +93,55 @@ class UserService ...@@ -83,46 +93,55 @@ 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'] : '';
...@@ -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']) {
...@@ -224,6 +242,10 @@ class UserService ...@@ -224,6 +242,10 @@ class UserService
$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_services":"1.0.15", "api/php_services":"1.0.15",
"api/php_utils":"1.0.17",
"ext-openssl": "*" "ext-openssl": "*"
}, },
"minimum-stability": "dev", "minimum-stability": "dev",
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "6c937f48865aa02ab08f6ab0c9bf0b90", "content-hash": "b64691cd0b568f54f381382cdb77553b",
"packages": [ "packages": [
{ {
"name": "api/php_services", "name": "api/php_services",
...@@ -30,11 +30,11 @@ ...@@ -30,11 +30,11 @@
}, },
{ {
"name": "api/php_utils", "name": "api/php_utils",
"version": "v1.0.12", "version": "v1.0.17",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://git.yidian-inc.com:8021/bp/php_utils.git", "url": "https://git.yidian-inc.com:8021/bp/php_utils.git",
"reference": "bb58e98113fdd1a439828bb61cc716b0de0b6b0c" "reference": "aa70ccdd545f3e421eaf717274954990f1805b87"
}, },
"require": { "require": {
"elasticsearch/elasticsearch": "~7.0", "elasticsearch/elasticsearch": "~7.0",
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
} }
}, },
"description": "bp api php_utils", "description": "bp api php_utils",
"time": "2021-08-24T08:58:56+00:00" "time": "2021-09-06T08:57:33+00:00"
}, },
{ {
"name": "bacon/bacon-qr-code", "name": "bacon/bacon-qr-code",
......
...@@ -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 ]
colonel.wallet.transfer_service_id="21090614423333205002"
colonel.wallet.transfer_service_secret="4916927cf3305292f5a524db592dfa95"
[dev : common ] [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
...@@ -54,7 +54,8 @@ class Pindan implements DaemonServiceInterface ...@@ -54,7 +54,8 @@ class Pindan implements DaemonServiceInterface
$params = [ $params = [
self::emojiFilter($marketing['marketing_name']), self::emojiFilter($marketing['marketing_name']),
$marketing['start_time'], $marketing['start_time'],
$pindan['pindan_desc'] ?: self::DEFAULT_DESC $pindan['pindan_desc'] ?: self::DEFAULT_DESC,
$marketing['marketing_id']
]; ];
//发送消息 //发送消息
......
#!/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
...@@ -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;
}
}
...@@ -4,4 +4,4 @@ ...@@ -4,4 +4,4 @@
require_once __DIR__ . '/composer/autoload_real.php'; require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit14d712e6ba9ca61e9e636d6cf65f43bf::getLoader(); return ComposerAutoloaderInit147d97defc074a277015f080b27e01c6::getLoader();
...@@ -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',
...@@ -133,6 +141,7 @@ return array( ...@@ -133,6 +141,7 @@ return array(
'App\\Models\\user\\mysql\\UserWechatBind' => $baseDir . '/application/models/user/mysql/UserWechatBind.php', 'App\\Models\\user\\mysql\\UserWechatBind' => $baseDir . '/application/models/user/mysql/UserWechatBind.php',
'App\\Plugins\\Hook' => $baseDir . '/application/plugins/Hook.php', 'App\\Plugins\\Hook' => $baseDir . '/application/plugins/Hook.php',
'App\\Services\\common\\CommonService' => $baseDir . '/application/services/common/CommonService.php', 'App\\Services\\common\\CommonService' => $baseDir . '/application/services/common/CommonService.php',
'App\\Services\\common\\KafkaService' => $baseDir . '/application/services/common/KafkaService.php',
'App\\Services\\demo\\ElasticService' => $baseDir . '/application/services/demo/ElasticService.php', 'App\\Services\\demo\\ElasticService' => $baseDir . '/application/services/demo/ElasticService.php',
'App\\Services\\demo\\MongoService' => $baseDir . '/application/services/demo/MongoService.php', 'App\\Services\\demo\\MongoService' => $baseDir . '/application/services/demo/MongoService.php',
'App\\Services\\demo\\MysqlService' => $baseDir . '/application/services/demo/MysqlService.php', 'App\\Services\\demo\\MysqlService' => $baseDir . '/application/services/demo/MysqlService.php',
...@@ -142,11 +151,14 @@ return array( ...@@ -142,11 +151,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 +238,8 @@ return array( ...@@ -226,6 +238,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',
'320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php',
'8825ede83f2f289127722d4e842cf7e8' => $vendorDir . '/symfony/polyfill-intl-grapheme/bootstrap.php',
'e69f7f6ee287b969198c3c9d6777bd38' => $vendorDir . '/symfony/polyfill-intl-normalizer/bootstrap.php',
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php', '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
'e69f7f6ee287b969198c3c9d6777bd38' => $vendorDir . '/symfony/polyfill-intl-normalizer/bootstrap.php',
'8825ede83f2f289127722d4e842cf7e8' => $vendorDir . '/symfony/polyfill-intl-grapheme/bootstrap.php',
'320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php',
'b6b991a57620e2fb6b2f66f03fe9ddc2' => $vendorDir . '/symfony/string/Resources/functions.php', 'b6b991a57620e2fb6b2f66f03fe9ddc2' => $vendorDir . '/symfony/string/Resources/functions.php',
'0d59ee240a4cd96ddbb4ff164fccea4d' => $vendorDir . '/symfony/polyfill-php73/bootstrap.php',
'7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php', '7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php',
'ad155f8f1cf0d418fe49e248db8c661b' => $vendorDir . '/react/promise/src/functions_include.php', 'ad155f8f1cf0d418fe49e248db8c661b' => $vendorDir . '/react/promise/src/functions_include.php',
'0d59ee240a4cd96ddbb4ff164fccea4d' => $vendorDir . '/symfony/polyfill-php73/bootstrap.php',
'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php', 'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php',
'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',
'8592c7b0947d8a0965a9e8c3d16f9c24' => $vendorDir . '/elasticsearch/elasticsearch/src/autoload.php', 'a9ed0d27b5a698798a89181429f162c5' => $vendorDir . '/khanamiryan/qrcode-detector-decoder/lib/Common/customFunctions.php',
'37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php', '37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php',
'3a37ebac017bc098e9a86b35401e7a68' => $vendorDir . '/mongodb/mongodb/src/functions.php', '3a37ebac017bc098e9a86b35401e7a68' => $vendorDir . '/mongodb/mongodb/src/functions.php',
'8592c7b0947d8a0965a9e8c3d16f9c24' => $vendorDir . '/elasticsearch/elasticsearch/src/autoload.php',
); );
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer // autoload_real.php @generated by Composer
class ComposerAutoloaderInit14d712e6ba9ca61e9e636d6cf65f43bf class ComposerAutoloaderInit147d97defc074a277015f080b27e01c6
{ {
private static $loader; private static $loader;
...@@ -24,15 +24,15 @@ class ComposerAutoloaderInit14d712e6ba9ca61e9e636d6cf65f43bf ...@@ -24,15 +24,15 @@ class ComposerAutoloaderInit14d712e6ba9ca61e9e636d6cf65f43bf
require __DIR__ . '/platform_check.php'; require __DIR__ . '/platform_check.php';
spl_autoload_register(array('ComposerAutoloaderInit14d712e6ba9ca61e9e636d6cf65f43bf', 'loadClassLoader'), true, true); spl_autoload_register(array('ComposerAutoloaderInit147d97defc074a277015f080b27e01c6', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
spl_autoload_unregister(array('ComposerAutoloaderInit14d712e6ba9ca61e9e636d6cf65f43bf', 'loadClassLoader')); spl_autoload_unregister(array('ComposerAutoloaderInit147d97defc074a277015f080b27e01c6', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) { if ($useStaticLoader) {
require __DIR__ . '/autoload_static.php'; require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit14d712e6ba9ca61e9e636d6cf65f43bf::getInitializer($loader)); call_user_func(\Composer\Autoload\ComposerStaticInit147d97defc074a277015f080b27e01c6::getInitializer($loader));
} else { } else {
$map = require __DIR__ . '/autoload_namespaces.php'; $map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) { foreach ($map as $namespace => $path) {
...@@ -53,19 +53,19 @@ class ComposerAutoloaderInit14d712e6ba9ca61e9e636d6cf65f43bf ...@@ -53,19 +53,19 @@ class ComposerAutoloaderInit14d712e6ba9ca61e9e636d6cf65f43bf
$loader->register(true); $loader->register(true);
if ($useStaticLoader) { if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInit14d712e6ba9ca61e9e636d6cf65f43bf::$files; $includeFiles = Composer\Autoload\ComposerStaticInit147d97defc074a277015f080b27e01c6::$files;
} else { } else {
$includeFiles = require __DIR__ . '/autoload_files.php'; $includeFiles = require __DIR__ . '/autoload_files.php';
} }
foreach ($includeFiles as $fileIdentifier => $file) { foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire14d712e6ba9ca61e9e636d6cf65f43bf($fileIdentifier, $file); composerRequire147d97defc074a277015f080b27e01c6($fileIdentifier, $file);
} }
return $loader; return $loader;
} }
} }
function composerRequire14d712e6ba9ca61e9e636d6cf65f43bf($fileIdentifier, $file) function composerRequire147d97defc074a277015f080b27e01c6($fileIdentifier, $file)
{ {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file; require $file;
......
This diff is collapsed.
...@@ -27,12 +27,12 @@ ...@@ -27,12 +27,12 @@
}, },
{ {
"name": "api/php_utils", "name": "api/php_utils",
"version": "v1.0.12", "version": "v1.0.17",
"version_normalized": "1.0.12.0", "version_normalized": "1.0.17.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://git.yidian-inc.com:8021/bp/php_utils.git", "url": "https://git.yidian-inc.com:8021/bp/php_utils.git",
"reference": "bb58e98113fdd1a439828bb61cc716b0de0b6b0c" "reference": "aa70ccdd545f3e421eaf717274954990f1805b87"
}, },
"require": { "require": {
"elasticsearch/elasticsearch": "~7.0", "elasticsearch/elasticsearch": "~7.0",
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
"mongodb/mongodb": "1.4.3", "mongodb/mongodb": "1.4.3",
"php": "7.2.*" "php": "7.2.*"
}, },
"time": "2021-08-24T08:58:56+00:00", "time": "2021-09-06T08:57:33+00:00",
"type": "library", "type": "library",
"installation-source": "source", "installation-source": "source",
"autoload": { "autoload": {
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
'type' => 'project', 'type' => 'project',
'install_path' => __DIR__ . '/../../', 'install_path' => __DIR__ . '/../../',
'aliases' => array(), 'aliases' => array(),
'reference' => 'fbcd418b6a1b47fab2b71637dc63a9e415392206', 'reference' => '2af24ef59d9888a3a8c64df2ea4efd62c8a675a1',
'name' => 'yidian/yaf_demo', 'name' => 'yidian/yaf_demo',
'dev' => true, 'dev' => true,
), ),
...@@ -20,12 +20,12 @@ ...@@ -20,12 +20,12 @@
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'api/php_utils' => array( 'api/php_utils' => array(
'pretty_version' => 'v1.0.12', 'pretty_version' => 'v1.0.17',
'version' => '1.0.12.0', 'version' => '1.0.17.0',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../api/php_utils', 'install_path' => __DIR__ . '/../api/php_utils',
'aliases' => array(), 'aliases' => array(),
'reference' => 'bb58e98113fdd1a439828bb61cc716b0de0b6b0c', 'reference' => 'aa70ccdd545f3e421eaf717274954990f1805b87',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'bacon/bacon-qr-code' => array( 'bacon/bacon-qr-code' => array(
...@@ -314,7 +314,7 @@ ...@@ -314,7 +314,7 @@
'type' => 'project', 'type' => 'project',
'install_path' => __DIR__ . '/../../', 'install_path' => __DIR__ . '/../../',
'aliases' => array(), 'aliases' => array(),
'reference' => 'fbcd418b6a1b47fab2b71637dc63a9e415392206', 'reference' => '2af24ef59d9888a3a8c64df2ea4efd62c8a675a1',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
), ),
......
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