12345678910111213141516171819202122232425262728293031 |
- <?php
- if (!defined('BASEPATH'))exit('No direct script access allowed');
- class Batmanage_model extends CI_Model {
- public function __construct() {
- parent::__construct();
- }
-
- public function get_record_id($data, $table){
- $this->db->where('cmdtype', $data['cmdtype']);
- $this->db->where('relateid', $data['relateid']);
- $query = $this->db->get($table);
- $row = $query->row_array();
- if (!empty($row)) {
- // if ($table=='batch_update_cmd' && $row['statuscmd']==0 && (time() - strtotime($row['updatetime']) < 120)) {
- // return -1;
- // } else {
- $this->db->where('id', $row['id']);
- $this->db->update($table, $data);
- return $row['id'];
- // }
- } else {
- $this->db->insert($table, $data);
- return $this->db->insert_id();
- }
- }
- }
- ?>
|