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
efdd23e0
Commit
efdd23e0
authored
Aug 20, 2021
by
pengfei
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'colonel' of
https://git.yidian-inc.com:8021/bp/goods
into colonel
parents
fb7d313b
a971875f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
119 additions
and
1 deletion
+119
-1
MarketingException.php
application/exception/custom/MarketingException.php
+5
-1
PindanActivityColonelConfig.php
...on/models/marketing/mysql/PindanActivityColonelConfig.php
+53
-0
PindanActivityColonelConfigService.php
...services/marketing/PindanActivityColonelConfigService.php
+61
-0
No files found.
application/exception/custom/MarketingException.php
View file @
efdd23e0
...
...
@@ -15,6 +15,8 @@ class MarketingException extends BaseException
const
TAKE_PLACE_NOT_EXIST
=
20
;
const
COLONEL_APPLY_EXIST
=
23
;
const
COLONEL_APPLY_FAILED
=
24
;
const
COLONEL_CONFIG_NULL
=
25
;
const
COLONEL_LEVEL_SIX
=
26
;
protected
$cus
=
[
0
=>
'活动名称不能为空'
,
...
...
@@ -41,6 +43,8 @@ class MarketingException extends BaseException
21
=>
"活动开始时间不能大于或者等于结束时间"
,
22
=>
"自提点不能为空"
,
self
::
COLONEL_APPLY_EXIST
=>
'当前用户已提交团长申请'
,
self
::
COLONEL_APPLY_FAILED
=>
'团长申请失败'
self
::
COLONEL_APPLY_FAILED
=>
'团长申请失败'
,
self
::
COLONEL_CONFIG_NULL
=>
"团长分销配置内容不能为空"
,
self
::
COLONEL_LEVEL_SIX
=>
"档位最多设定6档"
,
];
}
\ No newline at end of file
application/models/marketing/mysql/PindanActivityColonelConfig.php
0 → 100644
View file @
efdd23e0
<?php
namespace
App\Models\marketing\mysql
;
use
Api\PhpUtils\Mysql\MysqlBase
;
class
PindanActivityColonelConfig
extends
MysqlBase
{
const
TABLE_NAME
=
'pindan_activity_colonel_config'
;
const
CONFIG_INDEX
=
'marketing'
;
const
PRIMARY_KEY
=
'colonel_config_id'
;
const
TYPE_COLONEL
=
1
;
//团长分销活动
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
application/services/marketing/PindanActivityColonelConfigService.php
0 → 100644
View file @
efdd23e0
<?php
namespace
App\Services\marketing
;
use
App\Exception\custom\MarketingException
;
use
App\Models\marketing\mysql\Marketing
;
use
App\Models\marketing\mysql\PindanActivityColonelConfig
;
class
PindanActivityColonelConfigService
{
/**
* 编辑团长分销活动配置
* @param array $params
* @return \Api\PhpUtils\Mysql\MysqlBase
* @throws MarketingException
*/
public
static
function
editColonelConfig
(
$params
=
[])
{
$date
=
$params
[
"date"
];
$type
=
empty
(
$params
[
"type"
])
?
PindanActivityColonelConfig
::
TYPE_COLONEL
:
$params
[
"type"
];
$configList
=
json_decode
(
$params
[
"config"
],
true
);
if
(
empty
(
$configList
))
{
throw
new
MarketingException
([
'cus'
=>
MarketingException
::
COLONEL_CONFIG_NULL
]);
}
if
(
count
(
$configList
)
>
6
)
{
throw
new
MarketingException
([
'cus'
=>
MarketingException
::
COLONEL_LEVEL_SIX
]);
}
PindanActivityColonelConfig
::
beginTransaction
();
$idsRes
=
PindanActivityColonelConfig
::
select
([
"colonel_config_id"
],
[
"date"
=>
$date
,
"type"
=>
$type
],
[]);
if
(
!
empty
(
$idsRes
))
{
$ids
=
array_column
(
$idsRes
,
"colonel_config_id"
);
PindanActivityColonelConfig
::
deleteRecord
([
"colonel_config_id"
=>
$ids
]);
}
$data
=
[];
foreach
(
$configList
as
$key
=>
$item
)
{
$data
[
$key
][
"date"
]
=
$date
;
$data
[
$key
][
"level"
]
=
$item
[
"level"
];
$data
[
$key
][
"assess_order_num"
]
=
$item
[
"assess_order_num"
];
$data
[
$key
][
"reward_amount"
]
=
$item
[
"reward_amount"
];
}
PindanActivityColonelConfig
::
save
(
$data
);
if
(
!
PindanActivityColonelConfig
::
commit
())
{
PindanActivityColonelConfig
::
rollback
();
throw
new
MarketingException
([
"cus"
=>
5
]);
}
return
true
;
}
public
static
function
colonelConfig
(
$params
=
[])
{
}
}
\ 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