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


PHP CRUD::updateById方法代码示例

本文整理汇总了PHP中CRUD::updateById方法的典型用法代码示例。如果您正苦于以下问题:PHP CRUD::updateById方法的具体用法?PHP CRUD::updateById怎么用?PHP CRUD::updateById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRUD的用法示例。


在下文中一共展示了CRUD::updateById方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getAccessToken

 /**
  * author: codeMonkey QQ:631872807
  * 全局access_token获取
  * @return
  */
 public function getAccessToken()
 {
     global $_W;
     $tokenUrl = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" . $this->appid . "&secret=" . $this->secret;
     $accessToken = CRUD::findUnique(CRUD::$table_sin_token, array(":weid" => $_W['weid']));
     load()->func('communication');
     if (!empty($accessToken)) {
         $expires_in = $accessToken['expires_in'];
         if (TIMESTAMP - $accessToken['createtime'] >= $expires_in - 200) {
             // 过期
             $content = ihttp_get($tokenUrl);
             $token = @json_decode($content['content'], true);
             $data = array('weid' => $_W['weid'], 'access_token' => $token['access_token'], 'expires_in' => $token['expires_in'], 'createtime' => TIMESTAMP);
             CRUD::updateById(CRUD::$table_sin_token, $data, $accessToken['id']);
             return $token['access_token'];
         } else {
             return $accessToken['access_token'];
         }
     } else {
         $content = ihttp_get($tokenUrl);
         $token = @json_decode($content['content'], true);
         $data = array('weid' => $_W['weid'], 'access_token' => $token['access_token'], 'expires_in' => $token['expires_in'], 'createtime' => TIMESTAMP);
         CRUD::create(CRUD::$table_sin_token, $data);
         return $token['access_token'];
     }
 }
开发者ID:aspnmy,项目名称:weizan,代码行数:31,代码来源:oauth2.class.php

示例2: fieldsFormSubmit

 public function fieldsFormSubmit($rid)
 {
     global $_GPC, $_W;
     $fid = $_GPC['fid'];
     $data = array('title' => $_GPC['title'], 'rid' => $rid, 'follow_url' => $_GPC['follow_url'], 'weid' => $this->weid, 'new_icon' => $_GPC['new_icon'], 'new_title' => $_GPC['new_title'], 'new_content' => $_GPC['new_content'], 'share_icon' => $_GPC['share_icon'], 'share_title' => $_GPC['share_title'], 'share_content' => $_GPC['share_content'], 'createtime' => TIMESTAMP);
     if (empty($fid)) {
         CRUD::create(CRUD::$table_fool, $data);
     } else {
         CRUD::updateById(CRUD::$table_fool, $data, $fid);
     }
     return true;
 }
开发者ID:aspnmy,项目名称:weizan,代码行数:12,代码来源:module.php

示例3: fieldsFormSubmit

 public function fieldsFormSubmit($rid)
 {
     global $_GPC, $_W;
     $sid = $_GPC['sin_id'];
     $data = array('title' => $_GPC['title'], 'rid' => $rid, 'starttime' => strtotime($_GPC['starttime']), 'endtime' => strtotime($_GPC['endtime']), 'follow_credit_allow' => $_GPC['follow_credit_allow'], 'follow_credit' => $_GPC['follow_credit'], 'leave_credit_clear' => $_GPC['leave_credit_clear'], 'sign_credit' => $_GPC['sign_credit'], 'sync_credit' => $_GPC['sync_credit'], 'sin_suc_msg' => $_GPC['sin_suc_msg'], 'sin_suc_fail' => $_GPC['sin_suc_fail'], 'sin_suc_member' => $_GPC['sin_suc_member'], 'rule' => htmlspecialchars_decode($_GPC['rule']), 'uniacid' => $this->uniacid, 'copyright' => $_GPC['copyright'], 'new_icon' => $_GPC['new_icon'], 'new_title' => $_GPC['new_title'], 'new_content' => $_GPC['new_content'], 'createtime' => TIMESTAMP);
     if (empty($sid)) {
         CRUD::create(CRUD::$table_sign, $data);
         $sid = pdo_insertid();
     } else {
         CRUD::updateById(CRUD::$table_sign, $data, $sid);
     }
     //连续 签到处理
     $serialids = array();
     $serial_ids = $_GPC['serial_ids'];
     $serial_days = $_GPC['serial_day'];
     $serial_credits = $_GPC['serial_credit'];
     if (is_array($serial_ids)) {
         foreach ($serial_ids as $key => $value) {
             $value = intval($value);
             $d = array('sid' => $sid, 'day' => $serial_days[$key], 'credit' => $serial_credits[$key], 'createtime' => TIMESTAMP);
             if (empty($value)) {
                 CRUD::create(CRUD::$table_sign_serial, $d);
                 $serialids[] = pdo_insertid();
             } else {
                 CRUD::updateById(CRUD::$table_sign_serial, $d, $value);
                 $serialids[] = $value;
             }
         }
         if (count($serialids) > 0) {
             pdo_query("delete from " . tablename(CRUD::$table_sign_serial) . " where sid='{$sid}' and id not in (" . implode(",", $serialids) . ")");
         } else {
             pdo_query("delete from " . tablename(CRUD::$table_sign_serial) . " where sid='{$sid}' ");
         }
     }
     //快捷菜单处理
     $link_ids = $_GPC['link_ids'];
     $link_urls = $_GPC['link_url'];
     $link_names = $_GPC['link_name'];
     $link_sorts = $_GPC['link_sort'];
     pdo_query("delete from " . tablename(CRUD::$table_sign_link) . " where sid=:sid", array(":sid" => $sid));
     if (is_array($link_ids)) {
         foreach ($link_ids as $key => $value) {
             $value = intval($value);
             $d = array("sid" => $sid, "sort" => $link_sorts[$key], "link_name" => $link_names[$key], "link_url" => $link_urls[$key], 'createtime' => TIMESTAMP);
             CRUD::create(CRUD::$table_sign_link, $d);
         }
     }
     return true;
 }
开发者ID:ChainBoy,项目名称:wxfx,代码行数:49,代码来源:module.php

示例4: updateUserSinTime

 /**
 *  更新用户时间
 * 
 * @param $begin_time
 * @param $endime
 * @param $uid
 */
 public function updateUserSinTime($begin_time, $endime, $uid)
 {
     CRUD::updateById(CRUD::$table_sign_user, array("begin_sign_time" => $begin_time, "end_sign_time" => $endime), $uid);
 }
开发者ID:ChainBoy,项目名称:wxfx,代码行数:11,代码来源:site.php


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