function callback($in, &$paymentId, &$money, &$message, &$tradeno) { //比对md5码 $pKey = $this->getConf($paymentId, 'PrivateKey'); $user_id = ISafe::get('user_id'); ksort($in); unset($in['controller']); unset($in['action']); unset($in['payment_name']); $temp = array(); foreach ($in as $k => $v) { if ($k != 'sign') { $temp[] = $k . '=' . urlencode($v); } } $testStr = join('&', $temp) . '&' . $user_id . $pKey; $tradeno = $in['order_no']; $money = $in['total_fee']; if ($in['sign'] == md5($testStr)) { //支付单号 switch ($in['is_success']) { case 'T': $log = new AccountLog(); $config = array('user_id' => ISafe::get('user_id'), 'event' => 'pay', 'note' => '通过余额支付方式进行商品购买', 'num' => '-' . $money, 'order_id' => $tradeno); $log->write($config); return PAY_SUCCESS; break; case 'F': return PAY_FAILED; break; } } else { IError::show(403, '校验码不正确'); } }
/** * @see paymentplugin::callback() */ public function callback($ExternalData, &$paymentId, &$money, &$message, &$orderNo) { $partnerKey = Payment::getConfigParam($paymentId, 'M_PartnerKey'); $user_id = ISafe::get('user_id'); ksort($ExternalData); $temp = array(); foreach ($ExternalData as $k => $v) { if ($k != 'sign') { $temp[] = $k . '=' . urlencode($v); } } $encryptKey = isset(IWeb::$app->config['encryptKey']) ? IWeb::$app->config['encryptKey'] : 'iwebshop'; $testStr = join('&', $temp) . '&' . $user_id . $partnerKey . $encryptKey; $orderNo = $ExternalData['order_no']; $money = $ExternalData['total_fee']; if ($ExternalData['sign'] == md5($testStr)) { //支付单号 switch ($ExternalData['is_success']) { case 'T': $log = new AccountLog(); $config = array('user_id' => $user_id, 'event' => 'pay', 'note' => '通过余额支付方式进行商品购买', 'num' => '-' . $money, 'order_id' => $orderNo); $log->write($config); return true; break; case 'F': return false; break; } } else { $message = '校验码不正确'; } return false; }
public function countGoodsFee() { $seller_id = $this->seller['seller_id']; $start_time = IFilter::act(IReq::get('start_time')); $end_time = IFilter::act(IReq::get('end_time')); $queryObject = CountSum::getSellerGoodsFeeQuery($seller_id, $start_time, $end_time, 0); $countData = CountSum::countSellerOrderFee($queryObject->find()); if ($countData['orderAmountPrice'] > 0) { $replaceData = array('{startTime}' => $start_time, '{endTime}' => $end_time, '{goodsNums}' => count($countData['order_goods_ids']), '{goodsSums}' => $countData['goodsSum'], '{deliveryPrice}' => $countData['deliveryPrice'], '{protectedPrice}' => $countData['insuredPrice'], '{taxPrice}' => $countData['taxPrice'], '{totalSum}' => $countData['orderAmountPrice']); $billString = AccountLog::sellerBillTemplate($replaceData); $result = array('result' => 'success', 'data' => $billString); } else { $result = array('result' => 'fail', 'data' => '当前没有任何款项可以结算'); } die(JSON::encode($result)); }
<div class="page_content" style="-webkit-transform: translate3d(0px, 0px, 0px);"> <?php $this->renderPartial('//wechat/common/usertop'); ?> <div class="col-lg-12" style="padding:10px 25px 0px 25px;min-height:350px;"> <table class="table table-striped table-hover text-left" style="background-color:#f0f0f0;"> <tr> <th>时间</th> <th>操作资金</th> <th>查看</th> </tr> <?php #获得用户资金记录 $accountlog = AccountLog::model()->findAll("user_id=:user_id order by id desc limit 10", array(":user_id" => Yii::app()->user->getId())); if ($accountlog) { foreach ($accountlog as $values) { ?> <tr> <td><?php echo date("Y.m.d H.i.s", $values->addtime); ?> </td> <td><?php echo $values->money; ?> </td> <td>详情</td> </tr> <?php }
function member_recharge() { $id = IReq::get('check'); $balance = IReq::get('balance'); $type = IReq::get('type'); $order_no = IFilter::act(IReq::get('order_no')); $even = ''; if (!$id) { echo JSON::encode(array('flag' => 'fail', 'message' => '请选择要操作的用户')); return; } if ($type == '3') { $balance = '-' . abs($balance); $even = 'withdraw'; } else { $balance = abs($balance); if ($type == '1') { $even = 'recharge'; } else { $even = 'drawback'; if (is_array($id) && count($id) > 1) { echo JSON::encode(array('flag' => 'fail', 'message' => '订单退款功能不能批量处理')); return; } if (is_array($id)) { $id = end($id); } $id = intval($id); //检测这个订单是不是这个用户的,且是否申请退款了 $obj = new IModel("order"); $row = $obj->query("user_id={$id} AND order_no = '{$order_no}' and (pay_status = 1 or pay_status = 3)"); if (!$row) { echo JSON::encode(array('flag' => 'fail', 'message' => '不存在这个订单或付款状态不正确')); return; } } } $obj = new IModel('member'); if (is_array($id) && isset($id[0]) && $id[0] != '') { $id_str = join(',', $id); //按用户id数组查询出用户余额,然后进行充值 $member_info = $obj->query('user_id in (' . $id_str . ')'); if (count($member_info) > 0) { foreach ($member_info as $value) { $balance_bak = $value['balance'] + $balance; if ($balance_bak >= 0) { $obj->setData(array('balance' => $balance_bak)); $obj->update('user_id = ' . $value['user_id']); //用户余额进行的操作记入account_log表 $log = new AccountLog(); $config = array('user_id' => $value['user_id'], 'admin_id' => $this->admin['admin_id'], 'event' => $even, 'num' => $balance, 'order_no' => $order_no); $re = $log->write($config); } } } } else { //按用户id数组查询出用户余额,然后进行充值 $member_info = $obj->query('user_id = ' . $id); if (count($member_info) > 0) { $balance_bak = $member_info[0]['balance'] + $balance; if ($balance_bak >= 0) { $obj->setData(array('balance' => $balance_bak)); $obj->update('user_id = ' . $id); //用户余额进行的操作记入account_log表 $log = new AccountLog(); $config = array('user_id' => $id, 'admin_id' => $this->admin['admin_id'], 'event' => $even, 'num' => $balance, 'order_no' => $order_no); $re = $log->write($config); } } } echo JSON::encode(array('flag' => 'success')); return; }
public static function updateRecharge($recharge_no) { $rechargeObj = new IModel('online_recharge'); $rechargeRow = $rechargeObj->getObj('recharge_no = "' . $recharge_no . '"'); if (empty($rechargeRow)) { return false; } if ($rechargeRow['status'] == 1) { return true; } $dataArray = array('status' => 1); $rechargeObj->setData($dataArray); $result = $rechargeObj->update('recharge_no = "' . $recharge_no . '"'); if ($result == '') { return false; } $money = $rechargeRow['account']; $user_id = $rechargeRow['user_id']; $log = new AccountLog(); $config = array('user_id' => $user_id, 'event' => 'recharge', 'note' => '用户[' . $user_id . ']在线充值', 'num' => $money); $re = $log->write($config); return $is_success; }
function withdraw_status() { $id = IFilter::act(IReq::get('id'), 'int'); $re_note = IFilter::act(IReq::get('re_note'), 'string'); $status = IFilter::act(IReq::get('status'), 'int'); if ($id) { $withdrawObj = new IModel('withdraw'); $dataArray = array('re_note' => $re_note, 'status' => $status); $withdrawObj->setData($dataArray); $where = "`id`= {$id} AND `status` = 0"; $re = $withdrawObj->update($where); if ($re) { $logObj = new log('db'); $logObj->write('operation', array("管理员:" . $this->admin['admin_name'], "修改了提现申请", "ID值为:" . $id)); //提现成功 if ($status == 2) { $withdrawRow = $withdrawObj->getObj('id = ' . $id); //用户余额进行的操作记入account_log表 $log = new AccountLog(); $config = array('user_id' => $withdrawRow['user_id'], 'admin_id' => $this->admin['admin_id'], 'event' => "withdraw", 'num' => $withdrawRow['amount']); $result = $log->write($config); is_string($result) ? die($result) : ""; } } $this->withdraw_detail(); Util::showMessage("更新成功"); } else { $this->redirect('withdraw_list'); } }
/** * 余额付款 * T:支付失败; * F:支付成功; */ function payment_balance() { $urlStr = ''; $user_id = intval($this->user['user_id']); $return['attach'] = IReq::get('attach'); $return['total_fee'] = IReq::get('total_fee'); $return['order_no'] = IReq::get('order_no'); $return['return_url'] = IReq::get('return_url'); $sign = IReq::get('sign'); if (stripos($return['order_no'], 'recharge') !== false) { IError::show(403, '余额支付方式不能用于在线充值'); exit; } if (floatval($return['total_fee']) <= 0 || $return['order_no'] == '' || $return['return_url'] == '') { IError::show(403, '支付参数不正确'); } else { $paymentDB = new IModel('payment'); $paymentRow = $paymentDB->getObj('class_name = "balance" '); $pkey = Payment::getConfigParam($paymentRow['id'], 'M_PartnerKey'); //md5校验 ksort($return); foreach ($return as $key => $val) { $urlStr .= $key . '=' . urlencode($val) . '&'; } $encryptKey = isset(IWeb::$app->config['encryptKey']) ? IWeb::$app->config['encryptKey'] : 'iwebshop'; $urlStr .= $user_id . $pkey . $encryptKey; if ($sign != md5($urlStr)) { IError::show(403, '数据校验不正确'); } else { $memberObj = new IModel('member'); $memberRow = $memberObj->getObj('user_id = ' . $user_id); if (empty($memberRow)) { IError::show(403, '用户信息不存在'); exit; } else { if ($memberRow['balance'] < $return['total_fee']) { IError::show(403, '账户余额不足'); exit; } else { $orderObj = new IModel('order'); $orderRow = $orderObj->getObj('order_no = "' . IFilter::act($return['order_no']) . '" and pay_status = 0 and user_id = ' . $user_id); if (empty($orderRow)) { IError::show(403, '订单已经被处理过,请查看订单状态'); exit; } //扣除余额并且记录日志 $logObj = new AccountLog(); $config = array('user_id' => $user_id, 'event' => 'pay', 'num' => $return['total_fee'], 'order_no' => $return['order_no']); $is_success = $logObj->write($config); if ($is_success) { $return['is_success'] = 'T'; } else { $return['is_success'] = 'F'; } ksort($return); //返还的URL地址 $responseUrl = ''; foreach ($return as $key => $val) { $responseUrl .= $key . '=' . urlencode($val) . '&'; } $nextUrl = urldecode($return['return_url']); if (stripos($nextUrl, '?') === false) { $return_url = $nextUrl . '?' . $responseUrl; } else { $return_url = $nextUrl . '&' . $responseUrl; } //计算要发送的md5校验 $encryptKey = isset(IWeb::$app->config['encryptKey']) ? IWeb::$app->config['encryptKey'] : 'iwebshop'; $urlStrMD5 = md5($responseUrl . $user_id . $pkey . $encryptKey); //拼接进返还的URL中 $return_url .= 'sign=' . $urlStrMD5; header('location:' . $return_url); } } } } }
/** * @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; }
/** * @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; }
<table class="table table-bordered table-striped"> <tr> <td>序号</td> <td>资金类型</td> <td>交易金额</td> <td>交易方</td> <td>备注</td> <td>交易时间<span class="pull-right"><a href="/member/index/log.html?tab=tab2">更多记录</a></span></td> </tr> <?php #获得最新的资金记录 $zijinlogs = AccountLog::model()->findAll(array('condition' => 'user_id=:user_id', 'order' => 'id desc', 'limit' => '8', 'params' => array(':user_id' => Yii::app()->user->getState("_user_id")))); if ($zijinlogs) { foreach ($zijinlogs as $onezijin) { ?> <tr> <td><?php echo $onezijin->id; ?> </td> <td><?php echo FileCacheInitSet::$_linkage['account_type'][$onezijin->type]; ?> </td> <td><?php echo $onezijin->money; ?> </td> <td><?php echo $onezijin->touser->username; ?>
function member_recharge() { $id = IFilter::act(IReq::get('check'), 'int'); $balance = IFilter::act(IReq::get('balance'), 'float'); $type = IFIlter::act(IReq::get('type')); //操作类型 recharge充值,withdraw提现金 $even = ''; if (!$id) { die(JSON::encode(array('flag' => 'fail', 'message' => '请选择要操作的用户'))); return; } switch ($type) { case "recharge": $balance = abs($balance); break; case "withdraw": $balance = '-' . abs($balance); break; default: die(JSON::encode(array('flag' => 'fail', 'message' => '无法识别操作内容'))); break; } //执行写入操作 $id = is_array($id) ? join(',', $id) : $id; $memberDB = new IModel('member'); $memberData = $memberDB->query('user_id in (' . $id . ')'); foreach ($memberData as $value) { $balanceUpdate = $value['balance'] + $balance; if ($balanceUpdate >= 0) { $memberDB->setData(array('balance' => $balanceUpdate)); $memberDB->update('user_id = ' . $value['user_id']); //用户余额进行的操作记入account_log表 $log = new AccountLog(); $config = array('user_id' => $value['user_id'], 'admin_id' => $this->admin['admin_id'], 'event' => $type, 'num' => $balance); $re = $log->write($config); } } die(JSON::encode(array('flag' => 'success'))); }
public function countGoodsFee() { $seller_id = $this->seller['seller_id']; $start_time = IFilter::act(IReq::get('start_time')); $end_time = IFilter::act(IReq::get('end_time')); $queryObject = CountSum::getSellerGoodsFeeQuery($seller_id, $start_time, $end_time, 0); $countData = CountSum::countSellerOrderFee($queryObject->find()); if ($countData['countFee'] > 0) { $countData['start_time'] = $start_time; $countData['end_time'] = $end_time; $billString = AccountLog::sellerBillTemplate($countData); $result = array('result' => 'success', 'data' => $billString); } else { $result = array('result' => 'fail', 'data' => '当前没有任何款项可以结算'); } die(JSON::encode($result)); }
/** * @brief 保存退款单页面 */ public function order_refundment_doc() { //获得post变量参数 $order_id = IFilter::act(IReq::get('id'), 'int'); $order_no = IFilter::act(IReq::get('order_no')); $user_id = IFilter::act(IReq::get('user_id'), 'int'); $amount = IFilter::act(IReq::get('amount'), 'float'); if (!$user_id) { echo '<script text="text/javascript">parent.actionFailCallback("游客无法退款");</script>'; exit; } $tb_refundment_doc = new IModel('refundment_doc'); $arr = array('order_id' => $order_id, 'order_no' => $order_no, 'user_id' => $user_id, 'amount' => $amount, 'if_del' => 0, 'admin_id' => $this->admin['admin_id']); $refundmentObj = $tb_refundment_doc->getObj('order_id = ' . $order_id); if ($refundmentObj) { $tb_refundment_doc->setData($arr); $tb_refundment_doc->update('order_id=' . $order_id); } else { $arr['time'] = date('Y-m-d H:i:s'); $arr['pay_status'] = '2'; $arr['dispose_time'] = date('Y-m-d H:i:s'); $arr['dispose_idea'] = '退款成功'; $tb_refundment_doc->setData($arr); $tb_refundment_doc->add(); } //更新发货状态 $tb_order = new IModel('order'); $tb_order->setData(array('pay_status' => 2)); $tb_order->update('id=' . $order_id); //生成订单日志 $tb_order_log = new IModel('order_log'); $tb_order_log->setData(array('order_id' => $order_id, 'user' => $this->admin['admin_name'], 'action' => '退款', 'result' => '成功', 'note' => '订单【' . $order_no . '】退款', 'addtime' => date('Y-m-d H:i:s'))); $tb_order_log->add(); //作废订单-还原红包 $prop = 'id = ' . $order_id . ' and pay_status =0 and prop is not null'; $order_info = $tb_order->query($prop); if (count($order_info) > 0) { $tb_prop = new IModel('prop'); foreach ($order_info as $value) { $tb_prop->setData(array('is_close' => 0)); if ($value['prop']) { $tb_prop->update('id=' . $value['prop']); } } } $logObj = new log('db'); $logObj->write('operation', array("管理员:" . ISafe::get('admin_name'), "订单更新为退款", '订单号:' . $arr['order_no'])); //进行用户的余额增加操作 $obj = new IModel('member'); $memberObj = $obj->getObj('user_id = ' . $user_id, 'balance'); $updateAmount = $memberObj['balance'] + $amount; $obj->setData(array('balance' => $updateAmount)); $isSuccess = $obj->update('user_id = ' . $user_id); if ($isSuccess) { //用户余额进行的操作记入account_log表 $log = new AccountLog(); $config = array('user_id' => $user_id, 'admin_id' => $this->admin['admin_id'], 'event' => 'drawback', 'num' => $amount, 'order_no' => $order_no); $re = $log->write($config); echo '<script text="text/javascript">parent.actionCallback();</script>'; } else { echo '<script text="text/javascript">parent.actionFailCallback();</script>'; } }