Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
my-yaf-project
Project
Project
Details
Activity
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
chenchuanwen
my-yaf-project
Commits
fc72a893
Commit
fc72a893
authored
Nov 05, 2018
by
liuyuzhen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
配送公式
parent
31b45f87
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
6 deletions
+22
-6
DeliveryFormula.php
application/models/DAO/DeliveryFormula.php
+22
-6
No files found.
application/models/DAO/DeliveryFormula.php
View file @
fc72a893
...
...
@@ -109,6 +109,10 @@ class DeliveryFormulaModel extends \DAO\AbstractModel {
return
$return
;
}
public
function
delDeliverFormulaByStoreId
(
$storeId
){
return
\Our\RedisHelper
::
delCachedFunction
(
\Redis\Db6\DeliveryFormulaRedisModel
::
getInstance
(),
array
(
&
$this
,
'getOne'
),
array
(),
\Our\ApiConst
::
sevenDaySecond
,
array
(
$storeId
));
}
/**
* 新的配送公式
* @param $store
...
...
@@ -142,11 +146,23 @@ class DeliveryFormulaModel extends \DAO\AbstractModel {
}
}
$formula
=
array
();
$formula
[
'half'
]
=
max
(
array_column
(
$distanceFormulaList
,
'half'
));
$formula
[
'one'
]
=
max
(
array_column
(
$distanceFormulaList
,
'one'
));
$formula
[
'two'
]
=
max
(
array_column
(
$distanceFormulaList
,
'two'
));
$formula
[
'oneday'
]
=
max
(
array_column
(
$distanceFormulaList
,
'oneday'
));
$formula
[
'other'
]
=
max
(
array_column
(
$distanceFormulaList
,
'other'
));
$halfList
=
array
();
$oneList
=
array
();
$twoList
=
array
();
$dayList
=
array
();
$otherList
=
array
();
foreach
(
$distanceFormulaList
as
$tempFormuala
){
$halfList
[]
=
$tempFormuala
[
'half'
]
?
$tempFormuala
[
'half'
]
:
$tempFormuala
[
'other'
];
$oneList
[]
=
$tempFormuala
[
'one'
]
?
$tempFormuala
[
'one'
]
:
$tempFormuala
[
'other'
];
$twoList
[]
=
$tempFormuala
[
'one'
]
?
$tempFormuala
[
'two'
]
:
$tempFormuala
[
'other'
];
$dayList
[]
=
$tempFormuala
[
'day'
]
?
$tempFormuala
[
'day'
]
:
$tempFormuala
[
'other'
];
$otherList
[]
=
$tempFormuala
[
'other'
];
}
$formula
[
'half'
]
=
max
(
$distanceFormulaList
);
$formula
[
'one'
]
=
max
(
$oneList
);
$formula
[
'two'
]
=
max
(
$twoList
);
$formula
[
'day'
]
=
max
(
$dayList
);
$formula
[
'other'
]
=
max
(
$otherList
);
$currentTime
=
TIMESTAMP
;
$time
=
date
(
'Y-m-d'
,
$currentTime
);
...
...
@@ -226,7 +242,7 @@ class DeliveryFormulaModel extends \DAO\AbstractModel {
}
else
if
(
$interval
<=
\Our\ApiConst
::
halfHour
*
4
){
$temp
[
'price'
]
=
$formulaPrice
[
'two'
];
}
else
{
$temp
[
'price'
]
=
$formulaPrice
[
'
one
day'
];
$temp
[
'price'
]
=
$formulaPrice
[
'day'
];
}
if
(
$deliveryFreeFlag
){
$temp
[
'price'
]
=
\Our\ApiConst
::
zero
;
...
...
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