|
|
@@ -16,6 +16,55 @@ class ItemClass extends BaseClass
|
|
|
|
|
|
public static $baseFile = '\bizGhs\item\models\Item';
|
|
|
|
|
|
+ public static function errorPrice($shop)
|
|
|
+ {
|
|
|
+ $mainId = $shop->mainId ?? 0;
|
|
|
+ $itemList = ItemClass::getAllByCondition(['mainId' => $mainId, 'delStatus' => 0], null, '*');
|
|
|
+ $arr = [];
|
|
|
+ if (!empty($itemList)) {
|
|
|
+ foreach ($itemList as $item) {
|
|
|
+ $name = $item['name'] ?? '';
|
|
|
+ $price = $item['price'] ?? 0;
|
|
|
+ $name = trim(strtolower($name));
|
|
|
+ $name = str_replace(" ", "", $name);
|
|
|
+
|
|
|
+ $hasLevel = true;
|
|
|
+ $keyName = '';
|
|
|
+ $keyLevel = 'a';
|
|
|
+ if (strstr($name, "a级") != false) {
|
|
|
+ $keyName = str_replace("a级", "x级", $name);
|
|
|
+ $keyLevel = 'a';
|
|
|
+ } elseif (strstr($name, "b级") != false) {
|
|
|
+ $keyName = str_replace("b级", "x级", $name);
|
|
|
+ $keyLevel = 'b';
|
|
|
+ } elseif (strstr($name, "c级") != false) {
|
|
|
+ $keyName = str_replace("c级", "x级", $name);
|
|
|
+ $keyLevel = 'c';
|
|
|
+ } else {
|
|
|
+ $hasLevel = false;
|
|
|
+ }
|
|
|
+ if ($hasLevel) {
|
|
|
+ $arr[$keyName][$keyLevel] = $price;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $error = [];
|
|
|
+ if (!empty($arr)) {
|
|
|
+ foreach ($arr as $key => $it) {
|
|
|
+ if (isset($it['a']) && isset($it['b']) && $it['b'] > $it['a']) {
|
|
|
+ $error[$key] = $it;
|
|
|
+ }
|
|
|
+ if (isset($it['b']) && isset($it['c']) && $it['c'] > $it['b']) {
|
|
|
+ $error[$key] = $it;
|
|
|
+ }
|
|
|
+ if (isset($it['a']) && isset($it['c']) && $it['c'] > $it['a']) {
|
|
|
+ $error[$key] = $it;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return $error;
|
|
|
+ }
|
|
|
+
|
|
|
//初始化花材 lqh 2021.4.12 modify ssh 20210711
|
|
|
public static function initItem($mainId)
|
|
|
{
|