check_permissions($_SESSION['admin_purview'], "ord_show"); $smarty->assign('pageheader', "订单管理"); $smarty->assign('url', $_SERVER["HTTP_REFERER"]); $smarty->assign('payment', get_order_one($_GET['id'])); $smarty->display('company/admin_order_show.htm'); } elseif ($act == 'order_notes_save') { check_token(); $link[0]['text'] = "返回列表"; $link[0]['href'] = $_POST['url']; !$db->query("UPDATE " . table('order') . " SET notes='" . $_POST['notes'] . "' WHERE id='" . intval($_GET['id']) . "'") ? adminmsg('操作失败', 1) : adminmsg("操作成功!", 2, $link); } elseif ($act == 'order_set') { get_token(); check_permissions($_SESSION['admin_purview'], "ord_set"); $smarty->assign('pageheader', "订单管理"); $smarty->assign('url', $_SERVER["HTTP_REFERER"]); $smarty->assign('payment', get_order_one($_GET['id'])); $smarty->display('company/admin_order_set.htm'); } elseif ($act == 'order_set_save') { check_token(); check_permissions($_SESSION['admin_purview'], "ord_set"); if (order_paid(trim($_POST['oid']))) { $link[0]['text'] = "返回列表"; $link[0]['href'] = $_POST['url']; !$db->query("UPDATE " . table('order') . " SET notes='" . $_POST['notes'] . "' WHERE id=" . intval($_GET['id']) . " LIMIT 1 ") ? adminmsg('操作失败', 1) : adminmsg("操作成功!", 2, $link); } else { adminmsg('操作失败', 1); } } elseif ($act == 'order_del') { check_token(); check_permissions($_SESSION['admin_purview'], "ord_del"); $id = !empty($_REQUEST['id']) ? $_REQUEST['id'] : adminmsg("你没有选择项目!", 1);
</table>'); } } else { exit('<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tableall"> <tr> <td width="20" align="right"></td> <td style="text-align:center;"> 您的积分不足,请重新选择礼品兑换!<br> <a class="prevListIndex" href="shop_list.php">返回首页</a> </td> </tr> </table>'); } } elseif ($act == "order_show") { $id = intval($_GET['id']); $order_show = get_order_one($id); if (!empty($order_show)) { if ($order_show['state'] == 0) { $order_show['state_cn'] = "<span class=\"coff9125\">待审核</span>"; } elseif ($order_show['state'] == 1) { $order_show['state_cn'] = "<span class=\"co5dbc47\">审核通过</span>"; } else { $order_show['state_cn'] = "<span class=\"cofe4848\">审核未通过</span>"; } exit('<div class="order-d-wrap"> <div class="order-d-item clearfix"> <div class="od-type f-left">订单内容:</div> <div class="od-content f-left">' . $order_show['shop_title'] . ' * ' . $order_show['shop_num'] . '</div> </div> <div class="order-d-item clearfix"> <div class="od-type f-left">订单状态:</div>
header("location:?act=payment&order_id=" . $order_id); } else { showmsg("添加订单失败!", 0); } } elseif ($act == 'payment') { $setmeal = get_user_setmeal($_SESSION['uid']); if ($setmeal['endtime'] > 0) { $setmeal_endtime = sub_day($setmeal['endtime'], time()); } else { $setmeal_endtime = "无限期"; } $smarty->assign('user_setmeal', $setmeal); $smarty->assign('setmeal_endtime', $setmeal_endtime); $smarty->assign('payment', get_payment()); $order_id = intval($_GET['order_id']); $myorder = get_order_one($_SESSION['uid'], $order_id); $payment = get_payment_info($myorder['payment_name']); if (empty($payment)) { showmsg("支付方式错误!", 0); } $fee = number_format($amount / 100 * $payment['fee'], 1, '.', ''); //手续费 $order['oid'] = $myorder['oid']; //订单号 $order['v_url'] = $_CFG['site_domain'] . $_CFG['site_dir'] . "include/payment/respond_" . $payment['typename'] . ".php"; $order['v_amount'] = $myorder['amount'] + $fee; if ($myorder['payment_name'] != 'remittance' && $myorder['payment_name'] != 'weixinpay') { require_once QISHI_ROOT_PATH . "include/payment/" . $payment['typename'] . ".php"; $payment_form = get_code($order, $payment); if (empty($payment_form)) { showmsg("在线支付参数错误!", 0);
function set_order($id, $state) { global $db; $state = intval($state); if (!is_array($id)) { $id = array($id); } $return = 0; foreach ($id as $value) { $order_show = get_order_one($value); if ($order_show['state'] != 0) { continue; } $shop_one = get_shop_one($order_show['shop_id']); // 审核不通过 退回企业积分 if ($state == 2) { $exchange_arr['state'] = 2; $db->updatetable(table("shop_exchange"), $exchange_arr, array("order_id" => $order_show['id'], "shop_id" => $order_show['shop_id'], "company_uid" => $order_show['uid'])); report_deal($order_show['uid'], 1, $order_show['order_points']); //写入日志 $user_points = get_user_points($order_show['uid']); write_memberslog($order_show['uid'], 1, 9001, $order_show['company_name'], $order_show['company_name'] . "积分兑换商品:<strong>{$setarr['shop_title']}</strong>未通过审核,并且返回积分:({$order_show['order_points']})。", 1, 2008, "返回积分", "+{$order_show['order_points']}", "{$user_points}"); } else { $shop_stock = $shop_one['shop_stock'] - $order_show['shop_num']; $click = $shop_one['click'] + $order_show['shop_num']; $db->query("update " . table("shop_goods") . " set shop_stock={$shop_stock},click={$click} where id={$order_show['shop_id']}"); $exchange_arr['state'] = 1; $db->updatetable(table("shop_exchange"), $exchange_arr, array("order_id" => $order_show['id'], "shop_id" => $order_show['shop_id'], "company_uid" => $order_show['uid'])); } if ($db->query("update " . table("shop_order") . " set state={$state} where id={$value}")) { $return++; } } return $return; }