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
f9243919
Commit
f9243919
authored
Sep 01, 2021
by
jianghaiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'online_time'
parents
5d3bf93c
29521b6b
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
335 additions
and
8 deletions
+335
-8
GoodsException.php
application/exception/custom/GoodsException.php
+1
-0
GoodsOnlineSiteValidate.php
application/library/Validate/GoodsOnlineSiteValidate.php
+23
-0
Goods.php
application/modules/Goods/controllers/Goods.php
+15
-0
GoodsService.php
application/services/goods/GoodsService.php
+222
-4
MarketingGoodsService.php
application/services/marketing/MarketingGoodsService.php
+7
-3
MarketingService.php
application/services/marketing/MarketingService.php
+3
-0
Goods.php
daemon/Goods.php
+64
-1
No files found.
application/exception/custom/GoodsException.php
View file @
f9243919
...
...
@@ -70,5 +70,6 @@ class GoodsException extends BaseException
49
=>
'库存不得小于已售库存'
,
self
::
RULE_LIMIT_ERROR
=>
'单人可买上限填写错误'
,
self
::
NOT_FIND_MARKETING
=>
'找不到活动'
,
52
=>
'过期时间不得小于等于上架开始时间'
,
];
}
\ No newline at end of file
application/library/Validate/GoodsOnlineSiteValidate.php
0 → 100644
View file @
f9243919
<?php
namespace
Validate
;
/**
* Class GoodsAuditValidate
*
* @package Validate
*/
class
GoodsOnlineSiteValidate
extends
BaseValidate
{
protected
$rule
=
[
'goods_spu_id'
=>
'require'
,
'online_type'
=>
'require'
,
];
protected
$message
=
[
"goods_spu_id"
=>
"商品id不能为空"
,
"online_type"
=>
"设置类型不能为空"
,
];
}
\ No newline at end of file
application/modules/Goods/controllers/Goods.php
View file @
f9243919
...
...
@@ -16,6 +16,7 @@ use \Validate\GoodsOnlineOfflineValidate;
use
\Validate\PaySuccessGoodsCallbackValidate
;
use
\Validate\GoodsInitShopValidate
;
use
\Validate\PindanGoodsAddValidate
;
use
\Validate\GoodsOnlineSiteValidate
;
use
\App\Services\goods\ElasticGoodService
;
use
\App\Services\goods\MarketingPindanGoodsService
;
use
\App\Models\marketing\mysql\Marketing
;
...
...
@@ -118,6 +119,20 @@ class GoodsController extends Base
$this
->
success
();
}
/**
* 修改商品定点上架设置
* @date 2021-08-25
* @license [license]
* @version [version]
*/
public
function
online_siteAction
()
{
$params
=
$this
->
params
;
(
new
GoodsOnlineSiteValidate
())
->
validate
();
GoodsService
::
onlineSite
(
$params
);
$this
->
success
();
}
/**
* 审核通过/驳回
*/
...
...
application/services/goods/GoodsService.php
View file @
f9243919
This diff is collapsed.
Click to expand it.
application/services/marketing/MarketingGoodsService.php
View file @
f9243919
...
...
@@ -150,12 +150,12 @@ class MarketingGoodsService
//比例
if
(
!
empty
(
$secondCommission
)
&&
$commissionMode
==
1
)
{
$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
)
{
$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'
];
...
...
@@ -195,9 +195,13 @@ class MarketingGoodsService
$data
=
[];
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
);
}
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
;
}
...
...
application/services/marketing/MarketingService.php
View file @
f9243919
...
...
@@ -493,6 +493,9 @@ class MarketingService
$clearPrice
=
!
empty
(
$value
[
"clear_price"
])
?
$value
[
"clear_price"
]
:
0
;
$price
=
!
empty
(
$value
[
"price"
])
?
$value
[
"price"
]
:
0
;
$chargeFee
=
!
empty
(
$price
)
?
(
float
)
bcmul
(
$price
,
self
::
CHARGEFEE
,
2
)
:
0
;
//手续费 (分)
if
(
$chargeFee
<
1
)
{
$chargeFee
=
0
;
}
if
(
!
empty
(
$clearPrice
)
&&
$clearPrice
>
0
)
{
if
(
$commissionMode
==
Marketing
::
COMMISSION_MODE_RATE
)
{
$commissionTotal
=
(
$firstCommissionRate
+
$secondCommissionRate
)
/
10000
*
$price
;
...
...
daemon/Goods.php
View file @
f9243919
...
...
@@ -29,8 +29,10 @@ class Goods implements DaemonServiceInterface
GoodsSku
::
save
(
$colums
,
$where
);
//更新es
GoodsService
::
updateGoodsInfoToEs
(
$where
[
'goods_sku_id'
]);
}
$this
->
onlineGoods
();
$this
->
onlineOffGoods
();
}
...
...
@@ -53,4 +55,65 @@ class Goods implements DaemonServiceInterface
GoodsService
::
updateGoodsInfoToEs
(
$where
[
'goods_sku_id'
]);
}
}
/**
*
* 自动上线
*/
public
function
onlineGoods
()
{
sleep
(
2
);
$orderData
=
[
'online_type'
=>
2
,
'online_status'
=>
[
0
,
2
],
'audit_status'
=>
1
,
'online_start_time[<]'
=>
date
(
"Y-m-d H:i:s"
,
time
()),
'online_end_time[>]'
=>
date
(
"Y-m-d H:i:s"
,
time
()),
'LIMIT'
=>
100
,
];
$goodsList
=
GoodsSku
::
getRecords
(
$orderData
);
DaemonLog
::
info
(
'DaemonServiceOnline_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'
=>
1
,
];
GoodsSku
::
save
(
$colums
,
$where
);
//更新es
GoodsService
::
updateGoodsInfoToEs
(
$where
[
'goods_sku_id'
]);
}
}
/**
*
* 自动下架
*/
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