Commit 5b271e60 authored by pengfei's avatar pengfei

Merge branch 'colonel' of https://git.yidian-inc.com:8021/bp/goods into colonel

parents bfd6511e f2a74387
......@@ -25,6 +25,7 @@ class MarketingException extends BaseException
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 => '活动名称不能为空',
......@@ -60,10 +61,11 @@ class MarketingException extends BaseException
self::COLONEL_TAKE_PLACE_EXIST => '自提点名称已存在',
self::COLONEL_TAKE_PLACE_PARAMS => '自提点信息不存在',
self::COLONEL_TAKE_PLACE_FAILED => '自提点添加失败',
self::COLONEL_APPLY_EXIST => '当前用户已提交团长申请',
33 => '分润金额+手续费不能大于售价金额',
self::COLONEL_AUDIT_STATUS_USE => '该团长已审核',
self::COLONEL_ADD_FAILED => '团长入库失败',
self::COLONEL_TAKE_PLACE_EDIT_FAILED => '修改团长自提点失败',
33 => '分润金额+手续费不能大于售价金额',
self::COLONEL_APPLY_EXIST => '当前用户已提交团长申请',
self::COLONEL_DATE_ERROR => '当前日期的配置不能修改',
];
}
......@@ -22,6 +22,10 @@ class PindanActivityColonelConfigService
public static function editColonelConfig($params = [])
{
$date = $params["date"];
$today = date("Y-m-d");
if ($date <= $today) {
throw new MarketingException(['cus' => MarketingException::COLONEL_DATE_ERROR]);
}
$type = empty($params["type"]) ? ColonelDistributorConfig::TYPE_COLONEL : $params["type"];
$configList = $params["config"];
$marketingId = $params["marketing_id"];
......@@ -34,15 +38,14 @@ class PindanActivityColonelConfigService
throw new MarketingException(['cus' => MarketingException::COLONEL_LEVEL_SIX]);
}
$idRes = ColonelDistributorConfig::getRecord(["date" => $date, "type" => $type, "marketing_id" => $marketingId], ["colonel_config_id"]);
if (!empty($idRes)) {
$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["colonel_config_id"]]);
], ["colonel_config_id" => $idRes[0]["colonel_config_id"]]);
} else {
ColonelDistributorConfig::save([
"marketing_id" => $marketingId,
......
......@@ -142,10 +142,10 @@ class PindanActivityInviteOrderService
$data[$userId]["yesterday_reward"] = 0;
$data[$userId]["all_reward"] = 0;
if (!empty($yesterdayData[$userId])) {
$data[$userId]["yesterday_reward"] = sprintf("%.2f", array_sum($yesterdayData[$userId]) / 100);
$data[$userId]["yesterday_reward"] = sprintf("%.1f", array_sum($yesterdayData[$userId]) / 100);
}
if (!empty($allData[$userId])) {
$data[$userId]["all_reward"] = sprintf("%.2f", array_sum($allData[$userId]) / 100);
$data[$userId]["all_reward"] = sprintf("%.1f", array_sum($allData[$userId]) / 100);
}
}
......
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