Commit 17fb594a authored by mengweifu's avatar mengweifu

update: merge master

parents 2af24ef5 bcd65f3a
......@@ -22,26 +22,33 @@ class BaseException extends \Exception
*/
public function __construct($params = [])
{
if (!is_array($params)) {
if (empty($params)) {
return;
}
if (!is_array($params)) {
return $this->setCusMsg($params);
}
$this->code = $params['code'] ?? Registry::get('config')->exception->user->code;
$this->msg = $params['msg'] ?? Registry::get('config')->exception->user->msg;
if (isset($params['cus']) && $this->cus && isset($this->cus[intval($params['cus'])]) && $this->base_code) {
return $this->setCusMsg($params['cus'],$params['data']??'');
}
}
//每个服务都有自己的codePrefix
$appid = \Yaf\Application::app()->getConfig()->get("appid");
$codePrefix = \Yaconf::get('bizcode.prefix.' . $appid);
$codePrefix = intval($codePrefix);
public function setCusMsg($cus,$data = '')
{
//每个服务都有自己的codePrefix
$appid = \Yaf\Application::app()->getConfig()->get("appid");
$codePrefix = \Yaconf::get('bizcode.prefix.' . $appid);
$codePrefix = intval($codePrefix);
$cus_code = intval($params['cus']);
$base_code = intval($this->base_code);
$cus_code = intval($cus);
$base_code = intval($this->base_code);
$this->code = $codePrefix + $base_code + $cus_code;
$this->msg = isset($params['data']) ? vsprintf($this->cus[$cus_code],$params['data']) : $this->cus[$cus_code];
}
$this->code = $codePrefix + $base_code + $cus_code;
$this->msg = !empty($data) ? vsprintf($this->cus[$cus_code],$data) : $this->cus[$cus_code];
}
public function __get($name): bool
......
......@@ -3,7 +3,6 @@
namespace App\Exception\custom;
use App\Exception\BaseException;
class MarketingException extends BaseException
......@@ -13,6 +12,20 @@ class MarketingException extends BaseException
const LIFE_ACCOUNT_NO_EXIST = 16;
const RELATION_ALREADY_EXIST = 17;
const TAKE_PLACE_NOT_EXIST = 20;
const COLONEL_APPLY_FAILED = 24;
const COLONEL_CONFIG_NULL = 25;
const COLONEL_LEVEL_SIX = 26;
const COLONEL_AUDIT_STATUS = 27;
const COLONEL_AUDIT_STATUS_FAILED = 28;
const COMMIT_ERROR = 29;
const COLONEL_TAKE_PLACE_EXIST = 30;
const COLONEL_TAKE_PLACE_PARAMS = 31;
const COLONEL_TAKE_PLACE_FAILED = 32;
const COLONEL_AUDIT_STATUS_USE = 34;
const COLONEL_ADD_FAILED = 35;
const COLONEL_TAKE_PLACE_EDIT_FAILED = 36;
const COLONEL_APPLY_EXIST = 37;
const COLONEL_DATE_ERROR = 38;
protected $cus = [
0 => '活动名称不能为空',
......@@ -38,6 +51,21 @@ class MarketingException extends BaseException
self::TAKE_PLACE_NOT_EXIST => '自提点不存在',
21 => "活动开始时间不能大于或者等于结束时间",
22 => "自提点不能为空",
23 => '分润金额+手续费不能大于售价金额',
self::COLONEL_APPLY_FAILED => '团长申请失败',
self::COLONEL_CONFIG_NULL => "团长分销配置内容不能为空",
self::COLONEL_LEVEL_SIX => "档位最多设定6档",
self::COLONEL_AUDIT_STATUS => '团长审核状态错误',
self::COLONEL_AUDIT_STATUS_FAILED => '团长审核失败',
self::COMMIT_ERROR => '事务commit失败',
self::COLONEL_TAKE_PLACE_EXIST => '自提点名称已存在',
self::COLONEL_TAKE_PLACE_PARAMS => '自提点信息不存在',
self::COLONEL_TAKE_PLACE_FAILED => '自提点添加失败',
33 => '分润金额+手续费不能大于售价金额',
self::COLONEL_AUDIT_STATUS_USE => '该团长已审核',
self::COLONEL_ADD_FAILED => '团长入库失败',
self::COLONEL_TAKE_PLACE_EDIT_FAILED => '修改团长自提点失败',
self::COLONEL_APPLY_EXIST => '当前用户已提交团长申请',
self::COLONEL_DATE_ERROR => '当前日期的配置不能修改',
];
}
\ No newline at end of file
}
......@@ -41,7 +41,7 @@ class BaseValidate extends Validate
protected function isMobile($value)
{
$rule = '^1(3|4|5|7|8)[0-9]\d{8}$^';
$rule = '^1(3|4|5|6|7|8|9)[0-9]\d{8}$^';
$result = preg_match($rule, $value);
if ($result) {
return true;
......@@ -49,4 +49,19 @@ class BaseValidate extends Validate
return false;
}
}
protected function isDate($value)
{
//匹配日期格式
if (preg_match("/^([0-9]{4})-([0-9]{2})-([0-9]{2})$/", $value, $parts)) {
//检测是否为日期
if (checkdate($parts[2], $parts[3], $parts[1])) {
return true;
} else {
return false;
}
} else {
return false;
}
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: pengfei@yidian-inc.com
* Date: 2021/8/24 1:32 下午
*/
namespace Validate;
class ColonelAddPointValidate extends BaseValidate
{
protected $rule = [
'colonel_apply_id' => 'require',
'longitude' => 'require',
'latitude' => 'require',
'location' => 'require',
'address' => 'require',
'province' => 'require',
'city' => 'require',
'area' => 'require',
'contact_name' => 'require',
'phone' => 'isMobile',
'take_place_name' => 'require',
];
protected $message = [
'colonel_apply_id' => '申请id不能为空',
'longitude' => '位置经度不能为空',
'latitude' => '位置纬度不能为空',
'location' => '自提点地址不能为空',
'address' => '详细地址不能为空',
'province' => '省份不能为空',
'city' => '城市不能为空',
'area' => '地区不能为空',
'contact_name' => '联系人不能为空',
'phone' => '请输入正确的手机号',
'take_place_name' => '自提点名称不能为空',
];
}
<?php
/**
* Created by PhpStorm.
* User: pengfei@yidian-inc.com
* Date: 2021/8/20 3:11 下午
*/
namespace Validate;
class ColonelApplyValidate extends BaseValidate
{
protected $rule = [
'user_id' => 'require',
'phone' => 'isMobile',
'contact_name' => 'require',
];
protected $message = [
'user_id' => '用户id不能为空',
'phone' => '请输入正确的手机号',
'contact_name' => '联系人不能为空'
];
}
<?php
namespace Validate;
class ColonelAuditValidate extends BaseValidate
{
protected $rule = [
'colonel_apply_id' => 'require',
'audit_status' => 'require',
];
protected $message = [
"colonel_apply_id" => "申请id不能为空",
"audit_status" => "审核状态不能为空",
];
}
<?php
namespace Validate;
class ColonelCenterValidate extends BaseValidate
{
protected $rule = [
'user_id' => 'require',
];
protected $message = [
'user_id' => 'user_id 参数不能为空',
];
}
\ No newline at end of file
<?php
namespace Validate;
class ColonelConfigValidate extends BaseValidate
{
protected $rule = [
'date' => 'require|isDate',
'config' => 'require',
];
protected $message = [
'date' => 'date 参数格式错误',
'config' => 'config 参数不能为空',
'marketing_id' => 'marketing_id 参数不能为空',
];
public function sceneAdd()
{
return $this->only(["date","config","marketing_id"])->append("marketing_id", "require");
}
}
\ No newline at end of file
......@@ -22,4 +22,9 @@ class MarketingOnlineStatusValidate extends BaseValidate
"marketing_type" => "marketing_type 不能为空",
"online_status" => "online_status 不能为空",
];
public function sceneYingxiao()
{
return $this->only(['marketing_id','online_status']);
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: pengfei@yidian-inc.com
* Date: 2021/8/23 1:46 下午
*/
namespace App\Models\marketing\mysql;
use Api\PhpUtils\Mysql\MysqlBase;
class ColonelDistributorColonel extends MysqlBase
{
const TABLE_NAME = 'colonel_distributor_colonel';
const CONFIG_INDEX = 'marketing';
const PRIMARY_KEY = 'colonel_id';
const COLONEL_SOURCE_APPLY = 1; //用户申请
const COLONEL_SOURCE_ADMIN = 2; //运营添加
const DEFAULT_COLUMN = ['colonel_id','user_id','take_place_id','phone','contact_name','colonel_source'];
public static function getColonelUserIds()
{
$colonelUserData = ColonelDistributorColonel::select(['user_id']);
return array_column((array)$colonelUserData, 'user_id');
}
public static function getRecord(array $where, $column = '*')
{
return self::get($column, $where);
}
public static function getRecords(array $where, $column = '*')
{
return self::select($column, $where);
}
public static function updateRecord(array $columns, array $where)
{
return self::update($columns, $where);
}
public static function insertRecord(array $column) : int
{
$id = self::insert($column);
return intval($id);
}
public static function getPages(array $where = [], $column = '*', int $page, int $pageSize, array $orderBy = ['colonel_apply_id' => 'DESC'])
{
if (empty($column)) {
$column = self::DEFAULT_COLUMN;
}
$data = $where;
$count = self::count([], $where);
if (empty($count)) {
return ['list' => [],'count' => 0];
}
if (!empty($page) && !empty($pageSize)) {
$offset = ($page - 1) * $pageSize;
$data['LIMIT'] = [$offset,$pageSize];
}
if (!empty($orderBy)) {
$data['ORDER'] = $orderBy;
}
$result = self::select($column, $data);
return ['result' => $result,'count' => $count];
}
}
<?php
/**
* Created by PhpStorm.
* User: pengfei@yidian-inc.com
* Date: 2021/8/20 2:38 下午
*/
namespace App\Models\marketing\mysql;
use Api\PhpUtils\Mysql\MysqlBase;
class ColonelDistributorColonelApply extends MysqlBase
{
const TABLE_NAME = 'colonel_distributor_colonel_apply';
const CONFIG_INDEX = 'marketing';
const PRIMARY_KEY = 'colonel_apply_id';
const STATUS_AUDIT = 0;//待审核
const STATUS_PASS = 1;//审核通过
const STATUS_REJECT = 2;//审核驳回
const DEFAULT_COLUMN = ['colonel_apply_id','audit_status','user_id','phone','contact_name','take_place_name','province','city','area','location','address'];
public static function insertRecord(array $column) : int
{
$id = self::insert($column);
return intval($id);
}
public static function getRecord(array $where, $column = '*')
{
return self::get($column, $where);
}
public static function updateRecord(array $columns, array $where)
{
return self::update($columns, $where);
}
public static function getPages(array $where = [], $column = '*', int $page, int $pageSize, array $orderBy = ['colonel_apply_id' => 'DESC'])
{
if (empty($column)) {
$column = self::DEFAULT_COLUMN;
}
$data = $where;
$count = self::count([], $where);
if (empty($count)) {
return ['list' => [],'count' => 0];
}
if (!empty($page) && !empty($pageSize)) {
$offset = ($page - 1) * $pageSize;
$data['LIMIT'] = [$offset,$pageSize];
}
if (!empty($orderBy)) {
$data['ORDER'] = $orderBy;
}
$result = self::select($column, $data);
return ['result' => $result,'count' => $count];
}
public static function existUser(string $userId) : bool
{
$exist = self::getRecord(['user_id' => $userId], ['colonel_apply_id']);
return !empty($exist);
}
}
<?php
namespace App\Models\marketing\mysql;
use Api\PhpUtils\Mysql\MysqlBase;
class ColonelDistributorConfig extends MysqlBase
{
const TABLE_NAME = 'colonel_distributor_colonel_config';
const CONFIG_INDEX = 'marketing';
const PRIMARY_KEY = 'colonel_config_id';
const TYPE_COLONEL = 1;//团长分销活动
public static function getRecord($where, $columns = [], $options = [])
{
if (empty($columns)) {
$columns = '*';
}
return self::get($columns, $where, $options);
}
public static function getRecordMaster($where, $columns = [], $options = [])
{
if (empty($columns)) {
$columns = '*';
}
return self::selectMaster($columns, $where, $options);
}
public static function insertRecord($columns, $options = [])
{
return self::insert($columns, $options);
}
public static function updateRecord($columns, $where)
{
return self::update($columns, $where);
}
public static function save($data, $where = [], $options = [])
{
if (empty($where)) {
return self::insert($data, $options);
}
return self::update($data, $where);
}
public static function deleteRecord($where)
{
return self::delete($where);
}
}
\ No newline at end of file
<?php
namespace App\Models\marketing\mysql;
use Api\PhpUtils\Mysql\MysqlBase;
class ColonelDistributorInviteOrder extends MysqlBase
{
const TABLE_NAME = 'colonel_distributor_invite_order';
const CONFIG_INDEX = 'marketing';
const PRIMARY_KEY = 'invite_order_id';
const IS_REFUND_NO = 0;//未退款
const IS_REFUND_YES = 1;//已退款
public static function getRecord($where, $columns = [], $options = [])
{
if (empty($columns)) {
$columns = '*';
}
return self::get($columns, $where, $options);
}
public static function getRecordMaster($where, $columns = [], $options = [])
{
if (empty($columns)) {
$columns = '*';
}
return self::selectMaster($columns, $where, $options);
}
public static function insertRecord($columns, $options = [])
{
return self::insert($columns, $options);
}
public static function updateRecord($columns, $where)
{
return self::update($columns, $where);
}
public static function save($data, $where = [], $options = [])
{
if (empty($where)) {
return self::insert($data, $options);
}
return self::update($data, $where);
}
public static function deleteRecord($where)
{
return self::delete($where);
}
}
\ No newline at end of file
<?php
namespace App\Models\marketing\mysql;
use Api\PhpUtils\Mysql\MysqlBase;
class ColonelDistributorInviteOrderNum extends MysqlBase
{
const TABLE_NAME = 'colonel_distributor_invite_order_num';
const CONFIG_INDEX = 'marketing';
const PRIMARY_KEY = 'invite_order_num_id';
public static function getRecord($where, $columns = [], $options = [])
{
if (empty($columns)) {
$columns = '*';
}
return self::get($columns, $where, $options);
}
public static function getRecords(array $where, $column = '*')
{
return (array)self::select($column, $where);
}
public static function getRecordMaster($where, $columns = [], $options = [])
{
if (empty($columns)) {
$columns = '*';
}
return self::selectMaster($columns, $where, $options);
}
public static function insertRecord($columns, $options = [])
{
return self::insert($columns, $options);
}
public static function updateRecord($columns, $where)
{
return self::update($columns, $where);
}
public static function save($data, $where = [], $options = [])
{
if (empty($where)) {
return self::insert($data, $options);
}
return self::update($data, $where);
}
public static function deleteRecord($where)
{
return self::delete($where);
}
}
<?php
namespace App\Models\marketing\mysql;
use Api\PhpUtils\Mysql\MysqlBase;
class ColonelDistributorPayInfo extends MysqlBase
{
const TABLE_NAME = 'colonel_distributor_pay_info';
const CONFIG_INDEX = 'marketing';
const PRIMARY_KEY = 'pay_info_id';
const TYPE_NEW_USER = 1;
const TYPE_FINISH_TARGET = 2;
const STATUS_NOT_USE = 0;
const STATUS_USE = 1;
public static $typeDesc = [
self::TYPE_NEW_USER => "邀请新用户",
self::TYPE_FINISH_TARGET => "完成目标单数",
];
public static function getRecords(array $where, $column = '*')
{
return (array)self::select($column, $where);
}
public static function getRecord($where, $columns = [], $options = [])
{
if (empty($columns)) {
$columns = '*';
}
return self::get($columns, $where, $options);
}
public static function getRecordMaster($where, $columns = [], $options = [])
{
if (empty($columns)) {
$columns = '*';
}
return self::selectMaster($columns, $where, $options);
}
public static function insertRecord($columns, $options = [])
{
return self::insert($columns, $options);
}
public static function updateRecord($columns, $where)
{
return (int)self::update($columns, $where);
}
public static function save($data, $where = [], $options = [])
{
if (empty($where)) {
return self::insert($data, $options);
}
return self::update($data, $where);
}
public static function deleteRecord($where)
{
return self::delete($where);
}
}
......@@ -14,6 +14,8 @@ class Marketing extends MysqlBase
const MARKETING_TYPE_TUANGOU = 2;
const MARKETING_TYPE_MIAOSHA = 3;
const MARKETING_TYPE_PINDAN = 4;
const MARKETING_TYPE_LIEBIAN = 5;
const MARKETING_TYPE_TUANZHANG = 6;
const ONLINE_STATUS_QIDONG = 1;
const ONLINE_STATUS_GUANBI = 2;
......@@ -125,6 +127,24 @@ class Marketing extends MysqlBase
$data['online_status'] = $where['online_status'];
}
if (!empty($where['marketing_type'])) {
$data['marketing_type'] = $where['marketing_type'];
}
return $data;
}
/**
* 判断活动是否在进行中
* @param $marketingId
* @return bool
*/
public static function isGoing($marketingId)
{
if (empty($marketingId)) {
return false;
}
$marketing = self::getRecord(["marketing_id" => $marketingId]);
return !empty($marketing) && $marketing["online_status"] == self::ONLINE_STATUS_QIDONG;
}
}
......@@ -13,6 +13,7 @@ class MarketingPindan extends MysqlBase
const ACTIVITY_STATUS_NO_START = 1;
const ACTIVITY_STATUS_IN_PROGRESS = 2;
const ACTIVITY_STATUS_FINISHED = 3;
const ACTIVITY_STATUS_START_TODAY = 4;//今日上新
public static function getRecord($where, $colums = [])
{
......
......@@ -3,6 +3,7 @@
namespace App\Models\marketing\mysql;
use Api\PhpUtils\Mysql\MysqlBase;
use App\Services\marketing\MarketingService;
/**
* 自提点
......@@ -25,7 +26,7 @@ class TakePlace extends MysqlBase
*/
public static function searchList($params)
{
$lifeAccountId = $params['life_account_id'] ?? 0;
$lifeAccountId = $params['life_account_id'] ?? MarketingService::getPublicLifeAccountId();
$keywords = $params['keywords'] ?? '';
$offset = $params['offset'] ?? 0;
$limit = $params['limit'] ?? 20;
......@@ -53,4 +54,20 @@ class TakePlace extends MysqlBase
return $res;
}
public static function getRecord(array $where, $column = '*')
{
return self::get($column, $where);
}
public static function getRecords(array $where, $column = '*')
{
return self::select($column, $where);
}
public static function existTakePlaceName(string $takePlaceName) : bool
{
$exist = self::getRecord(['take_place_name' => $takePlaceName], ['take_place_id']);
return !empty($exist);
}
}
<?php
namespace App\Base;
use Yaf\Controller_Abstract;
class Job extends Controller_Abstract
{
public function init() {
\Yaf\Dispatcher::getInstance()->disableView();
}
}
\ No newline at end of file
......@@ -339,4 +339,14 @@ class GoodsController extends Base
$res = GoodsService::getOtaInfoByGoodsSkuIds($this->params);
$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
<?php
/**
* Created by PhpStorm.
* User: pengfei@yidian-inc.com
* Date: 2021/9/3 2:23 下午
*/
use App\Base\Job;
use Api\PhpServices\Idgen\Idgen;
use App\Models\marketing\mysql\ColonelDistributorColonel;
use App\Models\marketing\mysql\ColonelDistributorConfig;
use App\Models\marketing\mysql\ColonelDistributorInviteOrderNum;
use App\Models\marketing\mysql\ColonelDistributorPayInfo;
use App\Exception\custom\InterfaceException;
use Api\PhpUtils\Http\HttpUtil;
use App\Models\marketing\mysql\Marketing;
use App\Models\user\mysql\UserWechatBind;
use App\Services\marketing\PindanActivityColonelConfigService;
use Api\PhpUtils\Log\JobLog;
use App\Services\marketing\ColonelService;
class ColonelorderController extends Job
{
const REWARD_UNIT = 100; // 奖励单位: 分
const INVITE_NEW_USER_REWARD = 3 * self::REWARD_UNIT; // 邀请新用户奖励
const DEFAULT_USER_BATCH_SIZE = 100; // 批量处理数据条数
const ACTIVITY_OFFLINE_BALANCE = 50 * self::REWARD_UNIT; // 活动余额下线阈值
public $colonelConfigList; // 活动配置
public $settlementDate; // 活动结算日
public $startTime; // 活动结算日-开始时间
public $endTime; // 活动结算日-结束时间
/**
* Notes: 初始化-读取配置
* User: pengfei@yidian-inc.com
* Date: 2021/9/3 4:13 下午
*/
public function init()
{
parent::init();
$this->loadTimeConfig();
$this->colonelConfigList = $this->getColonelConfig($this->settlementDate);
}
/**
* Notes: 计算奖励脚本
* User: pengfei@yidian-inc.com
* Date: 2021/9/3 4:05 下午
* @throws InterfaceException
*/
public function indexAction()
{
$this->loggerInfo('start');
if ($userIdList = ColonelDistributorColonel::getColonelUserIds()) {
$userIdList = array_chunk($userIdList, self::DEFAULT_USER_BATCH_SIZE);
$colonelPayInfoData = [];
foreach ($userIdList as $userIds) {
$this->getInviteOrderData($userIds, $colonelPayInfoData); // 完成目标单数
$this->getInviteNewUserData($userIds, $colonelPayInfoData); // 邀请新用户奖励
}
if (!empty($colonelPayInfoData)) {
try {
$this->loggerInfo('colonelPayInfoCount=' . count($colonelPayInfoData));
$this->handleMarketingBalance($colonelPayInfoData);
$colonelPayInfoData = $this->getFormatPayInfoData($colonelPayInfoData);
$this->handleSavePayInfo($colonelPayInfoData);
$this->loggerInfo('success');
} catch (Exception $e) {
$this->loggerError('error=' . $e->getMessage());
}
}
}
$this->loggerInfo('end');
}
/**
* Notes: 保存奖励信息
* User: pengfei@yidian-inc.com
* Date: 2021/9/7 10:40 上午
* @param $colonelPayInfoData
* @throws Exception
*/
private function handleSavePayInfo($colonelPayInfoData)
{
try {
ColonelDistributorPayInfo::beginTransaction();
if (!$this->addColonelDistributorPayInfo($colonelPayInfoData)) {
throw new Exception(sprintf("写入错误参数 %s", json_encode($colonelPayInfoData)));
}
if (!ColonelDistributorPayInfo::commit()) {
throw new Exception(sprintf("事务提交失败 %s", json_encode($colonelPayInfoData)));
}
} catch (Exception $e) {
ColonelDistributorPayInfo::rollback();
throw new Exception($e->getMessage());
}
}
/**
* Notes: 获取新用户奖励
* User: pengfei@yidian-inc.com
* Date: 2021/9/3 4:47 下午
* @param $userIds
* @param $colonelPayInfoData
* @throws InterfaceException
*/
private function getInviteNewUserData($userIds, &$colonelPayInfoData)
{
if ($inviteNewUserList = $this->getInviteNewUserList($userIds, $this->startTime, $this->endTime)) {
$userNickList = $this->getUserList(array_column($inviteNewUserList, 'user_id'));
foreach ($inviteNewUserList as $newUser) {
$colonelPayInfoData[] = [
'date' => $this->settlementDate,
'type' => ColonelDistributorPayInfo::TYPE_NEW_USER,
'reward' => self::INVITE_NEW_USER_REWARD,
'finish_num' => 1,
'invite_user_id' => $newUser['user_id'],
'invite_user_nick' => empty($userNickList[$newUser['user_id']]['user_nick']) ? '' : $userNickList[$newUser['user_id']]['user_nick'],
'colonel_user_id' => $newUser['inviter_user_id'],
];
}
}
}
/**
* Notes: 获取完成目标单数奖励
* User: pengfei@yidian-inc.com
* Date: 2021/9/3 4:47 下午
* @param $userIds
* @param $colonelPayInfoData
*/
private function getInviteOrderData($userIds, &$colonelPayInfoData)
{
if (!empty($this->colonelConfigList)) {
$inviteOrderNumList = $this->getInviteOrderNum($userIds, $this->settlementDate);
foreach ($inviteOrderNumList as $orderNum) {
foreach ($this->colonelConfigList as $config) {
if ($orderNum['num'] >= $config['assess_order_num']) {
$colonelPayInfoData[] = [
'date' => $this->settlementDate,
'type' => ColonelDistributorPayInfo::TYPE_FINISH_TARGET,
'reward' => $config['reward_amount'] * self::REWARD_UNIT,
'finish_num' => $config['assess_order_num'],
'invite_user_id' => 0,
'invite_user_nick' => '',
'colonel_user_id' => $orderNum['colonel_user_id'],
];
}
}
}
}
}
/**
* 团长任务配置
* @param $settlementDate
* @return array
*/
private function getColonelConfig($settlementDate): array
{
$config = ColonelDistributorConfig::getRecord([
'date[<=]' => $settlementDate,
'type' => ColonelDistributorConfig::TYPE_COLONEL,
'ORDER' => ['date' => 'DESC'],
'LIMIT' => 1
]);
$configData = [];
if (!empty($config['data'])) {
$configData = json_decode($config['data'], true);
}
return $configData;
}
/**
* 获取order num
* @param $colonelUserIds
* @param $date
* @return array
*/
private function getInviteOrderNum($colonelUserIds, $date): array
{
return ColonelDistributorInviteOrderNum::getRecords(
[
'colonel_user_id' => $colonelUserIds,
'date' => $date,
],
['colonel_user_id', 'num']
);
}
/**
* Notes: 获取有效新用户信息
* User: pengfei@yidian-inc.com
* Date: 2021/9/3 4:03 下午
* @param $userIds
* @param $startTime
* @param $endTime
* @return array
* @throws InterfaceException
*/
private function getInviteNewUserList($userIds, $startTime, $endTime): array
{
$url = config('interface', 'coupon.background.wx_invite_relation_list_by_user_ids');
if (empty($url)) {
throw new InterfaceException(['cus' => 0]);
}
$res = HttpUtil::get($url,
['user_ids' => $userIds, 'start_time' => $startTime, 'end_time' => $endTime]);
if (!empty($res['response']['result'])) {
return array_values(array_column($res['response']['result'], null, 'user_id'));
}
return [];
}
/**
* Notes: 获取pay_info数据
* User: pengfei@yidian-inc.com
* Date: 2021/9/7 10:34 上午
* @param $data
* @return array
* @throws Exception
*/
private function getFormatPayInfoData($data): array
{
$count = count($data);
$httpParams = [
[
'type' => 'goods',
'number' => 00,
'count' => $count
]
];
$res = Idgen::get(appConfig('idgen.partner'), appConfig('idgen.key'), [], $httpParams);
$ids = $res['id_datetime']['goods'] ?? [];
if ($count > count($ids)) {
throw new Exception('请求idgen服务失败,' . ['req' => $httpParams, 'res' => $res]);
}
foreach ($data as $key => $item) {
$data[$key]['pay_info_trade_id'] = $ids[$key];
}
return $data;
}
/**
* Notes: 用户信息,获取昵称
* User: pengfei@yidian-inc.com
* Date: 2021/9/3 4:09 下午
* @param $userIds
* @return array
*/
private function getUserList($userIds): array
{
$list = UserWechatBind::select(['user_id', 'user_nick'], ['user_id' => $userIds], []);
return array_column((array)$list, null, 'user_id');
}
/**
* Notes: 写入数据
* User: pengfei@yidian-inc.com
* Date: 2021/9/3 4:10 下午
* @param $data
* @return bool
*/
private function addColonelDistributorPayInfo($data): bool
{
return (int)ColonelDistributorPayInfo::save($data);
}
/**
* Notes: 获取团长分销资余额
* User: pengfei@yidian-inc.com
* Date: 2021/9/9 6:19 下午
* @return array
* @throws Exception
*/
private function getMarketingCapitalPoolBalance(): array
{
if (!$url = config('interface', 'coupon.capitalpool.detail')) {
throw new Exception('没有capitalpool配置');
}
if (!$marketing = ColonelService::getMarketingInfo()) {
throw new Exception('没有获取到资金池');
}
$httpParams = [
'capital_pool_id' => $marketing['capital_pool_id']
];
$response = HttpUtil::post($url, $httpParams, 100000, 3);
$this->loggerInfo("url=$url,request=" . json_encode($httpParams) . ";response=" . json_encode($response));
if (!isset($response['response']['result']['capital_pool_total'])) {
throw new Exception('没有获取到资金池信息,' . ['req' => $httpParams, 'res' => $response]);
}
$result = $response['response']['result'];
$balance = ($result['capital_pool_total'] - $result['capital_pool_lock'] - $result['capital_pool_used']);
return [
'marketing_id' => $marketing['marketing_id'],
'balance' => $balance
];
}
/**
* Notes: 检测资金余额,是否下线活动
* User: pengfei@yidian-inc.com
* Date: 2021/9/9 6:29 下午
* @param $colonelPayInfoData
* @throws Exception
*/
private function handleMarketingBalance($colonelPayInfoData)
{
$totalReward = array_sum(array_column($colonelPayInfoData, 'reward'));
$marketing = $this->getMarketingCapitalPoolBalance();
$diffBalance = $marketing['balance'] - $totalReward;
if (0 >= $diffBalance) {
throw new Exception('资金池可用余额不足');
}
// 达到活动下线条件
if (self::ACTIVITY_OFFLINE_BALANCE >= $diffBalance) {
Marketing::updateRecord(
['online_status' => Marketing::ONLINE_STATUS_GUANBI],
['marketing_id' => $marketing['marketing_id']]
);
}
}
/**
* Notes: 加载配置
* User: pengfei@yidian-inc.com
* Date: 2021/9/8 7:43 下午
*/
private function loadTimeConfig()
{
// 如果传入时间-使用指定时间
$params = $this->getRequest()->getParams();
if (empty($params['date']) || !strtotime($params['date'])) {
$timeRange = PindanActivityColonelConfigService::getSettlementTimeRange();
$this->settlementDate = $timeRange['date'];
$this->startTime = $timeRange['start_time'];
$this->endTime = $timeRange['end_time'];
} else {
$hour = PindanActivityColonelConfigService::ACTIVITY_DEFAULT_HOUR;
$this->settlementDate = $params['date'];
$this->startTime = "{$params['date']} $hour:00:00";
$this->endTime = date('Y-m-d H:i:s', strtotime($this->startTime . ' +1 day'));
}
}
/**
* Notes: 记录 info 日志
* User: pengfei@yidian-inc.com
* Date: 2021/9/3 4:10 下午
* @param $log
*/
private function loggerInfo($log)
{
JobLog::getInstance()->info('colonel_distributor_order', $log)->output();
}
/**
* Notes: 记录 error 日志
* User: pengfei@yidian-inc.com
* Date: 2021/9/3 4:10 下午
* @param $log
*/
private function loggerError($log)
{
JobLog::getInstance()->error('colonel_distributor_order', $log, null, 'bp-server@yidian-inc.com')->output();
}
}
<?php
/**
* Created by PhpStorm.
* User: pengfei@yidian-inc.com
* Date: 2021/9/3 2:23 下午
*/
use App\Base\Job;
use App\Models\marketing\mysql\ColonelDistributorPayInfo;
use Api\PhpUtils\Http\HttpUtil;
use Api\PhpUtils\Log\JobLog;
use App\Services\marketing\ColonelService;
class ColonelwalletController extends Job
{
const CAPITAL_POOL_OP = 200; //200:团长奖励
const WALLET_SERVICE_NAME = 10; // 10生活圈优惠券,11营销活动
const WALLET_SOURCE_NAME = 1; //使用方名,1生活圈,2主端
const WALLET_ORDER_TYPE_USER = 601; // 钱包-邀请新用户奖励类型
const WALLET_ORDER_TYPE_ORDER = 602; // 钱包-邀请下单奖励类型
public $capitalPoolId = null;
/**
* Notes: 初始化-读取配置
* User: pengfei@yidian-inc.com
* Date: 2021/9/10 10:01 上午
*/
public function init()
{
parent::init();
$marketing = ColonelService::getMarketingInfo();
$this->capitalPoolId = $marketing['capital_pool_id'] ?? 0;
}
/**
* Notes: 奖励结算脚本
* User: pengfei@yidian-inc.com
* Date: 2021/9/9 11:17 上午
*/
public function indexAction()
{
$this->loggerInfo('start');
$payInfoList = $this->getPayInfoList();
$this->loggerInfo('payInfoCount=' . count($payInfoList));
if (!empty($payInfoList)) {
try {
if ($this->deductingInventory($payInfoList)) {
if ($this->toWallet($payInfoList)) {
$this->handlePayInfoStatus(array_column($payInfoList, 'pay_info_id'));
}
}
$this->loggerInfo('success');
} catch (Exception $e) {
$this->loggerError('error:' . $e->getMessage());
}
}
$this->loggerInfo('end');
}
/**
* Notes: 结算写入钱包
* User: pengfei@yidian-inc.com
* Date: 2021/9/3 6:04 下午
* @param $payInfoList
* @return bool
* @throws Exception
*/
private function toWallet($payInfoList): bool
{
if (!$url = config('interface', 'wallet.account.transfer')) {
throw new Exception('没有wallet.account.transfer配置');
}
$httpParams = self::getWalletHttpParams();
$list = [];
foreach ($payInfoList as $payInfo) {
$thirdOrderInfo = self::getThirdOrderInfo($payInfo);
$list[] = [
'user_id' => $payInfo['colonel_user_id'],
'service_name' => self::WALLET_SERVICE_NAME,
'source_name' => self::WALLET_SOURCE_NAME,
'third_order_id' => $payInfo['pay_info_trade_id'],
'third_order_id_type' => $thirdOrderInfo['type'],
'third_order_desc' => $thirdOrderInfo['desc'],
'amount' => $payInfo['reward'],
'extra' => ''
];
}
$httpParams['list'] = $list;
$response = HttpUtil::post($url, $httpParams, 100000, 3);
$this->loggerInfo("url=$url,response:" . json_encode($response));
if (!empty($response['response']['result']) && $response['code'] == 0) {
$this->loggerInfo('调用钱包服务成功,count=' . count($payInfoList));
return true;
} else {
throw new Exception('调用钱包服务失败,' . json_encode(['req' => $httpParams, 'res' => $response]));
}
}
/**
* Notes: 资金池授予用户奖励
* User: pengfei@yidian-inc.com
* Date: 2021/9/3 6:04 下午
* @param $payInfoList
* @return bool
* @throws Exception
*/
private function deductingInventory($payInfoList): bool
{
if (!$url = config('interface', 'coupon.capitalpool.grant_user_amount')) {
throw new Exception('没有grant_user_amount配置');
}
$httpParams = [
'capital_pool_id' => $this->capitalPoolId
];
$body = [];
foreach ($payInfoList as $payInfo) {
$thirdOrderInfo = self::getThirdOrderInfo($payInfo);
$body[] = [
'op' => self::CAPITAL_POOL_OP,
'user_id' => $payInfo['colonel_user_id'],
'amount' => $payInfo['reward'],
'third_order_id' => $payInfo['pay_info_trade_id'],
'third_order_id_type' => $thirdOrderInfo['type'],
'third_order_desc' => $thirdOrderInfo['desc'],
];
}
$httpParams['body'] = $body;
$res = HttpUtil::post($url, $httpParams, 100000, 3);
$this->loggerInfo("url=$url,response:" . json_encode($res));
if ($res['code'] == 0 && isset($res['response']['result'])) {
$this->loggerInfo('调用资金池服务成功,count=' . count($payInfoList));
return true;
} else {
throw new Exception('调用资金池服务失败,' . ['req' => $httpParams,'res' => $res]);
}
}
/**
* Notes: 获取钱包服务请求参数
* User: pengfei@yidian-inc.com
* Date: 2021/9/3 7:34 下午
* @return array
*/
private function getWalletHttpParams(): array
{
// TODO 此处看后期业务发展 看是否需要封装WalletSdk
$date = date('Y-m-d H:i:s');
return [
'transfer_service_id' => appConfig('colonel.wallet.transfer_service_id'),
'sign' => self::getWalletHttpSign($date),
'time' => $date
];
}
/**
* Notes: 获取钱包签名
* User: pengfei@yidian-inc.com
* Date: 2021/9/3 7:34 下午
* @param $date
* @return string
*/
private function getWalletHttpSign($date): string
{
return md5($date . appConfig('colonel.wallet.transfer_service_secret'));
}
/**
* Notes: 获取待结算数据
* User: pengfei@yidian-inc.com
* Date: 2021/9/3 7:23 下午
* @return array
*/
private function getPayInfoList(): array
{
return ColonelDistributorPayInfo::getRecords(['status' => ColonelDistributorPayInfo::STATUS_NOT_USE]);
}
/**
* Notes: 获取描述信息
* User: pengfei@yidian-inc.com
* Date: 2021/9/3 6:10 下午
* @param $payInfo
* @return array
*/
private function getThirdOrderInfo($payInfo): array
{
$info = [];
if ($payInfo['type'] == ColonelDistributorPayInfo::TYPE_NEW_USER) {
$info = [
'desc' => "邀请新用户(" . $payInfo["invite_user_nick"] . ")完成下单奖励",
'type' => self::WALLET_ORDER_TYPE_USER,
];
} elseif ($payInfo['type'] == ColonelDistributorPayInfo::TYPE_FINISH_TARGET) {
$info = [
'desc' => "完成" . $payInfo["finish_num"] . "单用户下单奖励",
'type' => self::WALLET_ORDER_TYPE_ORDER,
];
}
return $info;
}
/**
* Notes: 修改状态
* User: pengfei@yidian-inc.com
* Date: 2021/9/9 11:15 上午
* @param array $payInfoIds
* @return bool
* @throws Exception
*/
private function handlePayInfoStatus(array $payInfoIds): bool
{
$upStatus = ColonelDistributorPayInfo::updateRecord(
['status' => ColonelDistributorPayInfo::STATUS_USE],
['pay_info_id' => $payInfoIds]
);
if (empty($upStatus)) {
throw new Exception('更新pay_info状态失败.pay_info_ids=' . implode(',', $payInfoIds));
}
return $upStatus;
}
/**
* Notes: 记录 info 日志
* User: pengfei@yidian-inc.com
* Date: 2021/9/3 4:10 下午
* @param $log
*/
private function loggerInfo($log)
{
JobLog::getInstance()->info('colonel_distributor_wallet', $log, false)->output();
}
/**
* Notes: 记录 error 日志
* User: pengfei@yidian-inc.com
* Date: 2021/9/3 4:10 下午
* @param $log
*/
private function loggerError($log)
{
JobLog::getInstance()->error('colonel_distributor_wallet', $log, null, 'bp-server@yidian-inc.com')->output();
}
}
<?php
use Api\PhpUtils\Http\Request;
use App\Base\Job;
use App\Exception\custom\InterfaceException;
use App\Models\goods\mysql\Category;
use \App\Models\goods\mysql\GoodsSku;
use \App\Services\goods\GoodsService;
use \App\Services\goods\ElasticGoodService;
use Api\PhpUtils\Log\DaemonLog;
use Api\PhpServices\JwUser\JwUser;
use App\Services\shop\ShopService;
/**
* 同步商品数据到es
* php public/cli.php goodstoes index
* Class GoodsToEsController
*/
class GoodstoesController extends Job
{
public function indexAction()
{
$this->initEsIndex();
$goodsSkuIds = $this->getGoodsSkuIdList();
$this->toEs($goodsSkuIds);
}
private function getGoodsSkuIdList()
{
return GoodsSku::select("goods_sku_id", ['LIMIT' => 10]);
}
private function toEs($goodsSkuIds)
{
if (!empty($goodsSkuIds)) {
foreach ($goodsSkuIds as $goodsSkuId) {
echo "当前正在同步的商品sku_id: $goodsSkuId \n";
$this->updateGoodsInfoToEs($goodsSkuId);
}
}
}
private function initEsIndex()
{
//删除原index
ElasticGoodService::deleteIndex();
//创建空index
ElasticGoodService::createIndex();
}
/**
* 写入到es
* @param $goodsSkuId
* @return array|callable
* @throws InterfaceException
*/
public function updateGoodsInfoToEs($goodsSkuId)
{
$goodsSkuInfoList = GoodsSku::getRecordMaster(["goods_sku_id" => $goodsSkuId]);
if (!empty($goodsSkuInfoList)) {
$goodsSkuInfo = $goodsSkuInfoList[0];
$nameList = Category::select("name", ["category_id" => [$goodsSkuInfo["category_1_id"], $goodsSkuInfo["category_2_id"]]]);
//生活号信息
$url = config('interface', 'merchant.lifeaccount.get_life_account_by_id');
if (empty($url)) {
throw new InterfaceException(['cus' => 0]);
}
$lifeAccountRes = (new Request())->get($url, ["life_account_id" => $goodsSkuInfo["life_account_id"]]);
//门店信息
$subShopList = ShopService::getRelationShop($goodsSkuId);
$latitude = empty($subShopList[0]["latitude"]) ? "" : $subShopList[0]["latitude"];
$longitude = empty($subShopList[0]["longitude"]) ? "" : $subShopList[0]["longitude"];
if (!empty($longitude) && !empty($latitude) && !empty($subShopList)) {
foreach ($subShopList as $subShop) {
$esId = $goodsSkuId."_".$subShop["sub_shop_id"];
$data = [
"goods_sku_id" => $goodsSkuInfo["goods_sku_id"],
"goods_desc_pic_url" => $goodsSkuInfo["desc_pic_url"],
"goods_name" => $goodsSkuInfo["goods_name"],
"inventory_rest" => $goodsSkuInfo["inventory_rest"],
"total_amount_sold" => $goodsSkuInfo["total_amount_sold"],
"original_price" => empty($goodsSkuInfo["original_price"]) ? "" : (string)($goodsSkuInfo["original_price"] / 100),
"price" => $goodsSkuInfo["price"] / 100,
"price_sort" => (int)$goodsSkuInfo["price"],
"audit_status" => $goodsSkuInfo["audit_status"],
"online_status" => $goodsSkuInfo["online_status"],
"desc" => $goodsSkuInfo["desc"],
"category_1_id" => $goodsSkuInfo["category_1_id"],
"category_2_id" => $goodsSkuInfo["category_2_id"],
"category_1_name" => $nameList[0],
"category_2_name" => $nameList[1],
"life_account_id" => $goodsSkuInfo["life_account_id"],
"life_account_name" => empty($lifeAccountRes["response"]["result"]["life_account_name"]) ? "" : $lifeAccountRes["response"]["result"]["life_account_name"],
"life_account_icon" => empty($lifeAccountRes["response"]["result"]["life_account_icon"]) ? "" : $lifeAccountRes["response"]["result"]["life_account_icon"],
"shop_name" => $subShop["shop_name"],
"shop_address" => $subShop["address"],
"shop_location" => $latitude.",".$longitude,
"update_time" => strtotime($goodsSkuInfo["update_time"]),
];
return ElasticGoodService::indexDoc($esId, $data);
}
}
}
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: pengfei@yidian-inc.com
* Date: 2021/8/20 2:06 下午
*/
use App\Base\Base;
use App\Services\marketing\ColonelService;
use \Validate\ColonelApplyValidate;
use \Validate\ColonelConfigValidate;
use \Validate\ColonelAuditValidate;
use \Validate\ColonelCenterValidate;
use \Validate\ColonelAddPointValidate;
use \App\Services\marketing\PindanActivityColonelConfigService;
use \App\Services\marketing\PindanActivityInviteOrderService;
use \App\Services\user\UserService;
class ColonelController extends Base
{
/**
* Notes: 申请成为团长
* User: pengfei@yidian-inc.com
* Date: 2021/8/20 3:21 下午
* @throws \App\Exception\custom\MarketingException
* @throws \App\Exception\custom\ParamException
*/
public function applyAction()
{
$params = $this->params;
(new ColonelApplyValidate())->validate();
$applyId = ColonelService::apply($params);
return $this->success(['result' => ['apply_id' => $applyId]]);
}
/**
* Notes: 是否已申请
* User: pengfei@yidian-inc.com
* Date: 2021/8/25 9:56 上午
* @throws \App\Exception\custom\ParamException
*/
public function is_applyAction()
{
$params = $this->params;
(new ColonelCenterValidate())->validate();
$applyInfo = ColonelService::isApply($params['user_id']);
return $this->success(['result' => $applyInfo]);
}
/**
* 编辑团长分销配置
* @throws \App\Exception\custom\MarketingException
* @throws \App\Exception\custom\ParamException
*/
public function add_configAction()
{
(new ColonelConfigValidate())->scene('add')->validate();
$params = $this->params;
PindanActivityColonelConfigService::editColonelConfig($params);
return $this->success();
}
/**
* 查看团长分销配置
* @throws \App\Exception\custom\ParamException
*/
public function colonel_configAction()
{
$params = $this->params;
$data = PindanActivityColonelConfigService::colonelConfig($params);
return $this->success(["result" => $data]);
}
/**
* Notes: 管理后台 - 申请团长审核列表
* User: pengfei@yidian-inc.com
* Date: 2021/8/23 2:17 下午
*/
public function manage_colonel_apply_listAction()
{
$params = $this->params;
$manageList = ColonelService::getManageApplyList($params);
return $this->success($manageList);
}
/**
* Notes: 管理后台 - 团长审核列表
* User: pengfei@yidian-inc.com
* Date: 2021/8/24 3:09 下午
*/
public function manage_colonel_listAction()
{
$params = $this->params;
$manageList = ColonelService::getManageList($params);
return $this->success($manageList);
}
/**
* Notes: 管理后台 - 申请团长审核
* User: pengfei@yidian-inc.com
* Date: 2021/8/23 2:16 下午
* @throws \App\Exception\custom\MarketingException
*/
public function manage_auditAction()
{
$params = $this->params;
(new ColonelAuditValidate())->validate();
ColonelService::handleManageAudit($params['colonel_apply_id'], $params['audit_status']);
return $this->success();
}
/**
* Notes: 管理后台 - 获取自提点信息
* User: pengfei@yidian-inc.com
* Date: 2021/8/24 2:43 下午
*/
public function manage_show_apply_pointAction()
{
$params = $this->params;
$colonelApply = ColonelService::getTakePlaceInfo($params['colonel_apply_id']);
return $this->success(['result' => $colonelApply]);
}
/**
* Notes: 管理后台 - 添加自提点信息
* User: pengfei@yidian-inc.com
* Date: 2021/8/25 2:52 下午
* @throws \App\Exception\custom\MarketingException
* @throws \App\Exception\custom\ParamException
*/
public function manage_add_apply_pointAction()
{
$params = $this->params;
(new ColonelAddPointValidate())->validate();
$takePlaceId = ColonelService::handleAddTaskPlace($params);
return $this->success(['result' => ['take_place_id' => $takePlaceId]]);
}
/**
* 团长分销下单处理统计数据逻辑
* @throws \App\Exception\custom\MarketingException
*/
public function place_order_process_logicAction()
{
$params = $this->params;
$data = PindanActivityInviteOrderService::placeOrder($params);
return $this->success(["result" => $data]);
}
/**
* 团长分销下单处理统计数据逻辑
* @throws \App\Exception\custom\MarketingException
*/
public function refund_order_process_logicAction()
{
$params = $this->params;
$data = PindanActivityInviteOrderService::refundOrder($params);
return $this->success(["result" => $data]);
}
/**
* 团长分销,任务中心
* @throws Exception
*/
public function task_controlAction()
{
$params = $this->params;
$data = PindanActivityColonelConfigService::getTaskData($params);
return $this->success(["result" => $data]);
}
/**
* 团长分销,数据统计
* @throws Exception
*/
public function colonel_indexAction()
{
(new ColonelCenterValidate())->validate();
$params = $this->params;
$userId = $params["user_id"];
$user = [];
if (!empty($userId)) {
$wechatInfo = UserService::userWechatBind(["user_id" => $userId]);
if (!empty($wechatInfo)) {
$user = [
"user_id" => $wechatInfo[0]["user_id"],
"user_nick" => $wechatInfo[0]["user_nick"],
"user_avatar" => $wechatInfo[0]["user_avatar"]
];
}
$incomeData = PindanActivityInviteOrderService::incomeStatistics(["user_ids" => [$userId]]);
$orderNumData = PindanActivityInviteOrderService::inviteOrderNumberStatistics(["user_ids" => [$userId]]);
return $this->success(["result" => [
"income" => $incomeData[$userId],
"order_num" => $orderNumData[$userId],
"user" => $user]]);
}
return $this->success(["result" => []]);
}
/**
* 团长分销,账单详情
* @throws Exception
*/
public function bill_infoAction()
{
(new ColonelCenterValidate())->validate();
$params = $this->params;
$data = PindanActivityInviteOrderService::getPayInfoList($params);
return $this->success(["result" => $data]);
}
/**
* 团长分销,下单记录
* @throws \App\Exception\custom\ParamException
*/
public function invite_order_recordAction()
{
(new ColonelCenterValidate())->validate();
$params = $this->params;
$data = PindanActivityInviteOrderService::getInviteOrderRecord($params);
return $this->success(["result" => $data]);
}
}
......@@ -7,6 +7,8 @@ use App\Services\marketing\MarketingGoodsService;
use \Validate\MarketingGoodsRateValidate;
use \Validate\MarketingOnlineStatusValidate;
use \Validate\MarketingInfoValidate;
use App\Models\marketing\mysql\Marketing;
use App\Models\marketing\mysql\MarketingPindan;
class MarketingController extends Base
{
......@@ -155,4 +157,88 @@ class MarketingController extends Base
$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
$skuParams['online_status'] = 0;
break;
default:
# code...
$skuParams['online_type'] = 1;
$skuParams['online_status'] = 0;
$skuParams['online_start_time'] = date("Y-m-d H:i:s");
break;
}
......
......@@ -3,6 +3,8 @@
namespace App\Services\goods;
use Api\PhpUtils\Common\GoodsSkuId;
use App\Models\goods\mysql\GoodsSnapshot;
use App\Models\goods\mysql\PindanGoodsSnapshot;
class GoodsSnapshotsService
......@@ -32,4 +34,42 @@ class GoodsSnapshotsService
}
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;
use Api\PhpUtils\Common\BaseConvert;
use Api\PhpUtils\Common\GoodsSkuId;
use Api\PhpUtils\Http\HttpUtil;
use Api\PhpUtils\Lock\FrequencyLockUtil;
use Api\PhpUtils\Log\FileLog;
use App\Exception\custom\GoodsException;
use App\Models\goods\mysql\Category;
use App\Models\goods\mysql\GoodsOperationRecord;
......@@ -498,11 +500,13 @@ class MarketingPindanGoodsService
]);
$row = PindanGoodsSku::save([
"total_amount_sold" => $sku["total_amount_sold"] - $params["num"],
"total_amount_order" => $sku["total_amount_order"] - $params["num"],
"inventory_rest" => $sku["inventory_rest"] + $params["num"],
"total_amount_sold[-]" => $params["num"],
"total_amount_order[-]" => $params["num"],
"inventory_rest[+]" => $params["num"],
], ["goods_sku_id" => $sku["goods_sku_id"], "total_amount_sold[>=]" => $params["num"], "total_amount_order[>=]" => $params["num"]]);
FileLog::info('goods_refund_log', 'json decode error raw:' . json_encode($params));
if ($row < 1){
PindanGoodsSku::rollback();
GoodsRefundRecord::save([
......
<?php
/**
* Created by PhpStorm.
* User: pengfei@yidian-inc.com
* Date: 2021/8/20 2:23 下午
*/
namespace App\Services\marketing;
use App\Exception\custom\MarketingException;
use App\Models\marketing\mysql\ColonelDistributorColonel;
use App\Models\marketing\mysql\ColonelDistributorColonelApply;
use App\Models\marketing\mysql\TakePlace;
use App\Models\user\mysql\UserWechatBind;
use App\Models\marketing\mysql\Marketing;
use Exception;
class ColonelService
{
/**
* Notes: 申请成为团长
* User: pengfei@yidian-inc.com
* Date: 2021/8/20 4:29 下午
* @param array $params
* @return int $applyId
* @throws MarketingException
*/
public static function apply(array $params): int
{
if (ColonelDistributorColonelApply::existUser($params['user_id'])) {
throw new MarketingException(MarketingException::COLONEL_APPLY_EXIST);
}
$colonelData = [
'user_id' => $params['user_id'],
'life_account_id' => MarketingService::getPublicLifeAccountId(),
'phone' => $params['phone'],
'contact_name' => $params['contact_name'],
'take_place_name' => $params['take_place_name'],
'take_place_pic' => $params['take_place_pic'] ?? '',
'longitude' => $params['longitude'] ?? 0,
'latitude' => $params['latitude'] ?? 0,
'location' => $params['location'] ?? '',
'address' => $params['address'] ?? '',
'province' => $params['province'] ?? '',
'city' => $params['city'] ?? '',
'area' => $params['area'] ?? '',
];
try {
if (!empty($colonelData['take_place_name'])) {
$colonelData['take_place_name'] = "【团长】{$colonelData['take_place_name']}";
}
if (!$applyId = ColonelDistributorColonelApply::insertRecord($colonelData)) {
throw new Exception(MarketingException::COLONEL_APPLY_FAILED);
}
return $applyId;
} catch (Exception $e) {
throw new MarketingException($e->getMessage());
}
}
/**
* Notes: 查看用户是否已申请
* User: pengfei@yidian-inc.com
* Date: 2021/8/25 11:42 上午
* @param $userId
* @return array
*/
public static function isApply($userId): array
{
$applyInfo = ColonelDistributorColonelApply::getRecord(['user_id' => $userId],
['colonel_apply_id', 'audit_status']);
return [
// -1.未申请 0.未审核 1.审核通过 2.审核未通过
'apply_status' => isset($applyInfo['audit_status']) ? intval($applyInfo['audit_status']) : -1
];
}
/**
* Notes: 团长申请列表-后台管理
* User: pengfei@yidian-inc.com
* Date: 2021/8/20 8:15 下午
* @param array $params
* @return array
*/
public static function getManageApplyList(array $params): array
{
$params = self::getPageParams($params);
$result = ColonelDistributorColonelApply::getPages([], ColonelDistributorColonelApply::DEFAULT_COLUMN,
$params['page'], $params['page_size']);
if (empty($result['count'])) {
return $result;
}
$userMap = self::getUserMap(array_column($result['result'], 'user_id'));
$takePlaceMap = self::getColonelTakePlaceMap(array_column($result['result'], 'colonel_apply_id'));
foreach ($result['result'] as &$applyVal) {
$applyVal['user_avatar'] = !empty($userMap[$applyVal['user_id']]['user_avatar']) ? $userMap[$applyVal['user_id']]['user_avatar'] : '';
// take_place_status 是否可以添加自提点 - 已审核通过并且未添加过自提点
$applyVal['take_place_status'] = 2;
if ($applyVal['audit_status'] == ColonelDistributorColonelApply::STATUS_PASS) {
if (empty($takePlaceMap[$applyVal['colonel_apply_id']])) {
$applyVal['take_place_status'] = 1;
}
}
}
unset($applyVal);
return $result;
}
/**
* Notes: 团长列表-后台管理
* User: pengfei@yidian-inc.com
* Date: 2021/8/24 3:04 下午
* @param array $params
* @return array
*/
public static function getManageList(array $params): array
{
$params = self::getPageParams($params);
$result = ColonelDistributorColonel::getPages([], ColonelDistributorColonel::DEFAULT_COLUMN, $params['page'],
$params['page_size']);
if (empty($result['count'])) {
return $result;
}
$userIds = array_column($result['result'], 'user_id');
$userMap = self::getUserMap($userIds);
$takePlaceMap = self::getTakePlaceMap(array_column($result['result'], 'take_place_id'));
$incomeMap = PindanActivityInviteOrderService::incomeStatistics(["user_ids" => $userIds]);
foreach ($result['result'] as &$colonelVal) {
$userId = $colonelVal['user_id'];
$takePlaceInfo = !empty($takePlaceMap[$colonelVal['take_place_id']]) ? $takePlaceMap[$colonelVal['take_place_id']] : [];
$colonelVal['take_place_name'] = $takePlaceInfo['take_place_name'] ?? '';
$colonelVal['location'] = $takePlaceInfo['location'] ?? '';
$colonelVal['address'] = $takePlaceInfo['address'] ?? '';
$colonelVal['user_avatar'] = !empty($userMap[$userId]['user_avatar']) ? $userMap[$userId]['user_avatar'] : '';
$colonelVal['no_settlement_income'] = !empty($incomeMap[$userId]['no_settlement']) ? $incomeMap[$userId]['no_settlement'] : 0;
$colonelVal['total_income'] = !empty($incomeMap[$userId]['all_reward']) ? $incomeMap[$userId]['all_reward'] : 0;
}
unset($colonelVal);
return $result;
}
/**
* Notes: 团长申请审核
* User: pengfei@yidian-inc.com
* Date: 2021/8/23 1:54 下午
* @param $applyId
* @param $auditStatus
* @return bool
* @throws MarketingException
*/
public static function handleManageAudit($applyId, $auditStatus): bool
{
// 审核状态参数检测
if (!in_array($auditStatus,
[ColonelDistributorColonelApply::STATUS_PASS, ColonelDistributorColonelApply::STATUS_REJECT])) {
throw new MarketingException(MarketingException::COLONEL_AUDIT_STATUS);
}
// 审核状态数据检测
$applyInfo = ColonelDistributorColonelApply::getRecord(['colonel_apply_id' => $applyId]);
if (empty($applyInfo) || $applyInfo['audit_status'] == ColonelDistributorColonelApply::STATUS_PASS) {
throw new MarketingException(MarketingException::COLONEL_AUDIT_STATUS_USE);
}
try {
ColonelDistributorColonelApply::beginTransaction();
// 修改申请状态
$updateStatus = ColonelDistributorColonelApply::updateRecord([
'audit_status' => $auditStatus,
'update_time' => date('Y-m-d H:i:s')
],
['colonel_apply_id' => $applyId, 'audit_status[!]' => ColonelDistributorColonelApply::STATUS_PASS]
);
if (empty($updateStatus)) {
throw new Exception(MarketingException::COLONEL_AUDIT_STATUS_FAILED);
}
// 审核成功
if ($auditStatus == ColonelDistributorColonelApply::STATUS_PASS) {
if (!self::handleAuditSuccess((array)$applyInfo)) {
throw new Exception(MarketingException::COLONEL_ADD_FAILED);
}
}
if (!ColonelDistributorColonelApply::commit()) {
throw new Exception(MarketingException::COMMIT_ERROR);
}
return true;
} catch (Exception $e) {
ColonelDistributorColonelApply::rollback();
throw new MarketingException($e->getMessage());
}
}
/**
* Notes: 获取自提点信息
* User: pengfei@yidian-inc.com
* Date: 2021/8/24 2:40 下午
* @param $applyId
* @return array
*/
public static function getTakePlaceInfo($applyId): array
{
$where = [
'colonel_apply_id' => $applyId
];
$colonelApply = ColonelDistributorColonelApply::getRecord($where);
return (array)$colonelApply;
}
/**
* Notes: 添加自提点
* User: pengfei@yidian-inc.com
* Date: 2021/8/24 2:41 下午
* @param array $params
* @return int
* @throws MarketingException
*/
public static function handleAddTaskPlace(array $params): int
{
// 自提点名称检测
if (TakePlace::existTakePlaceName($params['take_place_name'])) {
throw new MarketingException(MarketingException::COLONEL_TAKE_PLACE_EXIST);
}
$where = [
'colonel_apply_id' => $params['colonel_apply_id']
];
// 自提点信息检测
if (!$colonelApply = ColonelDistributorColonelApply::getRecord($where)) {
throw new MarketingException(MarketingException::COLONEL_TAKE_PLACE_PARAMS);
}
$params['life_account_id'] = $colonelApply['life_account_id'];
$params['name'] = $params['take_place_name'];
try {
ColonelDistributorColonel::beginTransaction();
// 添加自提点
if (!$takePlaceId = TakePlaceService::add($params)) {
throw new Exception(MarketingException::COLONEL_TAKE_PLACE_FAILED);
}
// 修改自提点id
if (!ColonelDistributorColonel::updateRecord(['take_place_id' => $takePlaceId], $where)) {
throw new Exception(MarketingException::COLONEL_TAKE_PLACE_EDIT_FAILED);
}
if (!ColonelDistributorColonel::commit()) {
throw new Exception(MarketingException::COMMIT_ERROR);
}
return (int)$takePlaceId;
} catch (Exception $e) {
ColonelDistributorColonel::rollback();
throw new MarketingException($e->getMessage());
}
}
/**
* Notes: 团长审核成功
* User: pengfei@yidian-inc.com
* Date: 2021/8/24 11:24 上午
* @param array $applyInfo
* @return int
*/
private static function handleAuditSuccess(array $applyInfo): int
{
// 入库团长表
$colonelData = [
'user_id' => $applyInfo['user_id'],
'colonel_apply_id' => $applyInfo['colonel_apply_id'],
'take_place_id' => 0,
'life_account_id' => $applyInfo['life_account_id'],
'phone' => $applyInfo['phone'],
'contact_name' => $applyInfo['contact_name'],
'colonel_source' => ColonelDistributorColonel::COLONEL_SOURCE_APPLY
];
return ColonelDistributorColonel::insertRecord($colonelData);
}
/**
* Notes: 获取用户信息
* User: pengfei@yidian-inc.com
* Date: 2021/8/20 8:16 下午
* @param array $userIds
* @return array
*/
private static function getUserMap(array $userIds): array
{
$userWechatList = UserWechatBind::getRecords(['user_id' => $userIds], ['user_id', 'user_nick', 'user_avatar']);
return array_column((array)$userWechatList, null, 'user_id');
}
/**
* Notes: 获取团长自提点
* User: pengfei@yidian-inc.com
* Date: 2021/8/20 8:16 下午
* @param array $colonelApplyIds
* @return array
*/
private static function getColonelTakePlaceMap(array $colonelApplyIds): array
{
$colonels = ColonelDistributorColonel::getRecords(['colonel_apply_id' => $colonelApplyIds],
['colonel_apply_id', 'take_place_id']);
return array_column((array)$colonels, 'take_place_id', 'colonel_apply_id');
}
/**
* Notes: 获取默认页码
* User: pengfei@yidian-inc.com
* Date: 2021/8/20 8:16 下午
* @param array $params
* @return int[]
*/
private static function getPageParams(array $params = []): array
{
$params['page'] = !empty($params['page']) ? $params['page'] : 1;
$params['page_size'] = !empty($params['page_size']) ? $params['page_size'] : 20;
return $params;
}
/**
* Notes: 获取自提点信息
* User: pengfei@yidian-inc.com
* Date: 2021/9/8 6:16 下午
* @param array $takePlaceId
* @return array
*/
private static function getTakePlaceMap(array $takePlaceId): array
{
$takePlaces = TakePlace::getRecords(['take_place_id' => $takePlaceId]);
return array_column((array)$takePlaces, null, 'take_place_id');
}
/**
* Notes: 获取团长分销活动
* User: pengfei@yidian-inc.com
* Date: 2021/9/9 6:06 下午
* @return array
*/
public static function getMarketingInfo(): array
{
$where = [
'marketing_type' => Marketing::MARKETING_TYPE_TUANZHANG,
'ORDER' => ['marketing_id' => 'DESC'],
];
$where['ORDER'] = ["create_time" => "DESC"];
$marketing = Marketing::getRecord($where, ['marketing_id', 'capital_pool_id']);
return (array)$marketing;
}
}
......@@ -82,8 +82,11 @@ class MarketingGoodsService
$goodsSkuId = array_column($data, 'goods_sku_id');
}
$goodsSkuList = GoodsSku::getRecordMaster(['goods_sku_id' => $goodsSkuId]);
$goodsSkuList = !empty($goodsSkuList) ? array_column($goodsSkuList,null,'goods_sku_id') : [];
$goodsSkuList = [];
if (!empty($goodsSkuId)) {
$goodsSkuList = GoodsSku::getRecordMaster(['goods_sku_id' => $goodsSkuId]);
$goodsSkuList = !empty($goodsSkuList) ? array_column($goodsSkuList,null,'goods_sku_id') : [];
}
$lastData = end($data);
$lastId = !empty($lastData['id']) ? $lastData['id'] : '';
......@@ -92,8 +95,11 @@ class MarketingGoodsService
$shopId[$key] = !empty($goodsSkuList[$value['goods_sku_id']]['shop_id']) ? $goodsSkuList[$value['goods_sku_id']]['shop_id'] : '';
}
$subShopList = SubShop::getRecordMaster(['shop_id' => $shopId]);
$subShopList = !empty($subShopList) ? array_column($subShopList,null,'shop_id') : [];
$subShopList = [];
if (!empty($shopId)) {
$subShopList = SubShop::getRecordMaster(['shop_id' => $shopId]);
$subShopList = !empty($subShopList) ? array_column($subShopList,null,'shop_id') : [];
}
$marketingList = !empty($marketingList) ? array_column($marketingList,null,'marketing_id') : [];
......
......@@ -4,7 +4,9 @@
namespace App\Services\marketing;
use Api\PhpServices\Ksy\Ks3Api;
use Api\PhpUtils\Http\Request;
use Api\PhpUtils\Http\HttpUtil;
use App\Exception\BaseException;
use App\Exception\custom\InterfaceException;
use App\Models\goods\mysql\Ota;
use App\Models\goods\mysql\PindanGoodsSku;
......@@ -18,6 +20,7 @@ use App\Models\marketing\mysql\MarketingPindan;
use App\Models\marketing\mysql\MarketingTakePlace;
use App\Models\marketing\mysql\TakePlace;
use App\Services\common\CommonService;
use App\Services\common\KafkaService;
use App\Services\goods\GoodsService;
use Daemon\Goods;
use App\Exception\custom\GoodsException;
......@@ -147,6 +150,49 @@ class MarketingService
}
}
/**
* 营销中心-活动列表
* @param $params
* @return array
*/
public static function yingxiaoList($params)
{
$where["marketing_type"] = [Marketing::MARKETING_TYPE_LIEBIAN, Marketing::MARKETING_TYPE_TUANZHANG];
$where['ORDER'] = ["create_time" => "DESC"];
$lists = Marketing::getRecords($where);
if ($lists && is_array($lists)) {
$capitalPoolIds = array_column($lists, 'capital_pool_id');
//获取资金池列表信息
$url = config('interface', 'coupon.capitalpool.fetch_map_capitalpool');
$capitalPoolList = (new Request())->get($url, ["capital_pool_ids" => $capitalPoolIds]);
$capitalPoolList = $capitalPoolList['response']['result'] ?: [];
$poolTotal = $poolUsed = $poolLock = 0;
foreach ($lists as &$val) {
if($capitalPoolList[$val['capital_pool_id']]) {
$val['capital_pool'] = $capitalPoolList[$val['capital_pool_id']];
foreach (['capital_pool_total','capital_pool_lock','capital_pool_used'] as $key){
$val['capital_pool'][$key] = sprintf("%0.02f",$val['capital_pool'][$key]/100);
}
$poolTotal += $val['capital_pool']['capital_pool_total'];
$poolUsed += $val['capital_pool']['capital_pool_used'];
$poolLock += $val['capital_pool']['capital_pool_lock'];
}else {
$val['capital_pool'] = [];
}
$val['online_status_desc'] = Marketing::$onlineStatusDesc[$val['online_status']];
}
unset($val);
}
$poolbalance = $poolTotal - $poolUsed - $poolLock;
$poolAnalysis = ['total'=>$poolTotal,'used'=>$poolUsed,'lock'=>$poolLock,'balance'=>$poolbalance];
return ['anlysis'=>$poolAnalysis,'list' => $lists];
}
/**
* 分销活动列表
* @param $params
......@@ -231,6 +277,17 @@ class MarketingService
$params['page'] = !empty($params['page']) ? $params['page'] : 1;
$limit = !empty($params['page_size']) ? $params['page_size'] : 20;
$page = ($params['page'] - 1) * $limit;
//排序规则
$sortField = $params['sort_field'] ?? 'update_time';
$sortType = isset($params['sort_type']) ? strtoupper($params['sort_type']) : 'desc';
//验证sort合法性
if(!in_array($params['sort_field'],['create_time','update_time','end_time','start_time'])) {
$sortField = 'update_time';
}
if(!in_array($params['sort_type'],['asc','desc'])) {
$sortType = 'DESC';
}
$where["marketing_type"] = Marketing::MARKETING_TYPE_PINDAN;
if (!empty($params['marketing_name'])) {
......@@ -248,16 +305,20 @@ class MarketingService
$where["end_time[>=]"] = $now;
} elseif ($params["activity_status"] == MarketingPindan::ACTIVITY_STATUS_FINISHED) {
$where["end_time[<]"] = $now;
}
if (!empty($params['from'])) {
$beforeSevenDay = date("Y-m-d H:i:s", strtotime("-7 day"));
$where["start_time[>]"] = $beforeSevenDay;
//七日内结束的活动
if (!empty($params['from']) && $params['from'] == 1) {
$beforeSevenDay = date("Y-m-d H:i:s", strtotime("-7 day"));
$where["end_time[>]"] = $beforeSevenDay;
}
} elseif ($params["activity_status"] == MarketingPindan::ACTIVITY_STATUS_START_TODAY) {//今日上新-未开始
$where["start_time[>]"] = $now;
$where["start_time[<=]"] = date("Y-m-d 00:00:00",strtotime('+1 days'));
$where["end_time[>=]"] = $now;
}
$where['life_account_id'] = self::getPublicLifeAccountId();
$where['ORDER'] = ["update_time" => "DESC"];
$where['ORDER'] = [$sortField => $sortType];
$where['LIMIT'] = [$page, $limit];
$list = Marketing::select(["marketing_id", "marketing_name", "start_time", "end_time",
"online_status", "update_time", "create_time"]
......@@ -270,7 +331,11 @@ class MarketingService
$marketingIds[] = $value["marketing_id"];
}
//参与人数:当前拼单成功支付的订单总数量
$userCount = self::getHaveBuyGoodsUserCount(["marketing_id" => $marketingIds]);
if(isset($params['need_buy_num']) && $params['need_buy_num']) {
$userCount = self::getHaveBuyGoodsUserCount(["marketing_id" => $marketingIds]);
}else {
$userCount = [];
}
$marketingPindanData = MarketingPindan::select(["marketing_id", "publish_life_account_id",
"min_price", "max_price", "pindan_desc","participate_number", "pindan_pic"]
......@@ -290,11 +355,6 @@ class MarketingService
$lists[$key]["online_status_desc"] = Marketing::$onlineStatusDesc[$value["online_status"]];
if (!empty($priceData[$value["marketing_id"]])) {
$currentLifeAccountId = $priceData[$value["marketing_id"]]["publish_life_account_id"];
//小程序前端过滤掉线上测试生活号发布的活动
//TODO::预发环境要调整这里
if ($params['from'] == 1 && $currentLifeAccountId == self::ONLINE_LIFE_ACCOUNT_ID_TEST) {
continue;
}
$lists[$key]["publish_life_account_id"] = $currentLifeAccountId;
if (!empty($lifeAccountList[$currentLifeAccountId])) {
......@@ -682,6 +742,19 @@ class MarketingService
throw new MarketingException(["cus" => 5]);
}
$picList = GoodsService::getUrlList($pindanPic);
KafkaService::productMarketingUpdate([
'activityId' => $marketingId,
'startDate' => $startTime,
'endDate' => $endTime,
'userId' => $lifeAccountId,
'activityName' => $marketingName,
'text' => $pindanDesc,
'imageId' => $picList[0] ?? '',
'createTime' => date('Y-m-d H:i:s'),
'onlineStatus' => Marketing::ONLINE_STATUS_QIDONG,
]);
return $pindanId;
}
......@@ -837,6 +910,20 @@ class MarketingService
throw new MarketingException(["cus" => 5]);
}
$picList = GoodsService::getUrlList($marketingPindan['pindan_pic']);
KafkaService::productMarketingUpdate([
'activityId' => $marketingId,
'startDate' => $startTime,
'endDate' => $endTime,
'userId' => config('lifeaccount','life_account_id'),
'activityName' => $marketingName,
'text' => $pindanDesc,
'imageId' => $picList[0] ?? '',
'createTime' => $marketing['create_time'],
'onlineStatus' => Marketing::ONLINE_STATUS_QIDONG,
]);
return true;
}
......@@ -863,9 +950,47 @@ class MarketingService
'online_status' => $onlineStatus,
'end_time' => $endTime,
];
if ($marketingType == Marketing::MARKETING_TYPE_PINDAN) {
$marketing = Marketing::getRecord(["marketing_id" => $marketingId]);
$marketingPindan = MarketingPindan::getRecord(["marketing_id" => $marketingId]);
$picList = GoodsService::getUrlList($marketingPindan['pindan_pic']);
KafkaService::productMarketingUpdate([
'activityId' => $marketingId,
'startDate' => $marketing['start_time'],
'endDate' => $endTime,
'userId' => config('lifeaccount','life_account_id'),
'activityName' => $marketing['marketing_name'],
'text' => $marketingPindan['pindan_desc'],
'imageId' => $picList[0] ?? '',
'createTime' => $marketing['create_time'],
'onlineStatus' => $onlineStatus,
]);
}
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
......@@ -1057,10 +1182,85 @@ class MarketingService
public static function getMarketingList($params)
{
$where['marketing_id'] = !empty($params['marketing_id']) ? $params['marketing_id'] : '';
if(!empty($params['marketing_type'])){
$where['marketing_type'] = !empty($params['marketing_type']) ? $params['marketing_type'] : '';
}
$marketing_list = Marketing::getMarketingList($where);
return $marketing_list;
}
/**
* 获取多个活动的商品列表
* @param $marketingIds
* @return array
* @throws InterfaceException
*/
public static function getGoodsSkuListByMarketingIds($marketingIds)
{
$marketingGoodsList = MarketingGoods::marketingGoodsList(['marketing_id' => $marketingIds, "ORDER" => ["id" => "ASC"]]);
$goodsSkuList = [];
if (!empty($marketingGoodsList)) {
$goodsSkuId = array_column($marketingGoodsList , 'goods_sku_id');
$goodsSkuList = PindanGoodsSku::select('*', ['goods_sku_id' => $goodsSkuId]);
$goodsSkuList = array_column((array)$goodsSkuList, null, "goods_sku_id");
}
$list = [];
if (!empty($goodsSkuList)) {
//活动sku购买数量
$soldNum = self::getHaveBuyGoodsStatistics(["marketing_id" => $marketingIds]);
//保持排序
foreach ($marketingGoodsList as $key => $value) {
if (empty($goodsSkuList[$value["goods_sku_id"]])) {
continue;
}
$list[$value['marketing_id']][$key] = $value;
$item = $goodsSkuList[$value["goods_sku_id"]];
$list[$value['marketing_id']][$key]['goods_name'] = $item['goods_name'];
$list[$value['marketing_id']][$key]["desc_pic_url_list"] = GoodsService::getUrlList($item["desc_pic_url"]);
$list[$value['marketing_id']][$key]["original_price"] = empty($item["original_price"]) ? '' : sprintf("%.2f", (int)$item["original_price"] / 100);
$list[$value['marketing_id']][$key]["price"] = sprintf("%.2f", $item["price"] / 100);
$list[$value['marketing_id']][$key]["all_have_buy_goods_count"] = $soldNum[$value["goods_sku_id"]] ?? 0;
$list[$value['marketing_id']][$key]['inventory_rest'] = $item['inventory_rest'];
}
//没有库存的放在最下面
foreach ($list as $marketingId => $item) {
foreach($item as $key=>$value) {
if ($value["inventory_rest"] == 0) {
unset($list[$marketingId][$key]);
array_push($list[$marketingId], $value);
}
}
$list[$marketingId] = array_values($list[$marketingId]);
}
}
return $list;
}
/**
* 获取活动支付用户列表
* @param $params
* @return array|mixed
* @throws InterfaceException
*/
public static function getMarketingOrderUser($params)
{
$url = config('interface', 'order.marketing.marketing_user');
if (empty($url)) {
throw new InterfaceException(['cus' => 0]);
}
$res = HttpUtil::get($url, $params);
$data = [];
if ($res['code'] == 0 && isset($res['response']["result"])) {
$data = $res["response"]["result"];
}
return $data;
}
/**
*判断长度
*
......
<?php
namespace App\Services\marketing;
use App\Exception\custom\MarketingException;
use App\Models\marketing\mysql\ColonelDistributorInviteOrderNum;
use App\Models\marketing\mysql\Marketing;
use App\Models\marketing\mysql\ColonelDistributorConfig;
class PindanActivityColonelConfigService
{
// 活动默认时间范围点
const ACTIVITY_DEFAULT_HOUR = 12;
/**
* 编辑团长分销活动配置
* @param array $params
* @return bool
* @throws MarketingException
*/
public static function editColonelConfig($params = [])
{
$date = $params["date"];
$today = date("Y-m-d");
$hour = date("H");
if ($date < $today || ($date == $today && $hour >= 12)) {
throw new MarketingException(['cus' => MarketingException::COLONEL_DATE_ERROR]);
}
$type = empty($params["type"]) ? ColonelDistributorConfig::TYPE_COLONEL : $params["type"];
$configList = $params["config"];
$marketingId = $params["marketing_id"];
if (empty($configList)) {
throw new MarketingException(['cus' => MarketingException::COLONEL_CONFIG_NULL]);
}
if (count($configList) > 6) {
throw new MarketingException(['cus' => MarketingException::COLONEL_LEVEL_SIX]);
}
$idRes = ColonelDistributorConfig::getRecordMaster(["date" => $date, "type" => $type, "marketing_id" => $marketingId], ["colonel_config_id"]);
if (!empty($idRes[0]["colonel_config_id"])) {
ColonelDistributorConfig::save([
"marketing_id" => $marketingId,
"date" => $date,
"type" => $type,
"data" => $configList,
], ["colonel_config_id" => $idRes[0]["colonel_config_id"]]);
} else {
ColonelDistributorConfig::save([
"marketing_id" => $marketingId,
"date" => $date,
"type" => $type,
"data" => $configList,
]);
}
return true;
}
/**
* 团长分销活动配置
* @param array $params
* @return array
*/
public static function colonelConfig($params = [])
{
$day = $params["date"];
$type = empty($params["type"]) ? ColonelDistributorConfig::TYPE_COLONEL : $params["type"];
if(empty($day)) {
//默认取最近更新的一条配置
$config = ColonelDistributorConfig::getRecord([
"type" => $type,"ORDER" => ["update_time" => "DESC"], "LIMIT" => 1
]);
}else {
$config = ColonelDistributorConfig::getRecord(["date" => $day, "type" => $type]);
}
if (empty($config)) {
$config = ColonelDistributorConfig::getRecord([
"date[<=]" => $day,
"ORDER" => ["date" => "DESC"],
"LIMIT" => 1
]);
}
$data = [];
if (!empty($config)) {
$configData = json_decode($config["data"], true);
foreach ($configData as $key => $item) {
$data[$key]["marketing_id"] = $config["marketing_id"];
$data[$key]["date"] = $config["date"];
$data[$key]["level"] = $item["level"];
$data[$key]["assess_order_num"] = $item["assess_order_num"];
$data[$key]["reward_amount"] = $item["reward_amount"];
}
$sortKeys = array_column($data, "level");
array_multisort($sortKeys, SORT_ASC, $data);
}
return $data;
}
/**
* 团长分销活动任务中心列表
* @param array $params
* @return array
*/
public static function getTaskData($params = [])
{
$timeRange = self::getActivityTimeRange();
$date = date("Y-m-d", strtotime($timeRange["start_time"]));
$configList = self::colonelConfig(["date" => $date, "type" => ColonelDistributorConfig::TYPE_COLONEL]);
$marketingId = empty($configList[0]["marketing_id"]) ? 0 : $configList[0]["marketing_id"];
if (!Marketing::isGoing($marketingId)) {
return ["number" => 0, 'list' => []];
}
$num = 0;
if (!empty($params["user_id"])) {
$inviteOrderNumRes = ColonelDistributorInviteOrderNum::getRecord([
"colonel_user_id" => $params["user_id"],
"date" => $date,
]);
$num = empty($inviteOrderNumRes["num"]) ? 0 : $inviteOrderNumRes["num"];
}
if (!empty($configList)) {
foreach ($configList as $key => $config) {
$configList[$key]["is_finish"] = 0;
if ($config["assess_order_num"] <= $num) {
$configList[$key]["is_finish"] = 1;
}
}
}
return ["number" => $num, 'list' => $configList];
}
/**
* Notes: 获取活动时间范围
* User: pengfei@yidian-inc.com
* Date: 2021/9/3 2:50 下午
* @return string[]
*/
public static function getActivityTimeRange() : array
{
// 获取活动时间范围 例如活动时间(2021-09-03) --- 2021-09-03:12:00:00 - 2021-09-04:12:00:00
$hour = ' '.self::ACTIVITY_DEFAULT_HOUR . ':00:00';
if (date('H') >= self::ACTIVITY_DEFAULT_HOUR) {
$startTime = date('Y-m-d').$hour;
$endTime = date('Y-m-d', strtotime('+1 day')).$hour;
} else {
$startTime = date('Y-m-d', strtotime('-1 day')).$hour;
$endTime = date('Y-m-d').$hour;
}
return [
'start_time' => $startTime,
'end_time' => $endTime,
'date' => date('Y-m-d', strtotime($startTime))
];
}
/**
* Notes: 获取结算时间范围
* User: pengfei@yidian-inc.com
* Date: 2021/9/3 2:50 下午
* @return string[]
*/
public static function getSettlementTimeRange() : array
{
// 获取活动时间范围 例如当前时间(2021-09-03 12:00:00) 应结算时间为 2021-08-31-:12:00:00 - 2021-09-01:12:00:00
$hour = ' '.self::ACTIVITY_DEFAULT_HOUR . ':00:00';
$startTime = date('Y-m-d', strtotime('-3 day')).$hour;
$endTime = date('Y-m-d', strtotime('-2 day')).$hour;
return [
'start_time' => $startTime,
'end_time' => $endTime,
'date' => date('Y-m-d', strtotime($startTime))
];
}
}
\ No newline at end of file
<?php
namespace App\Services\marketing;
use Api\PhpUtils\Http\HttpUtil;
use App\Exception\custom\InterfaceException;
use App\Exception\custom\MarketingException;
use App\Models\marketing\mysql\ColonelDistributorColonel;
use App\Models\marketing\mysql\ColonelDistributorConfig;
use App\Models\marketing\mysql\ColonelDistributorInviteOrder;
use App\Models\marketing\mysql\ColonelDistributorInviteOrderNum;
use App\Models\marketing\mysql\ColonelDistributorPayInfo;
use App\Services\user\UserService;
class PindanActivityInviteOrderService
{
/**
* 团长分销下单逻辑
* @param array $params
* @return bool
* @throws MarketingException
*/
public static function placeOrder($params = [])
{
$num = empty($params["num"]) ? 1 : $params["num"];
$inviteOrderData = [
"colonel_user_id" => $params["colonel_user_id"],
"user_id" => $params["user_id"],
"order_id" => $params["order_id"],
"refund_time" => null,
];
$inviteOrder = ColonelDistributorInviteOrder::selectMaster("*", $inviteOrderData, []);
if (!empty($inviteOrder)) {
return true;
}
$timeRange = PindanActivityColonelConfigService::getActivityTimeRange();
$inviteOrderNumData = [
"colonel_user_id" => $params["colonel_user_id"],
"date" => $timeRange['date']
];
$inviteOrderNum = ColonelDistributorInviteOrderNum::selectMaster("*", $inviteOrderNumData, []);
ColonelDistributorInviteOrder::beginTransaction();
$addInviteOrderRes = ColonelDistributorInviteOrder::save($inviteOrderData);
if (!empty($inviteOrderNum)) {
$addInviteOrderNumRes = ColonelDistributorInviteOrderNum::save(["num[+]" => $num], ["invite_order_num_id" => $inviteOrderNum[0]["invite_order_num_id"]]);
} else {
$inviteOrderNumData["num"] = $num;
$addInviteOrderNumRes = ColonelDistributorInviteOrderNum::save($inviteOrderNumData);
}
if (empty($addInviteOrderRes) || empty($addInviteOrderNumRes) || !ColonelDistributorInviteOrder::commit()) {
ColonelDistributorInviteOrder::rollback();
throw new MarketingException(["cus" => MarketingException::COMMIT_ERROR]);
}
return true;
}
/**
* 团长分销退单逻辑
* @param array $params
* @return bool
* @throws MarketingException
*/
public static function refundOrder($params = [])
{
$orderId = $params["order_id"];
$inviteOrder = ColonelDistributorInviteOrder::selectMaster("*", ["order_id" => $orderId], []);
if (!empty($inviteOrder) && $inviteOrder[0]["is_refund"] == ColonelDistributorInviteOrder::IS_REFUND_NO) {
$inviteOrderData = [
"colonel_user_id" => $inviteOrder[0]["colonel_user_id"],
"user_id" => $inviteOrder[0]["user_id"],
"order_id" => $orderId,
];
$inviteOrderNumData = [
"colonel_user_id" => $inviteOrder[0]["colonel_user_id"],
"date" => date("Y-m-d"),
];
ColonelDistributorInviteOrder::beginTransaction();
$addInviteOrderRes = ColonelDistributorInviteOrder::save([
"is_refund" => ColonelDistributorInviteOrder::IS_REFUND_YES,
"refund_time" => date("y-m-d H:i:s")
], $inviteOrderData);
$addInviteOrderNumRes = ColonelDistributorInviteOrderNum::save(["num[-]" => 1], $inviteOrderNumData);
if (empty($addInviteOrderRes) || empty($addInviteOrderNumRes) || !ColonelDistributorInviteOrder::commit()) {
ColonelDistributorInviteOrder::rollback();
throw new MarketingException(["cus" => MarketingException::COMMIT_ERROR]);
}
}
return true;
}
/**
* 团长分销,总收入
* @param array $params
* @return array
*/
public static function incomeStatistics($params = [])
{
$userIds = $params["user_ids"];
$allRewards = ColonelDistributorPayInfo::select(["colonel_user_id", "reward"], ["colonel_user_id" => $userIds], []);
$allData = [];
if (!empty($allRewards)) {
foreach ($allRewards as $item) {
$allData[$item["colonel_user_id"]][] = $item["reward"];
}
}
$data = [];
//未结算收益
$noSettlementStatistics = self::noSettlementStatistics($userIds);
foreach ($noSettlementStatistics as $userId => $item) {
$data[$userId]["no_settlement"] = $item;
}
foreach ($userIds as $userId) {
$data[$userId]["all_reward"] = 0;
if (!empty($allData[$userId])) {
$data[$userId]["all_reward"] = sprintf("%.1f", array_sum($allData[$userId]) / 100);
}
}
return $data;
}
/**
* 未结算收益
* @param $userIds
* @return array
* @throws InterfaceException
*/
private static function noSettlementStatistics($userIds)
{
$timeRange = self::getNoSettlementTimeRange();
$inviteOrderNumList = ColonelDistributorInviteOrderNum::select(["colonel_user_id", "num", "date"], [
"create_time[>]" => $timeRange["start_time"],
"colonel_user_id" => $userIds,
], []);
$inviteOrderNumData = [];
$inviteOrderStatistics = [];
//多个userId, 订单任务累计的未结算收益
if (!empty($inviteOrderNumList)) {
foreach ($inviteOrderNumList as $inviteOrderNum) {
$inviteOrderNumData[$inviteOrderNum["colonel_user_id"]][$inviteOrderNum["date"]] = $inviteOrderNum["num"];
}
if (!empty($inviteOrderNumData)) {
foreach ($inviteOrderNumData as $userId => $itemList) {
foreach ($itemList as $date => $num) {
$configList = self::getColonelConfig($date);
if (!empty($configList)) {
foreach ($configList as $config) {
if ($num >= $config["assess_order_num"]) {
if (empty($inviteOrderStatistics[$userId])) {
$inviteOrderStatistics[$userId] = 0;
}
$inviteOrderStatistics[$userId] += $config['reward_amount'] * 100;
}
}
}
}
}
}
}
//获取新用户奖励
$inviteUserData = [];
$inviteUserStatistics = [];
$inviteUserList = self::getInviteNewUserList($userIds, $timeRange["start_time"], $timeRange["end_time"]);
if (!empty($inviteUserList)) {
foreach ($inviteUserList as $userId => $item) {
$inviteUserData[$item["inviter_user_id"]][] = $userId;
}
foreach ($inviteUserData as $colonelUserId => $item) {
$inviteUserStatistics[$colonelUserId] = count($item) * 3 * 100;
}
}
$statistic = [];
foreach ($userIds as $userId) {
$inviteOrder = empty($inviteOrderStatistics[$userId]) ? 0 : $inviteOrderStatistics[$userId];
$inviteUser = empty($inviteUserStatistics[$userId]) ? 0 : $inviteUserStatistics[$userId];
$statistic[$userId] = sprintf("%.1f", ($inviteOrder + $inviteUser) / 100);;
}
return $statistic;
}
/**
* 获取未结算收益的时间段
* @return array|string[]
*/
public static function getNoSettlementTimeRange() : array
{
// 获取活动时间范围
// 例如当前时间(2021-09-03 11:00:00) 应结算时间为 2021-08-31 12:00:00 ~ 2021-09-03:12:00:00
// 例如当前时间(2021-09-03 13:00:00) 应结算时间为 2021-09-01 12:00:00 ~ 2021-09-03:12:00:00
$nowHour = date("H");
$hour = ' '.PindanActivityColonelConfigService::ACTIVITY_DEFAULT_HOUR . ':00:00';
if ($nowHour < 12) {
$startTime = date('Y-m-d', strtotime('-3 day')).$hour;
} else {
$startTime = date('Y-m-d', strtotime('-2 day')).$hour;
}
//$endTime = date("Y-m-d").$hour;
$endTime = date("Y-m-d H:i:s"); // 结束时间应该取当前时间
return [
'start_time' => $startTime,
'end_time' => $endTime,
];
}
/**
* 指定日期的团长配置
* @param $date
* @return array|mixed
*/
private static function getColonelConfig($date)
{
$config = ColonelDistributorConfig::getRecord([
'date' => $date,
'type' => ColonelDistributorConfig::TYPE_COLONEL
]);
if (empty($config)) {
$config = ColonelDistributorConfig::getRecord([
'date[<=]' => $date,
'ORDER' => ['date' => 'DESC'],
'LIMIT' => 1
]);
}
$configData = [];
if (!empty($config['data'])) {
$configData = json_decode($config['data'], true);
}
return $configData;
}
/**
* 获取新用户奖励
* @param $userIds
* @param $startTime
* @param $endTime
* @return array
* @throws InterfaceException
*/
private static function getInviteNewUserList($userIds, $startTime, $endTime): array
{
$url = config('interface', 'coupon.background.wx_invite_relation_list_by_user_ids');
if (empty($url)) {
throw new InterfaceException(['cus' => 0]);
}
$res = HttpUtil::get($url,
['user_ids' => $userIds, 'start_time' => $startTime, 'end_time' => $endTime]);
if (!empty($res['response']['result'])) {
return array_column($res['response']['result'], null, 'user_id');
}
return [];
}
/**
* 团长分销,累计转化单数
* @param array $params
* @return array
*/
public static function inviteOrderNumberStatistics($params = [])
{
$timeRange = self::getNoSettlementTimeRange();
$userIds = $params["user_ids"];
$allNums = ColonelDistributorInviteOrderNum::select(
["colonel_user_id", "num"],
["colonel_user_id" => $userIds, "create_time[<]" => $timeRange["start_time"]], []);
$allData = array_column($allNums, null, "colonel_user_id");
$data = [];
foreach ($userIds as $userId) {
$data[$userId]["all_order_num"] = 0;
if (!empty($allData[$userId])) {
$data[$userId]["all_order_num"] = $allData[$userId]["num"];
}
}
return $data;
}
/**
* 团长分销,账单详情
* @param array $params
* @return array
*/
public static function getPayInfoList($params = [])
{
$userId = $params["user_id"];
if (empty($userId)) {
return [];
}
$data = $res = [];
$nowHour = date("H");
if ($nowHour < 12) {
$todayNum = 3;
} else {
$todayNum = 2;
}
for ($i = 0; $i < $todayNum; $i++) {
$date = date("Y-m-d", strtotime("-$i day"));
$res[$date]["total"] = 0;
$res[$date]["date"] = $date;
$res[$date]["status"] = 2;
$res[$date]["data"] = [];
}
$weekDay = date("Y-m-d", strtotime("-7 day"));
$payList = ColonelDistributorPayInfo::select("*", [
"colonel_user_id" => $userId,
"date[>=]" => $weekDay,
"ORDER" => ["date" => "DESC"]
], []);
if (!empty($payList)) {
foreach ($payList as $item) {
$tempItem = [];
$tempItem["type"] = $item["type"];
$tempItem["type_desc"] = ColonelDistributorPayInfo::$typeDesc[$item["type"]];
$tempItem["invite_user_id"] = $item["invite_user_id"];
$tempItem["invite_user_nick"] = $item["invite_user_nick"];
$tempItem["reward"] = $item["reward"];
$tempItem["finish_num"] = $item["finish_num"];
$tempItem["status"] = $item["status"];
$data[$item["date"]][] = $tempItem;
}
foreach ($data as $key => $item) {
$rewards = array_column($item, "reward");
$total = array_sum($rewards);
$res[$key]["total"] = $total / 100;
$res[$key]["date"] = $key;
$res[$key]["status"] = 1;
$res[$key]["data"] = $item;
foreach ($item as $k => $v) {
$res[$key]["data"][$k]["reward"] = $v["reward"] / 100;
}
}
}
return array_values($res);
}
/**
* 团长分销,下单记录
* @param array $params
* @return array
*/
public static function getInviteOrderRecord($params = [])
{
$userId = $params["user_id"];
$lastId = empty($params["last_id"]) ? "" : $params["last_id"];
$limit = empty($params["page_size"]) ? 10 : $params["page_size"];
$dateRange = PindanActivityColonelConfigService::getActivityTimeRange();
$where = [];
$where["colonel_user_id"] = $userId;
$where["create_time[>]"] = $dateRange['start_time'];
$where["create_time[<]"] = $dateRange['end_time'];
$where["LIMIT"] = $limit;
$where["ORDER"] = ["invite_order_id" => "DESC"];
if (!empty($lastId)) {
$where["invite_order_id[<]"] = $lastId;
}
$list = ColonelDistributorInviteOrder::select(["invite_order_id", "user_id", "is_refund"], $where, []);
if (!empty($list)) {
$userIds = array_unique(array_column($list, "user_id"));
$userList = UserService::userWechatBind(["user_id"=>$userIds]);
if (!empty($userList)) {
$userList = array_column($userList, null, "user_id");
}
$count = count($list);
foreach ($list as $key => $item) {
if (!empty($userList[$item["user_id"]])) {
$list[$key]["user_nick"] = $userList[$item["user_id"]]["user_nick"];
$list[$key]["user_avatar"] = $userList[$item["user_id"]]["user_avatar"];
} else {
$list[$key]["user_nick"] = "";
$list[$key]["user_avatar"] = "";
}
$lastId = $item["invite_order_id"];
}
if ($count < $limit) {
$lastId = "-1";
}
} else {
$lastId = "-1";
}
return ["list" => $list, "last_id" => $lastId];
}
}
\ No newline at end of file
......@@ -54,7 +54,8 @@ class TakePlaceService
public static function add($params)
{
//验证life_account_id
if(isset($params['life_account_id'])) {
$lifeAccountId = MarketingService::getPublicLifeAccountId();
if(isset($params['life_account_id']) && $params['life_account_id'] != $lifeAccountId) {
$url = config('interface', 'merchant.lifeaccount.get_life_account_by_id');
$lifeAccountRes = (new Request())->get($url, ["life_account_id" => $params["life_account_id"]]);
......@@ -63,9 +64,9 @@ class TakePlaceService
}
}
$lifeAccountId = MarketingService::getPublicLifeAccountId();
$data['life_account_id'] = $params['life_account_id'] ?? $lifeAccountId;
$data['take_place_name'] = $params['name'];
$data['take_place_pic'] = $params['take_place_pic'] ?? '';
$data['longitude'] = $params['longitude'];
$data['latitude'] = $params['latitude'];
$data['location'] = $params['location'];
......
......@@ -3,6 +3,7 @@
namespace App\Services\tcc;
use Api\PhpUtils\Common\GoodsSkuId;
use Api\PhpUtils\Log\FileLog;
use App\Exception\custom\GoodsException;
use App\Models\goods\mysql\GoodsSku;
use App\Models\goods\mysql\PindanGoodsSku;
......@@ -491,7 +492,7 @@ class Tcc2Service
}
}
}
FileLog::info('goods_cancel_confirm_tcc', 'json decode error raw:' . $keys);
if ($isPindan) {
return self::pindanCancelConfirm($goodsInfoList);
} else {
......
......@@ -3,6 +3,7 @@
namespace App\Services\user;
use Api\PhpUtils\Mon\MonUtil;
use App\Models\user\mysql\UserWechatBind;
use Api\PhpUtils\Http\Request;
use App\Services\user\Weixin\WxBizDataCrypt;;
......@@ -27,8 +28,10 @@ class UserService
{
$code = !empty($params['code']) ? $params['code'] : '';//小程序授权code
$openid = !empty($params['openid']) ? $params['openid'] : '';//小程序授权code
$inviteUserId = !empty($params['invite_user_id']) ? intval($params['invite_user_id']) : 0;//邀请用户id
$activityType = !empty($params['activity_type']) ? intval($params['activity_type']) : 0;//活动类型
if (empty($code) && empty($openid)) {
FileLog::error("wechatLogin:获取参数为空", json_encode($params, JSON_UNESCAPED_UNICODE),'','jianghaiming@yidian-inc.com');
FileLog::error("wechatLogin:获取参数为空", json_encode($params, JSON_UNESCAPED_UNICODE), '', 'jianghaiming@yidian-inc.com');
throw new UserException(['cus' => 0]);
}
......@@ -49,30 +52,37 @@ class UserService
//需要授权微信
//if (empty($openid)) {
$appid = \Yaf\Registry::get('config')->wechat->appid;
$secret = \Yaf\Registry::get('config')->wechat->secret;
$grant_type = 'authorization_code';
$loginUrl = 'https://api.weixin.qq.com/sns/jscode2session';
//请求接口,获取用户openid
$params = [
'appid' => $appid,
'secret' => $secret,
'js_code' => $code,
'grant_type' => $grant_type,
];
$response = (new Request())->post($loginUrl, $params);
$appid = \Yaf\Registry::get('config')->wechat->appid;
$secret = \Yaf\Registry::get('config')->wechat->secret;
$grant_type = 'authorization_code';
$loginUrl = 'https://api.weixin.qq.com/sns/jscode2session';
//请求接口,获取用户openid
$params = [
'appid' => $appid,
'secret' => $secret,
'js_code' => $code,
'grant_type' => $grant_type,
];
$begin = microtime(true);
$response = (new Request())->post($loginUrl, $params);
if ($response['code'] == 0) {
$response = $response['response'];
}
$end = microtime(true);
$totalTime = round(($end - $begin), 4) * 1000;
if ($response['code'] == 0) {
$response = $response['response'];
}
if (empty($response) || array_key_exists('errcode', $response)) {
//throw new \Exception('获取openid失败:' . $response['errcode']);
FileLog::error("wechatLogin:获取openid失败", json_encode($params, JSON_UNESCAPED_UNICODE),'','jianghaiming@yidian-inc.com');
throw new UserException(['cus' => 1]);
}
//检查系统是已注册
$openid = !empty($response['openid']) ? $response['openid'] : '';
//mon打点
$env = \Yaf\Application::app()->environ() ?? "dev";
MonUtil::proxyMon($loginUrl, $response['code'], 'weixin_'.$env, $totalTime);
if (empty($response) || array_key_exists('errcode', $response)) {
//throw new \Exception('获取openid失败:' . $response['errcode']);
FileLog::error("wechatLogin:获取openid失败", json_encode($params, JSON_UNESCAPED_UNICODE), '', 'jianghaiming@yidian-inc.com');
throw new UserException(['cus' => 1]);
}
//检查系统是已注册
$openid = !empty($response['openid']) ? $response['openid'] : '';
//}
......@@ -83,51 +93,60 @@ class UserService
'openid' => !empty($response['openid']) ? $response['openid'] : '',
'union_id' => !empty($response['unionid']) ? $response['unionid'] : '',
'session_key' => !empty($response['session_key']) ? $response['session_key'] : '', //默认7200有效期
'invite_user_id' => $inviteUserId,
'activity_type' => $activityType,
'create_time' => date("Y-m-d H:i:s")
];
$sessionKey = !empty($response['session_key']) ? $response['session_key'] : '';
//$newWechatId = UserWechatBind::save($insert);
$newWechatId =UserWechatBind::insertDuplicate($insert, ['session_key' => $sessionKey,'create_time' => date("Y-m-d H:i:s")]);
$newWechatId = UserWechatBind::insertDuplicate($insert, ['session_key' => $sessionKey, 'create_time' => date("Y-m-d H:i:s")]);
if (!$newWechatId) {
FileLog::error("wechatLogin:登陆创建用户失败", json_encode($params, JSON_UNESCAPED_UNICODE),'','jianghaiming@yidian-inc.com');
FileLog::error("wechatLogin:登陆创建用户失败--insert", json_encode($insert, JSON_UNESCAPED_UNICODE),'','jianghaiming@yidian-inc.com');
FileLog::error("wechatLogin:登陆创建用户失败", json_encode($params, JSON_UNESCAPED_UNICODE), '', 'jianghaiming@yidian-inc.com');
FileLog::error("wechatLogin:登陆创建用户失败--insert", json_encode($insert, JSON_UNESCAPED_UNICODE), '', 'jianghaiming@yidian-inc.com');
throw new UserException(['cus' => 2]);
}
$user['wechat_id'] = $newWechatId;
$user['openid'] = $response['openid'];
$user['session_key'] = $response['session_key'];
}else{
} else {
if (empty($user)) {
FileLog::error("wechatLogin:登陆创建用户失败-- 微信response", json_encode($response, JSON_UNESCAPED_UNICODE),'','jianghaiming@yidian-inc.com');
FileLog::error("wechatLogin:登陆创建用户失败-- 微信response", json_encode($response, JSON_UNESCAPED_UNICODE), '', 'jianghaiming@yidian-inc.com');
throw new UserException(['cus' => 2]);
}
if (empty($response)){
FileLog::error("wechatLogin:登陆创建用户失败-- 微信response 获取失败", json_encode($params, JSON_UNESCAPED_UNICODE),'','jianghaiming@yidian-inc.com');
if (empty($response)) {
FileLog::error("wechatLogin:登陆创建用户失败-- 微信response 获取失败", json_encode($params, JSON_UNESCAPED_UNICODE), '', 'jianghaiming@yidian-inc.com');
throw new UserException(['cus' => 2]);
}
$insert = [
'session_key' => !empty($response['session_key']) ? $response['session_key'] : '',
];
$newWechatId = UserWechatBind::save($insert,['openid' => $openid]);
$newWechatId = UserWechatBind::save($insert, ['openid' => $openid]);
}
$user['third_session'] = self::generate3rdSession($openid);
$redis->set($keyCode, json_encode($user),120);
return $user;
return $user;
}
/**
* 绑定手机号
* @param $params
* @return \Api\PhpUtils\Mysql\MysqlBase
* @throws UserException
* @throws \App\Exception\custom\CodeSpecialException
* @throws \App\Exception\custom\InterfaceException
*/
public static function bindPhone($params)
{
$openid = !empty($params['openid']) ? $params['openid'] : '';
$encryptedData = !empty($params['encryptedData']) ? $params['encryptedData'] : '';
$iv = !empty($params['iv']) ? $params['iv'] : '';
$iv = !empty($params['iv']) ? $params['iv'] : '';
$appid = \Yaf\Registry::get('config')->wechat->appid;
if (!$encryptedData) {
FileLog::error("bindPhone:encryptedData 为空", json_encode($params, JSON_UNESCAPED_UNICODE),'','jianghaiming@yidian-inc.com');
throw new UserException(['cus' => 3]);
......@@ -164,7 +183,6 @@ class UserService
}
$phoneNumber = strval($decryptData['phoneNumber']);
//判断是否已
$user = UserWechatBind::getRecordMaster(['phone' => $phoneNumber]);
if (!empty($user) && $openid != $user['openid']) {
......@@ -213,7 +231,7 @@ class UserService
public static function userWechatBind($params)
{
$data['wechat_id[>]'] = 0;
if (!empty($params['openid'])) {
......@@ -223,7 +241,11 @@ class UserService
if (!empty($params['user_id'])) {
$data['user_id'] = $params['user_id'];
}
if (!empty($params['phone'])) {
$data['phone'] = $params['phone'];
}
$userList = UserWechatBind::getRecords($data);
return $userList;
}
......
......@@ -6,8 +6,8 @@
"require": {
"php": "7.2.*",
"ext-json": "*",
"api/php_utils":"1.0.12",
"api/php_services":"1.0.15",
"api/php_utils":"1.0.17",
"ext-openssl": "*"
},
"minimum-stability": "dev",
......
......@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "6c937f48865aa02ab08f6ab0c9bf0b90",
"content-hash": "b64691cd0b568f54f381382cdb77553b",
"packages": [
{
"name": "api/php_services",
......@@ -30,11 +30,11 @@
},
{
"name": "api/php_utils",
"version": "v1.0.12",
"version": "v1.0.17",
"source": {
"type": "git",
"url": "https://git.yidian-inc.com:8021/bp/php_utils.git",
"reference": "bb58e98113fdd1a439828bb61cc716b0de0b6b0c"
"reference": "aa70ccdd545f3e421eaf717274954990f1805b87"
},
"require": {
"elasticsearch/elasticsearch": "~7.0",
......@@ -53,7 +53,7 @@
}
},
"description": "bp api php_utils",
"time": "2021-08-24T08:58:56+00:00"
"time": "2021-09-06T08:57:33+00:00"
},
{
"name": "bacon/bacon-qr-code",
......
......@@ -11,6 +11,14 @@ idgen.partner = "bp"
idgen.key = "5cfdb867e96374c7883b31d6928cc4cb"
[prod : common]
colonel.wallet.transfer_service_id="21090614423333205002"
colonel.wallet.transfer_service_secret="4916927cf3305292f5a524db592dfa95"
[perf : common ]
colonel.wallet.transfer_service_id="21090614423333205002"
colonel.wallet.transfer_service_secret="4916927cf3305292f5a524db592dfa95"
[test: common ]
[dev : common ]
\ No newline at end of file
colonel.wallet.transfer_service_id="21090614423333205002"
colonel.wallet.transfer_service_secret="4916927cf3305292f5a524db592dfa95"
[dev : common ]
colonel.wallet.transfer_service_id="21090614322322205004"
colonel.wallet.transfer_service_secret="e24126c53d4507381ff800a6653611e4"
\ No newline at end of file
<?php
namespace Daemon;
use Api\PhpServices\Daemon\DaemonServiceInterface;
class Colonelorder implements DaemonServiceInterface
{
public function run()
{
//只在10:01执行逻辑
if(date('H') != 10 || date('i')!= 1) {
sleep(5);
return false;
}
\Yaf\Application::app()->bootstrap()->getDispatcher()->dispatch(new \Yaf\Request\Simple('', 'cli', 'colonelorder', 'index', []));
sleep(60);
}
}
\ No newline at end of file
<?php
namespace Daemon;
use Api\PhpServices\Daemon\DaemonServiceInterface;
use Api\PhpUtils\Log\FileLog;
use \App\Models\marketing\mysql\ColonelDistributorPayInfo;
use \App\Exception\custom\InterfaceException;
use Api\PhpUtils\Http\HttpUtil;
class Colonelwallet implements DaemonServiceInterface
{
public function run()
{
//只在10:01执行逻辑
if (date('H') != 10 || date('i') != 5) {
sleep(5);
return false;
}
\Yaf\Application::app()->bootstrap()->getDispatcher()->dispatch(new \Yaf\Request\Simple('', 'cli', 'colonelwallet', 'index', []));
}
}
\ No newline at end of file
......@@ -54,7 +54,8 @@ class Pindan implements DaemonServiceInterface
$params = [
self::emojiFilter($marketing['marketing_name']),
$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
apc.shm_size=1024M
apc.slam_defense=1
apc.serializer=igbinary
apc.enable_cli=1
[memcached]
memcached.sess_connect_timeout=1000
......
#!/bin/bash
#
#set -xeuo pipefail # 参考: https://mp.weixin.qq.com/s/VmM_U4RefRBHwIw8NegC8Q
# 运行环境env
if [[ X"$1" == X"" ]]; then
echo "env cannot be empty"
exit 1
fi
# 任务名称
if [[ X"$2" == X"" ]]; then
echo "controller name cannot be empty"
exit 1
fi
# method名称
if [[ X"$3" == X"" ]]; then
echo "method name cannot be empty"
exit 1
fi
environment=${1}
#php.ini要根据环境去修改
if [[ X"${environment}" == X"prod" || X"${environment}" == X"prod_internal" ]];then
sed -i "s#yaf.environ=dev#yaf.environ=prod#g" ini/php.ini
elif [[ X"${environment}" == X"perf" || X"${environment}" == X"perf_internal" ]];then
sed -i "s#yaf.environ=dev#yaf.environ=perf#g" ini/php.ini
elif [[ X"${environment}" == X"test" || X"${environment}" == X"test_internal" ]];then
sed -i "s#yaf.environ=dev#yaf.environ=test#g" ini/php.ini
fi
\cp -f ini/php.ini /etc/php.ini
rsyslogd >/dev/null 2>&1
if [[ -e "/usr/share/zoneinfo/Asia/Shanghai" ]]; then
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
fi
# fix dir permissions
chmod -R 755 /home/services/api.go2yd.com/logs
sysctl -w net.core.somaxconn=65535
php api.go2yd.com/htdocs/Website/public/job.php "$2" "$3" "$4"
ret=$?
if [ $ret -ne 0 ]; then
echo "Build failed"
exit $ret
else
echo "Build success"
fi
exit 0
\ No newline at end of file
......@@ -35,6 +35,9 @@ if ($param) {
$_SERVER['SERVER_NAME'] = 'daemon.goods';
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
if (empty($_SERVER['SERVER_ADDR'])) {
$_SERVER['SERVER_ADDR'] = 'azkaban-127.0.0.1';
}
$application->bootstrap()->getDispatcher()->dispatch(new Yaf\Request\Simple("", $module, $controller, $method, $param));
......
<?php
date_default_timezone_set("PRC");
ini_set("display_errors", "On");//打开错误提示
ini_set("error_reporting", E_ALL);//显示所有错误
/*
* cli入口脚本
* cli 配置文件:conf/cli.ini
* cli bootstrap:application/BootstrapCli.php ( 在cli.ini中配置
* 默认模块:modules/job
* 脚本位置:modules/job/controllers/xxx.php
* 调用方式:php job.php controller action "a=1&b=2"
* 测试脚本:php job.php test index "a=1&b=2"
*/
if (!substr(php_sapi_name(), 0, 3) == 'cli') {
die;
}
define('ROOT_PATH', realpath(__DIR__ . '/../'));
define('APPLICATION_PATH', realpath(__DIR__ . '/../'));
define('APP_START', microtime(true));
require APPLICATION_PATH . '/vendor/autoload.php';
require APPLICATION_PATH . '/application/library/helper.php';
$application = new Yaf\Application(APPLICATION_PATH . "/conf/cli.ini");
/**
* 获取模块/控制器/方法
*/
$module = "job";
$controller = $argv[1] ?? "";
$method = $argv[2] ?? "";
$param = $argv[3] ?? [];
if ($param) {
$param = convertUrlQuery($param);
}
$_SERVER['SERVER_NAME'] = 'job.goods';
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
if (empty($_SERVER['SERVER_ADDR'])) {
$_SERVER['SERVER_ADDR'] = 'azkaban-127.0.0.1';
}
$application->bootstrap()->getDispatcher()->dispatch(new Yaf\Request\Simple("", $module, $controller, $method, $param));
function convertUrlQuery($query)
{
$queryParts = explode('&', $query);
$params = array();
foreach ($queryParts as $param) {
$item = explode('=', $param);
$params[$item[0]] = $item[1];
}
return $params;
}
\ No newline at end of file
......@@ -61,7 +61,7 @@ class HttpUtil
{
// 增加traceId
if(is_array($headers)) {
$headers['X-TRACE-ID'] = Tracer::getTraceId();
$headers[] = 'X-TRACE-ID: ' . Tracer::getTraceId();
}
$url = $url ."?". http_build_query($params);
return self::curl($url, $timeout, $retries, $headers, [], $proxy, 'GET', $curl_opts);
......@@ -97,7 +97,7 @@ class HttpUtil
{
// 增加traceId
if(is_array($headers)) {
$headers['X-TRACE-ID'] = Tracer::getTraceId();
$headers[] = 'X-TRACE-ID: ' . Tracer::getTraceId();
}
return self::curl($url, $timeout, $retries, $headers, $post, $proxy, 'POST', $curl_opts);
}
......
......@@ -8,6 +8,7 @@ use Api\PhpUtils\Message\Email;
class FileLog
{
static private $log = true;
const PREFIX_FILELOG_ERROR = 'flerr:';
/**
* 用于记录info级别的错误
......@@ -18,6 +19,10 @@ class FileLog
*/
public static function info($signature, $detail_info = '', $with_access_log = false)
{
if(self::$log == false) {
return true;
}
$traceId = Tracer::getTraceId();
$log = 'PHP User_info: [' . $signature . '] [traceId:'. $traceId .'] [detail info:] ' . $detail_info;
if ($with_access_log) {
......@@ -26,6 +31,10 @@ class FileLog
error_log($log);
}
public static function closeInfo(bool $flag) {
self::$log = $flag;
}
/**
* 用于记录waring级别的错误,在日志分析时此级别日志会使用signature进行聚合
* 会记录请求上下文,不会发生报警邮件
......@@ -69,6 +78,7 @@ class FileLog
}
$subject = 'App api #' . $signature . '# ' . $_SERVER['SERVER_NAME'] . ' (' . $_SERVER['SERVER_ADDR'] . ') Alert Message';
$body = 'Error: ' . $signature . "\n\n";
$body .= 'traceId: ' . $traceId . "\n\n";
$body .= 'Detail info: ' . $detail_info . "\n\n";
$body .= 'Exception info: ' . $exception_info . "\n\n";
$body .= 'Request info: ' . self::accessLog() . "\n\n";
......
<?php
namespace Api\PhpUtils\Log;
/**
* @method JobLog info($signature, $detail_info = '', $with_access_log = false)
* @method JobLog waring($signature, $detail_info = '', $exception = null)
* @method JobLog error($signature, $detail_info = '', $exception = null, $mail_to = '')
*/
class JobLog
{
protected static $instance = null;
public $log = null;
protected function __construct()
{
}
protected function __clone()
{
}
public static function getInstance(): ?JobLog
{
if (is_null(self::$instance)) {
self::$instance = new static();
}
return self::$instance;
}
public function __call($name, $arguments)
{
$this->setLog($arguments);
if (in_array($name, get_class_methods(FileLog::class))) {
call_user_func_array([FileLog::class, $name], $arguments);
}
return $this;
}
private function setLog($arguments)
{
if (!empty($arguments[0]) && !empty($arguments[1])) {
$this->log = date('Y-m-d H:i:s') . ";$arguments[0]:$arguments[1]" . PHP_EOL;
}
}
public function output()
{
echo $this->log;
}
}
......@@ -4,4 +4,4 @@
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit14d712e6ba9ca61e9e636d6cf65f43bf::getLoader();
return ComposerAutoloaderInit147d97defc074a277015f080b27e01c6::getLoader();
......@@ -67,6 +67,7 @@ return array(
'Api\\PhpUtils\\Lock\\FrequencyLockUtil' => $vendorDir . '/api/php_utils/src/Lock/FrequencyLockUtil.php',
'Api\\PhpUtils\\Log\\DaemonLog' => $vendorDir . '/api/php_utils/src/Log/DaemonLog.php',
'Api\\PhpUtils\\Log\\FileLog' => $vendorDir . '/api/php_utils/src/Log/FileLog.php',
'Api\\PhpUtils\\Log\\JobLog' => $vendorDir . '/api/php_utils/src/Log/JobLog.php',
'Api\\PhpUtils\\Log\\Tracer' => $vendorDir . '/api/php_utils/src/Log/Tracer.php',
'Api\\PhpUtils\\Message\\Email' => $vendorDir . '/api/php_utils/src/Message/Email.php',
'Api\\PhpUtils\\Mon\\MonUtil' => $vendorDir . '/api/php_utils/src/Mon/MonUtil.php',
......@@ -83,6 +84,7 @@ return array(
'Api\\PhpUtils\\Validate\\ValidateRule' => $vendorDir . '/api/php_utils/src/Validate/ValidateRule.php',
'App\\Base\\Base' => $baseDir . '/application/modules/Base/Base.php',
'App\\Base\\Cli' => $baseDir . '/application/modules/Base/Cli.php',
'App\\Base\\Job' => $baseDir . '/application/modules/Base/Job.php',
'App\\Exception\\BaseException' => $baseDir . '/application/exception/BaseException.php',
'App\\Exception\\ErrorHandler' => $baseDir . '/application/exception/ErrorHandler.php',
'App\\Exception\\ExceptionErrorCatch' => $baseDir . '/application/exception/ExceptionErrorCatch.php',
......@@ -119,6 +121,12 @@ return array(
'App\\Models\\goods\\mysql\\PindanGoodsSnapshot' => $baseDir . '/application/models/goods/mysql/PindanGoodsSnapshot.php',
'App\\Models\\goods\\mysql\\Shop' => $baseDir . '/application/models/goods/mysql/Shop.php',
'App\\Models\\goods\\mysql\\Tcc' => $baseDir . '/application/models/goods/mysql/Tcc.php',
'App\\Models\\marketing\\mysql\\ColonelDistributorColonel' => $baseDir . '/application/models/marketing/mysql/ColonelDistributorColonel.php',
'App\\Models\\marketing\\mysql\\ColonelDistributorColonelApply' => $baseDir . '/application/models/marketing/mysql/ColonelDistributorColonelApply.php',
'App\\Models\\marketing\\mysql\\ColonelDistributorConfig' => $baseDir . '/application/models/marketing/mysql/ColonelDistributorConfig.php',
'App\\Models\\marketing\\mysql\\ColonelDistributorInviteOrder' => $baseDir . '/application/models/marketing/mysql/ColonelDistributorInviteOrder.php',
'App\\Models\\marketing\\mysql\\ColonelDistributorInviteOrderNum' => $baseDir . '/application/models/marketing/mysql/ColonelDistributorInviteOrderNum.php',
'App\\Models\\marketing\\mysql\\ColonelDistributorPayInfo' => $baseDir . '/application/models/marketing/mysql/ColonelDistributorPayInfo.php',
'App\\Models\\marketing\\mysql\\Distributor' => $baseDir . '/application/models/marketing/mysql/Distributor.php',
'App\\Models\\marketing\\mysql\\DistributorAuditRecord' => $baseDir . '/application/models/marketing/mysql/DistributorAuditRecord.php',
'App\\Models\\marketing\\mysql\\Marketing' => $baseDir . '/application/models/marketing/mysql/Marketing.php',
......@@ -133,6 +141,7 @@ return array(
'App\\Models\\user\\mysql\\UserWechatBind' => $baseDir . '/application/models/user/mysql/UserWechatBind.php',
'App\\Plugins\\Hook' => $baseDir . '/application/plugins/Hook.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\\MongoService' => $baseDir . '/application/services/demo/MongoService.php',
'App\\Services\\demo\\MysqlService' => $baseDir . '/application/services/demo/MysqlService.php',
......@@ -142,11 +151,14 @@ return array(
'App\\Services\\goods\\GoodsSnapshotsService' => $baseDir . '/application/services/goods/GoodsSnapshotsService.php',
'App\\Services\\goods\\MarketingPindanGoodsService' => $baseDir . '/application/services/goods/MarketingPindanGoodsService.php',
'App\\Services\\goods\\OtaService' => $baseDir . '/application/services/goods/OtaService.php',
'App\\Services\\marketing\\ColonelService' => $baseDir . '/application/services/marketing/ColonelService.php',
'App\\Services\\marketing\\DistributionService' => $baseDir . '/application/services/marketing/DistributionService.php',
'App\\Services\\marketing\\DistributorService' => $baseDir . '/application/services/marketing/DistributorService.php',
'App\\Services\\marketing\\MarketingForOrderService' => $baseDir . '/application/services/marketing/MarketingForOrderService.php',
'App\\Services\\marketing\\MarketingGoodsService' => $baseDir . '/application/services/marketing/MarketingGoodsService.php',
'App\\Services\\marketing\\MarketingService' => $baseDir . '/application/services/marketing/MarketingService.php',
'App\\Services\\marketing\\PindanActivityColonelConfigService' => $baseDir . '/application/services/marketing/PindanActivityColonelConfigService.php',
'App\\Services\\marketing\\PindanActivityInviteOrderService' => $baseDir . '/application/services/marketing/PindanActivityInviteOrderService.php',
'App\\Services\\marketing\\TakePlaceService' => $baseDir . '/application/services/marketing/TakePlaceService.php',
'App\\Services\\shop\\ShopService' => $baseDir . '/application/services/shop/ShopService.php',
'App\\Services\\tcc\\Tcc2Service' => $baseDir . '/application/services/tcc/Tcc2Service.php',
......@@ -226,6 +238,8 @@ return array(
'DASPRiD\\Enum\\Exception\\SerializeNotSupportedException' => $vendorDir . '/dasprid/enum/src/Exception/SerializeNotSupportedException.php',
'DASPRiD\\Enum\\Exception\\UnserializeNotSupportedException' => $vendorDir . '/dasprid/enum/src/Exception/UnserializeNotSupportedException.php',
'DASPRiD\\Enum\\NullValue' => $vendorDir . '/dasprid/enum/src/NullValue.php',
'Daemon\\Colonelorder' => $baseDir . '/daemon/Colonelorder.php',
'Daemon\\Colonelwallet' => $baseDir . '/daemon/Colonelwallet.php',
'Daemon\\Goods' => $baseDir . '/daemon/Goods.php',
'Daemon\\Marketing' => $baseDir . '/daemon/Marketing.php',
'Daemon\\Pindan' => $baseDir . '/daemon/Pindan.php',
......
......@@ -8,18 +8,18 @@ $baseDir = dirname($vendorDir);
return array(
'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php',
'6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php',
'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',
'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',
'0d59ee240a4cd96ddbb4ff164fccea4d' => $vendorDir . '/symfony/polyfill-php73/bootstrap.php',
'7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php',
'ad155f8f1cf0d418fe49e248db8c661b' => $vendorDir . '/react/promise/src/functions_include.php',
'0d59ee240a4cd96ddbb4ff164fccea4d' => $vendorDir . '/symfony/polyfill-php73/bootstrap.php',
'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php',
'a9ed0d27b5a698798a89181429f162c5' => $vendorDir . '/khanamiryan/qrcode-detector-decoder/lib/Common/customFunctions.php',
'a0edc8309cc5e1d60e3047b5df6b7052' => $vendorDir . '/guzzlehttp/psr7/src/functions_include.php',
'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',
'3a37ebac017bc098e9a86b35401e7a68' => $vendorDir . '/mongodb/mongodb/src/functions.php',
'8592c7b0947d8a0965a9e8c3d16f9c24' => $vendorDir . '/elasticsearch/elasticsearch/src/autoload.php',
);
......@@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit14d712e6ba9ca61e9e636d6cf65f43bf
class ComposerAutoloaderInit147d97defc074a277015f080b27e01c6
{
private static $loader;
......@@ -24,15 +24,15 @@ class ComposerAutoloaderInit14d712e6ba9ca61e9e636d6cf65f43bf
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__)));
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());
if ($useStaticLoader) {
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit14d712e6ba9ca61e9e636d6cf65f43bf::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit147d97defc074a277015f080b27e01c6::getInitializer($loader));
} else {
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
......@@ -53,19 +53,19 @@ class ComposerAutoloaderInit14d712e6ba9ca61e9e636d6cf65f43bf
$loader->register(true);
if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInit14d712e6ba9ca61e9e636d6cf65f43bf::$files;
$includeFiles = Composer\Autoload\ComposerStaticInit147d97defc074a277015f080b27e01c6::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire14d712e6ba9ca61e9e636d6cf65f43bf($fileIdentifier, $file);
composerRequire147d97defc074a277015f080b27e01c6($fileIdentifier, $file);
}
return $loader;
}
}
function composerRequire14d712e6ba9ca61e9e636d6cf65f43bf($fileIdentifier, $file)
function composerRequire147d97defc074a277015f080b27e01c6($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file;
......
......@@ -4,25 +4,25 @@
namespace Composer\Autoload;
class ComposerStaticInit14d712e6ba9ca61e9e636d6cf65f43bf
class ComposerStaticInit147d97defc074a277015f080b27e01c6
{
public static $files = array (
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
'6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php',
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
'8825ede83f2f289127722d4e842cf7e8' => __DIR__ . '/..' . '/symfony/polyfill-intl-grapheme/bootstrap.php',
'e69f7f6ee287b969198c3c9d6777bd38' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/bootstrap.php',
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
'e69f7f6ee287b969198c3c9d6777bd38' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/bootstrap.php',
'8825ede83f2f289127722d4e842cf7e8' => __DIR__ . '/..' . '/symfony/polyfill-intl-grapheme/bootstrap.php',
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
'b6b991a57620e2fb6b2f66f03fe9ddc2' => __DIR__ . '/..' . '/symfony/string/Resources/functions.php',
'0d59ee240a4cd96ddbb4ff164fccea4d' => __DIR__ . '/..' . '/symfony/polyfill-php73/bootstrap.php',
'7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php',
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
'0d59ee240a4cd96ddbb4ff164fccea4d' => __DIR__ . '/..' . '/symfony/polyfill-php73/bootstrap.php',
'c964ee0ededf28c96ebd9db5099ef910' => __DIR__ . '/..' . '/guzzlehttp/promises/src/functions_include.php',
'a9ed0d27b5a698798a89181429f162c5' => __DIR__ . '/..' . '/khanamiryan/qrcode-detector-decoder/lib/Common/customFunctions.php',
'a0edc8309cc5e1d60e3047b5df6b7052' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/functions_include.php',
'8592c7b0947d8a0965a9e8c3d16f9c24' => __DIR__ . '/..' . '/elasticsearch/elasticsearch/src/autoload.php',
'a9ed0d27b5a698798a89181429f162c5' => __DIR__ . '/..' . '/khanamiryan/qrcode-detector-decoder/lib/Common/customFunctions.php',
'37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php',
'3a37ebac017bc098e9a86b35401e7a68' => __DIR__ . '/..' . '/mongodb/mongodb/src/functions.php',
'8592c7b0947d8a0965a9e8c3d16f9c24' => __DIR__ . '/..' . '/elasticsearch/elasticsearch/src/autoload.php',
);
public static $prefixLengthsPsr4 = array (
......@@ -296,6 +296,7 @@ class ComposerStaticInit14d712e6ba9ca61e9e636d6cf65f43bf
'Api\\PhpUtils\\Lock\\FrequencyLockUtil' => __DIR__ . '/..' . '/api/php_utils/src/Lock/FrequencyLockUtil.php',
'Api\\PhpUtils\\Log\\DaemonLog' => __DIR__ . '/..' . '/api/php_utils/src/Log/DaemonLog.php',
'Api\\PhpUtils\\Log\\FileLog' => __DIR__ . '/..' . '/api/php_utils/src/Log/FileLog.php',
'Api\\PhpUtils\\Log\\JobLog' => __DIR__ . '/..' . '/api/php_utils/src/Log/JobLog.php',
'Api\\PhpUtils\\Log\\Tracer' => __DIR__ . '/..' . '/api/php_utils/src/Log/Tracer.php',
'Api\\PhpUtils\\Message\\Email' => __DIR__ . '/..' . '/api/php_utils/src/Message/Email.php',
'Api\\PhpUtils\\Mon\\MonUtil' => __DIR__ . '/..' . '/api/php_utils/src/Mon/MonUtil.php',
......@@ -312,6 +313,7 @@ class ComposerStaticInit14d712e6ba9ca61e9e636d6cf65f43bf
'Api\\PhpUtils\\Validate\\ValidateRule' => __DIR__ . '/..' . '/api/php_utils/src/Validate/ValidateRule.php',
'App\\Base\\Base' => __DIR__ . '/../..' . '/application/modules/Base/Base.php',
'App\\Base\\Cli' => __DIR__ . '/../..' . '/application/modules/Base/Cli.php',
'App\\Base\\Job' => __DIR__ . '/../..' . '/application/modules/Base/Job.php',
'App\\Exception\\BaseException' => __DIR__ . '/../..' . '/application/exception/BaseException.php',
'App\\Exception\\ErrorHandler' => __DIR__ . '/../..' . '/application/exception/ErrorHandler.php',
'App\\Exception\\ExceptionErrorCatch' => __DIR__ . '/../..' . '/application/exception/ExceptionErrorCatch.php',
......@@ -348,6 +350,12 @@ class ComposerStaticInit14d712e6ba9ca61e9e636d6cf65f43bf
'App\\Models\\goods\\mysql\\PindanGoodsSnapshot' => __DIR__ . '/../..' . '/application/models/goods/mysql/PindanGoodsSnapshot.php',
'App\\Models\\goods\\mysql\\Shop' => __DIR__ . '/../..' . '/application/models/goods/mysql/Shop.php',
'App\\Models\\goods\\mysql\\Tcc' => __DIR__ . '/../..' . '/application/models/goods/mysql/Tcc.php',
'App\\Models\\marketing\\mysql\\ColonelDistributorColonel' => __DIR__ . '/../..' . '/application/models/marketing/mysql/ColonelDistributorColonel.php',
'App\\Models\\marketing\\mysql\\ColonelDistributorColonelApply' => __DIR__ . '/../..' . '/application/models/marketing/mysql/ColonelDistributorColonelApply.php',
'App\\Models\\marketing\\mysql\\ColonelDistributorConfig' => __DIR__ . '/../..' . '/application/models/marketing/mysql/ColonelDistributorConfig.php',
'App\\Models\\marketing\\mysql\\ColonelDistributorInviteOrder' => __DIR__ . '/../..' . '/application/models/marketing/mysql/ColonelDistributorInviteOrder.php',
'App\\Models\\marketing\\mysql\\ColonelDistributorInviteOrderNum' => __DIR__ . '/../..' . '/application/models/marketing/mysql/ColonelDistributorInviteOrderNum.php',
'App\\Models\\marketing\\mysql\\ColonelDistributorPayInfo' => __DIR__ . '/../..' . '/application/models/marketing/mysql/ColonelDistributorPayInfo.php',
'App\\Models\\marketing\\mysql\\Distributor' => __DIR__ . '/../..' . '/application/models/marketing/mysql/Distributor.php',
'App\\Models\\marketing\\mysql\\DistributorAuditRecord' => __DIR__ . '/../..' . '/application/models/marketing/mysql/DistributorAuditRecord.php',
'App\\Models\\marketing\\mysql\\Marketing' => __DIR__ . '/../..' . '/application/models/marketing/mysql/Marketing.php',
......@@ -362,6 +370,7 @@ class ComposerStaticInit14d712e6ba9ca61e9e636d6cf65f43bf
'App\\Models\\user\\mysql\\UserWechatBind' => __DIR__ . '/../..' . '/application/models/user/mysql/UserWechatBind.php',
'App\\Plugins\\Hook' => __DIR__ . '/../..' . '/application/plugins/Hook.php',
'App\\Services\\common\\CommonService' => __DIR__ . '/../..' . '/application/services/common/CommonService.php',
'App\\Services\\common\\KafkaService' => __DIR__ . '/../..' . '/application/services/common/KafkaService.php',
'App\\Services\\demo\\ElasticService' => __DIR__ . '/../..' . '/application/services/demo/ElasticService.php',
'App\\Services\\demo\\MongoService' => __DIR__ . '/../..' . '/application/services/demo/MongoService.php',
'App\\Services\\demo\\MysqlService' => __DIR__ . '/../..' . '/application/services/demo/MysqlService.php',
......@@ -371,11 +380,14 @@ class ComposerStaticInit14d712e6ba9ca61e9e636d6cf65f43bf
'App\\Services\\goods\\GoodsSnapshotsService' => __DIR__ . '/../..' . '/application/services/goods/GoodsSnapshotsService.php',
'App\\Services\\goods\\MarketingPindanGoodsService' => __DIR__ . '/../..' . '/application/services/goods/MarketingPindanGoodsService.php',
'App\\Services\\goods\\OtaService' => __DIR__ . '/../..' . '/application/services/goods/OtaService.php',
'App\\Services\\marketing\\ColonelService' => __DIR__ . '/../..' . '/application/services/marketing/ColonelService.php',
'App\\Services\\marketing\\DistributionService' => __DIR__ . '/../..' . '/application/services/marketing/DistributionService.php',
'App\\Services\\marketing\\DistributorService' => __DIR__ . '/../..' . '/application/services/marketing/DistributorService.php',
'App\\Services\\marketing\\MarketingForOrderService' => __DIR__ . '/../..' . '/application/services/marketing/MarketingForOrderService.php',
'App\\Services\\marketing\\MarketingGoodsService' => __DIR__ . '/../..' . '/application/services/marketing/MarketingGoodsService.php',
'App\\Services\\marketing\\MarketingService' => __DIR__ . '/../..' . '/application/services/marketing/MarketingService.php',
'App\\Services\\marketing\\PindanActivityColonelConfigService' => __DIR__ . '/../..' . '/application/services/marketing/PindanActivityColonelConfigService.php',
'App\\Services\\marketing\\PindanActivityInviteOrderService' => __DIR__ . '/../..' . '/application/services/marketing/PindanActivityInviteOrderService.php',
'App\\Services\\marketing\\TakePlaceService' => __DIR__ . '/../..' . '/application/services/marketing/TakePlaceService.php',
'App\\Services\\shop\\ShopService' => __DIR__ . '/../..' . '/application/services/shop/ShopService.php',
'App\\Services\\tcc\\Tcc2Service' => __DIR__ . '/../..' . '/application/services/tcc/Tcc2Service.php',
......@@ -455,6 +467,8 @@ class ComposerStaticInit14d712e6ba9ca61e9e636d6cf65f43bf
'DASPRiD\\Enum\\Exception\\SerializeNotSupportedException' => __DIR__ . '/..' . '/dasprid/enum/src/Exception/SerializeNotSupportedException.php',
'DASPRiD\\Enum\\Exception\\UnserializeNotSupportedException' => __DIR__ . '/..' . '/dasprid/enum/src/Exception/UnserializeNotSupportedException.php',
'DASPRiD\\Enum\\NullValue' => __DIR__ . '/..' . '/dasprid/enum/src/NullValue.php',
'Daemon\\Colonelorder' => __DIR__ . '/../..' . '/daemon/Colonelorder.php',
'Daemon\\Colonelwallet' => __DIR__ . '/../..' . '/daemon/Colonelwallet.php',
'Daemon\\Goods' => __DIR__ . '/../..' . '/daemon/Goods.php',
'Daemon\\Marketing' => __DIR__ . '/../..' . '/daemon/Marketing.php',
'Daemon\\Pindan' => __DIR__ . '/../..' . '/daemon/Pindan.php',
......@@ -1301,9 +1315,9 @@ class ComposerStaticInit14d712e6ba9ca61e9e636d6cf65f43bf
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit14d712e6ba9ca61e9e636d6cf65f43bf::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit14d712e6ba9ca61e9e636d6cf65f43bf::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit14d712e6ba9ca61e9e636d6cf65f43bf::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit147d97defc074a277015f080b27e01c6::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit147d97defc074a277015f080b27e01c6::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit147d97defc074a277015f080b27e01c6::$classMap;
}, null, ClassLoader::class);
}
......
......@@ -27,12 +27,12 @@
},
{
"name": "api/php_utils",
"version": "v1.0.12",
"version_normalized": "1.0.12.0",
"version": "v1.0.17",
"version_normalized": "1.0.17.0",
"source": {
"type": "git",
"url": "https://git.yidian-inc.com:8021/bp/php_utils.git",
"reference": "bb58e98113fdd1a439828bb61cc716b0de0b6b0c"
"reference": "aa70ccdd545f3e421eaf717274954990f1805b87"
},
"require": {
"elasticsearch/elasticsearch": "~7.0",
......@@ -44,7 +44,7 @@
"mongodb/mongodb": "1.4.3",
"php": "7.2.*"
},
"time": "2021-08-24T08:58:56+00:00",
"time": "2021-09-06T08:57:33+00:00",
"type": "library",
"installation-source": "source",
"autoload": {
......
......@@ -5,7 +5,7 @@
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => 'fbcd418b6a1b47fab2b71637dc63a9e415392206',
'reference' => '2af24ef59d9888a3a8c64df2ea4efd62c8a675a1',
'name' => 'yidian/yaf_demo',
'dev' => true,
),
......@@ -20,12 +20,12 @@
'dev_requirement' => false,
),
'api/php_utils' => array(
'pretty_version' => 'v1.0.12',
'version' => '1.0.12.0',
'pretty_version' => 'v1.0.17',
'version' => '1.0.17.0',
'type' => 'library',
'install_path' => __DIR__ . '/../api/php_utils',
'aliases' => array(),
'reference' => 'bb58e98113fdd1a439828bb61cc716b0de0b6b0c',
'reference' => 'aa70ccdd545f3e421eaf717274954990f1805b87',
'dev_requirement' => false,
),
'bacon/bacon-qr-code' => array(
......@@ -314,7 +314,7 @@
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => 'fbcd418b6a1b47fab2b71637dc63a9e415392206',
'reference' => '2af24ef59d9888a3a8c64df2ea4efd62c8a675a1',
'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