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


PHP Point::update方法代码示例

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


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

示例1: implode

 /**
  * @brief 移动会员,修改会员等级
  */
 function member_remove()
 {
     $user_ids = IFilter::act(IReq::get('check', 'post'), 'int');
     $group_id = IFilter::act(IReq::get('move_group', 'post'), 'int');
     $point = IFilter::act(IReq::get('move_point', 'post'), 'int');
     if ($user_ids && is_array($user_ids)) {
         $ids = implode(',', $user_ids);
         if ($ids) {
             $tb_member = new IModel('member');
             $updatearray = array();
             //积分改动
             if ($point) {
                 $pointObj = new Point();
                 $userList = $tb_member->query('user_id in(' . $ids . ')', 'user_id,point');
                 foreach ($userList as $val) {
                     $c_point = intval($point - $val['point']);
                     if ($c_point != 0) {
                         $tip = $c_point > 0 ? '奖励' : '扣除';
                         $pointConfig = array('user_id' => $val['user_id'], 'point' => $c_point, 'log' => '管理员' . $this->admin['admin_name'] . '修改了积分,' . $tip . $c_point . '积分');
                         $pointObj->update($pointConfig);
                     }
                 }
             }
             $updatearray['group_id'] = $group_id;
             $tb_member->setData($updatearray);
             $where = "user_id in (" . $ids . ")";
             $tb_member->update($where);
         }
     }
     $this->member_list();
 }
开发者ID:Wen1750686723,项目名称:utao,代码行数:34,代码来源:member.php

示例2: array

 function member_save()
 {
     $user_id = IFilter::act(IReq::get('user_id'), 'int');
     $user_name = IFilter::act(IReq::get('username'));
     $email = IFilter::act(IReq::get('email'));
     $password = IFilter::act(IReq::get('password'));
     $repassword = IFilter::act(IReq::get('repassword'));
     $group_id = IFilter::act(IReq::get('group_id'), 'int');
     $truename = IFilter::act(IReq::get('true_name'));
     $sex = IFilter::act(IReq::get('sex'), 'int');
     $telephone = IFilter::act(IReq::get('telephone'));
     $mobile = IFilter::act(IReq::get('mobile'));
     $province = IFilter::act(IReq::get('province'), 'int');
     $city = IFilter::act(IReq::get('city'), 'int');
     $area = IFilter::act(IReq::get('area'), 'int');
     $contact_addr = IFilter::act(IReq::get('contact_addr'));
     $zip = IFilter::act(IReq::get('zip'));
     $qq = IFilter::act(IReq::get('qq'));
     $msn = IFilter::act(IReq::get('msn'));
     $exp = IFilter::act(IReq::get('exp'), 'int');
     $point = IFilter::act(IReq::get('point'), 'int');
     $_POST['area'] = ',' . $province . ',' . $city . ',' . $area . ',';
     if (!$user_id && $password == '') {
         $errorMsg = '请输入密码!';
     }
     if ($password != $repassword) {
         $errorMsg = '两次输入的密码不一致!';
     }
     //操作失败表单回填
     if (isset($errorMsg)) {
         $this->userInfo = $_POST;
         $this->redirect('member_edit', false);
         Util::showMessage($errorMsg);
     }
     $member = array('true_name' => $truename, 'telephone' => $telephone, 'mobile' => $mobile, 'area' => $_POST['area'], 'contact_addr' => $contact_addr, 'qq' => $qq, 'msn' => $msn, 'sex' => $sex, 'zip' => $zip, 'exp' => $exp, 'point' => $point, 'group_id' => $group_id);
     //创建会员操作类
     $userDB = new IModel("user");
     $memberDB = new IModel("member");
     //添加新会员
     if (empty($user_id)) {
         $user = array('username' => $user_name, 'password' => md5($password), 'email' => $email);
         $userDB->setData($user);
         $user_id = $userDB->add();
         $member['user_id'] = $user_id;
         $member['time'] = date('Y-m-d H:i:s');
         $memberDB->setData($member);
         $memberDB->add();
     } else {
         //修改密码
         if ($password) {
             $userDB->setData(array('password' => md5($password)));
             $userDB->update('id = ' . $user_id);
         }
         $member_info = $memberDB->getObj('user_id=' . $user_id);
         //修改积分记录日志
         if ($point != $member_info['point']) {
             $ctrlType = $point > $member_info['point'] ? '增加' : '减少';
             $diffPoint = $point - $member_info['point'];
             $pointObj = new Point();
             $pointConfig = array('user_id' => $user_id, 'point' => $diffPoint, 'log' => '管理员' . $this->admin['admin_name'] . '将积分' . $ctrlType . $diffPoint . '积分');
             $pointObj->update($pointConfig);
         }
         $memberDB->setData($member);
         $memberDB->update("user_id = " . $user_id);
     }
     $this->redirect('member_list');
 }
