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
453da3a2
Commit
453da3a2
authored
Aug 09, 2021
by
luhongguang
Browse files
Options
Browse Files
Download
Plain Diff
update:处理冲突
parents
a7ce397b
f7931107
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
64 additions
and
3 deletions
+64
-3
GoodsException.php
application/exception/custom/GoodsException.php
+3
-1
Marketing.php
application/models/marketing/mysql/Marketing.php
+7
-0
GoodsService.php
application/services/goods/GoodsService.php
+51
-2
MarketingService.php
application/services/marketing/MarketingService.php
+3
-0
No files found.
application/exception/custom/GoodsException.php
View file @
453da3a2
...
...
@@ -55,6 +55,8 @@ class GoodsException extends BaseException
self
::
PRINTER_ALREADY_EXIST
=>
'打印机已被%s绑定'
,
self
::
EMPTY_OTA_ID
=>
'供应商id为空'
,
self
::
OTA_NOT_EXIST
=>
'供应商不存在'
,
39
=>
'商品id非法'
,
39
=>
'结算价不能大于售价'
,
40
=>
'结算价不符合标准'
,
41
=>
'商品id非法'
,
];
}
\ No newline at end of file
application/models/marketing/mysql/Marketing.php
View file @
453da3a2
...
...
@@ -25,6 +25,13 @@ class Marketing extends MysqlBase
self
::
ONLINE_STATUS_DAOQI
=>
"到期"
,
];
const
COMMISSION_MODE_RATE
=
1
;
const
COMMISSION_MODE_FIXED
=
2
;
const
ONLINE_STATUS_OPEN
=
1
;
const
ONLINE_STATUS_STOP
=
2
;
const
ONLINE_STATUS_EXPIRE
=
3
;
public
static
function
getRecord
(
$where
,
$colums
=
[])
{
if
(
empty
(
$colums
))
{
...
...
application/services/goods/GoodsService.php
View file @
453da3a2
...
...
@@ -694,9 +694,15 @@ class GoodsService
"inventory_rest"
=>
$inventoryCount
,
"original_price"
=>
empty
(
$params
[
"original_price"
])
?
0
:
$params
[
"original_price"
]
*
100
,
"price"
=>
$params
[
"price"
]
*
100
,
"clear_price"
=>
empty
(
$params
[
"clear_price"
])
?
0
:
$params
[
"clear_price"
]
*
100
,
"goods_version"
=>
(
int
)
$skuData
[
"goods_version"
]
+
1
,
];
//验证结算价格
if
(
!
empty
(
$params
[
"clear_price"
]))
{
self
::
checkClearPrice
(
$goodsSkuId
,
$skuParams
);
}
if
(
self
::
isInitGoodsStatus
(
$params
,
$skuData
))
{
$skuParams
[
"audit_status"
]
=
GoodsSku
::
STATUS_AUDIT
;
$skuParams
[
"online_status"
]
=
GoodsSku
::
ONLINE_STATUS_NO_ONLINE
;
...
...
@@ -724,6 +730,48 @@ class GoodsService
return
GoodsSku
::
save
(
$skuParams
,
[
"goods_sku_id"
=>
$goodsSkuId
]);
}
/**
* 检查结算价格
* @param $goodsSkuId
* @param $skuParams
* @throws GoodsException
*/
private
static
function
checkClearPrice
(
$goodsSkuId
,
$skuParams
)
{
$clearPrice
=
$skuParams
[
"clear_price"
];
$price
=
$skuParams
[
"price"
];
if
(
$clearPrice
>
0
&&
$clearPrice
>
$price
)
{
throw
new
GoodsException
([
'cus'
=>
39
]);
}
$marketingIds
=
MarketingGoods
::
select
([
"marketing_id"
],
[
"goods_sku_id"
=>
$goodsSkuId
]);
if
(
!
empty
(
$marketingIds
))
{
$marketingIds
=
array_column
(
$marketingIds
,
"marketing_id"
);
$marketings
=
Marketing
::
select
(
"*"
,
[
"marketing_id"
=>
$marketingIds
,
"marketing_type"
=>
Marketing
::
MARKETING_TYPE_FENXIAO
,
"online_status"
=>
Marketing
::
ONLINE_STATUS_OPEN
]
);
if
(
!
empty
(
$marketings
))
{
foreach
(
$marketings
as
$marketing
)
{
if
(
$marketing
[
"commission_mode"
]
==
Marketing
::
COMMISSION_MODE_RATE
)
{
$commissionTotal
=
(
$marketing
[
"first_commission_value"
]
+
$marketing
[
"second_commission_value"
])
/
1000
*
$price
;
if
(
$price
-
$commissionTotal
<
$clearPrice
)
{
throw
new
GoodsException
([
'cus'
=>
40
]);
}
}
if
(
$marketing
[
"commission_mode"
]
==
Marketing
::
COMMISSION_MODE_FIXED
)
{
$commissionTotal
=
(
$marketing
[
"first_commission_value"
]
+
$marketing
[
"second_commission_value"
]);
if
(
$price
-
$commissionTotal
<
$clearPrice
)
{
throw
new
GoodsException
([
'cus'
=>
40
]);
}
}
}
}
}
}
/**
* 是否要初始化状态
* @param $params
...
...
@@ -744,7 +792,8 @@ class GoodsService
||
$params
[
"rule_desc"
]
!=
$sku
[
"rule_desc"
]
||
$params
[
"rule_refund"
]
!=
$sku
[
"rule_refund"
]
||
$params
[
"original_price"
]
!=
$sku
[
"original_price"
]
||
$params
[
"price"
]
!=
$sku
[
"price"
];
||
$params
[
"price"
]
!=
$sku
[
"price"
]
||
$params
[
"clear_price"
]
!=
$sku
[
"clear_price"
];
}
/**
...
...
@@ -872,7 +921,7 @@ class GoodsService
return
self
::
generalGoodsInfo
(
$params
);
}
}
else
{
throw
new
GoodsException
([
"cus"
=>
39
]);
throw
new
GoodsException
([
"cus"
=>
41
]);
}
}
...
...
application/services/marketing/MarketingService.php
View file @
453da3a2
...
...
@@ -324,7 +324,9 @@ class MarketingService
*/
private
static
function
addFenxiaoMarketing
(
$params
)
{
$commissionMode
=
!
empty
(
$params
[
'commission_mode'
])
?
$params
[
'commission_mode'
]
:
''
;
$marketingName
=
!
empty
(
$params
[
'marketing_name'
])
?
$params
[
'marketing_name'
]
:
''
;
$firstCommissionRate
=
!
empty
(
$params
[
'first_commission_value'
])
?
$params
[
'first_commission_value'
]
*
100
:
0
;
$secondCommissionRate
=
!
empty
(
$params
[
'second_commission_value'
])
?
$params
[
'second_commission_value'
]
*
100
:
0
;
$createUserEmail
=
!
empty
(
$params
[
'op_cur_user'
])
?
$params
[
'op_cur_user'
]
:
''
;
...
...
@@ -440,6 +442,7 @@ class MarketingService
'update_user_email'
=>
$createUserEmail
,
'update_time'
=>
date
(
"Y-m-d H:i:s"
),
'create_time'
=>
date
(
"Y-m-d H:i:s"
),
'commission_mode'
=>
$commissionMode
,
];
$marketingId
=
Marketing
::
insertRecord
(
$colums
);
if
(
empty
(
$marketingId
))
{
...
...
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