Commit f2a74387 authored by luhongguang's avatar luhongguang

update: SHQBD-1181

parent 2257dfc5
...@@ -25,6 +25,7 @@ class MarketingException extends BaseException ...@@ -25,6 +25,7 @@ class MarketingException extends BaseException
const COLONEL_ADD_FAILED = 35; const COLONEL_ADD_FAILED = 35;
const COLONEL_TAKE_PLACE_EDIT_FAILED = 36; const COLONEL_TAKE_PLACE_EDIT_FAILED = 36;
const COLONEL_APPLY_EXIST = 37; const COLONEL_APPLY_EXIST = 37;
const COLONEL_DATE_ERROR = 38;
protected $cus = [ protected $cus = [
0 => '活动名称不能为空', 0 => '活动名称不能为空',
...@@ -60,10 +61,11 @@ class MarketingException extends BaseException ...@@ -60,10 +61,11 @@ class MarketingException extends BaseException
self::COLONEL_TAKE_PLACE_EXIST => '自提点名称已存在', self::COLONEL_TAKE_PLACE_EXIST => '自提点名称已存在',
self::COLONEL_TAKE_PLACE_PARAMS => '自提点信息不存在', self::COLONEL_TAKE_PLACE_PARAMS => '自提点信息不存在',
self::COLONEL_TAKE_PLACE_FAILED => '自提点添加失败', self::COLONEL_TAKE_PLACE_FAILED => '自提点添加失败',
self::COLONEL_APPLY_EXIST => '当前用户已提交团长申请', 33 => '分润金额+手续费不能大于售价金额',
self::COLONEL_AUDIT_STATUS_USE => '该团长已审核', self::COLONEL_AUDIT_STATUS_USE => '该团长已审核',
self::COLONEL_ADD_FAILED => '团长入库失败', self::COLONEL_ADD_FAILED => '团长入库失败',
self::COLONEL_TAKE_PLACE_EDIT_FAILED => '修改团长自提点失败', self::COLONEL_TAKE_PLACE_EDIT_FAILED => '修改团长自提点失败',
33 => '分润金额+手续费不能大于售价金额', self::COLONEL_APPLY_EXIST => '当前用户已提交团长申请',
self::COLONEL_DATE_ERROR => '当前日期的配置不能修改',
]; ];
} }
...@@ -19,6 +19,10 @@ class PindanActivityColonelConfigService ...@@ -19,6 +19,10 @@ class PindanActivityColonelConfigService
public static function editColonelConfig($params = []) public static function editColonelConfig($params = [])
{ {
$date = $params["date"]; $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"]; $type = empty($params["type"]) ? ColonelDistributorConfig::TYPE_COLONEL : $params["type"];
$configList = $params["config"]; $configList = $params["config"];
$marketingId = $params["marketing_id"]; $marketingId = $params["marketing_id"];
...@@ -31,15 +35,14 @@ class PindanActivityColonelConfigService ...@@ -31,15 +35,14 @@ class PindanActivityColonelConfigService
throw new MarketingException(['cus' => MarketingException::COLONEL_LEVEL_SIX]); throw new MarketingException(['cus' => MarketingException::COLONEL_LEVEL_SIX]);
} }
$idRes = ColonelDistributorConfig::getRecord(["date" => $date, "type" => $type, "marketing_id" => $marketingId], ["colonel_config_id"]); $idRes = ColonelDistributorConfig::getRecordMaster(["date" => $date, "type" => $type, "marketing_id" => $marketingId], ["colonel_config_id"]);
if (!empty($idRes[0]["colonel_config_id"])) {
if (!empty($idRes)) {
ColonelDistributorConfig::save([ ColonelDistributorConfig::save([
"marketing_id" => $marketingId, "marketing_id" => $marketingId,
"date" => $date, "date" => $date,
"type" => $type, "type" => $type,
"data" => $configList, "data" => $configList,
], ["colonel_config_id" => $idRes["colonel_config_id"]]); ], ["colonel_config_id" => $idRes[0]["colonel_config_id"]]);
} else { } else {
ColonelDistributorConfig::save([ ColonelDistributorConfig::save([
"marketing_id" => $marketingId, "marketing_id" => $marketingId,
......
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