开发者ID:zhendeguoke1008,项目名称:shop,代码行数:67,代码来源:member.php

示例3: updateOrderStatus

 /**
  * 支付成功后修改订单状态
  * @param $orderNo  string 订单编号
  * @param $admin_id int    管理员ID
  * @param $note     string 收款的备注
  * @return false or int order_id
  */
 public static function updateOrderStatus($orderNo, $admin_id = '', $note = '')
 {
     //获取订单信息
     $orderObj = new IModel('order');
     $orderRow = $orderObj->getObj('order_no = "' . $orderNo . '"');
     if (empty($orderRow)) {
         return false;
     }
     if ($orderRow['pay_status'] == 1) {
         return $orderRow['id'];
     } else {
         if ($orderRow['pay_status'] == 0) {
             $dataArray = array('status' => 2, 'pay_time' => ITime::getDateTime(), 'pay_status' => 1);
             $orderObj->setData($dataArray);
             $is_success = $orderObj->update('order_no = "' . $orderNo . '"');
             if ($is_success == '') {
                 return false;
             }
             //删除订单中使用的道具
             $ticket_id = trim($orderRow['prop']);
             if ($ticket_id != '') {
                 $propObj = new IModel('prop');
                 $propData = array('is_userd' => 1);
                 $propObj->setData($propData);
                 $propObj->update('id = ' . $ticket_id);
             }
             if (intval($orderRow['user_id']) != 0) {
                 $user_id = $orderRow['user_id'];
                 //获取用户信息
                 $memberObj = new IModel('member');
                 $memberRow = $memberObj->getObj('user_id = ' . $user_id, 'prop,group_id');
                 //(1)删除订单中使用的道具
                 if ($ticket_id != '') {
                     $finnalTicket = str_replace(',' . $ticket_id . ',', ',', ',' . trim($memberRow['prop'], ',') . ',');
                     $memberData = array('prop' => $finnalTicket);
                     $memberObj->setData($memberData);
                     $memberObj->update('user_id = ' . $user_id);
                 }
                 if ($memberRow) {
                     //(2)进行促销活动奖励
                     $proObj = new ProRule($orderRow['real_amount']);
                     $proObj->setUserGroup($memberRow['group_id']);
                     $proObj->setAward($user_id);
                     //(3)增加经验值
                     $memberData = array('exp' => 'exp + ' . $orderRow['exp']);
                     $memberObj->setData($memberData);
                     $memberObj->update('user_id = ' . $user_id, 'exp');
                     //(4)增加积分
                     $pointConfig = array('user_id' => $user_id, 'point' => $orderRow['point'], 'log' => '成功购买了订单号:' . $orderRow['order_no'] . '中的商品,奖励积分' . $orderRow['point']);
                     $pointObj = new Point();
                     $pointObj->update($pointConfig);
                 }
             }
             //插入收款单
             $collectionDocObj = new IModel('collection_doc');
             $collectionData = array('order_id' => $orderRow['id'], 'user_id' => $orderRow['user_id'], 'amount' => $orderRow['order_amount'], 'time' => ITime::getDateTime(), 'payment_id' => $orderRow['pay_type'], 'pay_status' => 1, 'if_del' => 0, 'note' => $note, 'admin_id' => $admin_id ? $admin_id : 0);
             $collectionDocObj->setData($collectionData);
             $collectionDocObj->add();
             /*同步数据*/
             //同步团购的数据
             if ($orderRow['type'] == 1) {
                 $regimentUserObj = new IModel('regiment_user_relation');
                 $regimentUserObj->setData(array('is_over' => 1));
                 $regimentUserObj->update("order_no = '" . $orderRow['order_no'] . "'");
             }
             //更改购买商品的库存数量
             self::updateStore($orderRow['id'], 'reduce');
             return $orderRow['id'];
         } else {
             return false;
         }
     }
 }
