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
a8921578
Commit
a8921578
authored
Aug 20, 2021
by
luhongguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update: 临时
parent
460c0b41
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
116 additions
and
0 deletions
+116
-0
MarketingException.php
application/exception/custom/MarketingException.php
+2
-0
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 @
a8921578
...
...
@@ -38,5 +38,7 @@ class MarketingException extends BaseException
self
::
TAKE_PLACE_NOT_EXIST
=>
'自提点不存在'
,
21
=>
"活动开始时间不能大于或者等于结束时间"
,
22
=>
"自提点不能为空"
,
23
=>
"团长分销配置内容不能为空"
,
24
=>
"档位最多设定6档"
,
];
}
\ No newline at end of file
application/models/marketing/mysql/PindanActivityColonelConfig.php
0 → 100644
View file @
a8921578
<?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 @
a8921578
<?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'
=>
23
]);
}
if
(
count
(
$configList
)
>
6
)
{
throw
new
MarketingException
([
'cus'
=>
24
]);
}
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