This commit is contained in:
chenbo 2023-10-24 14:26:19 +08:00
parent f7dc74b3fc
commit 02f1b63096

View File

@ -657,6 +657,7 @@ class TaskLogic extends BaseLogic
*/ */
private static function marketingManagerTaskSettlement($taskSchedulePlan) private static function marketingManagerTaskSettlement($taskSchedulePlan)
{ {
try {
$taskTemplateInfo = $taskSchedulePlan['template_info']; $taskTemplateInfo = $taskSchedulePlan['template_info'];
// 任务类型用的数据字典主键id将id和value作映射避免测试和正式环境数据字典数据不一致时出问题 // 任务类型用的数据字典主键id将id和value作映射避免测试和正式环境数据字典数据不一致时出问题
$townTaskTypeList = DictData::where(['type_value' => 'town_task_type_marketing_director', 'status' => 1])->column('value', 'id'); $townTaskTypeList = DictData::where(['type_value' => 'town_task_type_marketing_director', 'status' => 1])->column('value', 'id');
@ -709,6 +710,10 @@ class TaskLogic extends BaseLogic
default: default:
return true; return true;
} }
} catch (Exception $e) {
Log::error(['镇农科任务结算失败',$e->getFile(), $e->getLine(), $e->getMessage()]);
}
} }
/** /**
@ -779,11 +784,11 @@ class TaskLogic extends BaseLogic
$param['end_time'] = time(); $param['end_time'] = time();
$param['responsible_area'] = $townCompany['responsible_area']; $param['responsible_area'] = $townCompany['responsible_area'];
$result = ShopRequestLogic::getSupplyChainMerchantCount($param); $result = ShopRequestLogic::getSupplyChainMerchantCount($param);
if (!$result) { if ($result['status'] != 200) {
Log::error('查询供应链商户统计接口失败'.ShopRequestLogic::getError()); Log::error('查询供应链商户统计接口失败'.ShopRequestLogic::getError());
return false; return false;
} }
$count = $result['count']; // todo 从$result取值 $count = $result['data']['count'];
// 完成数小于3关闭任务不做结算 // 完成数小于3关闭任务不做结算
if ($count < 3){ if ($count < 3){
@ -830,9 +835,13 @@ class TaskLogic extends BaseLogic
'mer_intention_id' => $merIntentionId, 'mer_intention_id' => $merIntentionId,
]; ];
$result = ShopRequestLogic::getProductListing($param); $result = ShopRequestLogic::getProductListing($param);
if ($result['status'] != 200) {
Log::info(['4.市场部长-供应链商户完成商品上架和库存更新任务-查询商城接口结果', json_encode($result)]); Log::info(['4.市场部长-供应链商户完成商品上架和库存更新任务-查询商城接口结果', json_encode($result)]);
// 达到目标数 完成则结算 todo 返回字段要对接 return false;
if ($result['count'] >= $templateInfo['extend']['target']){ }
$count = $result['data']['count'];
// 达到目标数 完成则结算
if ($count >= $templateInfo['extend']['target']){
// 结算金额 任务金额/目标数 * 天数 // 结算金额 任务金额/目标数 * 天数
$taskInfo['money'] = bcmul($templateInfo['stage_day_one'], bcdiv($templateInfo['money'], $templateInfo['extend']['target'])); $taskInfo['money'] = bcmul($templateInfo['stage_day_one'], bcdiv($templateInfo['money'], $templateInfo['extend']['target']));
Log::info(['5.市场部长-供应链商户完成商品上架任务-$taskSchedulePlan', json_encode($taskSchedulePlan)]); Log::info(['5.市场部长-供应链商户完成商品上架任务-$taskSchedulePlan', json_encode($taskSchedulePlan)]);
@ -852,8 +861,11 @@ class TaskLogic extends BaseLogic
'end_time' => $endTime, 'end_time' => $endTime,
'mer_intention_id' => $merIntentionId, 'mer_intention_id' => $merIntentionId,
]; ];
$result1 = ShopRequestLogic::getStockUpdate($param); // todo 返回字段要对接 $result1 = ShopRequestLogic::getStockUpdate($param);
if ($result['status'] != 200) {
Log::info(['4.市场部长-供应链商户完成库存更新任务-查询商城接口结果', json_encode($result)]); Log::info(['4.市场部长-供应链商户完成库存更新任务-查询商城接口结果', json_encode($result)]);
return false;
}
if ($result1['is_done'] == 1){ if ($result1['is_done'] == 1){
// 结算金额 任务金额/目标数 * 天数 // 结算金额 任务金额/目标数 * 天数
$taskInfo['money'] = bcmul($templateInfo['stage_day_two'], bcdiv($templateInfo['money_two'], $templateInfo['extend']['target'])); $taskInfo['money'] = bcmul($templateInfo['stage_day_two'], bcdiv($templateInfo['money_two'], $templateInfo['extend']['target']));