开发者ID:zhendeguoke1008,项目名称:shop,代码行数:80,代码来源:order_class.php

示例4: IModel

 function trade_ticket()
 {
     $ticketId = IFilter::act(IReq::get('ticket_id', 'post'), 'int');
     $message = '';
     if (intval($ticketId) == 0) {
         $message = '请选择要兑换的代金券';
     } else {
         $nowTime = ITime::getDateTime();
         $ticketObj = new IModel('ticket');
         $ticketRow = $ticketObj->getObj('id = ' . $ticketId . ' and point > 0 and start_time <= "' . $nowTime . '" and end_time > "' . $nowTime . '"');
         if (empty($ticketRow)) {
             $message = '对不起,此代金券不能兑换';
         } else {
             $memberObj = new IModel('member');
             $where = 'user_id = ' . $this->user['user_id'];
             $memberRow = $memberObj->getObj($where, 'point');
             if ($ticketRow['point'] > $memberRow['point']) {
                 $message = '对不起,您的积分不足,不能兑换此类代金券';
             } else {
                 //生成红包
                 $dataArray = array('condition' => $ticketRow['id'], 'name' => $ticketRow['name'], 'card_name' => 'T' . IHash::random(8), 'card_pwd' => IHash::random(8), 'value' => $ticketRow['value'], 'start_time' => $ticketRow['start_time'], 'end_time' => $ticketRow['end_time'], 'is_send' => 1);
                 $propObj = new IModel('prop');
                 $propObj->setData($dataArray);
                 $insert_id = $propObj->add();
                 //用户prop字段值null时
                 $memberArray = array('prop' => ',' . $insert_id . ',');
                 $memberObj->setData($memberArray);
                 $result = $memberObj->update('user_id = ' . $this->user["user_id"] . ' and ( prop is NULL or prop = "" )');
                 //用户prop字段值非null时
                 if (!$result) {
                     $memberArray = array('prop' => 'concat(prop,"' . $insert_id . ',")');
                     $memberObj->setData($memberArray);
                     $result = $memberObj->update('user_id = ' . $this->user["user_id"], 'prop');
                 }
                 //代金券成功
                 if ($result) {
                     $pointConfig = array('user_id' => $this->user['user_id'], 'point' => '-' . $ticketRow['point'], 'log' => '积分兑换代金券,扣除了 -' . $ticketRow['point'] . '积分');
                     $pointObj = new Point();
                     $pointObj->update($pointConfig);
                 }
             }
         }
     }
     //展示
     if ($message != '') {
         $this->integral();
         Util::showMessage($message);
     } else {
         $this->redirect('redpacket');
     }
 }
开发者ID:yongge666,项目名称:sunupedu,代码行数:51,代码来源:ucenter.php

