本文整理汇总了PHP中dbeav_model::update方法的典型用法代码示例。如果您正苦于以下问题:PHP dbeav_model::update方法的具体用法?PHP dbeav_model::update怎么用?PHP dbeav_model::update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dbeav_model
的用法示例。
在下文中一共展示了dbeav_model::update方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDetail
/**
* 获得商店详情
*
* @param array $param 参数
* @param number $update_visit 是否更新访问,1->更新(默认), 其它 -> 不更新
* @return array
*/
function getDetail($param = array(), $update_visit = 1)
{
$info = array();
$shop_id = $param['shop_id'] ? $param['shop_id'] : 0;
$member_id = $param['member_id'] ? $param['member_id'] : 0;
if ($shop_id > 0 || $member_id > 0) {
if ($shop_id) {
$filter['shop_id'] = $param['shop_id'];
}
if ($member_id) {
$filter['member_id'] = $param['member_id'];
}
$info = parent::dump($filter);
// 添加商品访问
if ($info['is_open'] == 1) {
if ($update_visit == 1) {
$_info = array('see_num' => $info['see_num'] + 1);
parent::update($_info, array('shop_id' => $info['shop_id']));
}
$_param = array('app' => 'microshop', 'ctl' => 'site_index', 'full' => 1, 'act' => 'detail', 'arg0' => $info['shop_id']);
$info['shop_link'] = app::get('site')->router()->gen_url($_param);
$m_mdl = app::get('b2c')->model('members');
$m_info = $m_mdl->dump($info['member_id']);
$info['follow_num'] = $m_info['follow_num'];
$info['fans_num'] = $m_info['follow_num'];
$info['cover'] = $m_info['cover'] ? kernel::single('base_storager')->image_path($m_info['cover']) : $this->app->res_url . '/images/top-bg.png';
$info['avatar'] = $m_info['avatar'] ? kernel::single('base_storager')->image_path($m_info['avatar']) : $this->app->res_url . '/images/top-bg.png';
$info['info'] = $m_info['info'];
}
}
return $info;
}
示例2: update
function update($data, $filter)
{
$c = parent::update($data, $filter);
if ($filter['role_id']) {
$role_id = array();
foreach ($this->getList('role_id', $filter) as $r) {
$role_id[] = $r['role_id'];
}
} else {
$role_id = $filter['role_id'];
}
if (count($role_id) == 1) {
$rows = $this->db->select('select action_id from sdb_base_lnk_acts where role_id in (' . implode(',', $role_id) . ')');
$in_db = array();
foreach ($rows as $r) {
$in_db[] = $r['action_id'];
}
$data['actions'] = $data['actions'] ? $data['actions'] : array();
$to_add = array_diff($data['actions'], $in_db);
$to_del = array_diff($in_db, $data['actions']);
if (count($to_add) > 0) {
$sql = 'INSERT INTO `sdb_base_lnk_acts` (`role_id`,`action_id`) VALUES ';
foreach ($to_add as $action_id) {
$actions[] = "({$role_id[0]},{$action_id})";
}
$sql .= implode($actions, ',') . ';';
$a = $this->db->exec($sql);
}
if (count($to_del) > 0) {
$this->db->exec('delete from sdb_base_lnk_acts where action_id in (' . implode(',', $to_del) . ') and role_id=' . intval($role_id[0]));
}
} else {
}
return $c;
}
示例3: update
public function update($params, $filter)
{
$params = $this->valid_update($params);
if (!$params) {
return false;
}
return parent::update($params, $filter);
}
示例4: update
public function update($params, $filter = array(), $mustUpdate = null)
{
$params = $this->format_params($params);
if (!$params) {
return false;
}
if (parent::update($params, $filter)) {
kernel::single('site_module_base')->create_site_config();
return true;
} else {
return false;
}
}
示例5: update
public function update($data, $filter, $mustUpdate = null)
{
$old_rows = $this->getList('*', $filter);
$res = parent::update($data, $filter, $mustUpdate);
if ($res) {
foreach ($old_rows as $row) {
kernel::single('site_route_static')->del_dispatch($row['static']);
kernel::single('site_route_static')->del_genurl($row['url']);
}
$rows = $this->getList('*', $filter);
foreach ($rows as $row) {
kernel::single('site_route_static')->set_dispatch($row['static'], $row);
kernel::single('site_route_static')->set_genurl($row['url'], $row);
}
}
return $res;
}
示例6: update_time
/**
* 更新发布时间.
*
* @param array $filter 符合条件
*
* @return bool 返回插入结果
*/
public function update_time($filter)
{
$params['uptime'] = time();
return parent::update($params, $filter);
}
示例7: update
/**
*直接调用父类UPDATE方法 完全是为了把会员信息存入KV by hanbingshu
*/
public function update($data, $filter, $mustUpdate = null)
{
return parent::update($data, $filter, $mustUpdate);
#return $this->save_member_info_kv($filter['member_id']);
}
示例8: update
/**
* 更新数据
* @param array $params 更新的数据
* @param array $filter 更新的条件
* @return bool 返回更新结果
*/
public function update($params, $filter = array(), $mustUpdate = null)
{
$params = $this->valid_update($params);
if (!$params) {
return false;
}
$rows = $this->getList('article_id', $filter);
if (parent::update($params, $filter)) {
foreach ($rows as $row) {
kernel::single('content_article_detail')->delete_body_kvstore($row['article_id']);
}
kernel::single('content_article_detail')->store_detail_change();
return true;
} else {
return false;
}
}
示例9: getSpecialInfo
/**
* 获得商品列表
*
* @param array $param 参数
* @param number $update_visit 是否更新访问,1->更新(默认), 其它 -> 不更新
* @return array
*/
function getSpecialInfo($param = array(), $update_visit = 1)
{
$info = array();
if ($param['special_id']) {
$filter = array('special_id' => $param['special_id']);
$info = parent::dump($filter);
$_param = array('app' => 'microshop', 'ctl' => 'site_index', 'full' => 1, 'act' => 'special', 'arg0' => $param['special_id']);
$info['special_url'] = app::get('site')->router()->gen_url($_param);
// 验证商店是否关闭
$s_mdl = $this->app->model('shop');
$_filter = array('shop_id' => $info['shop_id']);
$s_info = $s_mdl->getDetail($_filter, 2);
$info['shop_open'] = $s_info['is_open'];
if ($info['shop_open'] != 1) {
return $info;
}
// 专辑访问添加
if ($update_visit == 1) {
$_info = array('see_num' => $info['see_num'] + 1);
parent::update($_info, $filter);
}
// 获得商品信息
$mdl = $this->app->model('special_products');
$page = intval($param['page']);
$page = $page ? $page : 1;
$limit = $param['limit'] ? $param['limit'] : 20;
$offset = ($page - 1) * $limit;
$offset = $offset > 0 ? $offset : 0;
$orderby = $param['orderby'] ? $param['orderby'] : 'addtime DESC';
$fields = $param['fields'] ? $param['fields'] : '*';
$count = $mdl->count($filter);
$list = array();
if ($count > 0) {
$list = $mdl->getList($fields, $filter, $offset, $limit, $orderby);
}
$platform = $param['platform'] ? $param['platform'] : 'wap';
if ($list) {
$p_mdl = app::get('b2c')->model('products');
$g_mdl = app::get('b2c')->model('goods');
$p_ids = array();
foreach ($list as $v) {
$p_ids[] = $v['product_id'];
}
if ($p_ids) {
// 获得产品列表
$products = $p_mdl->getList('*', array('product_id' => $p_ids, 'marketable' => 'true'));
if ($products) {
$g_ids = array();
foreach ($products as $k => $v) {
$g_ids[$v['goods_id']] = $v['goods_id'];
}
$good_ids = array_values($g_ids);
// 获得商品图片
$img_arr = $g_mdl->getList('image_default_id, goods_id', array('goods_id' => $good_ids));
// 构造产品图片数据
foreach ($products as $k => $v) {
$products[$k]['title'] = $v['name'];
foreach ($img_arr as $val) {
if ($val['goods_id'] == $v['goods_id']) {
$img_id = $val['image_default_id'];
$products[$k]['images'] = array('big_url' => kernel::single('base_storager')->image_path($img_id, 'l'), 'thisuasm_url' => kernel::single('base_storager')->image_path($img_id, 'm'), 'small_url' => kernel::single('base_storager')->image_path($img_id, 's'));
$products[$k]['image_default_id'] = $img_id;
}
}
}
// 获得商品收藏
$fav_arr = app::get('b2c')->model('member_goods')->getList('goods_id', array('goods_id' => $good_ids, 'type' => 'fav'));
// 构造产品收藏数据
foreach ($products as $k => $v) {
$products[$k]['fav_num'] = $products[$k]['fav_num'] ? $products[$k]['fav_num'] : 0;
foreach ($fav_arr as $val) {
if ($val['goods_id'] == $v['goods_id']) {
$products[$k]['fav_num'] += 1;
}
}
}
// 将产品数据放入到列表中
foreach ($list as $k => $v) {
foreach ($products as $val) {
if ($val['product_id'] == $v['product_id']) {
$list[$k]['detail'] = $val;
}
}
$v['platform'] = $platform;
$list[$k]['buy_url'] = $this->getBuyUrl($v);
$list[$k]['buy_code'] = $this->getBuyCode($v);
}
}
}
}
$info['products'] = $list;
$info['products_count'] = $count;
}
//.........这里部分代码省略.........
示例10: update
public function update($params, $filter)
{
$params = $this->valid_update($params);
if (!$params) {
return false;
}
if (isset($params['parent_id'])) {
$node_path_arr = array();
if ($params['parent_id'] > 0) {
$node_path = $this->select()->columns('node_path')->where('node_id = ?', $params['parent_id'])->instance()->fetch_one();
if ($node_path) {
$node_path_arr = @explode(",", $node_path);
}
}
$rows = $this->getList('*', $filter);
foreach ($rows as $row) {
if ($row['node_id'] == $params['parent_id']) {
trigger_error('节点『' . $row['node_name'] . "』的父节点不能为自己", E_USER_ERROR);
return false;
//父节点不能更新为自己,防止错误
}
if (in_array($row['node_id'], $node_path_arr)) {
trigger_error('节点『' . $row['node_name'] . "』的父节点不能为自己的子节点", E_USER_ERROR);
return false;
//父节点不能移动至自己的子节点,防止错误
}
}
}
$res = parent::update($params, $filter);
if ($res) {
if (isset($params['parent_id'])) {
foreach ($rows as $row) {
if ($row['parent_id'] != $params['parent_id']) {
$this->upgrade_parent($row['node_id']);
$this->update_nodes_path($row['node_id']);
$this->update_node_path($row['parent_id']);
}
}
}
return true;
} else {
return false;
}
}
示例11: update
/**
* 更新节点
* @var int $node_id
* @var array $params
* @access public
* @return boolean
*/
public function update($params, $filter)
{
$params = $this->valid_update($params);
if (!$params) {
return false;
}
$rows = $this->getList('*', $filter);
if (isset($params['parent_id'])) {
$node_path_arr = array();
if ($params['parent_id'] > 0) {
$node_path = $this->select()->columns('node_path')->where('node_id = ?', $params['parent_id'])->instance()->fetch_one();
if ($node_path) {
$node_path_arr = @explode(",", $node_path);
}
}
foreach ($rows as $row) {
if ($row['node_id'] == $params['parent_id']) {
trigger_error(app::get('content')->_('节点『') . $row['node_name'] . app::get('content')->_("』的父节点不能为自己"), E_USER_ERROR);
return false;
//父节点不能更新为自己,防止错误
}
if (in_array($row['node_id'], $node_path_arr)) {
trigger_error(app::get('content')->_('节点『') . $row['node_name'] . app::get('content')->_("』的父节点不能为自己的子节点"), E_USER_ERROR);
return false;
//父节点不能移动至自己的子节点,防止错误
}
}
}
$res = parent::update($params, $filter);
if ($res) {
foreach ($rows as $row) {
if (isset($params['parent_id']) && $row['parent_id'] != $params['parent_id']) {
$this->upgrade_parent($row['node_id']);
$this->update_nodes_path($row['node_id']);
$this->update_node_path($row['parent_id']);
}
kernel::single('content_article_node')->delete_node_kvstore($row['node_id']);
//todo: 清空kvstore值
}
kernel::single('content_article_node')->store_nodes_change();
return true;
} else {
return false;
}
}
示例12: update
/**
* 更新菜单
* @var int $menu_id
* @var array $params
* @access public
* @return boolean
*/
public function update($params, $filter)
{
if (!$params) {
return false;
}
$rows = $this->getList('*', $filter);
if (isset($params['parent_id'])) {
$menu_path_arr = array();
if ($params['parent_id'] > 0) {
$menu_path = $this->select()->columns('menu_path')->where('menu_id = ?', $params['parent_id'])->instance()->fetch_one();
if ($menu_path) {
$menu_path_arr = @explode(",", $menu_path);
}
}
foreach ($rows as $row) {
if ($row['menu_id'] == $params['parent_id']) {
trigger_error(app::get('weixin')->_('菜单『') . $row['menu_name'] . app::get('weixin')->_("』的父菜单不能为自己"), E_USER_ERROR);
return false;
//父菜单不能更新为自己,防止错误
}
if (in_array($row['menu_id'], $menu_path_arr)) {
trigger_error(app::get('weixin')->_('菜单『') . $row['menu_name'] . app::get('weixin')->_("』的父菜单不能为自己的子节点"), E_USER_ERROR);
return false;
//父菜单不能移动至自己的子菜单,防止错误
}
}
}
$res = parent::update($params, $filter);
if ($res) {
foreach ($rows as $row) {
if (isset($params['parent_id']) && $row['parent_id'] != $params['parent_id']) {
$this->upgrade_parent($row['menu_id']);
$this->update_menus_path($row['menu_id']);
$this->update_menu_path($row['parent_id']);
}
}
return true;
} else {
return false;
}
}