|
@ -92,7 +92,7 @@ class mFormula extends mBase { |
|
|
|
|
|
|
|
|
$unit_name = preg_replace('/\d/', '', $num_str); |
|
|
$unit_name = preg_replace('/\d/', '', $num_str); |
|
|
|
|
|
|
|
|
$unit_type = $GLOBALS['weight_convert_list'][$unit_name]; |
|
|
$unit_type = array_search($unit_name, $GLOBALS['weight_convert_list']); |
|
|
if (!$unit_type) return false; |
|
|
if (!$unit_type) return false; |
|
|
if (!isset($unit_conv[$unit_type])) return false; |
|
|
if (!isset($unit_conv[$unit_type])) return false; |
|
|
|
|
|
|
|
@ -660,19 +660,28 @@ class mFormula extends mBase { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function getUnitConvByIds($ids) { |
|
|
public function getUnitConvByIds($ids) { |
|
|
return $this->obj->selectIn($this->unit_conv, array('id' => $ids), array('sql' => '`is_delete`=?', 'vals' => array(0))); |
|
|
return $this->obj->selectIn($this->unit_conv, array('id' => $ids), array('sql' => '`status`=?', 'vals' => array(0))); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function getUnitConvById($id) { |
|
|
public function getUnitConvById($id) { |
|
|
return $this->obj->select($this->unit_conv, array('sql' => '`id`=? and `is_delete`=?', 'vals' => array($id, 0))); |
|
|
return $this->obj->select($this->unit_conv, array('sql' => '`id`=?', 'vals' => array($id))); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function getUnitTypeConv($unit_type) { |
|
|
public function getUnitTypeConv($unit_type) { |
|
|
return $this->obj->selectAll($this->unit_conv, array('sql' => '`unit_type`=? and `is_delete`=?', 'vals' => array($unit_type, 0))); |
|
|
return $this->obj->selectAll($this->unit_conv, array('sql' => '`unit_type`=? and `status`=?', 'vals' => array($unit_type, 0))); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function getUnitConvList($unit_type) { |
|
|
public function getUnitConvList($condition, $page_num = 1, $page_size = 500) { |
|
|
return $this->obj->selectAll($this->unit_conv, array('sql' => '`unit_type`=?', 'vals' => array($unit_type))); |
|
|
$offset = ($page_num - 1) * $page_size; |
|
|
|
|
|
|
|
|
|
|
|
$where = "1=1 "; |
|
|
|
|
|
if (!empty($condition)) { |
|
|
|
|
|
foreach ($condition as $key => $val) { |
|
|
|
|
|
$where .= " and {$key}={$val}"; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return $this->obj->selectAll($this->unit_conv, array('sql' => $where, 'vals' => array()), 'id desc ', array($offset, $page_size)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function updateUnitConv($id, $info) { |
|
|
public function updateUnitConv($id, $info) { |
|
@ -707,7 +716,7 @@ class mFormula extends mBase { |
|
|
'unit_type' => $unit_type, |
|
|
'unit_type' => $unit_type, |
|
|
'num' => $num, |
|
|
'num' => $num, |
|
|
'from' => $from, |
|
|
'from' => $from, |
|
|
'is_delete' => 1, |
|
|
'status' => 1, |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
if (!$id) { |
|
|
if (!$id) { |
|
|