示例5: refund

 /**
  * @brief 订单退款操作
  * @param int $refundId 退款单ID
  * @param int $authorId 操作人ID
  * @param string $type admin:管理员;seller:商家
  * @param int $isNotBalance 是否充值到余额, 0:退款余额; 1:不退款到余额
  * @return
  */
 public static function refund($refundId, $authorId, $type = 'admin', $isNotBalance = 0)
 {
     $orderGoodsDB = new IModel('order_goods');
     $refundDB = new IModel('refundment_doc');
     //获取goods_id和product_id用于给用户减积分,经验
     $refundsRow = $refundDB->getObj('id = ' . $refundId);
     $order_id = $refundsRow['order_id'];
     $order_no = $refundsRow['order_no'];
     $user_id = $refundsRow['user_id'];
     $orderGoodsRow = $orderGoodsDB->getObj('order_id = ' . $order_id . ' and goods_id = ' . $refundsRow['goods_id'] . ' and product_id = ' . $refundsRow['product_id'] . ' and is_send != 2');
     if (!$orderGoodsRow) {
         return false;
     }
     $order_goods_id = $orderGoodsRow['id'];
     //如果管理员(商家)自定义了退款金额。否则就使用默认的付款商品金额
     $amount = $refundsRow['amount'] > 0 ? $refundsRow['amount'] : $orderGoodsRow['goods_nums'] * $orderGoodsRow['real_price'];
     //库存增加
     self::updateStore($order_goods_id, 'add');
     //更新退款状态
     $orderGoodsDB->setData(array('is_send' => 2));
     $orderGoodsDB->update('id = ' . $order_goods_id);
     //更新order表状态
     $isSendData = $orderGoodsDB->getObj('order_id = ' . $order_id . ' and is_send != 2');
     $orderStatus = 6;
     //全部退款
     if ($isSendData) {
         $orderStatus = 7;
         //部分退款
     }
     $tb_order = new IModel('order');
     $tb_order->setData(array('status' => $orderStatus));
     $tb_order->update('id=' . $order_id);
     /**
      * 进行用户的余额增加操作,积分,经验的减少操作,
      * 1,当全部退款时候,减少订单中记录的积分和经验;且如果没有发货的商品直接退回订单中的运费,报价,税金等
      * 2,当部分退款时候,查询商品表中积分和经验
      */
     if ($orderStatus == 6) {
         Order_class::resetOrderProp($order_id);
         $orderRow = $tb_order->getObj('id = ' . $order_id);
         //是否返还运费,报价,税金
         $isDeliveryData = $orderGoodsDB->getObj('order_id = ' . $order_id . ' and delivery_id > 0');
         if (!$isDeliveryData) {
             $amount += $orderRow['real_freight'] + $orderRow['insured'] + $orderRow['taxes'];
         }
     }
     //退款积分,经验
     $goodsDB = new IModel('goods');
     $goodsRow = $goodsDB->getObj('id = ' . $orderGoodsRow['goods_id']);
     $orderRow = array('exp' => $goodsRow['exp'] * $orderGoodsRow['goods_nums'], 'point' => $goodsRow['point'] * $orderGoodsRow['goods_nums'], 'order_no' => $order_no);
     //更新退款表
     $updateData = array('amount' => $amount, 'pay_status' => 2, 'dispose_time' => ITime::getDateTime());
     $refundDB->setData($updateData);
     $refundDB->update('id = ' . $refundId);
     //更新用户的信息
     $obj = new IModel('member');
     $memberObj = $obj->getObj('user_id = ' . $user_id, 'exp,point');
     $exp = $memberObj['exp'] - $orderRow['exp'];
     $obj->setData(array('exp' => $exp <= 0 ? 0 : $exp));
     $obj->update('user_id = ' . $user_id);
     //积分记录日志
     $pointConfig = array('user_id' => $user_id, 'point' => '-' . $orderRow['point'], 'log' => '退款订单号:' . $orderRow['order_no'] . '中的商品,减掉积分 -' . $orderRow['point']);
     $pointObj = new Point();
     $pointObj->update($pointConfig);
     //用户余额进行的操作记入account_log表
     $log = new AccountLog();
     $config = array('user_id' => $user_id, 'event' => 'drawback', 'num' => $amount, 'order_no' => $order_no);
     if ($type == 'admin') {
         $config['admin_id'] = $authorId;
         $adminObj = new IModel('admin');
         $adminRow = $adminObj->getObj('id = ' . $authorId);
         $authorName = $adminRow['admin_name'];
     } else {
         if ($type == 'seller') {
             $config['seller_id'] = $authorId;
             $sellerObj = new IModel('seller');
             $sellerRow = $sellerObj->getObj('id = ' . $authorId);
             $authorName = $sellerRow['seller_name'];
         }
     }
     //生成订单日志
     $tb_order_log = new IModel('order_log');
     $tb_order_log->setData(array('order_id' => $order_id, 'user' => $authorName, 'action' => '退款', 'result' => '成功', 'note' => '订单【' . $order_no . '】退款,退款金额:¥' . $amount, 'addtime' => ITime::getDateTime()));
     $tb_order_log->add();
     return $isNotBalance == 0 ? $log->write($config) : true;
 }
