本文整理汇总了PHP中truncate_table函数的典型用法代码示例。如果您正苦于以下问题:PHP truncate_table函数的具体用法?PHP truncate_table怎么用?PHP truncate_table使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了truncate_table函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process_order
/**
* 订单
*/
function process_order()
{
global $db, $ecs;
/* 清空订单、订单商品 */
truncate_table('order_info');
truncate_table('order_goods');
truncate_table('order_action');
/* 订单 */
$sql = "SELECT o.* FROM " . $this->sprefix . "orders AS o ";
$res = $this->sdb->query($sql);
while ($row = $this->sdb->fetchRow($res)) {
$order = array();
$order['order_sn'] = $row['order_id'];
$order['user_id'] = $row['member_id'];
$order['add_time'] = $row['createtime'];
$order['consignee'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['consignee']));
$order['address'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['ship_addr']));
$order['zipcode'] = $row['ship_zip'];
$order['tel'] = $row['ship_tel'];
$order['mobile'] = $row['ship_mobile'];
$order['email'] = $row['ship_email'];
$order['postscript'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['memo']));
$order['shipping_name'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['ship_name']));
$order['pay_name'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['shipping']));
$order['inv_payee'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['tax_company']));
$order['goods_amount'] = $row['total_amount'];
$order['shipping_fee'] = $row['cost_freight'];
$order['order_amount'] = $row['final_amount'];
$order['pay_time'] = $row['paytime'];
$order['shipping_time'] = $row['acttime'];
/* 状态 */
if ($row['ordstate'] == '0') {
$order['order_status'] = OS_UNCONFIRMED;
$order['shipping_status'] = SS_UNSHIPPED;
} elseif ($row['ordstate'] == '1') {
$order['order_status'] = OS_CONFIRMED;
$order['shipping_status'] = SS_UNSHIPPED;
} elseif ($row['ordstate'] == '9') {
$order['order_status'] = OS_INVALID;
$order['shipping_status'] = SS_UNSHIPPED;
} else {
$order['order_status'] = OS_CONFIRMED;
$order['shipping_status'] = SS_SHIPPED;
}
if ($row['pay_status'] == '1') {
$order['pay_status'] = PS_PAYED;
} else {
$order['pay_status'] = PS_UNPAYED;
}
if ($row['userrecsts'] == '1') {
if ($row['recsts'] == '1') {
if ($order['shipping_status'] == SS_SHIPPED) {
$order['shipping_status'] = SS_RECEIVED;
}
} elseif ($row['recsts'] == '2') {
$order['order_status'] = OS_CANCELED;
$order['pay_status'] = PS_UNPAYED;
$order['shipping_status'] = SS_UNSHIPPED;
}
}
if (!$db->autoExecute($ecs->table('order_info'), $order, 'INSERT', '', 'SILENT')) {
//return $db->error();
}
/* 订单商品 */
}
/* 返回 */
return TRUE;
}
示例2: process_order
/**
* 订单
*/
function process_order()
{
global $db, $ecs;
/* 清空订单、订单商品 */
truncate_table('order_info');
truncate_table('order_goods');
truncate_table('order_action');
/* 订单 */
$sql = "SELECT o.*, t.tmethod, p.payment FROM ".$this->sprefix."mall_orders AS o " .
"LEFT JOIN ".$this->sprefix."mall_offer_t AS t ON o.ttype = t.id " .
"LEFT JOIN ".$this->sprefix."mall_offer_p AS p ON o.ptype = p.id";
$res = $this->sdb->query($sql);
while ($row = $this->sdb->fetchRow($res))
{
$order = array();
$order['order_sn'] = $row['orderid'];
$order['user_id'] = $row['userid'];
$order['add_time'] = $row['ordertime'];
$order['consignee'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['name']));
$order['address'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['addr']));
$order['zipcode'] = $row['zip'];
$order['tel'] = $row['tel'];
$order['mobile'] = $row['mobile'];
$order['email'] = $row['email'];
$order['postscript'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['memo']));
$order['shipping_name'] = is_null($row['tmethod']) ? ' ' : ecs_iconv($this->scharset, $this->tcharset, addslashes($row['tmethod']));
$order['pay_name'] = is_null($row['payment']) ? ' ' : ecs_iconv($this->scharset, $this->tcharset, addslashes($row['payment']));
$order['inv_payee'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['invoiceform']));
$order['goods_amount'] = $row['item_amount'];
$order['shipping_fee'] = $row['freight'];
$order['order_amount'] = $row['total_amount'];
$order['pay_time'] = $row['paytime'];
$order['shipping_time'] = $row['sendtime'];
/* 状态 */
if ($row['ordstate'] == '0')
{
$order['order_status'] = OS_UNCONFIRMED;
$order['shipping_status'] = SS_UNSHIPPED;
}
elseif ($row['ordstate'] == '1')
{
$order['order_status'] = OS_CONFIRMED;
$order['shipping_status'] = SS_UNSHIPPED;
}
elseif ($row['ordstate'] == '9')
{
$order['order_status'] = OS_INVALID;
$order['shipping_status'] = SS_UNSHIPPED;
}
else // 3 发货 4 归档
{
$order['order_status'] = OS_CONFIRMED;
$order['shipping_status'] = SS_SHIPPED;
}
if ($row['ifsk'] == '1')
{
$order['pay_status'] = PS_PAYED;
}
else // 0 未付款 5 退款
{
$order['pay_status'] = PS_UNPAYED;
}
if ($row['userrecsts'] == '1') // 用户操作了
{
if ($row['recsts'] == '1') // 到货
{
if ($order['shipping_status'] == SS_SHIPPED)
{
$order['shipping_status'] = SS_RECEIVED;
}
}
elseif ($row['recsts'] == '2') // 取消
{
$order['order_status'] = OS_CANCELED;
$order['pay_status'] = PS_UNPAYED;
$order['shipping_status'] = SS_UNSHIPPED;
}
}
/* 如果已付款,修改已付款金额为订单总金额,修改订单总金额为0 */
if ($order['pay_status'] > PS_UNPAYED)
{
$order['money_paid'] = $order['order_amount'];
$order['order_amount'] = 0;
}
if (!$db->autoExecute($ecs->table('order_info'), $order, 'INSERT', '', 'SILENT'))
{
//return $db->error();
}
/* 订单商品 */
//.........这里部分代码省略.........