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
1a81427c
Commit
1a81427c
authored
Aug 31, 2021
by
pengfei
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'test' of
https://git.yidian-inc.com:8021/bp/goods
into test
parents
dc05741f
ca2143f4
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
180 additions
and
36 deletions
+180
-36
GoodsException.php
application/exception/custom/GoodsException.php
+1
-0
GoodsService.php
application/services/goods/GoodsService.php
+95
-20
MarketingGoodsService.php
application/services/marketing/MarketingGoodsService.php
+7
-3
MarketingService.php
application/services/marketing/MarketingService.php
+43
-11
Goods.php
daemon/Goods.php
+34
-2
No files found.
application/exception/custom/GoodsException.php
View file @
1a81427c
...
@@ -70,5 +70,6 @@ class GoodsException extends BaseException
...
@@ -70,5 +70,6 @@ class GoodsException extends BaseException
49
=>
'库存不得小于已售库存'
,
49
=>
'库存不得小于已售库存'
,
self
::
RULE_LIMIT_ERROR
=>
'单人可买上限填写错误'
,
self
::
RULE_LIMIT_ERROR
=>
'单人可买上限填写错误'
,
self
::
NOT_FIND_MARKETING
=>
'找不到活动'
,
self
::
NOT_FIND_MARKETING
=>
'找不到活动'
,
52
=>
'商品过期时间小于等于上架时间'
,
];
];
}
}
\ No newline at end of file
application/services/goods/GoodsService.php
View file @
1a81427c
...
@@ -267,7 +267,7 @@ class GoodsService
...
@@ -267,7 +267,7 @@ class GoodsService
switch
(
$online_type
)
{
switch
(
$online_type
)
{
case
1
:
case
1
:
$skuParams
[
'online_status'
]
=
1
;
$skuParams
[
'online_status'
]
=
0
;
$skuParams
[
'online_start_time'
]
=
date
(
"Y-m-d H:i:s"
);
$skuParams
[
'online_start_time'
]
=
date
(
"Y-m-d H:i:s"
);
break
;
break
;
case
2
:
case
2
:
...
@@ -281,6 +281,15 @@ class GoodsService
...
@@ -281,6 +281,15 @@ class GoodsService
break
;
break
;
}
}
if
(
!
empty
(
$skuData
[
"online_type"
]))
{
//立即上架和定时上架
if
(
in_array
(
$skuData
[
"online_type"
],
[
1
,
2
]))
{
if
(
$skuData
[
"expiration_time"
]
<=
$skuData
[
'online_start_time'
])
{
throw
new
GoodsException
([
"cus"
=>
52
]);
}
}
}
GoodsSku
::
save
(
$skuParams
);
GoodsSku
::
save
(
$skuParams
);
self
::
addGoodsSkuPicRecord
(
$skuId
,
$skuData
);
self
::
addGoodsSkuPicRecord
(
$skuId
,
$skuData
);
return
$skuId
;
return
$skuId
;
...
@@ -429,13 +438,25 @@ class GoodsService
...
@@ -429,13 +438,25 @@ class GoodsService
];
];
}
}
if
(
$status
==
GoodsSku
::
STATUS_PASS
)
{
$online_type
=
empty
(
$sku
[
"online_type"
])
?
0
:
$sku
[
"online_type"
];
$online_type
=
empty
(
$sku
[
"online_type"
])
?
0
:
$sku
[
"online_type"
];
if
(
$online_type
==
1
)
{
if
(
$online_type
==
1
)
{
if
(
$status
==
GoodsSku
::
STATUS_PASS
)
{
$statusData
[
'online_status'
]
=
GoodsSku
::
ONLINE_STATUS_ONLINE
;
$statusData
[
'online_status'
]
=
GoodsSku
::
ONLINE_STATUS_ONLINE
;
$statusData
[
'online_start_time'
]
=
date
(
"Y-m-d H:i:s"
);
$statusData
[
'online_start_time'
]
=
date
(
"Y-m-d H:i:s"
);
}
}
//定点上架
if
(
$online_type
==
2
)
{
$onlineStartTime
=
empty
(
$sku
[
"online_start_time"
])
?
0
:
strtotime
(
$sku
[
"online_start_time"
]);
if
(
$onlineStartTime
>
time
())
{
$statusData
[
'online_status'
]
=
GoodsSku
::
ONLINE_STATUS_OFFLINE
;
}
}
//暂不上架
if
(
$online_type
==
3
)
{
$statusData
[
'online_status'
]
=
GoodsSku
::
ONLINE_STATUS_OFFLINE
;
}
}
}
GoodsSku
::
save
(
$statusData
,
[
"goods_sku_id"
=>
$sku
[
"goods_sku_id"
]]);
GoodsSku
::
save
(
$statusData
,
[
"goods_sku_id"
=>
$sku
[
"goods_sku_id"
]]);
...
@@ -561,6 +582,11 @@ class GoodsService
...
@@ -561,6 +582,11 @@ class GoodsService
$goodsSkuList
=
GoodsSku
::
select
(
"*"
,
[
"goods_spu_id"
=>
$goodsSpuId
]);
$goodsSkuList
=
GoodsSku
::
select
(
"*"
,
[
"goods_spu_id"
=>
$goodsSpuId
]);
if
(
!
empty
(
$goodsSkuList
))
{
if
(
!
empty
(
$goodsSkuList
))
{
foreach
(
$goodsSkuList
as
$sku
)
{
foreach
(
$goodsSkuList
as
$sku
)
{
if
(
$sku
[
"expiration_time"
]
<
date
(
"Y-m-d H:i:s"
))
{
throw
new
GoodsException
([
"cus"
=>
30
]);
}
$goodsSkuId
=
$sku
[
"goods_sku_id"
];
$goodsSkuId
=
$sku
[
"goods_sku_id"
];
$goodsSkuData
=
[
$goodsSkuData
=
[
"online_type"
=>
$onlineType
,
"online_type"
=>
$onlineType
,
...
@@ -569,21 +595,29 @@ class GoodsService
...
@@ -569,21 +595,29 @@ class GoodsService
];
];
if
(
$onlineType
==
1
)
{
if
(
$onlineType
==
1
)
{
if
(
$sku
[
'audit_status'
]
==
1
)
{
if
(
$sku
[
'audit_status'
]
==
1
)
{
$goodsSkuData
[
'online_status'
]
=
1
;
$goodsSkuData
[
'online_status'
]
=
GoodsSku
::
ONLINE_STATUS_ONLINE
;
}
}
$goodsSkuData
[
'online_start_time'
]
=
date
(
"Y-m-d H:i:s"
);
$goodsSkuData
[
'online_start_time'
]
=
date
(
"Y-m-d H:i:s"
);
}
}
//暂不上架
//暂不上架
if
(
$onlineType
==
3
)
{
if
(
$onlineType
==
3
)
{
$goodsSkuData
[
'audit_status'
]
=
0
;
//
$goodsSkuData['audit_status'] = 0;
$goodsSkuData
[
'online_status'
]
=
0
;
$goodsSkuData
[
'online_status'
]
=
GoodsSku
::
ONLINE_STATUS_OFFLINE
;
}
}
if
(
$onlineType
==
2
)
{
if
(
$onlineType
==
2
)
{
$onlineStartTime
=
strtotime
(
$goodsSkuData
[
'online_start_time'
]);
$onlineStartTime
=
strtotime
(
$goodsSkuData
[
'online_start_time'
]);
if
(
$onlineStartTime
>
time
())
{
if
(
$onlineStartTime
>
time
())
{
$goodsSkuData
[
'online_status'
]
=
0
;
$goodsSkuData
[
'online_status'
]
=
GoodsSku
::
ONLINE_STATUS_OFFLINE
;
}
}
//立即上架和定时上架
if
(
in_array
(
$onlineType
,
[
1
,
2
]))
{
if
(
$sku
[
"expiration_time"
]
<=
$goodsSkuData
[
'online_start_time'
])
{
throw
new
GoodsException
([
"cus"
=>
52
]);
}
}
}
}
...
@@ -804,16 +838,26 @@ class GoodsService
...
@@ -804,16 +838,26 @@ class GoodsService
$skuParams
[
"setmeal"
]
=
$params
[
"setmeal"
];
$skuParams
[
"setmeal"
]
=
$params
[
"setmeal"
];
}
}
if
(
!
empty
(
$
skuData
[
"online_start_time"
]))
{
if
(
!
empty
(
$
params
[
"online_start_time"
]))
{
$skuParams
[
'online_start_time'
]
=
empty
(
$
skuData
[
"online_start_time"
])
?
""
:
$skuData
[
"online_start_time"
];
$skuParams
[
'online_start_time'
]
=
empty
(
$
params
[
"online_start_time"
])
?
""
:
$params
[
"online_start_time"
];
}
}
if
(
!
empty
(
$
skuData
[
"online_end_time"
]))
{
if
(
!
empty
(
$
params
[
"online_end_time"
]))
{
$skuParams
[
'online_end_time'
]
=
empty
(
$
skuData
[
"online_end_time"
])
?
""
:
$skuData
[
"online_end_time"
];
$skuParams
[
'online_end_time'
]
=
empty
(
$
params
[
"online_end_time"
])
?
""
:
$params
[
"online_end_time"
];
}
}
if
(
!
empty
(
$skuData
[
"online_type"
]))
{
if
(
!
empty
(
$params
[
"online_type"
]))
{
$skuParams
[
'online_type'
]
=
empty
(
$skuData
[
"online_type"
])
?
""
:
$skuData
[
"online_type"
];
$skuParams
[
'online_type'
]
=
empty
(
$params
[
"online_type"
])
?
0
:
$params
[
"online_type"
];
}
if
(
!
empty
(
$params
[
"online_type"
]))
{
//立即上架和定时上架
if
(
in_array
(
$params
[
"online_type"
],
[
1
,
2
]))
{
if
(
$skuData
[
"expiration_time"
]
<=
$skuParams
[
'online_start_time'
])
{
throw
new
GoodsException
([
"cus"
=>
52
]);
}
}
}
}
//商品操作记录
//商品操作记录
...
@@ -1128,14 +1172,31 @@ class GoodsService
...
@@ -1128,14 +1172,31 @@ class GoodsService
//是否是分销活动
//是否是分销活动
$runningMarketing
=
MarketingGoodsService
::
getRunningMarketing
([
$params
[
"goods_sku_id"
]]);
$runningMarketing
=
MarketingGoodsService
::
getRunningMarketing
([
$params
[
"goods_sku_id"
]]);
$data
[
"goods_info"
][
"is_fenxiao"
]
=
false
;
$data
[
"goods_info"
][
"is_fenxiao"
]
=
false
;
if
(
!
empty
(
$runningMarketing
[
$params
[
"goods_sku_id"
]]))
{
if
(
!
empty
(
$runningMarketing
[
$params
[
"goods_sku_id"
]]))
{
$data
[
"goods_info"
][
"is_fenxiao"
]
=
true
;
$data
[
"goods_info"
][
"is_fenxiao"
]
=
true
;
}
}
$marketingInfoList
=
MarketingGoods
::
select
([
"marketing_id"
,
"goods_sku_id"
],
[
"goods_sku_id"
=>
$params
[
"goods_sku_id"
]]);
$data
[
"goods_info"
][
'goods_share_code'
]
=
CommonService
::
getGoodsShareId
(
$params
);
if
(
!
empty
(
$marketingInfoList
))
{
foreach
(
$marketingInfoList
as
$marketingInfo
)
{
$marketingInfoIds
[
$marketingInfo
[
"goods_sku_id"
]]
=
$marketingInfo
[
"marketing_id"
];
}
$marketingIds
=
array_values
(
$marketingInfoIds
);
$now
=
date
(
"Y-m-d H:i:s"
);
$resMarketingList
=
Marketing
::
select
(
"*"
,
[
"start_time[<]"
=>
$now
,
"end_time[>]"
=>
$now
,
"marketing_id"
=>
$marketingIds
,
"marketing_type"
=>
Marketing
::
MARKETING_TYPE_FENXIAO
]);
if
(
!
empty
(
$resMarketingList
))
{
foreach
(
$resMarketingList
as
$res
)
{
$marketingList
[
$res
[
"marketing_id"
]]
=
$res
;
}
}
}
$marketing
=
!
empty
(
$marketingList
)
?
current
(
$marketingList
)
:
[];
$data
[
"goods_info"
][
'goods_share_code'
]
=
CommonService
::
getGoodsShareId
(
$params
);
//当前人是否是团长
//当前人是否是团长
$data
[
"goods_info"
][
"is_tuanzhang"
]
=
false
;
$data
[
"goods_info"
][
"is_tuanzhang"
]
=
false
;
if
(
!
empty
(
$params
[
"user_id"
]))
{
if
(
!
empty
(
$params
[
"user_id"
]))
{
...
@@ -1144,7 +1205,11 @@ class GoodsService
...
@@ -1144,7 +1205,11 @@ class GoodsService
$data
[
"goods_info"
][
"is_tuanzhang"
]
=
true
;
$data
[
"goods_info"
][
"is_tuanzhang"
]
=
true
;
if
(
!
empty
(
$runningMarketing
))
{
if
(
!
empty
(
$runningMarketing
))
{
//分销返现多少钱
//分销返现多少钱
$data
[
"goods_info"
][
"cash_back"
]
=
sprintf
(
"%.2f"
,
$runningMarketing
[
$params
[
"goods_sku_id"
]]
*
$data
[
"goods_info"
][
"price"
]);
if
(
!
empty
(
$marketing
)
&&
$marketing
[
'commission_mode'
]
==
2
)
{
$data
[
"goods_info"
][
"cash_back"
]
=
(
float
)
sprintf
(
"%.2f"
,
$runningMarketing
[
$params
[
"goods_sku_id"
]]);
}
else
{
$data
[
"goods_info"
][
"cash_back"
]
=
(
float
)
sprintf
(
"%.2f"
,
$runningMarketing
[
$params
[
"goods_sku_id"
]]
*
$data
[
"goods_info"
][
"price"
]);
}
}
}
}
}
}
}
...
@@ -1195,13 +1260,23 @@ class GoodsService
...
@@ -1195,13 +1260,23 @@ class GoodsService
$where
[
'ORDER'
]
=
[
"create_time"
=>
"DESC"
];
$where
[
'ORDER'
]
=
[
"create_time"
=>
"DESC"
];
$list
=
GoodsSku
::
select
([
"goods_spu_id"
,
"goods_sku_id"
,
"goods_name"
,
"category_1_id"
,
"category_2_id"
,
"life_account_id"
,
$list
=
GoodsSku
::
select
([
"goods_spu_id"
,
"goods_sku_id"
,
"goods_name"
,
"category_1_id"
,
"category_2_id"
,
"life_account_id"
,
"publish_user_id"
,
"update_time"
,
"create_time"
,
"audit_status"
,
"online_status"
,
"online_start_time"
],
"publish_user_id"
,
"update_time"
,
"create_time"
,
"audit_status"
,
"online_status"
,
"online_start_time"
,
"online_end_time"
,
"online_type"
],
$where
);
$where
);
if
(
!
empty
(
$list
))
{
if
(
!
empty
(
$list
))
{
foreach
(
$list
as
$key
=>
$item
)
{
foreach
(
$list
as
$key
=>
$item
)
{
$nameList
=
Category
::
select
(
"name"
,
[
"category_id"
=>
[
$item
[
"category_1_id"
],
$item
[
"category_2_id"
]]]);
$nameList
=
Category
::
select
(
"name"
,
[
"category_id"
=>
[
$item
[
"category_1_id"
],
$item
[
"category_2_id"
]]]);
$list
[
$key
][
"category_1_name"
]
=
$nameList
[
0
];
$list
[
$key
][
"category_1_name"
]
=
$nameList
[
0
];
$list
[
$key
][
"category_2_name"
]
=
$nameList
[
1
];
$list
[
$key
][
"category_2_name"
]
=
$nameList
[
1
];
if
(
$item
[
'online_type'
]
==
3
)
{
$list
[
$key
][
"online_start_time"
]
=
""
;
$list
[
$key
][
"online_end_time"
]
=
""
;
}
if
(
$item
[
'online_type'
]
==
1
)
{
$list
[
$key
][
"online_end_time"
]
=
""
;
}
}
}
}
}
return
[
"list"
=>
$list
,
"count"
=>
$count
];
return
[
"list"
=>
$list
,
"count"
=>
$count
];
...
...
application/services/marketing/MarketingGoodsService.php
View file @
1a81427c
...
@@ -156,12 +156,12 @@ class MarketingGoodsService
...
@@ -156,12 +156,12 @@ class MarketingGoodsService
//比例
//比例
if
(
!
empty
(
$secondCommission
)
&&
$commissionMode
==
1
)
{
if
(
!
empty
(
$secondCommission
)
&&
$commissionMode
==
1
)
{
$price
=
!
empty
(
$list
[
$i
][
'price'
])
?
$list
[
$i
][
'price'
]
:
0
;
$price
=
!
empty
(
$list
[
$i
][
'price'
])
?
$list
[
$i
][
'price'
]
:
0
;
$list
[
$i
][
'share_price'
]
=
substr
(
sprintf
(
"%.4f"
,
$secondCommission
*
$price
/
100
),
0
,
-
2
);
$list
[
$i
][
'share_price'
]
=
(
float
)
substr
(
sprintf
(
"%.4f"
,
$secondCommission
*
$price
/
100
),
0
,
-
2
);
}
}
//固定
//固定
if
(
!
empty
(
$commissionMode
)
&&
$commissionMode
==
2
)
{
if
(
!
empty
(
$commissionMode
)
&&
$commissionMode
==
2
)
{
$list
[
$i
][
'share_price'
]
=
substr
(
sprintf
(
"%.4f"
,
$secondCommission
/
100
),
0
,
-
2
);
$list
[
$i
][
'share_price'
]
=
(
float
)
substr
(
sprintf
(
"%.4f"
,
$secondCommission
),
0
,
-
2
);
}
}
$content
=
$userId
.
'_'
.
$value
[
'marketing_id'
];
$content
=
$userId
.
'_'
.
$value
[
'marketing_id'
];
...
@@ -201,9 +201,13 @@ class MarketingGoodsService
...
@@ -201,9 +201,13 @@ class MarketingGoodsService
$data
=
[];
$data
=
[];
foreach
(
$marketingInfoIds
as
$goodsSkuId
=>
$marketingId
)
{
foreach
(
$marketingInfoIds
as
$goodsSkuId
=>
$marketingId
)
{
if
(
!
empty
(
$marketingList
[
$marketingId
][
"second_commission_value"
]))
{
if
(
!
empty
(
$marketingList
[
$marketingId
][
"second_commission_value"
])
&&
$marketingList
[
$marketingId
][
"commission_mode"
]
==
1
)
{
$data
[
$goodsSkuId
]
=
substr
(
sprintf
(
"%.4f"
,
$marketingList
[
$marketingId
][
"second_commission_value"
]
/
10000
),
0
,
-
2
);
$data
[
$goodsSkuId
]
=
substr
(
sprintf
(
"%.4f"
,
$marketingList
[
$marketingId
][
"second_commission_value"
]
/
10000
),
0
,
-
2
);
}
}
if
(
!
empty
(
$marketingList
[
$marketingId
][
"second_commission_value"
])
&&
$marketingList
[
$marketingId
][
"commission_mode"
]
==
2
)
{
$data
[
$goodsSkuId
]
=
substr
(
sprintf
(
"%.4f"
,
$marketingList
[
$marketingId
][
"second_commission_value"
]
/
100
),
0
,
-
2
);
}
}
}
return
$data
;
return
$data
;
}
}
...
...
application/services/marketing/MarketingService.php
View file @
1a81427c
...
@@ -311,6 +311,8 @@ class MarketingService
...
@@ -311,6 +311,8 @@ class MarketingService
foreach
(
$list
as
$key
=>
$value
)
{
foreach
(
$list
as
$key
=>
$value
)
{
$marketingIds
[]
=
$value
[
"marketing_id"
];
$marketingIds
[]
=
$value
[
"marketing_id"
];
}
}
//参与人数:当前拼单成功支付的订单总数量
$userCount
=
self
::
getHaveBuyGoodsUserCount
([
"marketing_id"
=>
$marketingIds
]);
$marketingPindanData
=
MarketingPindan
::
select
([
"marketing_id"
,
"publish_life_account_id"
,
$marketingPindanData
=
MarketingPindan
::
select
([
"marketing_id"
,
"publish_life_account_id"
,
"min_price"
,
"max_price"
,
"pindan_desc"
,
"participate_number"
,
"pindan_pic"
]
"min_price"
,
"max_price"
,
"pindan_desc"
,
"participate_number"
,
"pindan_pic"
]
...
@@ -347,7 +349,7 @@ class MarketingService
...
@@ -347,7 +349,7 @@ class MarketingService
$lists
[
$key
][
"max_price"
]
=
sprintf
(
"%.2f"
,
$priceData
[
$value
[
"marketing_id"
]][
"max_price"
]
/
100
);
$lists
[
$key
][
"max_price"
]
=
sprintf
(
"%.2f"
,
$priceData
[
$value
[
"marketing_id"
]][
"max_price"
]
/
100
);
$lists
[
$key
][
"pindan_pic_url"
]
=
$picUrl
;
$lists
[
$key
][
"pindan_pic_url"
]
=
$picUrl
;
$lists
[
$key
][
"pindan_desc"
]
=
$priceData
[
$value
[
"marketing_id"
]][
"pindan_desc"
];
$lists
[
$key
][
"pindan_desc"
]
=
$priceData
[
$value
[
"marketing_id"
]][
"pindan_desc"
];
$lists
[
$key
][
"participate_number"
]
=
$priceData
[
$value
[
"marketing_id"
]][
"participate_number"
];
$lists
[
$key
][
"participate_number"
]
=
empty
(
$userCount
[
$value
[
'marketing_id'
]])
?
0
:
$userCount
[
$value
[
'marketing_id'
]
];
$shareDefaultStr
=
empty
(
$priceData
[
$value
[
"marketing_id"
]][
"pindan_pic"
])
?
$defaultPic
:
$priceData
[
$value
[
"marketing_id"
]][
"pindan_pic"
];
$shareDefaultStr
=
empty
(
$priceData
[
$value
[
"marketing_id"
]][
"pindan_pic"
])
?
$defaultPic
:
$priceData
[
$value
[
"marketing_id"
]][
"pindan_pic"
];
$strList
=
explode
(
","
,
$shareDefaultStr
);
$strList
=
explode
(
","
,
$shareDefaultStr
);
...
@@ -685,11 +687,16 @@ class MarketingService
...
@@ -685,11 +687,16 @@ class MarketingService
}
}
$marketingGoods
=
[];
$marketingGoods
=
[];
foreach
(
$skuInfoList
as
$key
=>
$skuInfo
)
{
$tempSkuInfoList
=
array_column
(
$skuInfoList
,
null
,
"goods_sku_id"
);
$marketingGoods
[
$key
][
"goods_spu_id"
]
=
$skuInfo
[
"goods_spu_id"
];
foreach
(
$goodsSkuId
as
$key
=>
$skuId
)
{
$marketingGoods
[
$key
][
"goods_sku_id"
]
=
$skuInfo
[
"goods_sku_id"
];
if
(
empty
(
$tempSkuInfoList
[
$skuId
][
"goods_spu_id"
]))
{
continue
;
}
$marketingGoods
[
$key
][
"goods_spu_id"
]
=
$tempSkuInfoList
[
$skuId
][
"goods_spu_id"
];
$marketingGoods
[
$key
][
"goods_sku_id"
]
=
$skuId
;
$marketingGoods
[
$key
][
"marketing_id"
]
=
$marketingId
;
$marketingGoods
[
$key
][
"marketing_id"
]
=
$marketingId
;
}
}
MarketingGoods
::
save
(
$marketingGoods
);
MarketingGoods
::
save
(
$marketingGoods
);
//自提点
//自提点
...
@@ -1001,7 +1008,8 @@ class MarketingService
...
@@ -1001,7 +1008,8 @@ class MarketingService
}
}
empty
(
$goodsSkuList
)
&&
$goodsSkuList
=
[];
empty
(
$goodsSkuList
)
&&
$goodsSkuList
=
[];
$userCount
=
self
::
getHaveBuyGoodsUserCount
([
"marketing_id"
=>
$params
[
'marketing_id'
]]);
$userCount
=
empty
(
$userCount
[
$params
[
'marketing_id'
]])
?
0
:
$userCount
[
$params
[
'marketing_id'
]];
$marketingData
[
"life_account_name"
]
=
$marketingData
[
"life_account_icon"
]
=
""
;
$marketingData
[
"life_account_name"
]
=
$marketingData
[
"life_account_icon"
]
=
""
;
if
(
!
empty
(
$lifeAccountList
[
$pindanMarketing
[
"publish_life_account_id"
]]))
{
if
(
!
empty
(
$lifeAccountList
[
$pindanMarketing
[
"publish_life_account_id"
]]))
{
...
@@ -1021,7 +1029,7 @@ class MarketingService
...
@@ -1021,7 +1029,7 @@ class MarketingService
$marketingData
[
"pindan_desc"
]
=
$pindanMarketing
[
"pindan_desc"
];
$marketingData
[
"pindan_desc"
]
=
$pindanMarketing
[
"pindan_desc"
];
$marketingData
[
"max_price"
]
=
sprintf
(
"%.2f"
,
$pindanMarketing
[
"max_price"
]
/
100
);
$marketingData
[
"max_price"
]
=
sprintf
(
"%.2f"
,
$pindanMarketing
[
"max_price"
]
/
100
);
$marketingData
[
"min_price"
]
=
sprintf
(
"%.2f"
,
$pindanMarketing
[
"min_price"
]
/
100
);
$marketingData
[
"min_price"
]
=
sprintf
(
"%.2f"
,
$pindanMarketing
[
"min_price"
]
/
100
);
$marketingData
[
"participate_number"
]
=
$
pindanMarketing
[
"participate_number"
]
;
$marketingData
[
"participate_number"
]
=
$
userCount
;
$marketingData
[
"create_time"
]
=
$marketingInfo
[
"create_time"
];
$marketingData
[
"create_time"
]
=
$marketingInfo
[
"create_time"
];
$defaultPic
=
"SHQ_goods_0_012Xh1AQcMqu"
;
$defaultPic
=
"SHQ_goods_0_012Xh1AQcMqu"
;
...
@@ -1077,6 +1085,8 @@ class MarketingService
...
@@ -1077,6 +1085,8 @@ class MarketingService
}
}
}
}
//前端排序,后端不排库存
if
(
!
empty
(
$params
[
"from"
]))
{
foreach
(
$goodsSkuList
as
$key
=>
$item
)
{
foreach
(
$goodsSkuList
as
$key
=>
$item
)
{
if
(
$item
[
"inventory_rest"
]
==
0
)
{
if
(
$item
[
"inventory_rest"
]
==
0
)
{
unset
(
$goodsSkuList
[
$key
]);
unset
(
$goodsSkuList
[
$key
]);
...
@@ -1086,6 +1096,8 @@ class MarketingService
...
@@ -1086,6 +1096,8 @@ class MarketingService
$goodsSkuList
=
array_values
(
$goodsSkuList
);
$goodsSkuList
=
array_values
(
$goodsSkuList
);
}
}
}
$takePlaceIds
=
MarketingTakePlace
::
getRecords
([
"marketing_id"
=>
$marketingData
[
"id"
]],
[
"take_place_id"
]);
$takePlaceIds
=
MarketingTakePlace
::
getRecords
([
"marketing_id"
=>
$marketingData
[
"id"
]],
[
"take_place_id"
]);
$takePlaces
=
[];
$takePlaces
=
[];
if
(
!
empty
(
$takePlaceIds
))
{
if
(
!
empty
(
$takePlaceIds
))
{
...
@@ -1160,4 +1172,24 @@ class MarketingService
...
@@ -1160,4 +1172,24 @@ class MarketingService
}
}
return
$data
;
return
$data
;
}
}
/**
* 参与人数:当前拼单成功支付的订单总数量,退款订单不刨除
* @param array $params
* @return array|mixed
* @throws InterfaceException
*/
public
static
function
getHaveBuyGoodsUserCount
(
$params
=
[])
{
$url
=
config
(
'interface'
,
'order.order.have_buy_goods_user_count'
);
if
(
empty
(
$url
))
{
throw
new
InterfaceException
([
'cus'
=>
0
]);
}
$res
=
HttpUtil
::
get
(
$url
,
$params
);
$data
=
[];
if
(
$res
[
'code'
]
==
0
&&
isset
(
$res
[
'response'
][
"result"
]))
{
$data
=
$res
[
"response"
][
"result"
];
}
return
$data
;
}
}
}
\ No newline at end of file
daemon/Goods.php
View file @
1a81427c
...
@@ -29,10 +29,10 @@ class Goods implements DaemonServiceInterface
...
@@ -29,10 +29,10 @@ class Goods implements DaemonServiceInterface
GoodsSku
::
save
(
$colums
,
$where
);
GoodsSku
::
save
(
$colums
,
$where
);
//更新es
//更新es
GoodsService
::
updateGoodsInfoToEs
(
$where
[
'goods_sku_id'
]);
GoodsService
::
updateGoodsInfoToEs
(
$where
[
'goods_sku_id'
]);
}
}
$this
->
onlineGoods
();
$this
->
onlineGoods
();
$this
->
onlineOffGoods
();
}
}
...
@@ -65,9 +65,10 @@ class Goods implements DaemonServiceInterface
...
@@ -65,9 +65,10 @@ class Goods implements DaemonServiceInterface
sleep
(
2
);
sleep
(
2
);
$orderData
=
[
$orderData
=
[
'online_type'
=>
2
,
'online_type'
=>
2
,
'online_status'
=>
0
,
'online_status'
=>
[
0
,
2
]
,
'audit_status'
=>
1
,
'audit_status'
=>
1
,
'online_start_time[<]'
=>
date
(
"Y-m-d H:i:s"
,
time
()),
'online_start_time[<]'
=>
date
(
"Y-m-d H:i:s"
,
time
()),
'online_end_time[>]'
=>
date
(
"Y-m-d H:i:s"
,
time
()),
'LIMIT'
=>
100
,
'LIMIT'
=>
100
,
];
];
$goodsList
=
GoodsSku
::
getRecords
(
$orderData
);
$goodsList
=
GoodsSku
::
getRecords
(
$orderData
);
...
@@ -84,4 +85,35 @@ class Goods implements DaemonServiceInterface
...
@@ -84,4 +85,35 @@ class Goods implements DaemonServiceInterface
}
}
}
}
/**
*
* 自动下架
*/
public
function
onlineOffGoods
()
{
sleep
(
2
);
$orderData
=
[
'online_type'
=>
2
,
'online_status'
=>
1
,
'audit_status'
=>
1
,
'online_end_time[<]'
=>
date
(
"Y-m-d H:i:s"
,
time
()),
'LIMIT'
=>
100
,
];
$goodsList
=
GoodsSku
::
getRecords
(
$orderData
);
DaemonLog
::
info
(
'DaemonServiceOnlineOff_goods'
,
json_encode
(
$goodsList
));
foreach
(
$goodsList
as
$key
=>
$value
)
{
$where
=
[];
$where
[
'goods_sku_id'
]
=
!
empty
(
$value
[
'goods_sku_id'
])
?
$value
[
'goods_sku_id'
]
:
''
;
$colums
=
[
'online_status'
=>
2
,
];
GoodsSku
::
save
(
$colums
,
$where
);
//更新es
GoodsService
::
updateGoodsInfoToEs
(
$where
[
'goods_sku_id'
]);
}
}
}
}
\ 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