本文整理汇总了PHP中IModel::update方法的典型用法代码示例。如果您正苦于以下问题:PHP IModel::update方法的具体用法?PHP IModel::update怎么用?PHP IModel::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IModel
的用法示例。
在下文中一共展示了IModel::update方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
/**
* 向词库中添加词
* @param $word string 多个词以','分隔
* @param $hot int 0:否;1:是
* @param $order int 排序
*/
public static function add($word, $hot = 0, $order = 99)
{
$word = IFilter::act($word);
$hot = intval($hot);
$order = intval($order);
if ($word != '') {
$keywordObj = new IModel('keyword');
$wordArray = explode(',', $word);
$wordArray = array_unique($wordArray);
//获取各个关键词的管理商品数量
$resultCount = self::count($wordArray);
foreach ($wordArray as $word) {
if (IString::getStrLen($word) >= 15) {
continue;
}
$is_exists = $keywordObj->getObj('word = "' . $word . '"', 'hot');
if (empty($is_exists)) {
$dataArray = array('hot' => $hot, 'word' => $word, 'goods_nums' => $resultCount[$word], 'order' => $order);
$keywordObj->setData($dataArray);
$keywordObj->add();
} else {
$dataArray = array('hot' => $hot, 'order' => $order);
$keywordObj->setData($dataArray);
$keywordObj->update("word = '" . $word . "'");
}
}
return array('flag' => true);
}
return array('flag' => false, 'data' => '请填写关键词');
}
示例2: editPoint
/**
* @brief 积分更新
* @param int $user_id 用户ID
* @param int $point 积分数(正,负)
*/
private function editPoint($user_id, $point)
{
$memberObj = new IModel('member');
$memberArray = array('point' => 'point + ' . $point);
$memberObj->setData($memberArray);
return $memberObj->update('user_id = ' . $user_id, 'point');
}
示例3: login
/**
* @brief 商家登录动作
*/
public function login()
{
$seller_name = IFilter::act(IReq::get('username'));
$password = IReq::get('password');
$message = '';
if ($seller_name == '') {
$message = '登录名不能为空';
} else {
if ($password == '') {
$message = '密码不能为空';
} else {
$sellerObj = new IModel('seller');
$sellerRow = $sellerObj->getObj('seller_name = "' . $seller_name . '" and is_del = 0 and is_lock = 0');
if ($sellerRow && $sellerRow['password'] == md5($password)) {
$dataArray = array('login_time' => ITime::getDateTime());
$sellerObj->setData($dataArray);
$where = 'id = ' . $sellerRow["id"];
$sellerObj->update($where);
//存入私密数据
ISafe::set('seller_id', $sellerRow['id']);
ISafe::set('seller_name', $sellerRow['seller_name']);
ISafe::set('seller_pwd', $sellerRow['password']);
$this->redirect('/seller/index');
} else {
$message = '用户名与密码不匹配';
}
}
}
if ($message != '') {
$this->redirect('index', false);
Util::showMessage($message);
}
}
示例4: IModel
/**
* @brief 保存品牌
*/
function brand_save()
{
$brand_id = IFilter::act(IReq::get('brand_id'), 'int');
$name = IFilter::act(IReq::get('name'));
$sort = IFilter::act(IReq::get('sort'), 'int');
$url = IFilter::act(IReq::get('url'));
$description = IFilter::act(IReq::get('description'), 'text');
$tb_brand = new IModel('brand');
$brand = array('name' => $name, 'sort' => $sort, 'url' => $url, 'description' => $description);
if (isset($_FILES['logo']['name']) && $_FILES['logo']['name'] != '') {
$uploadObj = new PhotoUpload();
$uploadObj->setIterance(false);
$photoInfo = $uploadObj->run();
if (isset($photoInfo['logo']['img']) && file_exists($photoInfo['logo']['img'])) {
$brand['logo'] = $photoInfo['logo']['img'];
}
}
$tb_brand->setData($brand);
if ($brand_id) {
$where = "id=" . $brand_id;
$tb_brand->update($where);
} else {
$tb_brand->add();
}
$this->brand_list();
}
示例5: intval
/**
* @brief 回复建议
*/
function suggestion_edit_act()
{
$id = intval(IReq::get('id', 'post'));
$re_content = IFilter::act(IReq::get('re_content', 'post'), 'string');
$tb = new IModel("suggestion");
$data = array('admin_id' => $this->admin['admin_id'], 're_content' => $re_content, 're_time' => date('Y-m-d H:i:s'));
$tb->setData($data);
$tb->update("id={$id}");
$this->redirect("/comment/suggestion_list");
}
示例6: intval
/**
* @brief 保存模板修改
*/
function tpl_save()
{
$tid = intval(IReq::get('tpl_id', 'post'));
if ($tid) {
$title = IFilter::act(IReq::get('title'), 'string');
$content = IFilter::act(IReq::get('content'), 'text');
$tb_msg_template = new IModel('msg_template');
$tb_msg_template->setData(array('title' => $title, 'content' => $content));
$tb_msg_template->update('id=' . $tid);
}
$this->redirect('tpl_list');
}
示例7: IModel
function login_act()
{
$admin_name = IFilter::act(IReq::get('admin_name'));
$password = IReq::get('password');
$captcha = IReq::get('captcha', 'post');
$message = '';
if ($admin_name == '') {
$message = '登录名不能为空';
} else {
if ($password == '') {
$message = '密码不能为空';
} else {
if ($captcha != ISafe::get('Captcha')) {
$message = '验证码输入不正确';
} else {
$adminObj = new IModel('admin');
$adminRow = $adminObj->getObj('admin_name = "' . $admin_name . '"');
if (!empty($adminRow) && $adminRow['password'] == md5($password) && $adminRow['is_del'] == 0) {
$dataArray = array('last_ip' => IClient::getIp(), 'last_time' => ITime::getDateTime());
$adminObj->setData($dataArray);
$where = 'id = ' . $adminRow["id"];
$adminObj->update($where);
//根据角色分配权限
if ($adminRow['role_id'] == 0) {
ISafe::set('admin_right', 'administrator');
ISafe::set('admin_role_name', '超级管理员');
} else {
$roleObj = new IModel('admin_role');
$where = 'id = ' . $adminRow["role_id"] . ' and is_del = 0';
$roleRow = $roleObj->getObj($where);
ISafe::set('admin_right', $roleRow['rights']);
ISafe::set('admin_role_name', $roleRow['name']);
}
ISafe::set('admin_id', $adminRow['id']);
ISafe::set('admin_name', $adminRow['admin_name']);
ISafe::set('admin_pwd', $adminRow['password']);
$this->redirect('/system/default');
} else {
$message = '用户名与密码不匹配';
}
}
}
}
if ($message != '') {
$this->admin_name = $admin_name;
$this->redirect('index', false);
Util::showMessage($message);
}
}
示例8: ucenter_order
public static function ucenter_order()
{
$siteConfig = new Config('site_config');
$order_cancel_time = $siteConfig->order_cancel_time !== "" ? intval($siteConfig->order_cancel_time) : 7;
$order_finish_time = $siteConfig->order_finish_time !== "" ? intval($siteConfig->order_finish_time) : 20;
$orderModel = new IModel('order');
$orderCancelData = $order_cancel_time >= 0 ? $orderModel->query(" if_del = 0 and pay_type != 0 and status in(1) and datediff(NOW(),create_time) >= {$order_cancel_time} ", "id,order_no,4 as type_data") : array();
$orderCreateData = $order_finish_time >= 0 ? $orderModel->query(" if_del = 0 and distribution_status = 1 and status in(1,2) and datediff(NOW(),send_time) >= {$order_finish_time} ", "id,order_no,5 as type_data") : array();
$resultData = array_merge($orderCreateData, $orderCancelData);
if ($resultData) {
foreach ($resultData as $key => $val) {
$type = $val['type_data'];
$order_id = $val['id'];
$order_no = $val['order_no'];
//oerder表的对象
$tb_order = new IModel('order');
$tb_order->setData(array('status' => $type, 'completion_time' => ITime::getDateTime()));
$tb_order->update('id=' . $order_id);
//生成订单日志
$tb_order_log = new IModel('order_log');
//订单自动完成
if ($type == '5') {
$action = '完成';
$note = '订单【' . $order_no . '】完成成功';
//完成订单并且进行支付
Order_Class::updateOrderStatus($order_no);
//增加用户评论商品机会
Order_Class::addGoodsCommentChange($order_id);
$logObj = new log('db');
$logObj->write('operation', array("系统自动", "订单更新为完成", '订单号:' . $order_no));
} else {
$action = '作废';
$note = '订单【' . $order_no . '】作废成功';
//订单重置取消
Order_class::resetOrderProp($order_id);
$logObj = new log('db');
$logObj->write('operation', array("系统自动", "订单更新为作废", '订单号:' . $order_no));
}
$tb_order_log->setData(array('order_id' => $order_id, 'user' => "系统自动", 'action' => $action, 'result' => '成功', 'note' => $note, 'addtime' => ITime::getDateTime()));
$tb_order_log->add();
}
}
}
示例9: write
/**
* 写入日志并且更新账户余额
* @param array $config config数据类型
* @return string|bool
*/
public function write($config)
{
if (isset($config['user_id'])) {
$this->setUser($config['user_id']);
} else {
throw new IException("用户信息不存在");
}
isset($config['seller_id']) ? $this->setSeller($config['seller_id']) : "";
isset($config['admin_id']) ? $this->setAdmin($config['admin_id']) : "";
isset($config['event']) ? $this->setEvent($config['event']) : "";
if (isset($config['num']) && is_numeric($config['num'])) {
$this->amount = abs(round($config['num'], 2));
//金额正负值处理
if (in_array($this->allow_event[$this->event], array(2, 3))) {
$this->amount = '-' . abs($this->amount);
}
} else {
throw new IException("金额必须大于0元");
}
$this->config = $config;
$this->noteData = isset($config['note']) ? $config['note'] : $this->note();
//写入数据库
$finnalAmount = $this->user['balance'] + $this->amount;
if ($finnalAmount < 0) {
throw new IException("用户余额不足");
}
$memberDB = new IModel('member');
$memberDB->setData(array("balance" => $finnalAmount));
$memberDB->update("user_id = " . $this->user['id']);
$tb_account_log = new IModel("account_log");
$insertData = array('admin_id' => $this->admin ? $this->admin['id'] : 0, 'user_id' => $this->user['id'], 'event' => $this->allow_event[$this->event], 'note' => $this->noteData, 'amount' => $this->amount, 'amount_log' => $finnalAmount, 'type' => $this->amount >= 0 ? 0 : 1, 'time' => ITime::getDateTime());
$tb_account_log->setData($insertData);
$result = $tb_account_log->add();
//后台管理员操作记录
if ($insertData['admin_id']) {
$logObj = new log('db');
$logObj->write('operation', array("管理员:" . $this->admin['admin_name'], "对账户金额进行了修改", $insertData['note']));
}
return $result;
}
示例10: SendMail
/**
* @brief 发送到货通知邮件
*/
function notify_send()
{
$smtp = new SendMail();
$error = $smtp->getError();
if ($error) {
$return = array('isError' => true, 'message' => $error);
echo JSON::encode($return);
exit;
}
$notify_ids = IFilter::act(IReq::get('notifyid'));
$message = '';
if ($notify_ids && is_array($notify_ids)) {
$ids = join(',', $notify_ids);
$query = new IQuery("notify_registry as notify");
$query->join = "right join goods as goods on notify.goods_id=goods.id left join user as u on notify.user_id = u.id";
$query->fields = "notify.*,u.username,goods.name as goods_name,goods.store_nums";
$query->where = "notify.id in(" . $ids . ")";
$items = $query->find();
//库存大于0,且处于未发送状态的 发送通知
$succeed = 0;
$failed = 0;
$tb_notify_registry = new IModel('notify_registry');
foreach ($items as $value) {
$body = mailTemplate::notify(array('{goodsName}' => $value['goods_name'], '{url}' => IUrl::getHost() . IUrl::creatUrl('/site/products/id/' . $value['goods_id'])));
$status = $smtp->send($value['email'], "到货通知", $body);
if ($status) {
//发送成功
$succeed++;
$data = array('notify_time' => ITime::getDateTime(), 'notify_status' => '1');
$tb_notify_registry->setData($data);
$tb_notify_registry->update('id=' . $value['id']);
} else {
//发送失败
$failed++;
}
}
}
$return = array('isError' => false, 'count' => count($items), 'succeed' => $succeed, 'failed' => $failed);
echo JSON::encode($return);
}
示例11: intval
function keyword_order()
{
$word = IFilter::act(IReq::get('id'));
$order = IReq::get('order') ? intval(IReq::get('order')) : 99;
$keywordObj = new IModel('keyword');
$dataArray = array('order' => $order);
$keywordObj->setData($dataArray);
$is_success = $keywordObj->update('word = "' . $word . '"');
if ($is_success === false) {
$result = array('isError' => true, 'message' => '更新排序失败');
} else {
$result = array('isError' => false);
}
echo JSON::encode($result);
}
示例12: IModel
function refundment_update()
{
$id = IFilter::act(IReq::get('id'), 'int');
$pay_status = IFilter::act(IReq::get('pay_status'), 'int');
$dispose_idea = IFilter::act(IReq::get('dispose_idea'));
//商户处理退款
if ($id && Order_Class::isSellerRefund($id, $this->seller['seller_id']) == 2) {
$tb_refundment_doc = new IModel('refundment_doc');
$updateData = array('dispose_time' => ITime::getDateTime(), 'dispose_idea' => $dispose_idea, 'pay_status' => $pay_status);
$tb_refundment_doc->setData($updateData);
$tb_refundment_doc->update('id = ' . $id);
if ($pay_status == 2) {
$result = Order_Class::refund($id, $this->seller['seller_id'], 'seller');
if (!$result) {
die('退款失败');
}
}
}
$this->redirect('refundment_list');
}
示例13: mod_cat_position
public static function mod_cat_position($id, $position, $value)
{
$id = intval($id);
$value = intval($value) == 1 ? 1 : 0;
if ($position != 'left' && $position != 'foot') {
return array('flag' => false, 'data' => '错误的位置');
}
$tb_help_category = new IModel("help_category");
$tb_help_category->setData(array("position_{$position}" => $value));
$tb_help_category->update("id={$id}");
return array('flag' => true);
}
示例14: loginAfter
/**
* @brief 登录后的处理
* @param array $userRow 用户数组信息
*/
public static function loginAfter($userRow)
{
//用户私密数据
ISafe::set('user_id', $userRow['id']);
ISafe::set('username', $userRow['username']);
ISafe::set('head_ico', $userRow['head_ico']);
ISafe::set('user_pwd', $userRow['password']);
ISafe::set('last_login', isset($userRow['last_login']) ? $userRow['last_login'] : '');
//更新最后一次登录时间
$memberObj = new IModel('member');
$dataArray = array('last_login' => ITime::getDateTime());
$memberObj->setData($dataArray);
$where = 'user_id = ' . $userRow["id"];
$memberObj->update($where);
$memberRow = $memberObj->getObj($where, 'exp');
//根据经验值分会员组
$groupObj = new IModel('user_group');
$groupRow = $groupObj->getObj($memberRow['exp'] . ' between minexp and maxexp and minexp > 0 and maxexp > 0', 'id', 'discount', 'desc');
if (!empty($groupRow)) {
$dataArray = array('group_id' => $groupRow['id']);
$memberObj->setData($dataArray);
$memberObj->update('user_id = ' . $userRow["id"]);
}
}
示例15: expresswaybill_edit_act
public function expresswaybill_edit_act()
{
$id = intval(IReq::get('id'));
$printExpress = IReq::get('printExpress');
$name = IFilter::act(IReq::get('express_name'));
$width = intval(IReq::get('width'));
$height = intval(IReq::get('height'));
$background = IFilter::act(IReq::get('printBackground'));
$background = ltrim($background, IUrl::creatUrl(''));
if (!$printExpress) {
$printExpress = array();
}
if (!$name) {
die('快递单的名称不能为空');
}
$expressObj = new IModel('expresswaybill');
$data = array('config' => serialize($printExpress), 'name' => $name, 'width' => $width, 'height' => $height, 'background' => $background);
$expressObj->setData($data);
//修改模式
if ($id) {
$is_result = $expressObj->update('id = ' . $id);
} else {
$is_result = $expressObj->add();
}
echo $is_result === false ? '操作失败' : 'success';
}