Ejemplo n.º 1
0
 function act_sureAddCurr()
 {
     $bool = array();
     $data = array();
     $id = trim($_POST['currId']);
     $data['currency'] = post_check(trim($_POST['currency']));
     $data['rates'] = post_check(trim($_POST['rates']));
     $data['userId'] = $_SESSION['sysUserId'];
     $data['modefyTime'] = time();
     if (empty($id)) {
         $bool = CurrencyModel::getCurrencyList("*", "where currency='{$data['currency']}'");
         if ($bool) {
             return 2;
         }
         $insertid = CurrencyModel::insertRow($data);
         if ($insertid) {
             return 1;
         } else {
             return false;
         }
     } else {
         $bool = CurrencyModel::getCurrencyList("*", "where id!={$id} and currency='{$data['currency']}'");
         if ($bool) {
             return 2;
         }
         $updatedata = CurrencyModel::update($data, "and id='{$id}'");
         if ($updatedata) {
             return 1;
         } else {
             return false;
         }
     }
 }