本文整理汇总了PHP中gmstr2time函数的典型用法代码示例。如果您正苦于以下问题:PHP gmstr2time函数的具体用法?PHP gmstr2time怎么用?PHP gmstr2time使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了gmstr2time函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: gmstr2time_end
/**
* 从字符串获取指定日期的结束时间(24:00)
*
* @author Garbin
* @param string $str
* @return int
*/
function gmstr2time_end($str)
{
return gmstr2time($str) + 86400;
}
示例2: edit
function edit()
{
$coupon_id = isset($_GET['id']) ? intval($_GET['id']) : 0;
if (empty($coupon_id)) {
echo Lang::get("no_coupon");
}
if (!IS_POST) {
header("Content-Type:text/html;charset=" . CHARSET);
$coupon = $this->_coupon_mod->get_info($coupon_id);
$this->assign('coupon', $coupon);
$this->display('coupon.form.html');
} else {
$coupon_value = floatval(trim($_POST['coupon_value']));
$use_times = intval(trim($_POST['use_times']));
$min_amount = floatval(trim($_POST['min_amount']));
if (empty($coupon_value) || $coupon_value < 0) {
$this->pop_warning('coupon_value_not');
exit;
}
if (empty($use_times)) {
$this->pop_warning('use_times_not_zero');
exit;
}
if ($min_amount < 0) {
$this->pop_warning("min_amount_gt_zero");
exit;
}
$start_time = gmstr2time(trim($_POST['start_time']));
$end_time = gmstr2time_end(trim($_POST['end_time'])) - 1;
//echo gmstr2time_end(trim($_POST['end_time'])) . '-------' .$end_time;exit;
if ($end_time < $start_time) {
$this->pop_warning('end_gt_start');
exit;
}
$coupon = array('coupon_name' => trim($_POST['coupon_name']), 'coupon_value' => $coupon_value, 'store_id' => $this->_store_id, 'use_times' => $use_times, 'start_time' => $start_time, 'end_time' => $end_time, 'min_amount' => $min_amount, 'if_issue' => trim($_POST['if_issue']) == 1 ? 1 : 0);
$this->_coupon_mod->edit($coupon_id, $coupon);
if ($this->_coupon_mod->has_error()) {
$this->pop_warning($this->_coupon_mod->get_error());
exit;
}
$this->pop_warning('ok', 'coupon_edit');
}
}
示例3: process_goods
/**
* 商品
* @return 成功返回true,失败返回错误信息
*/
function process_goods()
{
global $db, $ecs;
/* 清空商品、商品扩展分类、商品属性、商品相册、关联商品、组合商品、赠品 */
truncate_table('goods');
truncate_table('goods_cat');
truncate_table('goods_attr');
truncate_table('goods_gallery');
truncate_table('link_goods');
truncate_table('group_goods');
/* 查询品牌列表 name => id */
$brand_list = array();
$sql = "SELECT brand_id, brand_name FROM " . $ecs->table('brand');
$res = $db->query($sql);
while ($row = $db->fetchRow($res))
{
$brand_list[$row['brand_name']] = $row['brand_id'];
}
/* 取得商店设置 */
$sql = "SELECT offer_pointtype, offer_pointnum FROM ".$this->sprefix."mall_offer WHERE offerid = '1'";
$config = $this->sdb->getRow($sql);
/* 取得商品分类对应的商品类型 */
$cat_type_list = array();
$sql = "SELECT catid, prop_cat_id FROM ".$this->sprefix."mall_offer_pcat";
$res = $this->sdb->query($sql);
while ($row = $this->sdb->fetchRow($res))
{
$cat_type_list[$row['catid']] = $row['prop_cat_id'];
}
/* 查询商品并处理 */
$sql = "SELECT * FROM ".$this->sprefix."mall_goods";
$res = $this->sdb->query($sql);
while ($row = $this->sdb->fetchRow($res))
{
$goods = array();
if ($row['ifobject'] == '0')
{
/* 虚拟商品 */
$goods['is_real'] = '0';
}
elseif ($row['ifobject'] == '1')
{
/* 实体商品 */
$goods['is_real'] = '1';
}
elseif ($row['ifobject'] == '2')
{
/* 数字文件,暂时无法转换 */
continue;
}
elseif ($row['ifobject'] == '3')
{
/* 捆绑销售,暂时无法转换 */
continue;
}
else
{
/* 未知,无法转换 */
continue;
}
$goods['goods_id'] = $row['gid'];
$goods['cat_id'] = $row['catid'];
$goods['goods_sn'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['bn']));
$goods['goods_name'] = $row['goods'];
$goods['brand_id'] = trim($row['brand']) == '' ? '0' : $brand_list[ecs_iconv($this->scharset, $this->tcharset, addslashes($row['brand']))];
$goods['goods_number'] = $row['storage'];
$goods['goods_weight'] = $row['weight'];
$goods['market_price'] = $row['priceintro'];
$goods['shop_price'] = $row['ifdiscreteness'] == '1' ? $row['basicprice'] : $row['price'];
if ($row['tejia2'] == '1')
{
$goods['promote_price'] = $goods['shop_price'];
$goods['promote_start_date'] = gmtime();
$goods['promote_end_date'] = gmstr2time('+1 weeks');
}
$goods['warn_number'] = $row['ifalarm'] == '1' ? $row['alarmnum'] : '0';
$goods['goods_brief'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['intro']));
$goods['goods_desc'] = str_replace('pictures/newsimg/', $this->tdocroot . '/images/upload/Image/', ecs_iconv($this->scharset, $this->tcharset, addslashes($row['memo'])));
$goods['is_on_sale'] = $row['shop_iffb'];
$goods['is_alone_sale'] = $row['onsale'];
$goods['add_time'] = $row['uptime'];
$goods['sort_order'] = $row['offer_ord'];
$goods['is_delete'] = '0';
$goods['is_best'] = $row['recommand2'];
$goods['is_new'] = $row['new2'];
$goods['is_hot'] = $row['hot2'];
$goods['is_promote'] = $row['tejia2'];
$goods['goods_type'] = isset($cat_type_list[$row['catid']]) ? $cat_type_list[$row['catid']] : 0;
$goods['last_update'] = gmtime();
//.........这里部分代码省略.........
示例4: stripslashes
$result['goods_id'] = stripslashes($goods->goods_id);
if (is_array($goods->spec)) {
$result['product_spec'] = implode(',', $goods->spec);
} else {
$result['product_spec'] = $goods->spec;
}
}
}
$result['confirm_type'] = !empty($_CFG['cart_confirm']) ? $_CFG['cart_confirm'] : 2;
die($json->encode($result));
} elseif ($_REQUEST['step'] == 'checksendtime') {
include_once 'includes/cls_json.php';
$sendtime = $_REQUEST['sendtime'];
$result = array('error' => 0);
$json = new JSON();
if ((int) local_date("H") >= 12 && local_date('Y-m-d', gmstr2time("1 day")) == $sendtime) {
$result['error'] = 1;
}
die($json->encode($result));
} elseif ($_REQUEST['step'] == 'link_buy') {
$goods_id = intval($_GET['goods_id']);
if (!cart_goods_exists($goods_id, array())) {
addto_cart($goods_id);
}
ecs_header("Location:./flow.php\n");
exit;
} elseif ($_REQUEST['step'] == 'login') {
include_once 'languages/' . $_CFG['lang'] . '/user.php';
/*
* 用户登录注册
*/
示例5: _parse_taobao_csv
function _parse_taobao_csv($csv_string)
{
$records = explode("\n", trim($csv_string, "\n"));
array_shift($records);
// 去掉标题
foreach ($records as $key => $record) {
// dump($records);
$record = explode("\t", trim($record, "\t"));
// 按制表符构建每一行数据
foreach ($record as $k => $col) {
$col = trim($col);
// 去掉数据两端的空格
$col = trim($col, "\\\"");
// 去掉数据两端的\"
$col = trim($col, "\"");
// 去掉数据两端的"
/* 对字段数据进行分别处理 */
switch ($k) {
case FIELD_ADD_TIME:
$record[$k] = $col == '1980-01-01 00:00:00' || $col == '' ? gmtime() : gmstr2time($col);
break;
case FIELD_LAST_UPDATE:
$record[$k] = $col == '1980-01-01 00:00:00' || $col == '' ? $record[FIELD_ADD_TIME] : gmstr2time($col);
break;
case FIELD_DESCRIPTION:
$record[$k] = str_replace(array("\\\"\\\"", "\"\""), array("\\\"", "\""), $col);
break;
case FIELD_GOODS_IMAGE:
$record[$k] = substr($col, 0, strpos($col, ':'));
break;
case FIELD_IF_SHOW:
$record[$k] = $col == 1 ? 0 : 1;
break;
case FIELD_GOODS_NAME:
$record[$k] = $col;
break;
case FIELD_STOCK:
$record[$k] = $col;
break;
case FIELD_PRICE:
$record[$k] = $col;
break;
case FIELD_RECOMMENDED:
$record[$k] = $col;
break;
case FIELD_GOODS_ATTR:
$record[$k] = $col;
break;
case FIELD_SALE_ATTR:
$record[$k] = $col;
break;
case FIELD_CID:
$record[$k] = $col;
break;
default:
unset($record[$k]);
}
}
$records[$key] = $record;
}
return $records;
}
示例6: edit
function edit()
{
$coupon_id = isset($_GET['id']) ? intval($_GET['id']) : 0;
$current_coupon = $this->_coupon_mod->get_info($coupon_id);
if (empty($coupon_id)) {
echo Lang::get("no_coupon");
}
if (!IS_POST) {
$this->import_resource(array('script' => array(array('path' => 'jquery.ui/jquery.ui.js', 'attr' => ''), array('path' => 'jquery.ui/i18n/' . i18n_code() . '.js', 'attr' => ''), array('path' => 'jquery.plugins/jquery.validate.js', 'attr' => '')), 'style' => 'jquery.ui/themes/ui-lightness/jquery.ui.css'));
header("Content-Type:text/html;charset=" . CHARSET);
$gcategory_mod =& bm('gcategory', array('store_id' => 0));
$this->assign('scategories', $this->_get_scategories());
$this->assign('sgrades', $this->_get_sgrade());
$this->assign('gcategories', $gcategory_mod->get_options(0));
$current_coupon['selected'] = array();
$current_coupon['selected'][$current_coupon['type']] = $current_coupon['type_content'];
if ($current_coupon['coupon_image']) {
$current_coupon['coupon_image'] = dirname(site_url()) . "/" . $current_coupon['coupon_image'];
}
$store_mod =& m('store');
$store = $store_mod->find(array('conditions' => 'state=1', 'fields' => 'store_name,store_id'));
if ($current_coupon['type'] == 4) {
$type_content = unserialize($current_coupon['type_content']);
if (!empty($type_content)) {
foreach ($type_content as $key => $val) {
$store[$val]['selected'] = 1;
}
}
}
$this->assign('build_editor', $this->_build_editor(array('name' => 'tip', 'content_css' => SITE_URL . "/themes/mall/{$template_name}/styles/{$style_name}/css/ecmall.css")));
$this->assign('build_upload', $this->_build_upload(array('belong' => BELONG_ARTICLE, 'item_id' => 0)));
// 构建swfupload上传组件
$this->assign('store', $store);
$this->assign('coupon', $current_coupon);
$this->display('coupon.form.html');
} else {
if (!$current_coupon['if_issue']) {
$coupon_value = floatval(trim($_POST['coupon_value']));
$use_times = intval(trim($_POST['use_times']));
$min_amount = floatval(trim($_POST['min_amount']));
if (empty($coupon_value) || $coupon_value < 0) {
$this->show_warning('coupon_value_not');
exit;
}
if (empty($use_times)) {
$this->show_warning('use_times_not_zero');
exit;
}
if ($min_amount < 0) {
$this->show_warning("min_amount_gt_zero");
exit;
}
$start_time = gmstr2time(trim($_POST['start_time']));
$end_time = gmstr2time_end(trim($_POST['end_time'])) - 1;
//echo gmstr2time_end(trim($_POST['end_time'])) . '-------' .$end_time;exit;
if ($end_time < $start_time) {
$this->show_warning('end_gt_start');
exit;
}
$coupon = array('coupon_name' => trim($_POST['coupon_name']), 'coupon_value' => $coupon_value, 'store_id' => 0, 'use_times' => $use_times, 'start_time' => $start_time, 'end_time' => $end_time, 'min_amount' => $min_amount, 'if_issue' => trim($_POST['if_issue']) == 1 ? 1 : 0, 'tip' => $_POST['tip'], 'open_agree_item' => $_POST['open_agree_item'], 'show_in_list' => $_POST['show_in_list']);
if ($_POST['open_agree_item']) {
$coupon['type_content'] = $_POST['type'] == 4 ? serialize($_POST['type_content'][$_POST['type']]) : $_POST['type_content'][$_POST['type']];
$coupon['type'] = $_POST['type'];
} else {
$coupon['type_content'] = '';
$coupon['type'] = '';
}
/* 处理上传的图片 */
$coupon_image = $this->_upload_image($coupon_id);
if ($coupon_image) {
$coupon['coupon_image'] = $coupon_image;
}
if ($_POST['open_agree_item']) {
$store_ids = $this->_save_store_coupon($_POST['type'], $_POST['type_content'][$_POST['type']], $coupon_id);
if (trim($_POST['if_issue']) == 1) {
if ($store_ids) {
foreach ($store_ids as $key => $val) {
$ms =& ms();
$content = get_msg(Lang::get('to_store_owner_who_can_use_coupon'), array('coupon_name' => $_POST['coupon_name']));
$ms->pm->send(MSG_SYSTEM, $val, '', $content);
}
}
}
} else {
$store_coupon_mod =& m('store_coupon');
$store_coupon_mod->drop('coupon_id=' . $coupon_id);
}
} else {
$coupon['if_issue'] = trim($_POST['if_issue']) == 1 ? 1 : 0;
$coupon['tip'] = $_POST['tip'];
}
$this->_coupon_mod->edit($coupon_id, $coupon);
if ($this->_coupon_mod->has_error()) {
$this->show_warning($this->_coupon_mod->get_error());
exit;
}
$this->show_message('edit_coupon_success', 'back_list', 'index.php?app=coupon');
}
}
示例7: _handle_post_data
/**
* 检查提交的数据
*/
function _handle_post_data($post, $id = 0)
{
if ($post['if_publish'] == 1 || gmstr2time($post['start_time']) <= gmtime()) {
$post['start_time'] = gmtime();
//立即发布
$post['state'] = GROUP_ON;
} else {
$post['start_time'] = gmstr2time($post['start_time']);
$post['state'] = GROUP_PENDING;
}
if (intval($post['end_time'])) {
$post['end_time'] = gmstr2time_end($post['end_time']);
} else {
$this->_error('fill_end_time');
return false;
}
if ($post['end_time'] < $post['start_time']) {
$this->_error('start_not_gt_end');
return false;
}
if (($post['goods_id'] = intval($post['goods_id'])) == 0) {
$this->_error('fill_goods');
return false;
}
if (empty($post['spec_id']) || !is_array($post['spec_id'])) {
$this->_error('fill_spec');
return false;
}
foreach ($post['spec_id'] as $key => $val) {
if (empty($post['group_price'][$key])) {
$this->_error('invalid_group_price');
return false;
}
$spec_price[$val] = array('price' => number_format($post['group_price'][$key], 2, '.', ''));
}
$data = array('group_name' => $post['group_name'], 'group_desc' => $post['group_desc'], 'start_time' => $post['start_time'], 'end_time' => $post['end_time'] - 1, 'goods_id' => $post['goods_id'], 'spec_price' => serialize($spec_price), 'min_quantity' => $post['min_quantity'], 'max_per_user' => $post['max_per_user'], 'state' => $post['state'], 'store_id' => $this->_store_id);
if ($id > 0) {
$this->_groupbuy_mod->edit($id, $data);
if ($this->_groupbuy_mod->has_error()) {
$this->_error($this->_groupbuy_mod->get_error());
return false;
}
} else {
if (!($id = $this->_groupbuy_mod->add($data))) {
$this->_error($this->_groupbuy_mod->get_error());
return false;
}
}
$this->_last_update_id = $id;
return true;
}
示例8: order_list
//.........这里部分代码省略.........
$where .= " AND o.district = '{$filter['district']}'";
}
if ($filter['shipping_id']) {
$where .= " AND o.shipping_id = '{$filter['shipping_id']}'";
}
if ($filter['pay_id']) {
$where .= " AND o.pay_id = '{$filter['pay_id']}'";
}
if ($filter['order_status'] != -1) {
$where .= " AND o.order_status = '{$filter['order_status']}'";
}
if ($filter['shipping_status'] != -1) {
$where .= " AND o.shipping_status = '{$filter['shipping_status']}'";
}
if ($filter['pay_status'] != -1) {
$where .= " AND o.pay_status = '{$filter['pay_status']}'";
}
if ($filter['user_id']) {
$where .= " AND o.user_id = '{$filter['user_id']}'";
}
if ($filter['user_name']) {
$where .= " AND u.user_name LIKE '%" . mysql_like_quote($filter['user_name']) . "%'";
}
if ($filter['start_time']) {
$where .= " AND o.add_time >= '{$filter['start_time']}'";
}
if ($filter['start_time2']) {
$where .= " AND LEFT(o.best_time,10) >= '{$filter['start_time2']}'";
}
if ($filter['end_time2']) {
$where .= " AND LEFT(o.best_time,10) <= '{$filter['end_time2']}'";
}
if ($filter['second']) {
$where .= " AND LEFT(o.best_time,10) = '" . local_date('Y-m-d', gmstr2time("1 day")) . "'";
}
if ($filter['end_time']) {
$where .= " AND o.add_time <= '{$filter['end_time']}'";
}
if ($filter['fahuostart_time']) {
$where .= " AND o.shipping_time >= '{$filter['fahuostart_time']}'";
}
if ($filter['fahuoend_time']) {
$where .= " AND o.shipping_time <= '{$filter['fahuoend_time']}'";
}
//综合状态
switch ($filter['composite_status']) {
case CS_AWAIT_PAY:
$where .= order_query_sql('await_pay');
break;
case CS_AWAIT_SHIP:
$where .= order_query_sql('await_ship');
break;
case CS_FINISHED:
$where .= order_query_sql('finished');
break;
case PS_PAYING:
if ($filter['composite_status'] != -1) {
$where .= " AND o.pay_status = '{$filter['composite_status']}' ";
}
break;
case OS_SHIPPED_PART:
if ($filter['composite_status'] != -1) {
$where .= " AND o.shipping_status = '{$filter['composite_status']}'-2 ";
}
break;
default:
示例9: edit
function edit()
{
$id = empty($_GET['id']) ? 0 : intval($_GET['id']);
if (!IS_POST) {
/* 是否存在 */
$store = $this->_store_mod->get_info($id);
if (!$store) {
$this->show_warning('store_empty');
return;
}
if ($store['certification']) {
$certs = explode(',', $store['certification']);
foreach ($certs as $cert) {
$store['cert_' . $cert] = 1;
}
}
$this->assign('store', $store);
$sgrade_mod =& m('sgrade');
$this->assign('sgrades', $sgrade_mod->get_options());
$this->assign('states', array(STORE_OPEN => Lang::get('open'), STORE_CLOSED => Lang::get('close')));
$this->assign('recommended_options', array('1' => Lang::get('yes'), '0' => Lang::get('no')));
$region_mod =& m('region');
$this->assign('regions', $region_mod->get_options(0));
$this->assign('scategories', $this->_get_scategory_options());
$scates = $this->_store_mod->getRelatedData('has_scategory', $id);
$this->assign('scates', array_values($scates));
/* 导入jQuery的表单验证插件 */
$this->import_resource(array('script' => 'jquery.plugins/jquery.validate.js,mlselection.js'));
$this->assign('enabled_subdomain', ENABLED_SUBDOMAIN);
$this->display('store.form.html');
} else {
/* 检查名称是否已存在 */
if (!$this->_store_mod->unique(trim($_POST['store_name']), $id)) {
$this->show_warning('name_exist');
return;
}
$store_info = $this->_store_mod->get_info($id);
$domain = empty($_POST['domain']) ? '' : trim($_POST['domain']);
if ($domain && $domain != $store_info['domain']) {
if (!$this->_store_mod->check_domain($domain, Conf::get('subdomain_reserved'), Conf::get('subdomain_length'))) {
$this->show_warning($this->_store_mod->get_error());
return;
}
}
$data = array('store_name' => $_POST['store_name'], 'owner_name' => $_POST['owner_name'], 'owner_card' => $_POST['owner_card'], 'region_id' => $_POST['region_id'], 'region_name' => $_POST['region_name'], 'address' => $_POST['address'], 'zipcode' => $_POST['zipcode'], 'tel' => $_POST['tel'], 'sgrade' => $_POST['sgrade'], 'end_time' => empty($_POST['end_time']) ? 0 : gmstr2time(trim($_POST['end_time'])), 'state' => $_POST['state'], 'sort_order' => $_POST['sort_order'], 'recommended' => $_POST['recommended'], 'domain' => $domain);
$data['state'] == STORE_CLOSED && ($data['close_reason'] = $_POST['close_reason']);
$certs = array();
isset($_POST['autonym']) && ($certs[] = 'autonym');
isset($_POST['material']) && ($certs[] = 'material');
$data['certification'] = join(',', $certs);
$old_info = $this->_store_mod->get_info($id);
// 修改前的店铺信息
$this->_store_mod->edit($id, $data);
$this->_store_mod->unlinkRelation('has_scategory', $id);
$cate_id = intval($_POST['cate_id']);
if ($cate_id > 0) {
$this->_store_mod->createRelation('has_scategory', $id, $cate_id);
}
/* 如果修改了店铺状态,通知店主 */
if ($old_info['state'] != $data['state']) {
$ms =& ms();
if ($data['state'] == STORE_CLOSED) {
// 关闭店铺
$subject = Lang::get('close_store_notice');
//$content = sprintf(Lang::get(), $data['close_reason']);
$content = get_msg('toseller_store_closed_notify', array('reason' => $data['close_reason']));
} else {
// 开启店铺
$subject = Lang::get('open_store_notice');
$content = Lang::get('toseller_store_opened_notify');
}
$ms->pm->send(MSG_SYSTEM, $old_info['store_id'], '', $content);
$this->_mailto($old_info['email'], $subject, $content);
}
$ret_page = isset($_GET['ret_page']) ? intval($_GET['ret_page']) : 1;
$this->show_message('edit_ok', 'back_list', 'index.php?app=store&page=' . $ret_page, 'edit_again', 'index.php?app=store&act=edit&id=' . $id);
}
}
示例10: db_create_in
$goodslist = $db->getAll("select g.goods_name,g.shop_price,g.goods_sn,g.goods_id from " . $ecs->table("goods") . " g where g.goods_id " . db_create_in($goodsid) . " ");
$ngoodslist = array();
$gnums = unserialize($taocan['gnums']);
foreach ($goodslist as $n) {
foreach ($goodsid as $j => $id) {
if ($n['goods_id'] == $id) {
$n['goods_num'] = $gnums[$j];
$ngoodslist[] = $n;
}
}
}
$totalprice = 0;
foreach ($goodslist as $g) {
$totalprice += $g['shop_price'];
}
$order = array('order_sn' => get_order_sn(), 'user_id' => $taocan['user_id'], 'shipping_name' => '黑猫宅急便', 'shipping_id' => 2, 'order_status' => OS_CONFIRMED, 'shipping_status' => SS_UNSHIPPED, 'pay_status' => PS_PAYED, 'consignee' => $taocan['consignee'], 'country' => $taocan['country'], 'province' => $taocan['province'], 'city' => $taocan['city'], 'district' => $taocan['district'], 'address' => $taocan['address'], 'zipcode' => $taocan['zipcode'], 'tel' => '', 'mobile' => $taocan['mobile'], 'email' => $taocan['email'], 'best_time' => local_date('Y-m-d', gmstr2time("1 day")) . " " . $taocan['halfday'], 'sign_building' => '', 'email' => $taocan['email'], 'pay_id' => '4', 'pay_name' => '余额支付', 'goods_amount' => $totalprice, 'money_paid' => $ordertotalprice, 'order_amount' => $ordertotalprice, 'referer' => '用户套餐自动生成', 'add_time' => gmtime(), 'confirm_time' => gmtime(), 'pay_time' => gmtime(), 'shipping_time' => gmtime(), 'discount' => $totalprice - $ordertotalprice);
// Add by Edward
//fwrite($james,"订单号:".get_order_sn()."--用户ID:".$taocan['user_id']."——收货人:".$taocan['consignee']."\n");
$GLOBALS['db']->autoExecute($GLOBALS['ecs']->table('order_info'), $order, 'INSERT');
$new_order_id = $db->insert_id();
foreach ($ngoodslist as $goods) {
$ogoods = array('order_id' => $new_order_id, 'goods_id' => $goods['goods_id'], 'goods_name' => $goods['goods_name'], 'goods_sn' => $goods['goods_sn'], 'product_id' => '0', 'goods_number' => $goods['goods_num'], 'goods_price' => $goods['shop_price'], 'goods_attr' => '', 'send_number' => '0', 'is_real' => '1', 'extension_code' => '', 'parent_id' => '', 'is_gift' => '0', 'goods_attr_id' => '');
$GLOBALS['db']->autoExecute($GLOBALS['ecs']->table('order_goods'), $ogoods, 'INSERT');
}
//添加日志
order_action($order['order_sn'], OS_CONFIRMED, SS_UNSHIPPED, PS_PAYED, '', '套餐自动生成订单');
log_account_change($order['user_id'], -$ordertotalprice, 0, 0, 0, '用户套餐自动生成订单:' . $order['order_sn'] . ',自动扣除', ACT_OTHER);
$db->query("update " . $ecs->table("user_tc_goods") . " set weeks = " . $weeks . " where id=" . $taocan['tid']);
}
$db->query("update " . $ecs->table("taocan_job") . " set last_date='" . gmtime() . "', weeks = " . $weeks . "");
}
示例11: _handle_post_data
/**
* 检查提交的数据
*/
function _handle_post_data($post, $id = 0)
{
if (gmstr2time($post['start_time']) <= gmtime()) {
$post['start_time'] = gmtime();
} else {
$post['start_time'] = gmstr2time($post['start_time']);
}
if (intval($post['end_time'])) {
$post['end_time'] = gmstr2time_end($post['end_time']);
} else {
$this->_error('fill_end_time');
return false;
}
if ($post['end_time'] < $post['start_time']) {
$this->_error('start_not_gt_end');
return false;
}
if (($post['goods_id'] = intval($post['goods_id'])) == 0) {
$this->_error('fill_goods');
return false;
}
if ($id == 0 && $this->_promotion_mod->get(array('conditions' => 'goods_id=' . $post['goods_id']))) {
$this->_error('goods_has_set_promotion');
return false;
}
if (empty($post['spec_id']) || !is_array($post['spec_id'])) {
$this->_error('fill_spec');
return false;
}
$spec_id_yx = array();
//print_r($post['spec_id']);exit;
foreach ($post['spec_id'] as $key => $val) {
if (empty($post['pro_price' . $val])) {
$this->_error('invalid_pro_price');
return false;
}
$spec_id_yx[] = $val;
$spec_price[$val] = array('price' => $post['pro_price' . $val], 'pro_type' => $post['pro_type' . $val], 'is_pro' => 1);
}
// 取得所有 spec_id,对未设置的进行处理
$goods_info = $this->_query_goods_info($post['goods_id']);
foreach ($goods_info['_specs'] as $spec) {
if (!in_array($spec['spec_id'], $spec_id_yx)) {
$spec_price[$spec['spec_id']] = array('is_pro' => 0);
// 设置未选中的 spec_id
}
}
//print_r($spec_price);exit;
$data = array('pro_name' => $post['pro_name'], 'pro_desc' => $post['pro_desc'], 'start_time' => $post['start_time'], 'end_time' => $post['end_time'] - 1, 'goods_id' => $post['goods_id'], 'spec_price' => serialize($spec_price), 'store_id' => $this->_store_id);
if ($id > 0) {
$this->_promotion_mod->edit($id, $data);
if ($this->_promotion_mod->has_error()) {
$this->_error($this->_promotion_mod->get_error());
return false;
}
} else {
if (!($id = $this->_promotion_mod->add($data))) {
$this->_error($this->_promotion_mod->get_error());
return false;
}
}
$this->_last_update_id = $id;
return true;
}