/** * Retrieve an associated array, the first field value is the code, the second field is the value * @param int $field Two fields to look for * @param array $where query criteria * @return Array/Pub
Lic function Fetchpairs ($field, $where = Array ()) {$where [' terminalid '] = Get_terminalid ();
$results = $this->findall ($where, $field);
$data = Array (); if (Is_array ($results) && count ($results) > 0) {foreach ($results as $value) {$data [$val
ue[$field [0]]] = $value [$field [1]];
return $data;
else {return false;
/** * Gets a key value in a two-dimensional array with a unique key value @param array $input two-dimensional array * @param string $columnKey The key of the array @param string $indexKey The index of the array +----------------------------------------------------------* @return Array returns the value +--------------------------------- -------------------------/function Array_column_unique (array $input, $columnKey, $indexKey = null) {return Array_u
Nique (Array_column ($input, $columnKey, $indexKey)); Call method protected function _format ($list) {//access to professional information $specIds = Array_column_unique ($list, "specid"); Count ($specIds) && $specData = D (' huaqin/specialty ')->fetchpairs (array (' ID ', ' zymc '), array ("ID" =>
Array ("in", $specIds));
Educational system Data $xuezhiIds = Array_column_unique ($list, "XZ"); Count ($xuezhiIds) && $xuezhiData = D (' Huaqin/xuezi ')->fetchpairs (array (' ID ', ' XZMC '), array ("ID" =>
Array ("in", $xuezhiIds));
foreach ($list as & $value) {$value [' zymc '] = $specData [$value [' specid ']];
$value [' xzmc '] = $xuezhiData [$value [' XZ ']];
return $list;
}
/**
* Retrieve an associated array, the first field value is the code, the second field is the value
* @param array $field two field array to look for (' Field 1 ', ' Field 2 ')
* @param array $ where query condition
* @return Array
*
/Public Function fetchpairs ($field, $where = Array ())
{
$where [' Terminalid '] = Get_terminalid ();
$results = $this->findall ($where, $field);
$data = Array ();
if (Is_array ($results) && count ($results) > 0) {
foreach ($results as $value) {
$data [$value [$field [0]]] = $value [$field [1]];
}
return $data;
} else {return
false;
}
}