Commit 9b4940dd authored by pengfei's avatar pengfei

add 团长分销活动-团长审核接口

parent e55ad745
<?php
namespace Validate;
class ColonelConfigValidate extends BaseValidate
{
protected $rule = [
'date' => 'require',
'config' => 'require',
];
protected $message = [
'phone' => 'date 参数不能为空',
'config' => 'config 参数不能为空'
];
public function sceneDate()
{
return $this->only(["date"])->append("date", "require");
}
}
\ No newline at end of file
<?php
namespace App\Models\marketing\mysql;
use Api\PhpUtils\Mysql\MysqlBase;
class PindanActivityInfo extends MysqlBase
{
const TABLE_NAME = 'pindan_activity_info';
const CONFIG_INDEX = 'marketing';
const PRIMARY_KEY = 'pindan_activity_id';
public static function getRecord($where, $columns = [], $options = [])
{
if (empty($columns)) {
$columns = '*';
}
return self::get($columns, $where, $options);
}
public static function getRecordMaster($where, $columns = [], $options = [])
{
if (empty($columns)) {
$columns = '*';
}
return self::selectMaster($columns, $where, $options);
}
public static function insertRecord($columns, $options = [])
{
return self::insert($columns, $options);
}
public static function updateRecord($columns, $where)
{
return self::update($columns, $where);
}
public static function save($data, $where = [], $options = [])
{
if (empty($where)) {
return self::insert($data, $options);
}
return self::update($data, $where);
}
public static function deleteRecord($where)
{
return self::delete($where);
}
}
\ No newline at end of file
<?php
namespace App\Models\marketing\mysql;
use Api\PhpUtils\Mysql\MysqlBase;
class PindanActivityInviteOrder extends MysqlBase
{
const TABLE_NAME = 'pindan_activity_invite_order';
const CONFIG_INDEX = 'marketing';
const PRIMARY_KEY = 'invite_order_id';
public static function getRecord($where, $columns = [], $options = [])
{
if (empty($columns)) {
$columns = '*';
}
return self::get($columns, $where, $options);
}
public static function getRecordMaster($where, $columns = [], $options = [])
{
if (empty($columns)) {
$columns = '*';
}
return self::selectMaster($columns, $where, $options);
}
public static function insertRecord($columns, $options = [])
{
return self::insert($columns, $options);
}
public static function updateRecord($columns, $where)
{
return self::update($columns, $where);
}
public static function save($data, $where = [], $options = [])
{
if (empty($where)) {
return self::insert($data, $options);
}
return self::update($data, $where);
}
public static function deleteRecord($where)
{
return self::delete($where);
}
}
\ No newline at end of file
<?php
namespace App\Models\marketing\mysql;
use Api\PhpUtils\Mysql\MysqlBase;
class PindanActivityInviteOrderNum extends MysqlBase
{
const TABLE_NAME = 'pindan_activity_invite_order_num';
const CONFIG_INDEX = 'marketing';
const PRIMARY_KEY = 'invite_order_num_id';
public static function getRecord($where, $columns = [], $options = [])
{
if (empty($columns)) {
$columns = '*';
}
return self::get($columns, $where, $options);
}
public static function getRecordMaster($where, $columns = [], $options = [])
{
if (empty($columns)) {
$columns = '*';
}
return self::selectMaster($columns, $where, $options);
}
public static function insertRecord($columns, $options = [])
{
return self::insert($columns, $options);
}
public static function updateRecord($columns, $where)
{
return self::update($columns, $where);
}
public static function save($data, $where = [], $options = [])
{
if (empty($where)) {
return self::insert($data, $options);
}
return self::update($data, $where);
}
public static function deleteRecord($where)
{
return self::delete($where);
}
}
\ No newline at end of file
<?php
namespace App\Models\marketing\mysql;
use Api\PhpUtils\Mysql\MysqlBase;
class PindanActivityPayInfo extends MysqlBase
{
const TABLE_NAME = 'pindan_activity_pay_info';
const CONFIG_INDEX = 'marketing';
const PRIMARY_KEY = 'pindan_activity_pay_info_id';
public static function getRecord($where, $columns = [], $options = [])
{
if (empty($columns)) {
$columns = '*';
}
return self::get($columns, $where, $options);
}
public static function getRecordMaster($where, $columns = [], $options = [])
{
if (empty($columns)) {
$columns = '*';
}
return self::selectMaster($columns, $where, $options);
}
public static function insertRecord($columns, $options = [])
{
return self::insert($columns, $options);
}
public static function updateRecord($columns, $where)
{
return self::update($columns, $where);
}
public static function save($data, $where = [], $options = [])
{
if (empty($where)) {
return self::insert($data, $options);
}
return self::update($data, $where);
}
public static function deleteRecord($where)
{
return self::delete($where);
}
}
\ No newline at end of file
......@@ -8,7 +8,8 @@
use App\Base\Base;
use App\Services\marketing\ColonelService;
use \Validate\ColonelApplyValidate;
use \Validate\ColonelAuditValidate;
use \Validate\ColonelConfigValidate;
use \App\Services\marketing\PindanActivityColonelConfigService;
class ColonelController extends Base
{
......@@ -28,10 +29,38 @@ class ColonelController extends Base
return $this->success(['result' => ['applyId' => $applyId]]);
}
/**
* 编辑团长分销配置
* @throws \App\Exception\custom\MarketingException
* @throws \App\Exception\custom\ParamException
*/
public function add_configAction()
{
(new ColonelConfigValidate())->validate();
$params = $this->params;
PindanActivityColonelConfigService::editColonelConfig($params);
return $this->success();
}
/**
* 查看团长分销配置
* @throws \App\Exception\custom\ParamException
*/
public function colonel_configAction()
{
(new ColonelConfigValidate())->scene("date")->validate();
$params = $this->params;
$data = PindanActivityColonelConfigService::colonelConfig($params);
return $this->success(["result"=>$data]);
}
/**
* Notes: 管理后台 - 申请团长审核列表
* User: pengfei@yidian-inc.com
* Date: 2021/8/20 8:45 下午
* Date: 2021/8/23 2:17 下午
* @throws Exception
*/
public function manage_listAction()
......@@ -41,7 +70,12 @@ class ColonelController extends Base
return $this->success($manageList);
}
/**
* Notes: 管理后台 - 申请团长审核
* User: pengfei@yidian-inc.com
* Date: 2021/8/23 2:16 下午
* @throws \App\Exception\custom\MarketingException
*/
public function manage_auditAction()
{
$params = $this->params;
......@@ -49,4 +83,4 @@ class ColonelController extends Base
ColonelService::handleManageAudit($params['colonel_apply_id'], $params['audit_status']);
return $this->success();
}
}
}
\ No newline at end of file
......@@ -12,7 +12,7 @@ class PindanActivityColonelConfigService
/**
* 编辑团长分销活动配置
* @param array $params
* @return \Api\PhpUtils\Mysql\MysqlBase
* @return bool
* @throws MarketingException
*/
public static function editColonelConfig($params = [])
......@@ -53,9 +53,30 @@ class PindanActivityColonelConfigService
return true;
}
/**
* 团长分销活动配置
* @param array $params
* @return array
*/
public static function colonelConfig($params = [])
{
$day = empty($params["date"]) ? date("Y-m-d") : $params["date"];
$type = empty($params["type"]) ? PindanActivityColonelConfig::TYPE_COLONEL : $params["type"];
$list = PindanActivityColonelConfig::select("*", ["date" => $day, "type" => $type], []);
$data = [];
if (!empty($list)) {
foreach ($list as $key => $item) {
$data[$key]["colonel_config_id"] = $item["colonel_config_id"];
$data[$key]["date"] = $item["date"];
$data[$key]["level"] = $item["level"];
$data[$key]["assess_order_num"] = $item["assess_order_num"];
$data[$key]["reward_amount"] = $item["reward_amount"];
}
$sortKeys = array_column($data, "level");
array_multisort($sortKeys, SORT_ASC, $data);
}
return $data;
}
}
\ 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