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
fe261c15
Commit
fe261c15
authored
Aug 01, 2021
by
luhongguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update:拼单商品list
parent
d5d1e354
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
6 deletions
+59
-6
MarketingService.php
application/services/marketing/MarketingService.php
+59
-6
No files found.
application/services/marketing/MarketingService.php
View file @
fe261c15
...
...
@@ -116,11 +116,31 @@ class MarketingService
* @return array|mixed
*/
public
static
function
marketingList
(
$params
)
{
$marketingType
=
!
empty
(
$params
[
'marketing_type'
])
?
$params
[
'marketing_type'
]
:
Marketing
::
MARKETING_TYPE_FENXIAO
;
if
(
$marketingType
==
Marketing
::
MARKETING_TYPE_FENXIAO
)
{
return
self
::
fenxiaoMarketingList
(
$params
);
}
else
if
(
$marketingType
==
Marketing
::
MARKETING_TYPE_TUANGOU
)
{
return
[];
}
else
if
(
$marketingType
==
Marketing
::
MARKETING_TYPE_MIAOSHA
)
{
return
[];
}
else
if
(
$marketingType
==
Marketing
::
MARKETING_TYPE_PINDAN
)
{
return
self
::
pindanMarketingList
(
$params
);
}
}
/**
* 分销活动列表
* @param $params
* @return array
*/
private
static
function
fenxiaoMarketingList
(
$params
)
{
$params
[
'page'
]
=
!
empty
(
$params
[
'page'
])
?
$params
[
'page'
]
:
1
;
$limit
=
!
empty
(
$params
[
'page_size'
])
?
$params
[
'page_size'
]
:
20
;
$page
=
(
$params
[
'page'
]
-
1
)
*
$limit
;
$where
[
"marketing_type"
]
=
Marketing
::
MARKETING_TYPE_FENXIAO
;
if
(
!
empty
(
$params
[
'marketing_name'
]))
{
$where
[
'marketing_name'
]
=
$params
[
'marketing_name'
];
}
...
...
@@ -135,7 +155,7 @@ class MarketingService
if
(
!
empty
(
$valu
))
{
$where
[
'online_status'
][
$key
]
=
$valu
;
}
else
{
$where
[
'online_status'
]
=
[
1
,
2
];
$where
[
'online_status'
]
=
[
1
,
2
];
break
;
}
}
...
...
@@ -153,11 +173,11 @@ class MarketingService
}
else
{
$marketingId
=
array_column
(
$marketingGoodsList
,
'marketing_id'
);
if
(
!
empty
(
$where
[
'marketing_id'
]))
{
array_push
(
$marketingId
,
$where
[
'marketing_id'
]);
array_push
(
$marketingId
,
$where
[
'marketing_id'
]);
}
$where
[
'marketing_id'
]
=
$marketingId
;
}
}
$where
[
'ORDER'
]
=
[
"create_time"
=>
"DESC"
];
...
...
@@ -165,9 +185,9 @@ class MarketingService
$list
=
Marketing
::
getRecords
(
$where
);
$lists
=
[];
foreach
(
$list
as
$key
=>
$value
)
{
$lists
[
$key
]
=
$value
;
$lists
[
$key
][
'first_commission_value'
]
=
!
empty
(
$value
[
'first_commission_value'
])
?
$value
[
'first_commission_value'
]
/
100
:
0
;
$lists
[
$key
][
'second_commission_value'
]
=
!
empty
(
$value
[
'second_commission_value'
])
?
$value
[
'second_commission_value'
]
/
100
:
0
;
$lists
[
$key
]
=
$value
;
$lists
[
$key
][
'first_commission_value'
]
=
!
empty
(
$value
[
'first_commission_value'
])
?
$value
[
'first_commission_value'
]
/
100
:
0
;
$lists
[
$key
][
'second_commission_value'
]
=
!
empty
(
$value
[
'second_commission_value'
])
?
$value
[
'second_commission_value'
]
/
100
:
0
;
}
unset
(
$where
[
'LIMIT'
]);
unset
(
$where
[
'ORDER'
]);
...
...
@@ -176,6 +196,39 @@ class MarketingService
return
$data
;
}
/**
* 拼单活动列表
* @param $params
* @return array
*/
private
static
function
pindanMarketingList
(
$params
)
{
$params
[
'page'
]
=
!
empty
(
$params
[
'page'
])
?
$params
[
'page'
]
:
1
;
$limit
=
!
empty
(
$params
[
'page_size'
])
?
$params
[
'page_size'
]
:
20
;
$page
=
(
$params
[
'page'
]
-
1
)
*
$limit
;
$where
[
"marketing_type"
]
=
Marketing
::
MARKETING_TYPE_PINDAN
;
if
(
!
empty
(
$params
[
'marketing_name'
]))
{
$where
[
'marketing_name'
]
=
$params
[
'marketing_name'
];
}
if
(
!
empty
(
$params
[
'online_status'
]))
{
$where
[
'online_status'
]
=
$params
[
'online_status'
];
}
$where
[
'ORDER'
]
=
[
"create_time"
=>
"DESC"
];
$where
[
'LIMIT'
]
=
[
$page
,
$limit
];
$list
=
Marketing
::
select
([
"marketing_id"
,
"marketing_name"
,
"online_status"
,
"update_time"
,
"create_time"
],
$where
);
$lists
=
[];
foreach
(
$list
as
$key
=>
$value
)
{
$lists
[
$key
]
=
$value
;
}
unset
(
$where
[
'LIMIT'
]);
unset
(
$where
[
'ORDER'
]);
$count
=
Marketing
::
count
(
"*"
,
$where
);
return
[
'result'
=>
$lists
,
'count'
=>
$count
];
}
/**
* 创建活动
* @param $params
...
...
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