|
|
@@ -162,6 +162,16 @@ class ProductRepository extends BaseRepository
|
|
162
|
162
|
public function create(array $data)
|
|
163
|
163
|
{
|
|
164
|
164
|
return Db::transaction(function () use ($data) {
|
|
|
165
|
+ if ($data['extension_type'] != 1) {
|
|
|
166
|
+ $base_commission = Db::name('system_config_value')->where('config_key', 'base_commission')->where('mer_id', $data['mer_id'])->value('value');
|
|
|
167
|
+ if ($base_commission < 5) {
|
|
|
168
|
+ $base_commission = 5;
|
|
|
169
|
+ }
|
|
|
170
|
+ foreach ($data['attrValue'] as &$value) {
|
|
|
171
|
+ $value['extension_one'] = $base_commission;
|
|
|
172
|
+ }
|
|
|
173
|
+ }
|
|
|
174
|
+
|
|
165
|
175
|
$pension = bcsub($data['attrValue'][0]['price'], bcmul($data['attrValue'][0]['price'], $data['commission'], 2), 2);
|
|
166
|
176
|
if ($data['pension'] > $pension) {
|
|
167
|
177
|
return ['code' => 201, 'msg' => '养老金金额和佣金金额总和不能超过商品单价'];
|