/** * @积分(图腾币)记录 * @param uid int 用户uid * @param tob string 业务类型 * @param scores int 积分(图腾币)点数 * @param round int 第几轮签到记录 * @param title string 名称 * @return boolean(true/false) */ public function addPointsLog($data) { $user = $this->user->get($data['uid']); $this->load->model('Dcredit_model', 'dcredit'); $froum_credit = $this->dcredit->get_user_credit($user['mobile']); $round = empty($data['round']) ? 1 : $data['round']; $userinfo = $this->user_info->get($data['uid']); $all_point = $userinfo['points'] + $froum_credit; if (in_array($data['tob'], $this->tob_get, true)) { $points = $all_point + $data['scores']; } elseif (in_array($data['tob'], $this->tob_use, true)) { if ($userinfo['points'] < $data['scores']) { return false; } $points = $all_point - $data['scores']; } $pointlogs = array('uid' => $data['uid'], 'tob' => $data['tob'], 'scores' => $data['scores'], 'round' => $round, 'title' => $data['title'], 'after_points' => $points, 'created' => date('Y-m-d H:i:s', time())); $this->db->trans_begin(); parent::create($pointlogs); $dta['points'] = $userinfo['points'] + $data['scores']; $this->user_info->save($dta, $userinfo['uid']); if ($this->db->trans_status() === false) { $this->db->trans_rollback(); return false; } else { $this->db->trans_commit(); return true; } }
public function write($data) { if (!isset($data['id']) || empty($data['id'])) { $data['id'] = unique_id(); } return parent::create($data); }
public function addCourse($params) { if (parent::is_exist(array("title" => $params["title"]))) { return -2; } return parent::create($params) > 0 ? 0 : -1; }
/** * Creacion de un nuevo usuario */ public function create($params) { $this->db->trans_start(); $id = parent::create($params); if (isset($params['materia'])) { foreach ($params['materias'] as $val) { $this->db->insert('materias_usuarios', array('materia_id' => $val, 'usuario_id' => $id)); } } $this->db->trans_complete(); }
public function create_admin($params) { if ($this->require_login() == false) { return false; } extract($params); if ($this->is_exist(array('name' => $name))) { return false; } $salt = substr(uniqid(rand()), -10); return parent::create(array('nickname' => $nickname, 'name' => $name, 'salt' => $salt, 'pwd' => md5($pwd . $salt))); }
/** * Crea un nuevo curso con todas las materias */ public function create($params) { $this->db->trans_start(); $curso = $params; $curso['materias'] = isset($params['materias']) ? count($params['materias']) : 0; $id = parent::create($curso); if (isset($params['materias'])) { foreach ($params['materias'] as $val) { $this->db->insert('cursos_materias', array('curso_id' => $id, 'materia_id' => $val)); } } $this->db->trans_complete(); }
/** * 创建统计 * @param array $data 传入参数 * @return bool */ public function create($data = array()) { if (!isset($data['uid'])) { return false; } else { $result = parent::create($data); if (is_null($result)) { return false; } else { return true; } } }
private function add($dta) { $data = array('uid' => $dta['uid'], 'bizid' => $dta['bizid'], 'flag' => $dta['flag'], 'remark' => $dta['remark']); return parent::create($data); }
public function check_login() { $id = $this->session->userdata($this->id_name); if (!isset($id)) { return false; } $userdata = $this->get(array("id" => $id)); if ($userdata["avatar"] == NULL) { $userdata["avatar"] = "static/image/default.jpg"; } $this->load->model("news_model"); $userdata['news_nuw'] = $this->news_model->get_count(array("target" => $id, "status" => 0)); return $userdata; } public function get_user_data($id) { $userdata = parent::get(array("id" => $id)); $userdata["skilled_tags"] = $this->tag_model->get_list_by_json($userdata['skilled_tags']); if (count($userdata) <= 0) { return false; } if (@$userdata["avatar"] == NULL) { @($userdata["avatar"] = "static/image/default.jpg"); } return $userdata; } // email, nickname, pwd public function create($params) { extract($params); $oauthkey = isset($params['oauth_key']) ? $params['oauth_key'] : false; if ($this->is_exist(array('email' => $email))) { return '该邮箱已被使用'; } if ($this->is_exist(array('nickname' => $nickname))) { return '该昵称已被使用';
public function create($params) { $this->db->query('update user set god_course_count = god_course_count + 1 where id = ' . $params['god']); $id = parent::create($params); return $id; }
public function create($data) { $this->switching($this->_idx_table); return parent::create($data); }
public function create($params) { $new_id = parent::create($params); }