Commit 0bff98bc authored by jianghaiming's avatar jianghaiming

Merge branch 'test' of https://gitlab.yidian-inc.com/bp/goods into test

parents 68ca9988 385ffe46
......@@ -133,4 +133,18 @@ class Marketing extends MysqlBase
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;
}
}
<?php
/**
* Created by PhpStorm.
* User: pengfei@yidian-inc.com
* Date: 2021/8/31 1:36 下午
*/
use App\Base\Job;
use Api\PhpServices\Idgen\Idgen;
......@@ -16,7 +11,7 @@ use App\Exception\custom\InterfaceException;
use Api\PhpUtils\Http\HttpUtil;
use App\Models\user\mysql\UserWechatBind;
class ColonelOrderController extends Job
class ColonelorderController extends Job
{
const DEFAULT_USER_BATCH_SIZE = 100;
......
<?php
/**
* Created by PhpStorm.
* User: pengfei@yidian-inc.com
* Date: 2021/8/31 2:28 下午
*/
use App\Base\Job;
use Api\PhpUtils\Log\FileLog;
......@@ -11,7 +6,7 @@ use App\Models\marketing\mysql\ColonelDistributorPayInfo;
use App\Exception\custom\InterfaceException;
use Api\PhpUtils\Http\HttpUtil;
class ColonelWalletController extends Job
class ColonelwalletController extends Job
{
public function indexAction()
{
......
......@@ -212,6 +212,7 @@ class MarketingController extends Base
$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];//状态 , 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') : [];
......@@ -236,6 +237,7 @@ class MarketingController extends Base
$listPart = array_values($listPart);
}
unset($listPart);
$list['life_account_id'] = MarketingService::getPublicLifeAccountId();
$this->success(['result' => $list]);
}
......
......@@ -157,11 +157,6 @@ class GoodsService
throw new GoodsException(['cus' => 2]);
}
$spuId = $res[0];
$checkName = self::checkGoodsName($spuData["goods_name"], $spuData["life_account_id"]);
if (!$checkName["can_use"]) {
throw new GoodsException(['cus' => 17]);
}
$spuParams = [
"goods_spu_id" => $spuId,
"shop_id" => $shopId,
......@@ -771,13 +766,6 @@ class GoodsService
*/
private static function editGoodsSpu($goodsSpu, $params = [])
{
$checkName = self::checkGoodsName($params["goods_name"], $goodsSpu["life_account_id"], $goodsSpu["goods_spu_id"]);
if (!$checkName["can_use"]) {
throw new GoodsException(['cus' => 17]);
}
return GoodsSpu::save([
"goods_name" => $params["goods_name"],
"desc_pic_url" => $params["desc_pic_url"],
......
......@@ -165,12 +165,6 @@ class MarketingPindanGoodsService
*/
private static function addGoodsSku($spuData, $shopId, $skuData = [])
{
$pindanSku = PindanGoodsSku::get("goods_sku_id", ["goods_name" => $skuData["goods_name"]
, "life_account_id" => $skuData["life_account_id"]]);
if (!empty($pindanSku)) {
throw new GoodsException(['cus' => 17]);
}
$res = GoodsService::getIdgenId(substr($shopId, -2), "goods");
if (empty($res)) {
throw new GoodsException(['cus' => 2]);
......@@ -267,11 +261,6 @@ class MarketingPindanGoodsService
*/
private static function editGoodsSpu($goodsSpu, $params = [])
{
$checkName = GoodsService::checkGoodsName($params["goods_name"], $goodsSpu["life_account_id"], $goodsSpu["goods_spu_id"]);
if (!$checkName["can_use"]) {
throw new GoodsException(['cus' => 17]);
}
return GoodsSpu::save([
"desc_pic_url" => $params["desc_pic_url"],
"desc" => $params["desc"],
......
......@@ -95,7 +95,7 @@ class ColonelService
// take_place_status 是否可以添加自提点 - 已审核通过并且未添加过自提点
$applyVal['take_place_status'] = 2;
if ($applyVal['audit_status'] == ColonelDistributorColonelApply::STATUS_PASS) {
if (empty($takePlaceMap[$applyVal['colonel_apply_id']]['take_place_id'])) {
if (empty($takePlaceMap[$applyVal['colonel_apply_id']])) {
$applyVal['take_place_status'] = 1;
}
}
......
......@@ -332,7 +332,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"]
......@@ -1008,6 +1012,16 @@ class MarketingService
return $info;
}
/**
* 获取生活号加入生活圈天数
* @param $createTime
* @return false|float
*/
private static function countAccountRegisterDays($createTime)
{
return ceil((time() - strtotime($createTime)) / 86400);
}
/**
* 拼单活动详情
* @param $params
......@@ -1038,7 +1052,9 @@ class MarketingService
if (!empty($lifeAccountList[$pindanMarketing["publish_life_account_id"]])) {
$marketingData["life_account_name"] = $lifeAccountList[$pindanMarketing["publish_life_account_id"]]["life_account_name"];
$marketingData["life_account_icon"] = $lifeAccountList[$pindanMarketing["publish_life_account_id"]]["life_account_icon"];
$marketingData["life_account_register_days"] = self::countAccountRegisterDays($lifeAccountList[$pindanMarketing["publish_life_account_id"]]['create_time']);
}
$marketingData["id"] = $marketingInfo["marketing_id"];
$marketingData["marketing_name"] = $marketingInfo["marketing_name"];
$marketingData["good_count"] = $marketingInfo["good_count"];
......
......@@ -74,6 +74,7 @@ class PindanActivityColonelConfigService
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"];
......@@ -101,6 +102,12 @@ class PindanActivityColonelConfigService
$date = date("Y-m-d");
}
$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([
......@@ -110,7 +117,6 @@ class PindanActivityColonelConfigService
$num = empty($inviteOrderNumRes["num"]) ? 0 : $inviteOrderNumRes["num"];
}
$configList = self::colonelConfig(["date" => $date, "type" => ColonelDistributorConfig::TYPE_COLONEL]);
if (!empty($configList)) {
foreach ($configList as $key => $config) {
$configList[$key]["is_finish"] = 0;
......
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