开发者ID:herrify,项目名称:iwebshop,代码行数:94,代码来源:order_class.php

示例6: giftAction

 /**
  * @brief 赠品促销规则奖励操作
  * @param array 赠品促销规则奖励信息
  */
 private function giftAction($giftArray, $user_id)
 {
     foreach ($giftArray as $key => $val) {
         $award_type = $val['award_type'];
         $award_value = $val['award_value'];
         switch ($award_type) {
             //积分
             case "3":
                 $pointConfig = array('user_id' => $user_id, 'point' => $award_value, 'log' => '促销奖励,消费满' . $this->sum . '元,奖励' . $award_value . '积分');
                 $pointObj = new Point();
                 $pointObj->update($pointConfig);
                 break;
                 //代金券
             //代金券
             case "4":
                 /*(1)修改prop表*/
                 $ticketObj = new IModel('ticket');
                 $where = 'id = ' . $award_value;
                 $ticketRow = $ticketObj->getObj($where);
                 //奖励的红包没有过期
                 $time = ITime::getDateTime();
                 if ($time > $ticketRow['start_time'] && $time < $ticketRow['end_time']) {
                     $dataArray = array('condition' => $award_value, 'name' => $ticketRow['name'], 'card_name' => 'T' . IHash::random(8), 'card_pwd' => IHash::random(8), 'value' => $ticketRow['value'], 'start_time' => $ticketRow['start_time'], 'end_time' => $ticketRow['end_time'], 'is_send' => 1);
                     $propObj = new IModel('prop');
                     $propObj->setData($dataArray);
                     $insert_id = $propObj->add();
                     /*(2)修改member表*/
                     $memberObj = new IModel('member');
                     //用户prop字段值null时
                     $memberArray = array('prop' => ',' . $insert_id . ',');
                     $memberObj->setData($memberArray);
                     $result = $memberObj->update('user_id = ' . $user_id . ' and ( prop is NULL or prop = "" )');
                     //用户prop字段值非null时
                     if (!$result) {
                         $memberArray = array('prop' => 'concat(prop,"' . $insert_id . ',")');
                         $memberObj->setData($memberArray);
                         $memberObj->update('user_id = ' . $user_id, 'prop');
                     }
                 }
                 break;
                 //赠送经验
             //赠送经验
             case "5":
                 $memberObj = new IModel('member');
                 $memberArray = array('exp' => 'exp' + $award_value);
                 $memberObj->setData($memberArray);
                 $memberObj->update('user_id = ' . $user_id, 'exp');
                 break;
         }
     }
 }
开发者ID:chenyongze,项目名称:iwebshop,代码行数:55,代码来源:prorule.php

