Commit 887ece58 authored by mengweifu's avatar mengweifu

Merge branch 'master' into feature_mwf_azkaban

parents a7d3fd75 8873d65c
......@@ -15,6 +15,7 @@ class GoodsException extends BaseException
const EMPTY_OTA_ID = 37;
const OTA_NOT_EXIST = 38;
const RULE_LIMIT_ERROR = 50;
const NOT_FIND_MARKETING = 51;
protected $cus = [
0 => '商品创建失败,请稍后重试',
......@@ -68,5 +69,6 @@ class GoodsException extends BaseException
48 => '请满足以下条件后提交,售价-分销总金额-手续费>=结算价',
49 => '库存不得小于已售库存',
self::RULE_LIMIT_ERROR => '单人可买上限填写错误',
self::NOT_FIND_MARKETING => '找不到活动',
];
}
\ No newline at end of file
......@@ -39,7 +39,7 @@ class MarketingfororderController extends Base
$addressList = [];
//
if (!empty($takePlaceList))
$addressList = array_unique(array_column($takePlaceList, 'address'));
$addressList = array_values(array_unique(array_column($takePlaceList, 'address')));
//
$this->success(["result" => [
'take_place_list' => $takePlaceList,
......
......@@ -922,6 +922,10 @@ class MarketingService
private static function pindanMarketingInfo($params)
{
$marketingInfo = Marketing::getRecord(['marketing_id' => $params['marketing_id'], "marketing_type" => Marketing::MARKETING_TYPE_PINDAN]);
if (empty($marketingInfo))
throw new GoodsException(['cus' => GoodsException::NOT_FIND_MARKETING]);
$pindanMarketing = MarketingPindan::getRecord(['marketing_id' => $params['marketing_id']]);
$lifeAccountList = CommonService::getlifeAccountList(['life_account_id' => [$pindanMarketing["publish_life_account_id"]]]);
......
......@@ -6,7 +6,7 @@ namespace Daemon;
use Api\PhpServices\Daemon\DaemonServiceInterface;
use Api\PhpUtils\Log\DaemonLog;
use App\Services\marketing\MarketingService;
use App\Models\marketing\mysql\Marketing;
use Api\PhpServices\Wechat\Msg;
class Pindan implements DaemonServiceInterface
......@@ -22,15 +22,21 @@ class Pindan implements DaemonServiceInterface
}
try{
//查询进行中的拼单活动
$params['marketing_type'] = 4;//1分销 2团购 3秒杀 4团餐
$params['online_status'] = 1;//状态 , 1启用,2关闭,3 到期
$params['activity_status'] = 2;//1 未开始,2进行中,3已结束
$params['page'] = 1;
$params['page_size'] = 1;
$list = MarketingService::marketingList($params);
//查询进行中的 今天开始的 拼单活动 --昨天16:40以后开始的活动 视为新上的活动
$lastStartTime = date("Y-m-d 16:40:00",strtotime('-1 days'));
$now = date("Y-m-d H:i:00");
$where['marketing_type'] = 4;
$where['online_status'] = 1;
$where["start_time[<=]"] = $now;
$where["start_time[>]"] = $lastStartTime;
$where["end_time[>=]"] = $now;
$where['ORDER'] = ["update_time" => "DESC"];
$where['LIMIT'] = [0, 1];
$list = Marketing::select(["marketing_id", "marketing_name", "marketing_type","start_time", "end_time",
"online_status", "update_time", "create_time"]
, $where);
if(empty($list['result'])) {
if(empty($list)) {
DaemonLog::info(
'DaemonServiceInterface_pindan',
'no need to send at'.date('Y-m-d H:i:s')
......@@ -47,9 +53,9 @@ class Pindan implements DaemonServiceInterface
$type = 2; // 1 公众号 2 小程序
//活动信息
$params = [
self::emojiFilter($list['result'][0]['marketing_name']),
$list['result'][0]['create_time'],
$list['result'][0]['pindan_desc'] ?: self::DEFAULT_DESC
self::emojiFilter($list[0]['marketing_name']),
$list[0]['start_time'],
$list[0]['pindan_desc'] ?: self::DEFAULT_DESC
];
//发送消息
DaemonLog::info(
......
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