Commit 0320dded authored by luhongguang's avatar luhongguang

update: 团长分销任务中心

parent 8d33292b
......@@ -106,4 +106,15 @@ class ColonelController extends Base
$data = PindanActivityInviteOrderService::refundOrder($params);
return $this->success(["result"=>$data]);
}
/**
* 团长分销任务中心
* @throws Exception
*/
public function task_controlAction()
{
$params = $this->params;
$data = PindanActivityColonelConfigService::getTaskData($params);
return $this->success(["result"=>$data]);
}
}
\ No newline at end of file
......@@ -4,6 +4,7 @@ namespace App\Services\marketing;
use App\Exception\custom\MarketingException;
use App\Models\marketing\mysql\ColonelDistributorInviteOrderNum;
use App\Models\marketing\mysql\Marketing;
use App\Models\marketing\mysql\ColonelDistributorConfig;
......@@ -79,4 +80,36 @@ class PindanActivityColonelConfigService
return $data;
}
/**
* 团长分销活动任务中心列表
* @param array $params
* @return array
*/
public static function getTaskData($params = [])
{
$num = 0;
if (!empty($params["user_id"])) {
$inviteOrderNumRes = ColonelDistributorInviteOrderNum::getRecord(["colonel_user_id" => $params["user_id"]]);
$num = $inviteOrderNumRes["num"];
}
$hour = date("H");
if ($hour < 10 && $hour > 0) {
$date = date("Y-m-d", strtotime("-1 day"));
} elseif ($hour > 16) {
$date = date("Y-m-d");
} else {
$date = date("Y-m-d");
}
$configList = self::colonelConfig(["date" => $date, "type" => ColonelDistributorConfig::TYPE_COLONEL]);
if (!empty($configList)) {
foreach ($configList as $key => $config) {
$configList[$key]["is_finish"] = 0;
if ($config["num"] <= $num) {
$configList[$key]["is_finish"] = 1;
}
}
}
return ["number" => $num, 'list' => $configList];
}
}
\ No newline at end of file
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