Commit 6f42d1d9 authored by luhongguang's avatar luhongguang

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

parents 5d81489c 356401b9
......@@ -7,7 +7,7 @@
namespace Validate;
class ColonelAddPoint extends BaseValidate
class ColonelAddPointValidate extends BaseValidate
{
protected $rule = [
'colonel_apply_id' => 'require',
......
......@@ -10,12 +10,18 @@ class ColonelConfigValidate extends BaseValidate
];
protected $message = [
'phone' => 'date 参数不能为空',
'config' => 'config 参数不能为空'
'date' => 'date 参数不能为空',
'config' => 'config 参数不能为空',
'marketing_id' => 'marketing_id 参数不能为空',
];
public function sceneDate()
{
return $this->only(["date"])->append("date", "require");
}
public function sceneAdd()
{
return $this->only(["date","config","marketing_id"])->append("marketing_id", "require");
}
}
\ No newline at end of file
......@@ -11,7 +11,7 @@ use \Validate\ColonelApplyValidate;
use \Validate\ColonelConfigValidate;
use \Validate\ColonelAuditValidate;
use \Validate\ColonelCenterValidate;
use \Validate\ColonelAddPoint;
use \Validate\ColonelAddPointValidate;
use \App\Services\marketing\PindanActivityColonelConfigService;
use \App\Services\marketing\PindanActivityInviteOrderService;
use \App\Services\user\UserService;
......@@ -55,7 +55,7 @@ class ColonelController extends Base
*/
public function add_configAction()
{
(new ColonelConfigValidate())->validate();
(new ColonelConfigValidate())->scene('add')->validate();
$params = $this->params;
PindanActivityColonelConfigService::editColonelConfig($params);
......@@ -135,7 +135,7 @@ class ColonelController extends Base
public function manage_add_apply_pointAction()
{
$params = $this->params;
(new ColonelAddPoint())->validate();
(new ColonelAddPointValidate())->validate();
$takePlaceId = ColonelService::handleAddTaskPlace($params);
return $this->success(['result' => ['take_place_id' => $takePlaceId]]);
}
......
......@@ -66,10 +66,10 @@ class ColonelService
*/
public static function isApply(int $userId): array
{
$applyInfo = ColonelDistributorColonelApply::getRecord(['user_id' => $userId],['colonel_apply_id','audit_status']);
$applyInfo = ColonelDistributorColonelApply::getRecord(['user_id' => $userId], ['colonel_apply_id','audit_status']);
return [
'is_apply' => !empty($applyInfo) ? 1 : 0,
'audit_status' => $applyInfo['audit_status']
// -1.未申请 0.未审核 1.审核通过 2.审核未通过
'apply_status' => isset($applyInfo['audit_status']) ? intval($applyInfo['audit_status']) : -1
];
}
......
......@@ -21,6 +21,7 @@ class PindanActivityColonelConfigService
$date = $params["date"];
$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]);
......@@ -29,28 +30,25 @@ class PindanActivityColonelConfigService
if (count($configList) > 6) {
throw new MarketingException(['cus' => MarketingException::COLONEL_LEVEL_SIX]);
}
ColonelDistributorConfig::beginTransaction();
$idRes = ColonelDistributorConfig::getRecord(["date" => $date, "type" => $type], ["colonel_config_id"]);
$idRes = ColonelDistributorConfig::getRecord(["date" => $date, "type" => $type, "marketing_id" => $marketingId], ["colonel_config_id"]);
if (!empty($idRes)) {
ColonelDistributorConfig::save([
"marketing_id" => $marketingId,
"date" => $date,
"type" => $type,
"data" => $configList,
], $idRes["colonel_config_id"]);
], ["colonel_config_id" => $idRes["colonel_config_id"]]);
} else {
ColonelDistributorConfig::save([
"marketing_id" => $marketingId,
"date" => $date,
"type" => $type,
"data" => $configList,
]);
}
if (!ColonelDistributorConfig::commit()) {
ColonelDistributorConfig::rollback();
throw new MarketingException(["cus" => 5]);
}
return true;
}
......
......@@ -193,6 +193,10 @@ class UserService
$data['user_id'] = $params['user_id'];
}
if (!empty($params['phone'])) {
$data['phone'] = $params['phone'];
}
$userList = UserWechatBind::getRecords($data);
return $userList;
}
......
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