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
c682fcaa
Commit
c682fcaa
authored
Aug 01, 2021
by
luhongguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update:拼单商品info
parent
e7fb431a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
77 additions
and
36 deletions
+77
-36
CommonService.php
application/services/common/CommonService.php
+0
-25
MarketingService.php
application/services/marketing/MarketingService.php
+77
-11
No files found.
application/services/common/CommonService.php
View file @
c682fcaa
...
@@ -58,29 +58,4 @@ class CommonService
...
@@ -58,29 +58,4 @@ class CommonService
return
$goodsShareId
;
return
$goodsShareId
;
}
}
public
static
function
getUrlList
(
$picUrlStr
)
{
$data
=
$ksyunParams
=
[];
$strList
=
explode
(
","
,
$picUrlStr
);
foreach
(
$strList
as
$key
=>
$str
)
{
$arr
=
explode
(
"/"
,
$str
);
if
(
count
(
$arr
)
!=
2
)
{
if
(
preg_match
(
"/^http[s]
{
0,1
}
:\/\/([\w.]+\/?)\S*/"
,
$str
))
{
$data
[]
=
$str
;
}
else
{
continue
;
}
}
else
{
$bucket
=
$arr
[
0
];
$objectId
=
$arr
[
1
];
$url
=
Ksyun
::
getPicUrl
(
"merchant-b"
,
'goods_temp'
,
$bucket
.
'/'
.
$objectId
,
200
,
200
,
'jpeg'
);
$data
[]
=
$url
;
}
}
return
$data
;
}
}
}
\ No newline at end of file
application/services/marketing/MarketingService.php
View file @
c682fcaa
...
@@ -12,12 +12,13 @@ use App\Exception\custom\MarketingException;
...
@@ -12,12 +12,13 @@ use App\Exception\custom\MarketingException;
use
Api\PhpServices\Sensitive\Sensitive
;
use
Api\PhpServices\Sensitive\Sensitive
;
use
App\Models\marketing\mysql\MarketingPindan
;
use
App\Models\marketing\mysql\MarketingPindan
;
use
App\Services\common\CommonService
;
use
App\Services\common\CommonService
;
use
App\Services\goods\GoodsService
;
use
Daemon\Goods
;
use
Daemon\Goods
;
class
MarketingService
class
MarketingService
{
{
const
PUBLIC_LIFE_ACCOUNT_ID
=
111
;
const
PUBLIC_LIFE_ACCOUNT_ID
=
"15238011155677187"
;
/**
/**
* op 后台获取活动需要参加的商品
* op 后台获取活动需要参加的商品
...
@@ -626,17 +627,41 @@ class MarketingService
...
@@ -626,17 +627,41 @@ class MarketingService
return
true
;
return
true
;
}
}
/**
* 分销活动详情
* @param $params
* @return array|mixed
* @throws \App\Exception\custom\InterfaceException
*/
public
static
function
marketingInfo
(
$params
)
public
static
function
marketingInfo
(
$params
)
{
{
$where
[
'marketing_id'
]
=
!
empty
(
$params
[
'marketing_id'
])
?
$params
[
'marketing_id'
]
:
''
;
$marketingType
=
!
empty
(
$params
[
'marketing_type'
])
?
$params
[
'marketing_type'
]
:
Marketing
::
MARKETING_TYPE_FENXIAO
;
$marketing_info
=
Marketing
::
getRecord
(
$where
);
if
(
$marketingType
==
Marketing
::
MARKETING_TYPE_FENXIAO
)
{
return
self
::
fenxiaoMarketingInfo
(
$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
::
pindanMarketingInfo
(
$params
);
}
}
/**
* 分销活动详情
* @param $params
* @return mixed
* @throws \App\Exception\custom\InterfaceException
*/
private
static
function
fenxiaoMarketingInfo
(
$params
)
{
$marketing_info
=
Marketing
::
getRecord
([
'marketing_id'
=>
$params
[
'marketing_id'
],
"marketing_type"
=>
Marketing
::
MARKETING_TYPE_FENXIAO
]);
$goodsSkuList
=
MarketingGoods
::
marketingGoodsList
(
$where
);
$goodsSkuList
=
MarketingGoods
::
marketingGoodsList
(
[
'marketing_id'
=>
$params
[
'marketing_id'
]]
);
$goodsSkuId
=
array_column
(
$goodsSkuList
,
'goods_sku_id'
);
$goodsSkuId
=
array_column
(
$goodsSkuList
,
'goods_sku_id'
);
$goodsSkuList
=
GoodsSku
::
select
(
'*'
,
[
'goods_sku_id'
=>
$goodsSkuId
]);
$goodsSkuList
=
GoodsSku
::
select
(
'*'
,
[
'goods_sku_id'
=>
$goodsSkuId
]);
$lifeAccountIds
=
[];
$lifeAccountIds
=
[];
...
@@ -652,18 +677,62 @@ class MarketingService
...
@@ -652,18 +677,62 @@ class MarketingService
$list
[
$key
][
'goods_spu_id'
]
=
$value
[
'goods_spu_id'
];
$list
[
$key
][
'goods_spu_id'
]
=
$value
[
'goods_spu_id'
];
$list
[
$key
][
'life_account_id'
]
=
$value
[
'life_account_id'
];
$list
[
$key
][
'life_account_id'
]
=
$value
[
'life_account_id'
];
$list
[
$key
][
'goods_name'
]
=
$value
[
'goods_name'
];
$list
[
$key
][
'goods_name'
]
=
$value
[
'goods_name'
];
$list
[
$key
][
'life_account_name'
]
=
!
empty
(
$lifeAccountList
[
$value
[
'life_account_id'
]][
'life_account_name'
])
?
$lifeAccountList
[
$value
[
'life_account_id'
]][
'life_account_name'
]
:
''
;
$list
[
$key
][
'life_account_name'
]
=
!
empty
(
$lifeAccountList
[
$value
[
'life_account_id'
]][
'life_account_name'
])
?
$lifeAccountList
[
$value
[
'life_account_id'
]][
'life_account_name'
]
:
''
;
}
}
}
}
$marketing_info
[
'first_commission_value'
]
=
!
empty
(
$marketing_info
[
'first_commission_value'
])
?
$marketing_info
[
'first_commission_value'
]
/
100
:
0
;
$marketing_info
[
'first_commission_value'
]
=
!
empty
(
$marketing_info
[
'first_commission_value'
])
?
$marketing_info
[
'first_commission_value'
]
/
100
:
0
;
$marketing_info
[
'second_commission_value'
]
=
!
empty
(
$marketing_info
[
'second_commission_value'
])
?
$marketing_info
[
'second_commission_value'
]
/
100
:
0
;
$marketing_info
[
'second_commission_value'
]
=
!
empty
(
$marketing_info
[
'second_commission_value'
])
?
$marketing_info
[
'second_commission_value'
]
/
100
:
0
;
$info
[
'marketing_info'
]
=
$marketing_info
;
$info
[
'marketing_info'
]
=
$marketing_info
;
$info
[
'goods_list'
]
=
$list
;
$info
[
'goods_list'
]
=
$list
;
return
$info
;
return
$info
;
}
}
/**
* 拼单活动详情
* @param $params
* @return mixed
* @throws \App\Exception\custom\InterfaceException
*/
private
static
function
pindanMarketingInfo
(
$params
)
{
$marketingInfo
=
Marketing
::
getRecord
([
'marketing_id'
=>
$params
[
'marketing_id'
],
"marketing_type"
=>
Marketing
::
MARKETING_TYPE_PINDAN
]);
$pindanMarketing
=
MarketingPindan
::
getRecord
([
'marketing_id'
=>
$params
[
'marketing_id'
]]);
$lifeAccountList
=
CommonService
::
getlifeAccountList
([
'life_account_id'
=>
[
$pindanMarketing
[
"publish_life_account_id"
]]]);
$goodsSkuList
=
MarketingGoods
::
marketingGoodsList
([
'marketing_id'
=>
$params
[
'marketing_id'
]]);
$goodsSkuId
=
array_column
(
$goodsSkuList
,
'goods_sku_id'
);
$goodsSkuList
=
PindanGoodsSku
::
select
(
'*'
,
[
'pindan_goods_sku_id'
=>
$goodsSkuId
]);
$marketingData
[
"life_account_name"
]
=
$lifeAccountList
[
$pindanMarketing
[
"publish_life_account_id"
]][
"life_account_name"
];
$marketingData
[
"life_account_icon"
]
=
$lifeAccountList
[
$pindanMarketing
[
"publish_life_account_id"
]][
"life_account_icon"
];
$marketingData
[
"id"
]
=
$marketingInfo
[
"marketing_id"
];
$marketingData
[
"marketing_name"
]
=
$marketingInfo
[
"marketing_name"
];
$marketingData
[
"good_count"
]
=
$marketingInfo
[
"good_count"
];
$marketingData
[
"start_time"
]
=
$marketingInfo
[
"start_time"
];
$marketingData
[
"end_time"
]
=
$marketingInfo
[
"end_time"
];
$marketingData
[
"online_status"
]
=
$marketingInfo
[
"online_status"
];
$marketingData
[
"marketing_type"
]
=
$marketingInfo
[
"marketing_type"
];
$marketingData
[
"publish_life_account_id"
]
=
$pindanMarketing
[
"publish_life_account_id"
];
$marketingData
[
"pindan_pic"
]
=
$pindanMarketing
[
"pindan_pic"
];
$marketingData
[
"pindan_pic_url"
]
=
GoodsService
::
getUrlList
(
$marketingData
[
"pindan_pic"
]);
$marketingData
[
"pindan_desc"
]
=
$pindanMarketing
[
"pindan_desc"
];
$marketingData
[
"max_price"
]
=
$pindanMarketing
[
"max_price"
];
$marketingData
[
"min_price"
]
=
$pindanMarketing
[
"min_price"
];
$marketingData
[
"participate_number"
]
=
$pindanMarketing
[
"participate_number"
];
$info
[
'marketing_info'
]
=
$marketingData
;
if
(
!
empty
(
$goodsSkuList
))
{
foreach
(
$goodsSkuList
as
$key
=>
$item
)
{
$goodsSkuList
[
$key
][
"desc_pic_url_list"
]
=
GoodsService
::
getUrlList
(
$item
[
"desc_pic_url"
]);
}
}
$info
[
'goods_list'
]
=
$goodsSkuList
;
return
$info
;
}
public
static
function
getMarketingList
(
$params
)
public
static
function
getMarketingList
(
$params
)
{
{
...
@@ -672,9 +741,6 @@ class MarketingService
...
@@ -672,9 +741,6 @@ class MarketingService
return
$marketing_list
;
return
$marketing_list
;
}
}
/**
/**
*判断长度
*判断长度
*
*
...
...
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