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