Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
goods
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bp
goods
Commits
6350e1a5
Commit
6350e1a5
authored
Aug 20, 2021
by
luhongguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update: 分销活动配置相关接口
parent
a971875f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
71 additions
and
1 deletion
+71
-1
ColonelConfigValidate.php
application/library/Validate/ColonelConfigValidate.php
+21
-0
Colonel.php
application/modules/Marketing/controllers/Colonel.php
+28
-0
PindanActivityColonelConfigService.php
...services/marketing/PindanActivityColonelConfigService.php
+22
-1
No files found.
application/library/Validate/ColonelConfigValidate.php
0 → 100644
View file @
6350e1a5
<?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
application/modules/Marketing/controllers/Colonel.php
View file @
6350e1a5
...
...
@@ -8,6 +8,8 @@
use
App\Base\Base
;
use
App\Services\marketing\ColonelService
;
use
\Validate\ColonelApplyValidate
;
use
\Validate\ColonelConfigValidate
;
use
\App\Services\marketing\PindanActivityColonelConfigService
;
class
ColonelController
extends
Base
{
...
...
@@ -27,4 +29,30 @@ 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
]);
}
}
\ No newline at end of file
application/services/marketing/PindanActivityColonelConfigService.php
View file @
6350e1a5
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment