Example #1
0
 public function __construct()
 {
     parent::__construct();
     //读取语言包
     Language::read('member_groupbuy,home_cart_index');
     //检查抢购功能是否开启
     if (intval(C('groupbuy_allow')) !== 1) {
         showMessage(Language::get('groupbuy_unavailable'), urlShop(), '', 'error');
     }
     //分类导航
     $nav_link = array(0 => array('title' => Language::get('homepage'), 'link' => SHOP_SITE_URL), 1 => array('title' => Language::get('nc_groupbuy')));
     Tpl::output('nav_link_list', $nav_link);
     Tpl::setLayout('home_groupbuy_layout');
     Tpl::output('index_sign', 'groupbuy');
     if ($_GET['op'] != 'groupbuy_detail') {
         // 抢购价格区间
         $this->groupbuy_price = rkcache('groupbuy_price', true);
         Tpl::output('price_list', $this->groupbuy_price);
         $model_groupbuy = Model('groupbuy');
         // 线上抢购分类
         $this->groupbuy_classes = $model_groupbuy->getGroupbuyClasses();
         Tpl::output('groupbuy_classes', $this->groupbuy_classes);
         // 虚拟抢购分类
         $this->groupbuy_vr_classes = $model_groupbuy->getGroupbuyVrClasses();
         Tpl::output('groupbuy_vr_classes', $this->groupbuy_vr_classes);
         // 虚拟抢购城市
         $this->groupbuy_vr_cities = $model_groupbuy->getGroupbuyVrCities();
         Tpl::output('groupbuy_vr_cities', $this->groupbuy_vr_cities);
         Tpl::output('city_name', $this->groupbuy_vr_cities['name'][cookie('city_id')]);
     }
 }
Example #2
0
 /**
  * 咨询管理
  */
 public function consultingOp()
 {
     $condition = array();
     if (chksubmit()) {
         $member_name = trim($_GET['member_name']);
         if ($member_name != '') {
             $condition['member_name'] = array('like', '%' . $member_name . '%');
             Tpl::output('member_name', $member_name);
         }
         $consult_content = trim($_GET['consult_content']);
         if ($consult_content != '') {
             $condition['consult_content'] = array('like', '%' . $consult_content . '%');
             Tpl::output('consult_content', $consult_content);
         }
         $ctid = intval($_GET['ctid']);
         if ($ctid > 0) {
             $condition['ct_id'] = $ctid;
             Tpl::output('ctid', $ctid);
         }
     }
     $model_consult = Model('consult');
     $consult_list = $model_consult->getConsultList($condition, '*', 0, 10);
     Tpl::output('show_page', $model_consult->showpage());
     Tpl::output('consult_list', $consult_list);
     // 咨询类型
     $consult_type = rkcache('consult_type', true);
     Tpl::output('consult_type', $consult_type);
     Tpl::showpage('consulting.index');
 }
Example #3
0
 public function __construct()
 {
     parent::__construct();
     Language::read('stat');
     import('function.statistics');
     import('function.datehelper');
     $model = Model('stat');
     //存储参数
     $this->search_arr = $_REQUEST;
     //处理搜索时间
     if (in_array($_REQUEST['op'], array('hotrank', 'storesales'))) {
         $this->search_arr = $model->dealwithSearchTime($this->search_arr);
         //获得系统年份
         $year_arr = getSystemYearArr();
         //获得系统月份
         $month_arr = getSystemMonthArr();
         //获得本月的周时间段
         $week_arr = getMonthWeekArr($this->search_arr['week']['current_year'], $this->search_arr['week']['current_month']);
         Tpl::output('year_arr', $year_arr);
         Tpl::output('month_arr', $month_arr);
         Tpl::output('week_arr', $week_arr);
     }
     Tpl::output('search_arr', $this->search_arr);
     //店铺分类
     $this->store_class = rkcache('store_class', true);
     Tpl::output('store_class', $this->store_class);
 }
Example #4
0
    /**
     * 获取自营店铺的ID
     *
     * @param boolean $bind_all_gc = false 是否只获取绑定全部类目的自营店 默认否(即全部自营店)
     * @return array
     */
    public function getOwnShopIds($bind_all_gc = false) {

        $data = $this->ownShopIds;

        // 属性为空则取缓存
        if (!$data) {
            $data = rkcache('own_shop_ids');

            // 缓存为空则查库
            if (!$data) {
                $data = array();
                $all_own_shops = $this->table('store')->field('store_id,bind_all_gc')->where(array(
                    'is_own_shop' => 1,
                ))->select();
                foreach ((array) $all_own_shops as $v) {
                    $data[$v['store_id']] = (int) (bool) $v['bind_all_gc'];
                }

                // 写入缓存
                wkcache('own_shop_ids', $data);
            }

            // 写入属性
            $this->ownShopIds = $data;
        }

        return array_keys($bind_all_gc ? array_filter($data) : $data);
    }
Example #5
0
 public function send($param = array())
 {
     $msg_tpl = rkcache('store_msg_tpl', true);
     if (!isset($msg_tpl[$this->code]) || $this->store_id <= 0) {
         return false;
     }
     $tpl_info = $msg_tpl[$this->code];
     $setting_info = Model('store_msg_setting')->getStoreMsgSettingInfo(array('smt_code' => $this->code, 'store_id' => $this->store_id));
     // 发送站内信
     if ($tpl_info['smt_message_switch'] && ($tpl_info['smt_message_forced'] || $setting_info['sms_message_switch'])) {
         $message = ncReplaceText($tpl_info['smt_message_content'], $param);
         $this->sendMessage($message);
     }
     // 发送短消息
     if ($tpl_info['smt_short_switch'] && $setting_info['sms_short_number'] != '' && ($tpl_info['smt_short_forced'] || $setting_info['sms_short_switch'])) {
         $param['site_name'] = C('site_name');
         $message = ncReplaceText($tpl_info['smt_short_content'], $param);
         $this->sendShort($setting_info['sms_short_number'], $message);
     }
     // 发送邮件
     if ($tpl_info['smt_mail_switch'] && $setting_info['sms_mail_number'] != '' && ($tpl_info['smt_mail_forced'] || $setting_info['sms_mail_switch'])) {
         $param['site_name'] = C('site_name');
         $param['mail_send_time'] = date('Y-m-d H:i:s');
         $subject = ncReplaceText($tpl_info['smt_mail_subject'], $param);
         $message = ncReplaceText($tpl_info['smt_mail_content'], $param);
         $this->sendMail($setting_info['sms_mail_number'], $subject, $message);
     }
 }
Example #6
0
    /**
     * 商品咨询列表页
     */
    public function consult_listOp(){
        $consult	= Model('consult');
        $list_consult	= array();
        $where = array();
        if (trim($_GET['type']) == 'to_reply') {
            $where['consult_reply'] = array('eq', '');
        } elseif (trim($_GET['type'] == 'replied')) {
            $where['consult_reply'] = array('neq', '');
        }
        if (intval($_GET['ctid']) > 0) {
            $where['ct_id'] = intval($_GET['ctid']);
        }
        $where['store_id'] = $_SESSION['store_id'];
        $list_consult	= $consult->getConsultList($where,'*', 0, 10);
        Tpl::output('show_page',$consult->showpage());
        Tpl::output('list_consult',$list_consult);

        // 咨询类型
        $consult_type = rkcache('consult_type', true);
        Tpl::output('consult_type', $consult_type);

        $_GET['type']	= empty($_GET['type'])?'consult_list':$_GET['type'];
        self::profile_menu('consult',$_GET['type']);
        Tpl::showpage('store_consult_manage');
    }
Example #7
0
 /**
  * 构造函数
  */
 public function __construct()
 {
     /**
      * 读取通用、布局的语言包
      */
     Language::read('common');
     Language::read('microshop');
     /**
      * 判断微商城是否关闭
      */
     if (C('microshop_isuse') != '1') {
         header('location: ' . SHOP_SITE_URL);
         die;
     }
     /**
      * 设置布局文件内容
      */
     Tpl::setLayout('microshop_layout');
     /**
      * 转码
      */
     if ($_GET['column'] && strtoupper(CHARSET) == 'GBK') {
         $_GET = Language::getGBK($_GET);
     }
     /**
      * 获取导航
      */
     Tpl::output('nav_list', rkcache('nav', true));
     /**
      * 搜索类型列表
      */
     $search_type = array();
     $search_type['goods'] = Language::get('nc_microshop_goods');
     $search_type['personal'] = Language::get('nc_microshop_personal');
     $search_type['store'] = Language::get('nc_microshop_store');
     //$search_type['album'] = Language::get('nc_microshop_album');
     Tpl::output('search_type', $search_type);
     /**
      * 登录后读取用户头像
      */
     if (!empty($_SESSION['member_id']) && intval($_SESSION['member_id']) > 0) {
         self::get_member_avatar($_SESSION['member_id']);
     }
     /**
      * 系统状态检查
      */
     if (!C('site_status')) {
         halt(C('closed_reason'));
     }
     /**
      * seo
      */
     Tpl::output('html_title', Language::get('nc_microshop') . '-' . C('site_name') . ' ');
     Tpl::output('seo_keywords', C('microshop_seo_keywords'));
     Tpl::output('seo_description', C('microshop_seo_description'));
 }
Example #8
0
 /**
  * 列表
  */
 public function mb_home_listOp()
 {
     $model = Model('mb_home');
     $h_list = $model->getMbHomeList(array());
     Tpl::output('h_list', $h_list);
     //商品分类
     $goods_class = ($nav = F('goods_class')) ? $nav : rkcache('goods_class', true, 'file');
     Tpl::output('goods_class', $goods_class);
     Tpl::showpage('mb_home.list');
 }
Example #9
0
 /**
  * 自提物流列表
  */
 public function get_zt_listOp()
 {
     $express_list = rkcache('express', true);
     foreach ($express_list as $k => $v) {
         if ($v['e_zt_state'] == '0') {
             unset($express_list[$k]);
         }
     }
     output_data(array('express_array' => $express_list));
 }
Example #10
0
 /**
  * 根据编号查询快递列表
  */
 public function getExpressListByID($id = null)
 {
     $express_list = rkcache('express', true);
     if (!empty($id)) {
         $id_array = explode(',', $id);
         foreach ($express_list as $key => $value) {
             if (!in_array($key, $id_array)) {
                 unset($express_list[$key]);
             }
         }
         return $express_list;
     } else {
         return array();
     }
 }
Example #11
0
 /**
  * get setting
  */
 private static function parse_conf(&$setting_config)
 {
     $nc_config = $GLOBALS['config'];
     if (is_array($nc_config['db']['slave']) && !empty($nc_config['db']['slave'])) {
         $dbslave = $nc_config['db']['slave'];
         $sid = array_rand($dbslave);
         $nc_config['db']['slave'] = $dbslave[$sid];
     } else {
         $nc_config['db']['slave'] = $nc_config['db'][1];
     }
     $nc_config['db']['master'] = $nc_config['db'][1];
     $setting_config = $nc_config;
     $setting = ($setting = rkcache('setting')) ? $setting : rkcache('setting', true);
     //$setting['hao_version'] = 'Copyright 2015 <a href="http://shopnc.club" target="_blank">shopnc.club</a> All rights reserved.<br />本演示来源于<a href="http://shopnc.club" target="_blank">shopnc.club</a>';
     $setting_config = array_merge_recursive($setting, $nc_config);
 }
Example #12
0
 /**
  * get setting
  */
 private static function parse_conf(&$setting_config)
 {
     $nc_config = $GLOBALS['config'];
     if (is_array($nc_config['db']['slave']) && !empty($nc_config['db']['slave'])) {
         $dbslave = $nc_config['db']['slave'];
         $sid = array_rand($dbslave);
         $nc_config['db']['slave'] = $dbslave[$sid];
     } else {
         $nc_config['db']['slave'] = $nc_config['db'][1];
     }
     $nc_config['db']['master'] = $nc_config['db'][1];
     $setting_config = $nc_config;
     $setting = ($setting = rkcache('setting')) ? $setting : rkcache('setting', true);
     $setting['shopnc_version'] = 'Copyright 2015</a>';
     $setting_config = array_merge_recursive($setting, $nc_config);
 }
Example #13
0
 /**
  * get setting
  */
 private static function parse_conf(&$setting_config)
 {
     $nc_config = $GLOBALS['config'];
     if (is_array($nc_config['db']['slave']) && !empty($nc_config['db']['slave'])) {
         $dbslave = $nc_config['db']['slave'];
         $sid = array_rand($dbslave);
         $nc_config['db']['slave'] = $dbslave[$sid];
     } else {
         $nc_config['db']['slave'] = $nc_config['db'][1];
     }
     $nc_config['db']['master'] = $nc_config['db'][1];
     $setting_config = $nc_config;
     $setting = ($setting = rkcache('setting')) ? $setting : rkcache('setting', true);
     $setting['shopnc_version'] = 'Copyright 2016 <a href="http://www.corecreate.cn" target="_blank">www.corecreate.cn</a> All rights reserved.<br />中国诚信网<a href="http://www.zhongguocx.org:85" target="_blank">www.zhongguocx.org:85</a>';
     $setting_config = array_merge_recursive($setting, $nc_config);
 }
Example #14
0
 /**
  * get setting
  */
 private static function parse_conf(&$setting_config)
 {
     $nc_config = $GLOBALS['config'];
     if (is_array($nc_config['db']['slave']) && !empty($nc_config['db']['slave'])) {
         $dbslave = $nc_config['db']['slave'];
         $sid = array_rand($dbslave);
         $nc_config['db']['slave'] = $dbslave[$sid];
     } else {
         $nc_config['db']['slave'] = $nc_config['db'][1];
     }
     $nc_config['db']['master'] = $nc_config['db'][1];
     $setting_config = $nc_config;
     $setting = ($setting = rkcache('setting')) ? $setting : rkcache('setting', true);
     $setting['shopnc_version'] = 'Copyright 2007-2014 <a href="http://www.xiaobenup.com" target="_blank">bbs.33hao.com</a> All rights reserved.<br />本演示来源于<a href="http://33haocom.taobao.com" target="_blank">33haocom.taobao.com</a>,Powered by ShopNC';
     $setting_config = array_merge_recursive($setting, $nc_config);
 }
Example #15
0
File: base.php Project: noikiy/ejia
	/**
	 * get setting
	 */
	private static function parse_conf(&$setting_config){
		$nc_config = $GLOBALS['config'];
		if(is_array($nc_config['db']['slave']) && !empty($nc_config['db']['slave'])){
			$dbslave = $nc_config['db']['slave'];
			$sid     = array_rand($dbslave);
			$nc_config['db']['slave'] = $dbslave[$sid];
		}else{
			$nc_config['db']['slave'] = $nc_config['db'][1];
		}
		$nc_config['db']['master'] = $nc_config['db'][1];
		$setting_config = $nc_config;
		$setting = ($setting = rkcache('setting')) ? $setting : rkcache('setting',true);
		$setting['shopnc_version'] = 'Copyright 2007-2015 All rights reserved.<br /><a href="javascript:;"><img src="/data/upload/shop/adv/img1.jpg"></a><a href="javascript:;"><img src="/data/upload/shop/adv/img2.jpg"></a><a href="javascript:;"><img src="/data/upload/shop/adv/img3.jpg"></a><a href="javascript:;"><img src="/data/upload/shop/adv/img4.jpg"></a>
';
		$setting_config = array_merge_recursive($setting,$nc_config);
	}
Example #16
0
 /**
  * 构造函数
  */
 public function __construct(){
     /**
      * 读取通用、布局的语言包
      */
     Language::read('common');
     /**
      * 设置布局文件内容
      */
     Tpl::setLayout('delivery_layout');
     /**
      * SEO
      */
     $this->SEO();
     /**
      * 获取导航
      */
     Tpl::output('nav_list', rkcache('nav',true));
 }
Example #17
0
 /**
  * 生成表结构信息
  *
  * @param string $table
  * @return
  */
 public function tableInfo($table)
 {
     if (empty($table)) {
         return false;
     }
     //只取主键,find(2)等自动匹配主键时使用
     if (C('cache_open')) {
         $this->fields = rkcache('field/_pk', __CLASS__ . '::fetchTablePkArray');
     } else {
         if (file_exists(BASE_DATA_PATH . '/cache/fields/_pk.php')) {
             $this->fields = (require BASE_DATA_PATH . '/cache/fields/_pk.php');
         } else {
             $_pk_array = self::fetchTablePkArray();
             F('_pk', $_pk_array, 'cache/fields');
             $this->fields = $_pk_array;
         }
     }
     return $this->fields[$table];
 }
Example #18
0
 public function send($param = array())
 {
     $msg_tpl = rkcache('member_msg_tpl', true);
     //        if (!isset($msg_tpl[$this->code]) || $this->member_id <= 0) {
     //            return false;
     //        }
     $this->pushAndroidAll($param);
     $tpl_info = $msg_tpl[$this->code];
     $setting_info = Model('member_msg_setting')->getMemberMsgSettingInfo(array('mmt_code' => $this->code, 'member_id' => $this->member_id), 'is_receive');
     if (empty($setting_info) || $setting_info['is_receive']) {
         // 发送站内信
         if ($tpl_info['mmt_message_switch']) {
             $message = ncReplaceText($tpl_info['mmt_message_content'], $param);
             $this->sendMessage($message);
         }
         // 发送短消息
         if ($tpl_info['mmt_short_switch']) {
             $this->getMemberInfo();
             if (!empty($this->mobile)) {
                 $this->member_info['member_mobile'] = $this->mobile;
             }
             if ($this->member_info['member_mobile_bind'] && !empty($this->member_info['member_mobile'])) {
                 $param['site_name'] = C('site_name');
                 $message = ncReplaceText($tpl_info['mmt_short_content'], $param);
                 $this->sendShort($this->member_info['member_mobile'], $message);
             }
         }
         // 发送邮件
         if ($tpl_info['mmt_mail_switch']) {
             $this->getMemberInfo();
             if (!empty($this->email)) {
                 $this->member_info['member_email'] = $this->email;
             }
             if ($this->member_info['member_email_bind'] && !empty($this->member_info['member_email'])) {
                 $param['site_name'] = C('site_name');
                 $param['mail_send_time'] = date('Y-m-d H:i:s');
                 $subject = ncReplaceText($tpl_info['mmt_mail_subject'], $param);
                 $message = ncReplaceText($tpl_info['mmt_mail_content'], $param);
                 $this->sendMail($this->member_info['member_email'], $subject, $message);
             }
         }
     }
 }
Example #19
0
 /**
  * 获得推荐的热门代金券列表
  * @param int $num 查询条数
  */
 public function getRecommendTemplate($num)
 {
     //查询店铺分类
     $store_class = rkcache('store_class', true);
     //查询推荐的热门代金券列表
     $where = array();
     $where['voucher_t_recommend'] = '1';
     $where['voucher_t_state'] = $this->templatestate_arr['usable'][0];
     $where['voucher_t_end_date'] = array('gt', time());
     $recommend_voucher = $this->getVoucherTemplateList($where, $field = '*', $num, 0, 'voucher_t_id desc');
     if ($recommend_voucher) {
         foreach ($recommend_voucher as $k => $v) {
             $v['voucher_t_sc_name'] = $store_class[$v['voucher_t_sc_id']]['sc_name'];
             $recommend_voucher[$k] = $v;
         }
     }
     return $recommend_voucher;
 }
Example #20
0
 public function step4Op()
 {
     $store_class_ids = array();
     $store_class_names = array();
     if (!empty($_POST['store_class_ids'])) {
         foreach ($_POST['store_class_ids'] as $value) {
             $store_class_ids[] = $value;
         }
     }
     if (!empty($_POST['store_class_names'])) {
         foreach ($_POST['store_class_names'] as $value) {
             $store_class_names[] = $value;
         }
     }
     //取最小级分类最新分佣比例
     $sc_ids = array();
     foreach ($store_class_ids as $v) {
         $v = explode(',', trim($v, ','));
         if (!empty($v) && is_array($v)) {
             $sc_ids[] = end($v);
         }
     }
     if (!empty($sc_ids)) {
         $store_class_commis_rates = array();
         $goods_class_list = Model('goods_class')->getGoodsClassListByIds($sc_ids);
         if (!empty($goods_class_list) && is_array($goods_class_list)) {
             $sc_ids = array();
             foreach ($goods_class_list as $v) {
                 $store_class_commis_rates[] = $v['commis_rate'];
             }
         }
     }
     $param = array();
     $param['seller_name'] = $_POST['seller_name'];
     $param['store_name'] = $_POST['store_name'];
     $param['store_class_ids'] = serialize($store_class_ids);
     $param['store_class_names'] = serialize($store_class_names);
     $param['joinin_year'] = intval($_POST['joinin_year']);
     $param['joinin_state'] = STORE_JOIN_STATE_NEW;
     $param['store_class_commis_rates'] = implode(',', $store_class_commis_rates);
     //取店铺等级信息
     $grade_list = rkcache('store_grade', true);
     if (!empty($grade_list[$_POST['sg_id']])) {
         $param['sg_id'] = $_POST['sg_id'];
         $param['sg_name'] = $grade_list[$_POST['sg_id']]['sg_name'];
         $param['sg_info'] = serialize(array('sg_price' => $grade_list[$_POST['sg_id']]['sg_price']));
     }
     //取最新店铺分类信息
     $store_class_info = Model('store_class')->getStoreClassInfo(array('sc_id' => intval($_POST['sc_id'])));
     if ($store_class_info) {
         $param['sc_id'] = $store_class_info['sc_id'];
         $param['sc_name'] = $store_class_info['sc_name'];
         $param['sc_bail'] = $store_class_info['sc_bail'];
     }
     //店铺应付款
     $param['paying_amount'] = floatval($grade_list[$_POST['sg_id']]['sg_price']) * $param['joinin_year'] + floatval($param['sc_bail']);
     $this->step4_save_valid($param);
     $model_store_joinin = Model('store_joinin');
     $model_store_joinin->modify($param, array('member_id' => $_SESSION['member_id']));
     @header('location: index.php?act=store_joinin');
 }
Example #21
0
 /**
  * 获取团购列表
  */
 public function get_oversea_listOp()
 {
     $size = 10;
     $condition = array();
     $condition['is_vr'] = 0;
     $condition['state'] = 20;
     $condition['goods_type'] = array('gt', 0);
     $type = intval($_GET['type']);
     if ($type == '1') {
         $condition['start_time'] = array('gt', TIMESTAMP);
     } else {
         $condition['start_time'] = array('lt', TIMESTAMP);
         $condition['end_time'] = array('gt', TIMESTAMP);
     }
     if ($type == '2') {
         $condition['end_time'] = array('lt', strtotime("today") + 86400);
     } elseif ($type == '3') {
         $size = 2;
     }
     $page = intval($_GET['page']);
     $page = $page <= 0 ? 1 : $page;
     $group_list = Model('groupbuy')->field('goods_id')->where($condition)->order('start_time desc')->limit(($page - 1) * $size . ',' . $size)->select();
     if ($group_list) {
         //国家
         $country_list = rkcache('country');
         $model_goods = Model('goods');
         foreach ($group_list as $k => $v) {
             $goods = $model_goods->getGoodsInfoByID($v['goods_id'], 'country_id,goods_promotion_price,goods_jingle,goods_image,goods_name,goods_marketprice,goods_storage');
             $v['img_url'] = thumb($goods, 360);
             $v['soon'] = $type == 1 ? 1 : 0;
             $v['country_icon'] = $country_list[$goods['country_id']]['country_img_url'];
             $group_list[$k] = array_merge($v, $goods);
         }
     }
     output_data(array('group_list' => $group_list));
 }
Example #22
0
 /**
  * 申请续签
  */
 public function reopen_addOp()
 {
     if (!chksubmit()) {
         exit;
     }
     if (intval($_POST['re_grade_id']) <= 0 || intval($_POST['re_year']) <= 0) {
         exit;
     }
     // 店铺信息
     $model_store = Model('store');
     $store_info = $this->store_info;
     if (empty($store_info['store_end_time'])) {
         showDialog('您的店铺使用期限无限制,无须续签');
     }
     $model_store_reopen = Model('store_reopen');
     //如果存在有未上传凭证或审核中的信息,则不能再申请续签
     $condition = array();
     $condition['re_state'] = array('in', array(0, 1));
     $condition['re_store_id'] = $_SESSION['store_id'];
     if ($model_store_reopen->getStoreReopenCount($condition)) {
         showDialog('目前尚存在申请中的续签信息,不能重复申请');
     }
     $data = array();
     //取店铺等级信息
     $grade_list = rkcache('store_grade', true);
     if (empty($grade_list[$_POST['re_grade_id']])) {
         exit;
     }
     //取得店铺信息
     $data['re_grade_id'] = $_POST['re_grade_id'];
     $data['re_grade_name'] = $grade_list[$_POST['re_grade_id']]['sg_name'];
     $data['re_grade_price'] = $grade_list[$_POST['re_grade_id']]['sg_price'];
     $data['re_store_id'] = $_SESSION['store_id'];
     $data['re_store_name'] = $_SESSION['store_name'];
     $data['re_year'] = intval($_POST['re_year']);
     $data['re_pay_amount'] = $data['re_grade_price'] * $data['re_year'];
     $data['re_create_time'] = TIMESTAMP;
     if ($data['re_pay_amount'] == 0) {
         //             $data['re_start_time'] = strtotime(date('Y-m-d 0:0:0',$store_info['store_end_time']))+24*3600;
         //             $data['re_end_time'] = strtotime(date('Y-m-d 23:59:59', $data['re_start_time'])." +".intval($data['re_year'])." year");
         $data['re_state'] = 1;
     }
     $insert = $model_store_reopen->addStoreReopen($data);
     if ($insert) {
         if ($data['re_pay_amount'] == 0) {
             // 	            $model_store->editStore(array('store_end_time'=>$data['re_end_time']),array('store_id'=>$_SESSION['store_id']));
             showDialog('您的申请已经提交,请等待管理员审核', 'reload', 'succ', '', 5);
         } else {
             showDialog(Language::get('nc_common_save_succ') . ',需付款金额' . ncPriceFormat($data['re_pay_amount']) . '元,请尽快完成付款,付款完成后请上传付款凭证', 'reload', 'succ', '', 5);
         }
     } else {
         showDialog(Language::get('nc_common_del_fail'));
     }
 }
Example #23
0
 /**
  * circle member level
  */
 public function levelOp()
 {
     // Circle information
     $this->circleInfo();
     // Membership information
     $this->circleMemberInfo();
     // Members to join the circle list
     $this->memberJoinCircle();
     if (chksubmit()) {
         $insert = array();
         $insert['circle_id'] = $this->c_id;
         $mld_array = rkcache('circle_level') ? rkcache('circle_level') : rkcache('circle_level', true);
         if ($_POST['levelset'] == 'custom') {
             $insert['mlref_id'] = null;
             $insert['ml_1'] = $_POST['levelname']['1'] != '' ? $_POST['levelname']['1'] : $mld_array['1']['mld_name'];
             $insert['ml_2'] = $_POST['levelname']['2'] != '' ? $_POST['levelname']['2'] : $mld_array['2']['mld_name'];
             $insert['ml_3'] = $_POST['levelname']['3'] != '' ? $_POST['levelname']['3'] : $mld_array['3']['mld_name'];
             $insert['ml_4'] = $_POST['levelname']['4'] != '' ? $_POST['levelname']['4'] : $mld_array['4']['mld_name'];
             $insert['ml_5'] = $_POST['levelname']['5'] != '' ? $_POST['levelname']['5'] : $mld_array['5']['mld_name'];
             $insert['ml_6'] = $_POST['levelname']['6'] != '' ? $_POST['levelname']['6'] : $mld_array['6']['mld_name'];
             $insert['ml_7'] = $_POST['levelname']['7'] != '' ? $_POST['levelname']['7'] : $mld_array['7']['mld_name'];
             $insert['ml_8'] = $_POST['levelname']['8'] != '' ? $_POST['levelname']['8'] : $mld_array['8']['mld_name'];
             $insert['ml_9'] = $_POST['levelname']['9'] != '' ? $_POST['levelname']['9'] : $mld_array['9']['mld_name'];
             $insert['ml_10'] = $_POST['levelname']['10'] != '' ? $_POST['levelname']['10'] : $mld_array['10']['mld_name'];
             $insert['ml_11'] = $_POST['levelname']['11'] != '' ? $_POST['levelname']['11'] : $mld_array['11']['mld_name'];
             $insert['ml_12'] = $_POST['levelname']['12'] != '' ? $_POST['levelname']['12'] : $mld_array['12']['mld_name'];
             $insert['ml_13'] = $_POST['levelname']['13'] != '' ? $_POST['levelname']['13'] : $mld_array['13']['mld_name'];
             $insert['ml_14'] = $_POST['levelname']['14'] != '' ? $_POST['levelname']['14'] : $mld_array['14']['mld_name'];
             $insert['ml_15'] = $_POST['levelname']['15'] != '' ? $_POST['levelname']['15'] : $mld_array['15']['mld_name'];
             $insert['ml_16'] = $_POST['levelname']['16'] != '' ? $_POST['levelname']['16'] : $mld_array['16']['mld_name'];
         } else {
             $levelset = intval($_POST['levelset']);
             if ($levelset) {
                 $mlref_info = Model()->table('circle_mlref')->find($levelset);
             }
             if (!empty($mlref_info)) {
                 $insert['mlref_id'] = $mlref_info['mlref_id'];
                 $insert['ml_1'] = $mlref_info['mlref_1'];
                 $insert['ml_2'] = $mlref_info['mlref_2'];
                 $insert['ml_3'] = $mlref_info['mlref_3'];
                 $insert['ml_4'] = $mlref_info['mlref_4'];
                 $insert['ml_5'] = $mlref_info['mlref_5'];
                 $insert['ml_6'] = $mlref_info['mlref_6'];
                 $insert['ml_7'] = $mlref_info['mlref_7'];
                 $insert['ml_8'] = $mlref_info['mlref_8'];
                 $insert['ml_9'] = $mlref_info['mlref_9'];
                 $insert['ml_10'] = $mlref_info['mlref_10'];
                 $insert['ml_11'] = $mlref_info['mlref_11'];
                 $insert['ml_12'] = $mlref_info['mlref_12'];
                 $insert['ml_13'] = $mlref_info['mlref_13'];
                 $insert['ml_14'] = $mlref_info['mlref_14'];
                 $insert['ml_15'] = $mlref_info['mlref_15'];
                 $insert['ml_16'] = $mlref_info['mlref_16'];
             } else {
                 $insert['mlref_id'] = 0;
                 $insert['ml_1'] = $mld_array['1']['mld_name'];
                 $insert['ml_2'] = $mld_array['2']['mld_name'];
                 $insert['ml_3'] = $mld_array['3']['mld_name'];
                 $insert['ml_4'] = $mld_array['4']['mld_name'];
                 $insert['ml_5'] = $mld_array['5']['mld_name'];
                 $insert['ml_6'] = $mld_array['6']['mld_name'];
                 $insert['ml_7'] = $mld_array['7']['mld_name'];
                 $insert['ml_8'] = $mld_array['8']['mld_name'];
                 $insert['ml_9'] = $mld_array['9']['mld_name'];
                 $insert['ml_10'] = $mld_array['10']['mld_name'];
                 $insert['ml_11'] = $mld_array['11']['mld_name'];
                 $insert['ml_12'] = $mld_array['12']['mld_name'];
                 $insert['ml_13'] = $mld_array['13']['mld_name'];
                 $insert['ml_14'] = $mld_array['14']['mld_name'];
                 $insert['ml_15'] = $mld_array['15']['mld_name'];
                 $insert['ml_16'] = $mld_array['16']['mld_name'];
             }
         }
         $rs = Model('circle_level')->levelInsert($insert, true);
         showDialog(L('nc_common_op_succ'), 'reload', 'succ');
     }
     $model = Model();
     // Defaule Member Title list
     $mldefault_list = rkcache('circle_level') ? rkcache('circle_level') : rkcache('circle_level', true);
     if (!empty($mldefault_list)) {
         $mld_array = array();
         foreach ($mldefault_list as $val) {
             $mld_array[$val['mld_id']]['name'] = $val['mld_name'];
             $mld_array[$val['mld_id']]['exp'] = $val['mld_exp'];
         }
         // Refer to the Member Title list
         $mlref_list = $model->table('circle_mlref')->where(array('mlref_status' => 1))->select();
         // tidy
         if (!empty($mlref_list)) {
             $mlr_array = array();
             foreach ($mlref_list as $val) {
                 $mlr_array[$val['mlref_id']]['name'] = $val['mlref_name'];
                 $mlr_array[$val['mlref_id']]['info'][1]['name'] = $val['mlref_1'];
                 $mlr_array[$val['mlref_id']]['info'][2]['name'] = $val['mlref_2'];
                 $mlr_array[$val['mlref_id']]['info'][3]['name'] = $val['mlref_3'];
                 $mlr_array[$val['mlref_id']]['info'][4]['name'] = $val['mlref_4'];
                 $mlr_array[$val['mlref_id']]['info'][5]['name'] = $val['mlref_5'];
                 $mlr_array[$val['mlref_id']]['info'][6]['name'] = $val['mlref_6'];
                 $mlr_array[$val['mlref_id']]['info'][7]['name'] = $val['mlref_7'];
                 $mlr_array[$val['mlref_id']]['info'][8]['name'] = $val['mlref_8'];
                 $mlr_array[$val['mlref_id']]['info'][9]['name'] = $val['mlref_9'];
                 $mlr_array[$val['mlref_id']]['info'][10]['name'] = $val['mlref_10'];
                 $mlr_array[$val['mlref_id']]['info'][11]['name'] = $val['mlref_11'];
                 $mlr_array[$val['mlref_id']]['info'][12]['name'] = $val['mlref_12'];
                 $mlr_array[$val['mlref_id']]['info'][13]['name'] = $val['mlref_13'];
                 $mlr_array[$val['mlref_id']]['info'][14]['name'] = $val['mlref_14'];
                 $mlr_array[$val['mlref_id']]['info'][15]['name'] = $val['mlref_15'];
                 $mlr_array[$val['mlref_id']]['info'][16]['name'] = $val['mlref_16'];
             }
         }
         Tpl::output('mld_array', $mld_array);
         Tpl::output('mlr_array', $mlr_array);
     }
     $ml_info = $model->table('circle_ml')->find($this->c_id);
     if (!empty($ml_info)) {
         $ml_array = array();
         $cl_array = array();
         // checked level
         $ml_array['mlref_id'] = $ml_info['mlref_id'];
         if ($ml_info['mlref_id'] == null) {
             $ml_array['info'][1]['name'] = $ml_info['ml_1'];
             $ml_array['info'][2]['name'] = $ml_info['ml_2'];
             $ml_array['info'][3]['name'] = $ml_info['ml_3'];
             $ml_array['info'][4]['name'] = $ml_info['ml_4'];
             $ml_array['info'][5]['name'] = $ml_info['ml_5'];
             $ml_array['info'][6]['name'] = $ml_info['ml_6'];
             $ml_array['info'][7]['name'] = $ml_info['ml_7'];
             $ml_array['info'][8]['name'] = $ml_info['ml_8'];
             $ml_array['info'][9]['name'] = $ml_info['ml_9'];
             $ml_array['info'][10]['name'] = $ml_info['ml_10'];
             $ml_array['info'][11]['name'] = $ml_info['ml_11'];
             $ml_array['info'][12]['name'] = $ml_info['ml_12'];
             $ml_array['info'][13]['name'] = $ml_info['ml_13'];
             $ml_array['info'][14]['name'] = $ml_info['ml_14'];
             $ml_array['info'][15]['name'] = $ml_info['ml_15'];
             $ml_array['info'][16]['name'] = $ml_info['ml_16'];
         }
         Tpl::output('ml_info', $ml_array);
     }
     $this->sidebar_menu('level');
     Tpl::showpage('group_manage_memberlevel');
 }
Example #24
0
 /**
  * 退货记录查看页
  *
  */
 public function viewOp()
 {
     $model_refund = Model('refund_return');
     $condition = array();
     $condition['buyer_id'] = $_SESSION['member_id'];
     $condition['refund_id'] = intval($_GET['return_id']);
     $return_list = $model_refund->getReturnList($condition);
     $return = $return_list[0];
     Tpl::output('return', $return);
     $express_list = rkcache('express', true);
     if ($return['express_id'] > 0 && !empty($return['invoice_no'])) {
         Tpl::output('return_e_name', $express_list[$return['express_id']]['e_name']);
     }
     $info['buyer'] = array();
     if (!empty($return['pic_info'])) {
         $info = unserialize($return['pic_info']);
     }
     Tpl::output('pic_list', $info['buyer']);
     $condition = array();
     $condition['order_id'] = $return['order_id'];
     $model_refund->getRightOrderList($condition, $return['order_goods_id']);
     Tpl::showpage('member_return_view');
 }
Example #25
0
 /**
  * 物流跟踪
  */
 public function search_deliverOp()
 {
     Language::read('member_member_index');
     $lang = Language::getLangContent();
     $order_sn = $_GET['order_sn'];
     if (!is_numeric($order_sn)) {
         showMessage(Language::get('wrong_argument'), '', 'html', 'error');
     }
     $model_order = Model('order');
     $condition['order_sn'] = $order_sn;
     $condition['store_id'] = $_SESSION['store_id'];
     $order_info = $model_order->getOrderInfo($condition, array('order_common', 'order_goods'));
     if (empty($order_info) || $order_info['shipping_code'] == '') {
         showMessage('未找到信息', '', 'html', 'error');
     }
     $order_info['state_info'] = orderState($order_info);
     Tpl::output('order_info', $order_info);
     //卖家发货信息
     $daddress_info = Model('daddress')->getAddressInfo(array('address_id' => $order_info['extend_order_common']['daddress_id']));
     Tpl::output('daddress_info', $daddress_info);
     //取得配送公司代码
     $express = rkcache('express', true);
     Tpl::output('e_code', $express[$order_info['extend_order_common']['shipping_express_id']]['e_code']);
     Tpl::output('e_name', $express[$order_info['extend_order_common']['shipping_express_id']]['e_name']);
     Tpl::output('e_url', $express[$order_info['extend_order_common']['shipping_express_id']]['e_url']);
     Tpl::output('shipping_code', $order_info['shipping_code']);
     self::profile_menu('search', 'search');
     Tpl::showpage('store_deliver.detail');
 }
Example #26
0
 /**
  * 创建圈子
  */
 public function add_groupOp()
 {
     if ($_SESSION['is_login'] != 1) {
         @header('location: ' . SHOP_SITE_URL . '/index.php?act=login&ref_url=' . getRefUrl());
     }
     if (!intval(C('circle_iscreate'))) {
         showMessage(L('circle_grooup_not_create'), '', '', 'error');
     }
     $model = Model();
     // 在验证
     // 允许创建圈子验证
     $where = array();
     $where['circle_masterid'] = $_SESSION['member_id'];
     $create_count = $model->table('circle')->where($where)->count();
     if (intval($create_count) >= C('circle_createsum')) {
         showDialog(L('circle_create_max_error'));
     }
     // 允许加入圈子验证
     $where = array();
     $where['member_id'] = $_SESSION['member_id'];
     $join_count = $model->table('circle_member')->where($where)->count();
     if (intval($join_count) >= C('circle_joinsum')) {
         showDialog(L('circle_join_max_error'));
     }
     if (chksubmit()) {
         /**
          * 验证
          */
         $obj_validate = new Validate();
         $obj_validate->validateparam = array(array("input" => $_POST["c_name"], "require" => "true", "message" => L('circle_name_not_null')));
         $error = $obj_validate->validate();
         if ($error != '') {
             showDialog($error);
         } else {
             $insert = array();
             $insert['circle_name'] = $_POST['c_name'];
             $insert['circle_masterid'] = $_SESSION['member_id'];
             $insert['circle_mastername'] = $_SESSION['member_name'];
             $insert['circle_desc'] = $_POST['c_desc'];
             $insert['circle_tag'] = $_POST['c_tag'];
             $insert['circle_pursuereason'] = $_POST['c_pursuereason'];
             $insert['circle_status'] = 2;
             $insert['is_recommend'] = 0;
             $insert['class_id'] = intval($_POST['class_id']);
             $insert['circle_addtime'] = time();
             $insert['circle_mcount'] = 1;
             $result = $model->table('circle')->insert($insert);
             if ($result) {
                 // Membership level information
                 $data = rkcache('circle_level') ? rkcache('circle_level') : rkcache('circle_level', true);
                 // 把圈主信息加入圈子会员表
                 $insert = array();
                 $insert['member_id'] = $_SESSION['member_id'];
                 $insert['circle_id'] = $result;
                 $insert['circle_name'] = $_POST['c_name'];
                 $insert['member_name'] = $_SESSION['member_name'];
                 $insert['cm_applytime'] = $insert['cm_jointime'] = time();
                 $insert['cm_state'] = 1;
                 $insert['cm_level'] = $data[1]['mld_id'];
                 $insert['cm_levelname'] = $data[1]['mld_name'];
                 $insert['cm_exp'] = 1;
                 $insert['cm_nextexp'] = $data[2]['mld_exp'];
                 $insert['is_identity'] = 1;
                 $insert['cm_lastspeaktime'] = '';
                 $model->table('circle_member')->insert($insert);
                 showDialog(L('nc_common_op_succ'), 'index.php?act=group&c_id=' . $result, 'succ');
             } else {
                 showDialog(L('nc_common_op_fail'));
             }
         }
     }
     Tpl::output('create_count', $create_count);
     Tpl::output('join_count', $join_count);
     // 圈子分类
     $class_list = $model->table('circle_class')->where(array('class_status' => 1))->order('class_sort asc')->select();
     Tpl::output('class_list', $class_list);
     $this->circleSEO(L('circle_create'));
     Tpl::showpage('group_add');
 }
Example #27
0
 /**
  * 获取微信access_token
  */
 private function _get_wx_access_token()
 {
     // 尝试读取缓存的access_token
     $access_token = rkcache('wx_access_token');
     if ($access_token) {
         $access_token = unserialize($access_token);
         // 如果access_token未过期直接返回缓存的access_token
         if ($access_token['time'] > TIMESTAMP) {
             return $access_token['token'];
         }
     }
     $url = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s';
     $url = sprintf($url, $this->payment_config['wxpay_appid'], $this->payment_config['wxpay_appsecret']);
     $re = http_get($url);
     $result = json_decode($re, true);
     if ($result['errcode']) {
         return '';
     }
     // 缓存获取的access_token
     $access_token = array();
     $access_token['token'] = $result['access_token'];
     $access_token['time'] = TIMESTAMP + $result['expires_in'];
     wkcache('wx_access_token', serialize($access_token));
     return $result['access_token'];
 }
Example #28
0
 public function templateeditOp()
 {
     $t_id = intval($_GET['tid']);
     if ($t_id <= 0) {
         $t_id = intval($_POST['tid']);
     }
     if ($t_id <= 0) {
         showMessage(Language::get('param_error'), 'index.php?act=voucher&op=templatelist', '', 'error');
     }
     $model = Model('voucher');
     //查询模板信息
     $param = array();
     $param['voucher_t_id'] = $t_id;
     $t_info = $model->table('voucher_template')->where($param)->find();
     if (empty($t_info)) {
         showMessage(Language::get('param_error'), 'index.php?act=voucher&op=templatelist', 'html', 'error');
     }
     if (chksubmit()) {
         $points = intval($_POST['points']);
         if ($points < 0) {
             showMessage(Language::get('admin_voucher_template_points_error'), '', 'html', 'error');
         }
         $update_arr = array();
         $update_arr['voucher_t_points'] = $points;
         $update_arr['voucher_t_state'] = intval($_POST['tstate']) == $this->templatestate_arr['usable'][0] ? $this->templatestate_arr['usable'][0] : $this->templatestate_arr['disabled'][0];
         $update_arr['voucher_t_recommend'] = intval($_POST['recommend']) == 1 ? 1 : 0;
         $rs = $model->table('voucher_template')->where(array('voucher_t_id' => $t_info['voucher_t_id']))->update($update_arr);
         if ($rs) {
             $this->log(L('nc_edit,nc_voucher_price_manage,admin_voucher_styletemplate') . '[ID:' . $t_id . ']');
             showMessage(Language::get('nc_common_save_succ'), 'index.php?act=voucher&op=templatelist', 'succ');
         } else {
             showMessage(Language::get('nc_common_save_fail'), 'index.php?act=voucher&op=templatelist', 'error');
         }
     } else {
         //查询店铺分类
         $store_class = rkcache('store_class', true);
         TPL::output('store_class', $store_class);
         if (!$t_info['voucher_t_customimg'] || !file_exists(BASE_UPLOAD_PATH . DS . ATTACH_VOUCHER . DS . $t_info['voucher_t_store_id'] . DS . $t_info['voucher_t_customimg'])) {
             $t_info['voucher_t_customimg'] = '';
         } else {
             $t_info['voucher_t_customimg'] = UPLOAD_SITE_URL . DS . ATTACH_VOUCHER . DS . $t_info['voucher_t_store_id'] . DS . $t_info['voucher_t_customimg'];
         }
         TPL::output('t_info', $t_info);
         $this->show_menu('templateedit', 'templateedit');
         Tpl::showpage('voucher.templateedit');
     }
 }
Example #29
0
 public function expressOp()
 {
     $model = Model('store_extend');
     if (chksubmit()) {
         $data['store_id'] = $_SESSION['store_id'];
         if (is_array($_POST['cexpress']) && !empty($_POST['cexpress'])) {
             $data['express'] = implode(',', $_POST['cexpress']);
         } else {
             $data['express'] = '';
         }
         if (!$model->getby_store_id($_SESSION['store_id'])) {
             $result = $model->insert($data);
         } else {
             $result = $model->update($data);
         }
         if ($result) {
             showDialog(Language::get('nc_common_save_succ'), 'reload', 'succ');
         } else {
             showDialog(Language::get('nc_common_save_fail'), 'reload', 'error');
         }
     }
     $express_list = rkcache('express', true);
     //取得店铺启用的快递公司ID
     $express_select = $model->getfby_store_id($_SESSION['store_id'], 'express');
     if (!is_null($express_select)) {
         $express_select = explode(',', $express_select);
     } else {
         $express_select = array();
     }
     Tpl::output('express_select', $express_select);
     //页面输出
     self::profile_menu('daddress', 'express');
     Tpl::output('express_list', $express_list);
     Tpl::showpage('store_deliver_express');
 }
Example #30
0
 /**
  * 产品咨询
  */
 public function consulting_listOp()
 {
     $goods_id = intval($_GET['goods_id']);
     if ($goods_id <= 0) {
         showMessage(Language::get('wrong_argument'), '', 'html', 'error');
     }
     // 商品详细信息
     $model_goods = Model('goods');
     $goods_info = $model_goods->getGoodsInfoByID($goods_id, '*');
     // 验证商品是否存在
     if (empty($goods_info)) {
         showMessage(L('goods_index_no_goods'), '', 'html', 'error');
     }
     Tpl::output('goods', $goods_info);
     $this->getStoreInfo($goods_info['store_id']);
     // 当前位置导航
     $nav_link_list = Model('goods_class')->getGoodsClassNav($goods_info['gc_id'], 0);
     $nav_link_list[] = array('title' => $goods_info['goods_name'], 'link' => urlShop('goods', 'index', array('goods_id' => $goods_id)));
     $nav_link_list[] = array('title' => '商品咨询');
     Tpl::output('nav_link_list', $nav_link_list);
     //得到商品咨询信息
     $model_consult = Model('consult');
     $where = array();
     $where['goods_id'] = $goods_id;
     if (intval($_GET['ctid']) > 0) {
         $where['ct_id'] = intval($_GET['ctid']);
     }
     $consult_list = $model_consult->getConsultList($where, '*', 0, 20);
     Tpl::output('consult_list', $consult_list);
     Tpl::output('show_page', $model_consult->showpage());
     // 咨询类型
     $consult_type = rkcache('consult_type', true);
     Tpl::output('consult_type', $consult_type);
     $seo_param = array();
     $seo_param['name'] = $goods_info['goods_name'];
     $seo_param['key'] = $goods_info['goods_keywords'];
     $seo_param['description'] = $goods_info['goods_description'];
     Model('seo')->type('product')->param($seo_param)->show();
     Tpl::output('consult_able', $this->checkConsultAble($goods_info['store_id']));
     Tpl::showpage('goods.consulting_list');
 }