本文整理汇总了PHP中Base_model::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Base_model::create方法的具体用法?PHP Base_model::create怎么用?PHP Base_model::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Base_model
的用法示例。
在下文中一共展示了Base_model::create方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addPointsLog
/**
* @积分(图腾币)记录
* @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;
}
}
示例2: write
public function write($data)
{
if (!isset($data['id']) || empty($data['id'])) {
$data['id'] = unique_id();
}
return parent::create($data);
}
示例3: addCourse
public function addCourse($params)
{
if (parent::is_exist(array("title" => $params["title"]))) {
return -2;
}
return parent::create($params) > 0 ? 0 : -1;
}
示例4: create
/**
* 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();
}
示例5: create_admin
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)));
}
示例6: create
/**
* 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();
}
示例7: create
/**
* 创建统计
* @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;
}
}
}
示例8: add
private function add($dta)
{
$data = array('uid' => $dta['uid'], 'bizid' => $dta['bizid'], 'flag' => $dta['flag'], 'remark' => $dta['remark']);
return parent::create($data);
}
示例9: check_login
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 '该昵称已被使用';
示例10: create
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;
}
示例11: create
public function create($data)
{
$this->switching($this->_idx_table);
return parent::create($data);
}
示例12: create
public function create($params)
{
$new_id = parent::create($params);
}