Checks whether two multidimensional arrays have been
Public Function foo ($arr, & $rt, $key = ", $i =0) {if (Is_array ($arr)) {foreach ($arr as $k + = $v) {if (Is_array ($v)) {$this->foo ($v, $rt, $k, $i); } else {$rt [$key. ' $k. $i] = $v; } $i + +; }} return $rt; }
/**
* Commodity Information Cache Consistency check
* @param $productId
* @return BOOL
*/
Public Function Checkproductattach ($productId)
{
$getAttach = $this->productservice->getattach ($productId);
$getProductAttach = $this->productservice->getproductattach ($productId);
if ($getProductAttach = = False) {
Yii:: $app->datacache->getredis ()->del ([' Product_attach ', $productId]);
return true;
}
$isSame = $this->issame ($getAttach, $getProductAttach);
$arr = [];
$arrCache = $this->foo ($getAttach, $arr);
$arrService = $this->foo ($getProductAttach, $arr);
$result = [' issame ' = $isSame, ' diff ' =>array_diff ($arrService, $arrCache)];
if ($isSame ==false) {
Yii::getlogger ()->log ([' Errorkey ' = ' redischeckerror: '. $productId, ' errorvalue ' = Json_encode ($result [' Diff ']), logger::level_error);
}
return $result;
}
Checks whether two multidimensional arrays have been