当前位置: 首页>>代码示例>>PHP>>正文


PHP Base_model::create方法代码示例

本文整理汇总了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;
     }
 }
开发者ID:shuai959980629,项目名称:TTDV1,代码行数:38,代码来源:Points_model.php

示例2: write

 public function write($data)
 {
     if (!isset($data['id']) || empty($data['id'])) {
         $data['id'] = unique_id();
     }
     return parent::create($data);
 }
开发者ID:shuai959980629,项目名称:TTDV1,代码行数:7,代码来源:Cash_log_model.php

示例3: addCourse

 public function addCourse($params)
 {
     if (parent::is_exist(array("title" => $params["title"]))) {
         return -2;
     }
     return parent::create($params) > 0 ? 0 : -1;
 }
开发者ID:TF-Joynic,项目名称:tiandi,代码行数:7,代码来源:Course_model.php

示例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();
 }
开发者ID:boriscy,项目名称:san_lorenzo,代码行数:14,代码来源:usuario_model.php

示例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)));
 }
开发者ID:TF-Joynic,项目名称:tiandi,代码行数:12,代码来源:Admin_model.php

示例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();
 }
开发者ID:boriscy,项目名称:san_lorenzo,代码行数:16,代码来源:curso_model.php

示例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;
         }
     }
 }
开发者ID:shuai959980629,项目名称:TTDV1,代码行数:18,代码来源:User_account_count_model.php

示例8: add

 private function add($dta)
 {
     $data = array('uid' => $dta['uid'], 'bizid' => $dta['bizid'], 'flag' => $dta['flag'], 'remark' => $dta['remark']);
     return parent::create($data);
 }
开发者ID:shuai959980629,项目名称:shuai959980629.github.com,代码行数:5,代码来源:Task_flow_model.php

示例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 '该昵称已被使用';
开发者ID:TF-Joynic,项目名称:tiandi,代码行数:36,代码来源:User_model.php

示例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;
 }
开发者ID:TF-Joynic,项目名称:tiandi,代码行数:6,代码来源:God_course_model.php

示例11: create

 public function create($data)
 {
     $this->switching($this->_idx_table);
     return parent::create($data);
 }
开发者ID:shuai959980629,项目名称:TTDV1,代码行数:5,代码来源:Sharding_model.php

示例12: create

 public function create($params)
 {
     $new_id = parent::create($params);
 }
开发者ID:TF-Joynic,项目名称:tiandi,代码行数:4,代码来源:Course_chapter_model.php


注:本文中的Base_model::create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。