public function __construct() { $GLOBALS['tmpl']->assign("MODULE_NAME", MODULE_NAME); $GLOBALS['tmpl']->assign("ACTION_NAME", ACTION_NAME); $GLOBALS['fcache']->set_dir(APP_ROOT_PATH . "public/runtime/data/page_static_cache/"); $GLOBALS['dynamic_cache'] = $GLOBALS['fcache']->get("APP_DYNAMIC_CACHE_" . APP_INDEX . "_" . MODULE_NAME . "_" . ACTION_NAME); $GLOBALS['fcache']->set_dir(APP_ROOT_PATH . "public/runtime/data/avatar_cache/"); $GLOBALS['dynamic_avatar_cache'] = $GLOBALS['fcache']->get("AVATAR_DYNAMIC_CACHE"); //头像的动态缓存 //输出导航菜单 $nav_list = get_shop_nav_list(); $nav_list = init_nav_list($nav_list); $GLOBALS['tmpl']->assign("nav_list", $nav_list); //输出在线客服与时间 $qq = explode("|", app_conf("ONLINE_QQ")); $msn = explode("|", app_conf("ONLINE_MSN")); $GLOBALS['tmpl']->assign("online_qq", $qq); $GLOBALS['tmpl']->assign("online_msn", $msn); //输出页面的标题关键词与描述 $GLOBALS['tmpl']->assign("shop_info", get_shop_info()); //输出系统文章 $system_article = get_article_list(8, 0, "ac.type_id = 3", "", true); $GLOBALS['tmpl']->assign("system_article", $system_article['list']); //输出帮助 $deal_help = get_help(); $GLOBALS['tmpl']->assign("deal_help", $deal_help); //输出热门关键词 // 热门搜索词 $hot_kw = get_hot_kw(); $GLOBALS['tmpl']->assign("hot_kw", $hot_kw); if (MODULE_NAME == "index" && ACTION_NAME == "index" || MODULE_NAME == "acate" && ACTION_NAME == "index" || MODULE_NAME == "article" && ACTION_NAME == "index" || MODULE_NAME == "brand" && ACTION_NAME == "index" || MODULE_NAME == "cate" && ACTION_NAME == "index" || MODULE_NAME == "city" && ACTION_NAME == "index" || MODULE_NAME == "comment" && ACTION_NAME == "index" || MODULE_NAME == "daren" && ACTION_NAME == "index" || MODULE_NAME == "daren" && ACTION_NAME == "submit" || MODULE_NAME == "discount" && ACTION_NAME == "index" || MODULE_NAME == "discover" && ACTION_NAME == "index" || MODULE_NAME == "exchange" && ACTION_NAME == "index" || MODULE_NAME == "goods" && ACTION_NAME == "index" || MODULE_NAME == "group" && ACTION_NAME == "index" || MODULE_NAME == "group" && ACTION_NAME == "forum" || MODULE_NAME == "group" && ACTION_NAME == "create" || MODULE_NAME == "help" && ACTION_NAME == "index" || MODULE_NAME == "link" && ACTION_NAME == "index" || MODULE_NAME == "mall" && ACTION_NAME == "index" || MODULE_NAME == "mobile" && ACTION_NAME == "index" || MODULE_NAME == "msg" && ACTION_NAME == "index" || MODULE_NAME == "notice" && ACTION_NAME == "index" || MODULE_NAME == "notice" && ACTION_NAME == "list_notice" || MODULE_NAME == "rec" && ACTION_NAME == "rhot" || MODULE_NAME == "rec" && ACTION_NAME == "rnew" || MODULE_NAME == "rec" && ACTION_NAME == "rbest" || MODULE_NAME == "rec" && ACTION_NAME == "rsale" || MODULE_NAME == "score" && ACTION_NAME == "index" || MODULE_NAME == "space" && ACTION_NAME == "index" || MODULE_NAME == "space" && ACTION_NAME == "fav" || MODULE_NAME == "space" && ACTION_NAME == "fans" || MODULE_NAME == "space" && ACTION_NAME == "focus" || MODULE_NAME == "msg" && ACTION_NAME == "index" || MODULE_NAME == "ss" && ACTION_NAME == "index" || MODULE_NAME == "ss" && ACTION_NAME == "pick" || MODULE_NAME == "sys" && ACTION_NAME == "index" || MODULE_NAME == "sys" && ACTION_NAME == "list_notice" || MODULE_NAME == "topic" && ACTION_NAME == "index" || MODULE_NAME == "vote" && ACTION_NAME == "index") { set_gopreview(); } }
public function __construct() { $GLOBALS['tmpl']->assign("MODULE_NAME", MODULE_NAME); $GLOBALS['tmpl']->assign("ACTION_NAME", ACTION_NAME); $GLOBALS['fcache']->set_dir(APP_ROOT_PATH . "public/runtime/data/page_static_cache/"); $GLOBALS['dynamic_cache'] = $GLOBALS['fcache']->get("APP_DYNAMIC_CACHE_" . APP_INDEX . "_" . MODULE_NAME . "_" . ACTION_NAME); $GLOBALS['fcache']->set_dir(APP_ROOT_PATH . "public/runtime/data/avatar_cache/"); $GLOBALS['dynamic_avatar_cache'] = $GLOBALS['fcache']->get("AVATAR_DYNAMIC_CACHE"); //头像的动态缓存 //输出导航菜单 $nav_list = get_nav_list(); $nav_list = init_nav_list($nav_list); $GLOBALS['tmpl']->assign("nav_list", $nav_list); //输出在线客服与时间 $qq = explode("|", app_conf("ONLINE_QQ")); $msn = explode("|", app_conf("ONLINE_MSN")); $GLOBALS['tmpl']->assign("online_qq", $qq); $GLOBALS['tmpl']->assign("online_msn", $msn); //输出页面的标题关键词与描述 $GLOBALS['tmpl']->assign("shop_info", get_shop_info()); //输出帮助 $deal_help = get_help(); $GLOBALS['tmpl']->assign("deal_help", $deal_help); //输出系统文章 $system_article = get_article_list(8, 0, "ac.type_id = 3", "", true); $GLOBALS['tmpl']->assign("system_article", $system_article['list']); //输出热门关键词 $hot_kw = get_hot_kw(); $GLOBALS['tmpl']->assign("hot_kw", $hot_kw); if (MODULE_NAME == "deal" && ACTION_NAME == "index" || MODULE_NAME == "deals" && ACTION_NAME == "index" || MODULE_NAME == "dhapi" && ACTION_NAME == "index" || MODULE_NAME == "index" && ACTION_NAME == "index" || MODULE_NAME == "message" && ACTION_NAME == "index" || MODULE_NAME == "order" && ACTION_NAME == "index" || MODULE_NAME == "search" && ACTION_NAME == "index" || MODULE_NAME == "second" && ACTION_NAME == "index") { set_gopreview(); } }
public function __construct() { $GLOBALS['tmpl']->assign("MODULE_NAME", MODULE_NAME); $GLOBALS['tmpl']->assign("ACTION_NAME", ACTION_NAME); $GLOBALS['fcache']->set_dir(APP_ROOT_PATH . "public/runtime/data/page_static_cache/"); $GLOBALS['dynamic_cache'] = $GLOBALS['fcache']->get("APP_DYNAMIC_CACHE_" . APP_INDEX . "_" . MODULE_NAME . "_" . ACTION_NAME); $GLOBALS['fcache']->set_dir(APP_ROOT_PATH . "public/runtime/data/avatar_cache/"); $GLOBALS['dynamic_avatar_cache'] = $GLOBALS['fcache']->get("AVATAR_DYNAMIC_CACHE"); //头像的动态缓存 foreach ($GLOBALS['biz_nav'] as $k => $v) { if ($v['ctl'] == MODULE_NAME) { $GLOBALS['biz_nav'][$k]['current'] = 1; } } $GLOBALS['tmpl']->assign("biz_nav", $GLOBALS['biz_nav']); //输出页面的标题关键词与描述 $GLOBALS['tmpl']->assign("shop_info", get_shop_info()); }
public function cron() { $Product = M('Product'); $ProductBid = M('ProductBid'); /* 5分钟提示 */ $map = array('product_type' => array('in', '1,2'), 'is_send' => 0, 'status' => 1, 'end_time' => array('elt', NOW_TIME + 300)); $product_lists = $Product->where($map)->select(); print_r($product_lists); foreach ($product_lists as $value) { // $Product->where(array('product_id'=>$value['product_id']))->setField('is_send', 1); $bid_lists = $ProductBid->where(array('product_id' => $value['product_id']))->group('user_id')->select(); $data = array('touser' => '', 'msgtype' => 'news', 'news' => array('articles' => array(array('title' => '5分钟结拍提示', 'description' => '你好,【' . $value['product_name'] . '】还有5分钟结束。' . $money . PHP_EOL . '结拍时间:' . date('Y-m-d H:i:s', $value['end_time']), 'url' => C('WEB_SITE_URL') . U('Index/product', array('id' => $value['product_id'])), 'picurl' => '')))); foreach ($bid_lists as $val) { $data['touser'] = get_shop_info($val['user_id'], 'openid'); $this->WX->sendCustomMessage($data); } } /* 3分钟提示 */ $map = array('product_type' => array('in', '1,2'), 'is_send' => 1, 'status' => 1, 'end_time' => array('elt', NOW_TIME + 180)); $product_lists = $Product->where($map)->select(); foreach ($product_lists as $value) { $Product->where(array('product_id' => $value['product_id']))->setField('is_send', 2); $bid_lists = $ProductBid->where(array('product_id' => $value['product_id']))->group('user_id')->select(); $data = array('touser' => '', 'msgtype' => 'news', 'news' => array('articles' => array(array('title' => '3分钟结拍提示', 'description' => '你好,【' . $value['product_name'] . '】还有3分钟结束。' . $money . PHP_EOL . '结拍时间:' . date('Y-m-d H:i:s', $value['end_time']), 'url' => C('WEB_SITE_URL') . U('Index/product', array('id' => $value['product_id'])), 'picurl' => '')))); foreach ($bid_lists as $val) { $data['touser'] = get_shop_info($val['user_id'], 'openid'); $this->WX->sendCustomMessage($data); } } /* 1分钟提示 */ $map = array('product_type' => array('in', '1,2'), 'is_send' => 2, 'status' => 1, 'end_time' => array('elt', NOW_TIME + 60)); $product_lists = $Product->where($map)->select(); foreach ($product_lists as $value) { $Product->where(array('product_id' => $value['product_id']))->setField('is_send', 3); $bid_lists = $ProductBid->where(array('product_id' => $value['product_id']))->group('user_id')->select(); $data = array('touser' => get_shop_info($val['user_id'], 'openid'), 'msgtype' => 'news', 'news' => array('articles' => array(array('title' => '1分钟结拍提示', 'description' => '你好,【' . $value['product_name'] . '】还有1分钟结束。' . $money . PHP_EOL . '结拍时间:' . date('Y-m-d H:i:s', $value['end_time']), 'url' => C('WEB_SITE_URL') . U('Index/product', array('id' => $value['product_id'])), 'picurl' => '')))); foreach ($bid_lists as $val) { $data['touser'] = get_shop_info($val['user_id'], 'openid'); $this->WX->sendCustomMessage($data); } } }
public function sendMessage($id) { $info = $this->db->find($id); if (!$info) { $this->error('不存在!'); } else { $extend = I('extend'); if (empty($extend)) { $this->error('不能为空'); } $data = array('id' => $id, 'extend' => serialize($extend), 'update_time' => NOW_TIME, 'status' => 1); $this->db->save($data); $reply = $extend['reply']; if (empty($reply)) { $this->error('回复内容不能为空'); } $temp = array('touser' => get_shop_info($info['user_id'], 'openid'), 'template_id' => 'ufTo1hIDGpj30651OFoIG78s4Gm9xSRrM_bXaGkucQA', 'url' => '', 'topcolor' => '#FF0000', 'data' => array('first' => array('value' => '反馈问题:' . $info['content'], 'color' => ''), 'keyword1' => array('value' => C('WEB_SITE_TITLE'), 'color' => ''), 'keyword2' => array('value' => date('Y-m-d H:i:s'), 'color' => ''), 'keyword3' => array('value' => $reply, 'color' => '#FF0000'), 'remark' => array('value' => '非常感谢您对' . C('WEB_SITE_TITLE') . '的信任与支持。', 'color' => ''))); $this->WX->sendTemplateMessage($temp); $this->success('成功'); } }
public function send($saleIds) { if (empty($saleIds)) { $this->resultError(); } $UserQunfa = M('UserQunfa'); $map = array('user_id' => $this->user_info['user_id'], 'time' => array('gt', strtotime(date('Ymd')))); $yifa_num = $UserQunfa->where($map)->count(); if ($yifa_num >= C('SHARE_QUNFA_NUM')) { $this->resultError('每天最多群发' . C('SHARE_QUNFA_NUM') . '条'); } $UserCollect = M('UserCollect'); $fans_list = $UserCollect->where(array('shop' => $this->user_info['user_id']))->select(); if (empty($fans_list)) { $this->resultError('没有人收藏你的店铺'); } $Product = M('Product'); $map = array('user_id' => $this->user_info['user_id'], 'product_id' => array('in', $saleIds), 'status' => 1); $product_list = $Product->where($map)->select(); $data = array('touser' => '', 'msgtype' => 'news', 'news' => array('articles' => array())); $faing = array(); foreach ($product_list as $key => $value) { $data['news']['articles'][] = array('title' => $value['product_name'], 'description' => $value['product_desc'], 'url' => C('WEB_SITE_URL') . U('Index/product', array('id' => $value['product_id'])), 'picurl' => C('WEB_SITE_URL') . '/' . array_shift(json_decode($value['product_images'], true))); array_push($faing, $value['product_id']); } $success = $count = 0; foreach ($fans_list as $key => $value) { $data['touser'] = get_shop_info($value['user_id'], 'openid'); $result = $this->WX->sendCustomMessage($data); $count++; if ($result) { $success++; } } $UserQunfa->add(array('user_id' => $this->user_info['user_id'], 'data' => implode(',', $faing), 'time' => NOW_TIME)); $shop_data = array('touser' => $this->user_info['openid'], 'msgtype' => 'news', 'news' => array('articles' => array(array('title' => '新品发布通知用户的报表', 'description' => '【拥抱豹哥】您好,您共有' . $count . '位中华聚宝朋友,已经通知' . $success . '位', 'url' => C('WEB_SITE_URL') . U('User/index'), 'picurl' => '')))); $this->WX->sendCustomMessage($shop_data); $this->resultsuccess('拍品信息进入群发队列,稍后进行发送'); }
public function add($productId, $price) { if (!$this->user_info['is_subscribe']) { $this->resultError('请先关注公众平台【' . C('WEB_SITE_TITLE') . '】', '', 'http://mp.weixin.qq.com/s?__biz=MzI2OTA4MzI4NA==&mid=401275684&idx=4&sn=215571f800f39c82095f7dca83728a0e#rd'); } if (!$this->user_info['mobile']) { $this->resultError('请先完善个人资料手机号参数必填', '', U('Setting/index')); } $product_info = M('Product')->find($productId); // 拍品是否存在 if (!$product_info) { $this->resultError('拍品不存在...'); } if ($product_info['user_id'] == $this->user_info['user_id']) { $this->resultError('不可以自娱自乐...'); } // 判断类型 switch ($product_info['product_type']) { case '1': //加价 //加价 case '2': //竞速 // 是否在拍卖 if ($product_info['begin_time'] > NOW_TIME) { $this->resultError('拍卖未开始'); } if (NOW_TIME > $product_info['end_time']) { $this->resultError('拍卖已结束'); } // 拍品不在可出价状态 if ($product_info['status'] != 1) { $this->resultError('拍品不在可出价状态'); } // 检查当前用户是否出价最高 if (check_user_bid($productId, $this->user_info['user_id'])) { $this->resultError('出价已经最高'); } // 最低出价 // $bid_price = max_bid_price($productId); $product_info['bid_info'] = M('ProductBid')->where(array('product_id' => $product_info['product_id']))->order('bid_price desc')->find(); if ($product_info['bid_info']) { $xz_bid = $product_info['bid_info']['bid_price'] + $product_info['range_price']; } else { $xz_bid = $product_info['start_price']; } if ($xz_bid > $price) { $this->resultError('最低加价' . $xz_bid); } // 出价 $data = array('product_id' => $product_info['product_id'], 'user_id' => $this->user_info['user_id'], 'bid_price' => $price, 'create_time' => NOW_TIME, 'update_time' => NOW_TIME, 'status' => 1); $result = M('ProductBid')->add($data); if (!$result) { $this->resultError(); } if ($product_info['reserve_price'] && $price >= $product_info['reserve_price']) { // 下单 $order_id = create_order_id(); $end_time = strtotime('+2 day'); $data = array('order_id' => $order_id, 'shop_id' => $product_info['user_id'], 'user_id' => $this->user_info['user_id'], 'product_id' => $product_info['product_id'], 'price' => $price, 'postage' => $product_info['postage'], 'create_time' => NOW_TIME, 'update_time' => NOW_TIME, 'end_time' => $end_time, 'status' => 1); M('Order')->add($data); $Product->where(array('product_id' => $product_info['product_id']))->setField('status', 2); // 给卖家发 $data = array('first' => '你好,【' . $product_info['product_name'] . '】已经结拍,订单已经生成。', 'order_id' => $order_id, 'order_status' => '待支付(等待买家支付)', 'product_name' => $product_info['product_name'], 'order_price' => $price + $product_info['postage'], 'end_time' => '违约有效期:' . date('Y-m-d H:i:s', $end_time)); $this->sendOrder(get_shop_info($product_info['user_id'], 'openid'), U('Order/index', array('order_id' => $order_id)), $data); // 给买家发 $data['first'] = '你好,【' . $product_info['product_name'] . '】已经结拍,订单已经生成,请在付款有效期内付款。'; $this->sendOrder($this->user_info['openid'], U('Order/index', array('order_id' => $order_id)), $data); // 通知买家 if ($product_info['bid_info']) { $data = array('first' => '您的出价已被超越,【' . $this->user_info['user_name'] . '】出价' . $price . '元,已经得拍', 'product_id' => $product_info['product_id'], 'product_name' => $product_info['product_name'], 'remark' => '结拍时间:' . date('Y年m月d日 H:i:s', $product_info['end_time'])); $this->sendBid(get_shop_info($product_info['bid_info']['user_id'], 'openid'), U('Index/product', array('id' => $product_info['product_id'])), $data); } $this->resultSuccess('出价得拍'); } else { // 如果在结拍30内出价会延时5,3,1分 if ($product_info['end_time'] - NOW_TIME < 30) { $product_ys_num = F('product_' . $product_info['product_id']); switch ($product_ys_num) { case '1': $product_info['end_time'] += 180; F('product_' . $product_info['product_id'], 2); M('Product')->where(array('product_id' => $product_info['product_id']))->setField('end_time', $product_info['end_time']); break; case '2': $product_info['end_time'] += 60; F('product_' . $product_info['product_id'], 3); M('Product')->where(array('product_id' => $product_info['product_id']))->setField('end_time', $product_info['end_time']); break; case '3': // TODO: break; default: $product_info['end_time'] += 300; F('product_' . $product_info['product_id'], 1); M('Product')->where(array('product_id' => $product_info['product_id']))->setField('end_time', $product_info['end_time']); break; } } // 通知买家 if ($product_info['bid_info']) { $data = array('first' => '您的出价已被超越,【' . $this->user_info['user_name'] . '】出价' . $price . '元,目前领先', 'product_id' => $product_info['product_id'], 'product_name' => $product_info['product_name'], 'remark' => '提醒:' . date('Y年m月d日 H:i:s', $product_info['end_time']) . '拍卖结束'); $this->sendBid(get_shop_info($product_info['bid_info']['user_id'], 'openid'), U('Index/product', array('id' => $product_info['product_id'])), $data); } // 通知店铺 $data = array('first' => '您的拍品,【' . $this->user_info['user_name'] . '】出价' . $price . '元,目前领先', 'product_id' => $product_info['product_id'], 'product_name' => $product_info['product_name'], 'remark' => '提醒:' . date('Y年m月d日 H:i:s', $product_info['end_time']) . '拍卖结束'); $this->sendBid(get_shop_info($product_info['user_id'], 'openid'), U('Index/product', array('id' => $product_info['product_id'])), $data); $this->resultSuccess(); } break; case '3': //秒杀 // 是否在拍卖 if ($product_info['begin_time'] > NOW_TIME) { $this->resultError('秒杀未开始'); } if (NOW_TIME > $product_info['end_time']) { $this->resultError('秒杀已结束'); } // 拍品不在可出价状态 if ($product_info['status'] != 1) { $this->resultError('拍品不在可出价状态'); } // 检查当前用户是否已经秒杀 $map = array('product_id' => $product_info['product_id'], 'user_id' => $this->user_info['user_id']); $is_miaosha = M('ProductBid')->where($map)->find(); if ($is_miaosha) { $this->resultError('已经秒杀过了'); } // 拍品数量 if ($product_info['reserve_price'] < 1) { $this->resultError('秒杀数量有限下次早点来哦'); } // 秒杀价 if ($price < $product_info['range_price']) { $this->resultError('最低秒杀价' . $product_info['range_price']); } $map = array('product_id' => $product_info['product_id']); $result = M('Product')->where($map)->setDec('reserve_price', 1); if (!$result) { $this->resultError(); } $data = array('product_id' => $product_info['product_id'], 'user_id' => $this->user_info['user_id'], 'bid_price' => $price, 'create_time' => NOW_TIME, 'update_time' => NOW_TIME, 'status' => 1); $result = M('ProductBid')->add($data); if (!$result) { $this->resultError(); } // 下单 $order_id = create_order_id(); $end_time = strtotime('+2 day'); $data = array('order_id' => $order_id, 'shop_id' => $product_info['user_id'], 'user_id' => $this->user_info['user_id'], 'product_id' => $product_info['product_id'], 'price' => $price, 'postage' => $product_info['postage'], 'create_time' => NOW_TIME, 'update_time' => NOW_TIME, 'end_time' => $end_time, 'status' => 1); M('Order')->add($data); // 最后一个结束拍卖 if ($product_info['reserve_price'] == 1) { M('Product')->where(array('product_id' => $product_info['product_id']))->setField('status', 2); } // 给卖家发 $data = array('first' => '你好,【' . $product_info['product_name'] . '】秒杀拍品,有人秒杀抢购。', 'order_id' => $order_id, 'order_status' => '待支付(等待买家支付)', 'product_name' => $product_info['product_name'], 'order_price' => $price + $product_info['postage'], 'end_time' => '违约有效期:' . date('Y-m-d H:i:s', $end_time)); $this->sendOrder(get_shop_info($product_info['user_id'], 'openid'), U('Order/index', array('order_id' => $order_id)), $data); // 给买家发 $data['first'] = '你好,【' . $product_info['product_name'] . '】订单已经生成,请在付款有效期内付款。'; $this->sendOrder($this->user_info['openid'], U('Order/index', array('order_id' => $order_id)), $data); $this->resultSuccess(); break; default: $this->resultError('参数错误...'); break; } }
private function _run() { G('begin'); if (file_exists(WEB_ROOT . '/cron-0')) { return; } else { file_put_contents(WEB_ROOT . '/cron-0', 'cron-0'); } /* 订单处理 */ $Order = M('Order'); $map = array('end_time' => array('elt', NOW_TIME), 'status' => array('in', '1,2,3')); $order_lsits = $Order->where($map)->select(); foreach ($order_lsits as $key => $val) { $price = $val['price'] + $val['postage']; $product_name = get_product_info($val['product_id']); switch ($val['status']) { case '1': //未付款 $parm = array('status' => 5, 'update_time' => $val['end_time'], 'desc' => '买家违约'); $data = array('first' => '你好,【' . $product_name . '】订单已经关闭,买家没有付款。', 'order_id' => $val['order_id'], 'order_status' => '已关闭(买家违约)', 'product_name' => $product_name, 'order_price' => $val['price'] + $val['postage'], 'end_time' => '违约时间:' . date('Y-m-d H:i:s', $val['end_time'])); break; case '2': //未发货 $parm = array('status' => 5, 'update_time' => $val['end_time'], 'desc' => '卖家违约'); $data = array('first' => '你好,【' . $product_name . '】订单已经关闭,卖家没有发货,买家支付款将退还给买家', 'order_id' => $val['order_id'], 'order_status' => '已关闭(卖家违约)', 'product_name' => $product_name, 'order_price' => $price, 'end_time' => '违约时间:' . date('Y-m-d H:i:s', $val['end_time'])); // 退还买家支付款 fund_inc($val['user_id'], $price, '支付款退还'); break; case '3': //系统自动签收 $parm = array('status' => 4, 'update_time' => $val['end_time'], 'desc' => '自动签收'); $data = array('first' => '你好,【' . $product_name . '】订单已经完成,系统自动签收。', 'order_id' => $val['order_id'], 'order_status' => '已完成(自动签收)', 'product_name' => $product_name, 'order_price' => $price, 'end_time' => '完成时间:' . date('Y-m-d H:i:s', $val['end_time'])); // 为商家充值 fund_inc($val['shop_id'], $price, '买卖交易'); break; default: break; } // 更新订单状态 $Order->where(array('order_id' => $val['order_id']))->save($parm); // 给卖家发 $this->sendOrder(get_shop_info($val['shop_id'], 'openid'), U('Order/index', array('order_id' => $val['order_id'])), $data); // 给买家发 $this->sendOrder(get_shop_info($val['user_id'], 'openid'), U('Order/index', array('order_id' => $val['order_id'])), $data); } /* 产品处理 */ $Product = M('Product'); $ProductBid = M('ProductBid'); $map = array('status' => 1, 'end_time' => array('elt', NOW_TIME)); $product_lists = $Product->where($map)->select(); foreach ($product_lists as $key => $val) { switch ($val['product_type']) { case '1': //普通 //普通 case '2': //竞速 $bid_info = $ProductBid->where(array('product_id' => $val['product_id']))->order('bid_price desc')->find(); if ($bid_info) { if ($bid_info['bid_price'] >= $val['reserve_price']) { //改变状态 $result = $Product->where(array('product_id' => $val['product_id']))->setField('status', 2); $count = $Order->where(array('product_id' => $val['product_id']))->count(); if ($result && empty($count)) { // 下单 $order_id = create_order_id(); $end_time = strtotime('+2 day'); $data = array('order_id' => $order_id, 'shop_id' => $val['user_id'], 'user_id' => $bid_info['user_id'], 'product_id' => $val['product_id'], 'price' => $bid_info['bid_price'], 'postage' => $val['postage'], 'create_time' => NOW_TIME, 'update_time' => NOW_TIME, 'end_time' => $end_time, 'status' => 1); M('Order')->add($data); // 给卖家发 $data = array('first' => '你好,【' . $val['product_name'] . '】已经自动结拍,订单已经生成。', 'order_id' => $order_id, 'order_status' => '待支付(等待买家支付)', 'product_name' => $val['product_name'], 'order_price' => $bid_info['bid_price'] + $val['postage'], 'end_time' => '违约有效期:' . date('Y-m-d H:i:s', $end_time)); $this->sendOrder(get_shop_info($val['user_id'], 'openid'), U('Order/index', array('order_id' => $order_id)), $data); // 给买家发 $data['first'] = '你好,【' . $val['product_name'] . '】已经自动结拍,订单已经生成,请在付款有效期内付款。'; $this->sendOrder(get_shop_info($bid_info['user_id'], 'openid'), U('Order/index', array('order_id' => $order_id)), $data); } } else { // 给卖家发 $data = array('first' => '你好,【' . $val['product_name'] . '】已经流拍,出价没有高于或等于保留价。', 'product_id' => $val['product_id'], 'product_name' => $val['product_name'], 'remark' => '流拍时间:' . date('Y-m-d H:i:s', $val['end_time'])); $this->sendBid(get_shop_info($val['user_id'], 'openid'), U('Index/product', array('id' => $val['product_id'])), $data); $Product->where(array('product_id' => $val['product_id']))->setField('status', 3); } } else { // 给卖家发 $data = array('first' => '你好,【' . $val['product_name'] . '】已经流拍,没有人出价。', 'product_id' => $val['product_id'], 'product_name' => $val['product_name'], 'remark' => '流拍时间:' . date('Y-m-d H:i:s', $val['end_time'])); $this->sendBid(get_shop_info($val['user_id'], 'openid'), U('Index/product', array('id' => $val['product_id'])), $data); $Product->where(array('product_id' => $val['product_id']))->setField('status', 3); } break; case '3': //秒杀 $Product->where(array('product_id' => $val['product_id']))->setField('status', 2); break; default: # code... break; } } /* 5分钟提示 */ $map = array('product_type' => array('in', '1,2'), 'is_send' => 0, 'status' => 1, 'end_time' => array('elt', NOW_TIME + 300)); $product_lists = $Product->where($map)->select(); foreach ($product_lists as $value) { $Product->where(array('product_id' => $value['product_id']))->setField('is_send', 1); $bid_lists = $ProductBid->where(array('product_id' => $value['product_id']))->group('user_id')->select(); $data = array('touser' => '', 'msgtype' => 'news', 'news' => array('articles' => array(array('title' => '5分钟结拍提示', 'description' => '你好,【' . $value['product_name'] . '】还有5分钟结束。' . $money . PHP_EOL . '结拍时间:' . date('Y-m-d H:i:s', $value['end_time']), 'url' => C('WEB_SITE_URL') . U('Index/product', array('id' => $value['product_id'])), 'picurl' => '')))); foreach ($bid_lists as $val) { $data['touser'] = get_shop_info($val['user_id'], 'openid'); $this->WX->sendCustomMessage($data); } } /* 3分钟提示 */ $map = array('product_type' => array('in', '1,2'), 'is_send' => 1, 'status' => 1, 'end_time' => array('elt', NOW_TIME + 180)); $product_lists = $Product->where($map)->select(); foreach ($product_lists as $value) { $Product->where(array('product_id' => $value['product_id']))->setField('is_send', 2); $bid_lists = $ProductBid->where(array('product_id' => $value['product_id']))->group('user_id')->select(); $data = array('touser' => '', 'msgtype' => 'news', 'news' => array('articles' => array(array('title' => '3分钟结拍提示', 'description' => '你好,【' . $value['product_name'] . '】还有3分钟结束。' . $money . PHP_EOL . '结拍时间:' . date('Y-m-d H:i:s', $value['end_time']), 'url' => C('WEB_SITE_URL') . U('Index/product', array('id' => $value['product_id'])), 'picurl' => '')))); foreach ($bid_lists as $val) { $data['touser'] = get_shop_info($val['user_id'], 'openid'); $this->WX->sendCustomMessage($data); } } /* 1分钟提示 */ $map = array('product_type' => array('in', '1,2'), 'is_send' => 2, 'status' => 1, 'end_time' => array('elt', NOW_TIME + 60)); $product_lists = $Product->where($map)->select(); foreach ($product_lists as $value) { $Product->where(array('product_id' => $value['product_id']))->setField('is_send', 3); $bid_lists = $ProductBid->where(array('product_id' => $value['product_id']))->group('user_id')->select(); $data = array('touser' => get_shop_info($val['user_id'], 'openid'), 'msgtype' => 'news', 'news' => array('articles' => array(array('title' => '1分钟结拍提示', 'description' => '你好,【' . $value['product_name'] . '】还有1分钟结束。' . $money . PHP_EOL . '结拍时间:' . date('Y-m-d H:i:s', $value['end_time']), 'url' => C('WEB_SITE_URL') . U('Index/product', array('id' => $value['product_id'])), 'picurl' => '')))); foreach ($bid_lists as $val) { $data['touser'] = get_shop_info($val['user_id'], 'openid'); $this->WX->sendCustomMessage($data); } } G('end'); @unlink(WEB_ROOT . '/cron-0'); // file_put_contents(WEB_ROOT .'/cron-log.txt', date('Y-m-d H:i:s') . PHP_EOL . G('begin','end') . '0s' . PHP_EOL, FILE_APPEND); }
public function user($status = 1) { if (IS_AJAX) { $page_size = 10; $page = I('page', 1, 'intval'); $start = ($page - 1) * $page_size; $map = array('user_id' => $this->user_info['user_id'], 'status' => $status); $Order = M('Order'); $total_count = $Order->where($map)->count(); if ($total_count) { $total_page = ceil($total_count / $page_size); $order_list = $Order->where($map)->order('create_time desc')->limit($start . ',' . $page_size)->select(); foreach ($order_list as $key => $value) { $order_list[$key]['shop_info'] = get_shop_info($value['shop_id'], ''); $order_list[$key]['product_info'] = get_product_info($value['product_id'], ''); $order_list[$key]['z_price'] = $order_list[$key]['product_info']['postage'] + $value['price']; } $this->assign('order_list', $order_list); // print_r($order_list); exit; $content = $this->fetch('ajaxUser'); $value = array('htmlString' => $content, 'isNextPage' => $total_page == 1 || $total_page == $page ? false : true, 'page' => $page, 'pageSize' => $page_size, 'totalCount' => $total_count, 'totalPage' => $total_page); } else { $value = array('htmlString' => '<div class="ui-section no-item" id="no-item">暂无数据</div>', 'isNextPage' => false, 'page' => $page, 'pageSize' => $page_size, 'totalCount' => $total_count, 'totalPage' => 1); } $this->resultSuccess('加载中...', $value); } else { $this->assign('status', $status); $this->display(); } }
if (!isset($json->{'ShopId'})) { echo_invalid_param($json); } get_access_point($json); break; case OPCODE::SERVICE_GET_COMMENT_REQUEST: if (!isset($json->{'ShopId'})) { echo_invalid_param($json); } get_comment($json); break; case OPCODE::SERVICE_GET_SHOP_INFO_REQUEST: if (!isset($json->{'ShopId'})) { echo_invalid_param($json); } get_shop_info($json); break; case OPCODE::SERVICE_GET_SHOP_INFO_REQUEST_BY_BSSID: if (!isset($json->{'BSSID'})) { echo_invalid_param($json); } get_shop_info_by_bssid($json); break; case OPCODE::SERVICE_GET_PICTURE_REQUEST: if (!isset($json->{'ShopId'})) { echo_invalid_param($json); } get_picture($json); break; case OPCODE::SERVICE_GET_PROMOTION_REQUEST: if (!isset($json->{'ShopId'})) {
?> " title=""><?php echo get_fx_group($user_info['fx_group'], 'name'); ?> </a></span> </dt> <dd> 会员ID :<?php echo $user_info['user_id']; ?> <br /> 昵称 :<?php echo $user_info['user_name']; ?> <br /> 推荐人: <?php echo empty($user_info['fx_sup']) ? '中华聚宝' : get_shop_info($user_info['user_avatar']); ?> <a href="<?php echo U('index'); ?> " title=""><img src="/Public/Fenxiao/jfsd/images/bg3.png" alt=""></a> </dd> </dl> <script type="text/javascript"> var updateUserInfo = function() { $.ajax({ url: '<?php echo U('syncUserInfo'); ?> ', type: 'post',
++$i; ?> <tr> <td align="center"><input type="checkbox" name="user_id" value="<?php echo $v['user_id']; ?> "><?php echo $v['id']; ?> </td> <td align="center"><?php echo get_shop_info($v['user_id']); ?> </td> <td align="center"><?php echo get_shop_info($v['user_id'], 'openid'); ?> </td> <td align="center"><?php echo $v['money']; ?> </td> <td align="center"><?php echo date('Y-m-d H:i:s', $v['create_time']); ?> </td> <td align="center"><?php echo date('Y-m-d H:i:s', $v['update_time']); ?> </td> <td align="center">
} } } } } $GLOBALS['tmpl']->assign("nav_list", $nav_list); $now = get_gmtime(); $vote = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "vote where is_effect = 1 and begin_time < " . $now . " and (end_time = 0 or end_time > " . $now . ") order by sort desc limit 1"); $GLOBALS['tmpl']->assign("vote", $vote); //输出在线客服与时间 $qq = explode("|", app_conf("ONLINE_QQ")); $msn = explode("|", app_conf("ONLINE_MSN")); $GLOBALS['tmpl']->assign("online_qq", $qq); $GLOBALS['tmpl']->assign("online_msn", $msn); //输出页面的标题关键词与描述 $GLOBALS['tmpl']->assign("shop_info", get_shop_info()); //输出系统文章 $system_article = get_article_list(8, 0, "ac.type_id = 3", "", true); $GLOBALS['tmpl']->assign("system_article", $system_article['list']); //输出帮助 $deal_help = get_help(); $GLOBALS['tmpl']->assign("deal_help", $deal_help); //开始输出友情链接 $f_link_group = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "link_group where is_effect = 1 order by sort desc"); foreach ($f_link_group as $k => $v) { $g_links = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "link where is_effect = 1 and show_index = 1 and group_id = " . $v['id'] . " order by sort desc"); if ($g_links) { foreach ($g_links as $kk => $vv) { if (substr($vv['url'], 0, 7) == 'http://') { $g_links[$kk]['url'] = str_replace("http://", "", $vv['url']); }
public function notify() { vendor('WxPayPubHelper.WxPayPubHelper'); //使用通用通知接口 $notify = new \Notify_pub(); //存储微信的回调 $xml = $GLOBALS['HTTP_RAW_POST_DATA']; $notify->saveData($xml); //验证签名,并回应微信。 //对后台通知交互时,如果微信收到商户的应答不是成功或超时,微信认为通知失败, //微信会通过一定的策略(如30分钟共8次)定期重新发起通知, //尽可能提高通知的成功率,但微信不保证通知最终能成功。 if ($notify->checkSign() == FALSE) { $notify->setReturnParameter("return_code", "FAIL"); //返回状态码 $notify->setReturnParameter("return_msg", "签名失败"); //返回信息 } else { $notify->setReturnParameter("return_code", "SUCCESS"); //设置返回码 } $returnXml = $notify->returnXml(); echo $returnXml; //==商户根据实际情况设置相应的处理流程,此处仅作举例======= //以log文件形式记录回调信息 // $log_ = new Log_(); $log_name = 'Public/notify_url.log'; //log文件路径 log_result($log_name, "【接收到的notify通知】:\n" . $xml . "\n"); if ($notify->checkSign() == TRUE) { if ($notify->data["return_code"] == "FAIL") { //此处应该更新一下订单状态,商户自行增删操作 log_result($log_name, "【通信出错】:\n" . $xml . "\n"); } elseif ($notify->data["result_code"] == "FAIL") { //此处应该更新一下订单状态,商户自行增删操作 log_result($log_name, "【业务出错】:\n" . $xml . "\n"); } else { //此处应该更新一下订单状态,商户自行增删操作 log_result($log_name, "【支付成功】:\n" . $xml . "\n"); list($order_id) = explode('_', $notify->data['out_trade_no']); $order_info = M('Order')->where(array('order_id' => $order_id))->find(); $order_info['product_name'] = get_product_info($order_info['product_id']); if ($order_info && $order_info['status'] == 1) { $options = array('appid' => \WxPayConf_pub::APPID, 'appsecret' => \WxPayConf_pub::APPSECRET); $WX = new \Vendor\TPWechat($options); // 给客户发 $end_time = strtotime('+3 day'); $temp = array('touser' => get_shop_info($order_info['user_id'], 'openid'), 'template_id' => 'hIPbD2pnKDr-oUt5LdR3tFlAn2WaFdLi8KTRzSrvgH0', 'url' => \WxPayConf_pub::JS_API_CALL_URL . U('Order/index', array('order_id' => $order_id)), 'topcolor' => '#FF0000', 'data' => array('first' => array('value' => '你好,【' . $order_info['product_name'] . '】订单已经完成支付'), 'keyword1' => array('value' => $order_info['order_id']), 'keyword2' => array('value' => '支付成功(等待卖家发货)', 'color' => '#FF0000'), 'keyword3' => array('value' => $order_info['product_name']), 'remark' => array('value' => '违约有效期:' . date('Y-m-d H:i:s', $end_time)))); $WX->sendTemplateMessage($temp); // 给商家发 $temp['touser'] = get_shop_info($order_info['shop_id'], 'openid'); $temp['data']['first']['value'] = '你好,【' . $order_info['product_name'] . '】订单已经完成支付,请尽快发货'; $WX->sendTemplateMessage($temp); // 更新支付状态 $data = array('status' => 2, 'update_time' => NOW_TIME, 'end_time' => $end_time); M('Order')->where(array('order_id' => $order_info['order_id']))->save($data); $data = array('action' => 1, 'order_id' => $notify->data['out_trade_no'], 'fee' => $notify->data['total_fee'], 'time' => NOW_TIME); M('Pay_log')->add($data); } } //商户自行增加处理流程, //例如:更新订单状态 //例如:数据库操作 //例如:推送支付完成信息 } }