示例7: refund

 /**
  * @brief 订单退款操作
  * @param int $refundId 退款单ID
  * @param int $authorId 操作人ID
  * @param string $type admin:管理员;seller:商家
  * @return
  */
 public static function refund($refundId, $authorId, $type = 'admin')
 {
     $orderGoodsDB = new IModel('order_goods');
     $refundDB = new IModel('refundment_doc');
     //更新退款表
     $updateData = array('pay_status' => 2, 'dispose_time' => ITime::getDateTime());
     $refundDB->setData($updateData);
     $refundDB->update('id = ' . $refundId);
     //获取goods_id和product_id用于给用户减积分,经验
     $refundsRow = $refundDB->getObj('id = ' . $refundId);
     $order_id = $refundsRow['order_id'];
     $order_no = $refundsRow['order_no'];
     $amount = $refundsRow['amount'];
     $user_id = $refundsRow['user_id'];
     $orderGoodsRow = $orderGoodsDB->getObj('order_id = ' . $order_id . ' and goods_id = ' . $refundsRow['goods_id'] . ' and product_id = ' . $refundsRow['product_id']);
     $order_goods_id = $orderGoodsRow['id'];
     //更新退款状态
     $orderGoodsDB->setData(array('is_send' => 2));
     $orderGoodsDB->update('id = ' . $order_goods_id);
     //更新order表状态
     $isSendData = $orderGoodsDB->getObj('order_id = ' . $order_id . ' and is_send != 2');
     $orderStatus = 6;
     //全部退款
     if ($isSendData) {
         $orderStatus = 7;
         //部分退款
     }
     $tb_order = new IModel('order');
     $tb_order->setData(array('status' => $orderStatus));
     $tb_order->update('id=' . $order_id);
     if ($orderStatus == 6) {
         Order_class::resetOrderProp($order_id);
     }
     //生成订单日志
     $authorName = $type == 'admin' ? ISafe::get('admin_name') : ISafe::get('seller_name');
     $tb_order_log = new IModel('order_log');
     $tb_order_log->setData(array('order_id' => $order_id, 'user' => $authorName, 'action' => '退款', 'result' => '成功', 'note' => '订单【' . $order_no . '】退款,退款金额:¥' . $amount, 'addtime' => ITime::getDateTime()));
     $tb_order_log->add();
     /**
      * 进行用户的余额增加操作,积分,经验的减少操作,
      * 1,当全部退款时候,减少订单中记录的积分和经验;
      * 2,当部分退款时候,查询商品表中积分和经验
      */
     if ($orderStatus == 6) {
         $orderRow = $tb_order->getObj('id = ' . $order_id);
     } else {
         $goodsDB = new IModel('goods');
         $goodsRow = $goodsDB->getObj('id = ' . $orderGoodsRow['goods_id']);
         $orderRow = array('exp' => $goodsRow['exp'], 'point' => $goodsRow['point'], 'order_no' => $order_no);
     }
     $obj = new IModel('member');
     $memberObj = $obj->getObj('user_id = ' . $user_id, 'balance,exp,point');
     $exp = $memberObj['exp'] - $orderRow['exp'];
     $balance = $memberObj['balance'] + $amount;
     $obj->setData(array('balance' => $balance, 'exp' => $exp <= 0 ? 0 : $exp));
     $isSuccess = $obj->update('user_id = ' . $user_id);
     //积分记录日志
     $pointConfig = array('user_id' => $user_id, 'point' => '-' . $orderRow['point'], 'log' => '退款订单号:' . $orderRow['order_no'] . '中的商品,减掉积分 -' . $orderRow['point']);
     $pointObj = new Point();
     $pointObj->update($pointConfig);
     if ($isSuccess) {
         //用户余额进行的操作记入account_log表
         $log = new AccountLog();
         $config = array('user_id' => $user_id, 'event' => 'drawback', 'num' => $amount, 'order_no' => $order_no);
         if ($type == 'admin') {
             $config['admin_id'] = $authorId;
         } else {
             if ($type == 'seller') {
                 $config['seller_id'] = $authorId;
             }
         }
         $re = $log->write($config);
         return true;
     }
     return false;
 }
开发者ID:yongge666,项目名称:sunupedu,代码行数:83,代码来源:order_class.php


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