Example #1
0
 public function personal()
 {
     if (IS_POST) {
         $data = array();
         $data['nickname'] = isset($_POST['nickname']) ? trim($_POST['nickname']) : '';
         $data['avatar'] = isset($_POST['avatar']) ? trim($_POST['avatar']) : '';
         $data['intro'] = isset($_POST['intro']) ? trim($_POST['intro']) : '';
         M('User')->save_user(array('uid' => $this->user_session['uid']), $data);
         $_SESSION['user']['nickname'] = $data['nickname'];
         json_return(0, '设置成功');
     } else {
         if (empty($this->store_session)) {
             $condition_store['uid'] = $this->user_session['uid'];
             $store = D('Store')->where($condition_store)->order('`store_id` DESC')->find();
             if ($store) {
                 if (empty($store['logo'])) {
                     $store['logo'] = 'default_shop_2.jpg';
                 }
                 $_SESSION['store'] = $store;
             } else {
                 pigcms_tips('您需要先创建一个店铺', url('store:select'));
             }
         }
     }
     $this->display();
 }
Example #2
0
 public function case_load()
 {
     if (empty($_POST['page'])) {
         pigcms_tips('非法访问!', 'none');
     }
     if ($_POST['page'] == 'attachment_content') {
         $get_result = M('Attachment')->getListByStoreId($this->store_session['store_id']);
         $this->assign('get_result', $get_result);
     } else {
         if ($_POST['page'] == 'ad_content') {
             $this->_ad_content();
         } else {
             if ($_POST['page'] == 'ad_edit_content') {
                 $this->_ad_edit_content();
             } else {
                 if ($_POST['page'] == 'page_content') {
                     $this->_page_content();
                 } else {
                     if ($_POST['page'] == 'create_page_content') {
                         $this->_create_page_content();
                     } else {
                         if ($_POST['page'] == 'edit_page_content') {
                             $this->_edit_page_content();
                         }
                     }
                 }
             }
         }
     }
     $this->display($_POST['page']);
 }
Example #3
0
 public function load()
 {
     $action = strtolower(trim($_POST['page']));
     if (empty($action)) {
         pigcms_tips('非法访问!', 'none');
     }
     switch ($action) {
         case 'dashboard_content':
             //应用营销概况
             $this->_index_content();
             break;
         case 'present_index':
             $this->_present_index();
             break;
         case 'present_create':
             $this->_present_create();
             break;
         case 'present_edit':
             $this->_present_edit();
             break;
         case 'product_list':
             $this->_product_list();
             breka;
         default:
             //满减/送
         //满减/送
         case 'reward_index':
             $this->_reward_index();
         case 'reward_create':
             $this->_reward_create();
         default:
             break;
     }
     $this->display($_POST['page']);
 }
 public function load()
 {
     $action = strtolower(trim($_POST['page']));
     if (empty($action)) {
         pigcms_tips('非法访问!', 'none');
     }
     switch ($action) {
         //优惠券
         case 'coupon_index':
             $this->_coupon_index();
             break;
             //优惠券添加
         //优惠券添加
         case 'coupon_create':
             $this->_coupon_create();
             break;
         case 'coupon_edit':
             $this->_coupon_edit();
             break;
         case 'fetchlist':
             $this->_fetchlist();
             break;
         default:
             break;
     }
     $this->display($_POST['page']);
 }
Example #5
0
 public function __construct()
 {
     parent::__construct();
     $cate_id = $_GET['id'];
     if (!$cate_id) {
         pigcms_tips('非法访问!', 'none');
     }
     $this->cate_id = $cate_id;
     $this->assign('cid', $cate_id);
 }
Example #6
0
 public function load()
 {
     $action = strtolower(trim($_POST['page']));
     $start_time = isset($_POST['start_time']) ? trim($_POST['start_time']) : '';
     $stop_time = isset($_POST['stop_time']) ? trim($_POST['stop_time']) : '';
     $store_id = isset($_POST['store_id']) ? trim($_POST['store_id']) : $this->store_session['store_id'];
     if (empty($action)) {
         pigcms_tips('非法访问!', 'none');
     }
     switch ($action) {
         case 'index_content':
             $this->_index_content();
             break;
         case 'market_content':
             $this->_market_content();
             break;
         case 'goods_content':
             $this->_goods_content();
             break;
         case 'orders_content':
             $this->_orders_content();
             break;
         case 'order_detail_content':
             $this->_order_detail_content();
             break;
         case 'pay_order_content':
             $this->_pay_order_content();
             break;
         case 'supplier_content':
             $this->_supplier_content();
             break;
         case 'supplier_goods_content':
             $this->_supplier_goods_content();
             break;
         case 'goods_fx_setting_content':
             $this->_goods_fx_setting_content();
             break;
         case 'supplier_market_content':
             $this->_supplier_market_content();
             break;
         case 'edit_goods_content':
             $this->_edit_goods_content();
             break;
         case 'seller_content':
             $this->_seller_content();
             break;
         case 'statistics_content':
             $this->_statistics_content(array('start_time' => $start_time, 'stop_time' => $stop_time, 'store_id' => $store_id));
             break;
         case 'setting_content':
             $this->_setting_content();
             break;
     }
     $this->display($_POST['page']);
 }
Example #7
0
function shows()
{
    $store_id = isset($_GET['id']) ? $_GET['id'] : pigcms_tips('您输入的网址有误', 'none');
    //店铺资料
    $now_store = M('Store')->wap_getStore($store_id);
    if (empty($now_store)) {
        pigcms_tips('您访问的店铺不存在', 'none');
    }
    $action = isset($_GET['action']) ? $_GET['action'] : 'all';
    $orderList = array();
    include display('my_coupon');
    echo ob_get_clean();
}
Example #8
0
 public function __construct()
 {
     import('source.class.checkFunc');
     $checkFunc = new checkFunc();
     if (!function_exists('fdsrejsie3qklwewerzdagf4ds')) {
         exit('error-4');
     }
     $checkFunc->cfdwdgfds3skgfds3szsd3idsj();
     parent::__construct();
     if (!empty($_GET['sessid']) && !empty($_GET['token'])) {
         $_SESSION['sync_store'] = true;
         $user = M('User');
         $userinfo = $user->checkUser(array('session_id' => trim($_GET['sessid']), 'token' => trim($_GET['token'])));
         if (!empty($userinfo)) {
             $_SESSION['user'] = $userinfo;
         }
         if (!empty($_GET['store_id'])) {
             $tmp_store = M('Store')->getStoreById($_GET['store_id'], $userinfo['uid']);
             if ($tmp_store) {
                 if (empty($tmp_store['logo'])) {
                     $tmp_store['logo'] = 'default_shop_2.jpg';
                 }
                 $_SESSION['store'] = $tmp_store;
             } else {
                 pigcms_tips('该店铺不存在!');
             }
         }
         setcookie('session', serialize($_SESSION), $_SERVER['REQUEST_TIME'] + 10000000, '/');
     }
     if (empty($_SESSION['user'])) {
         if (!empty($_COOKIE['session'])) {
             $_SESSION = unserialize($_COOKIE['session']);
         } else {
             redirect('./account.php');
         }
     }
     $this->store_session = $_SESSION['store'];
     $this->assign('store_session', $_SESSION['store']);
     $this->user_session = $_SESSION['user'];
     $this->assign('user_session', $_SESSION['user']);
     $open_store_drp = option('config.open_store_drp');
     if (!$this->checkFx(true) && !$open_store_drp) {
         $this->assign('enabled_drp', false);
         $this->enabled_drp = false;
     } else {
         $this->assign('enabled_drp', true);
         $this->enabled_drp = true;
     }
 }
Example #9
0
function get_usercoupon_list($wap_user, $store_id)
{
    $store_id = isset($store_id) ? $store_id : pigcms_tips('您输入的网址有误', 'none');
    $page = $_POST['page'] ? $_POST['page'] : '1';
    $type = $_REQUEST['type'];
    $time = time();
    //$type = 'used';
    $type_arr = array('all', 'used', 'unused');
    if (!in_array($type, $type_arr)) {
        $type = 'all';
    }
    $where = array();
    //$where['uid'] = $wap_user['uid'];
    $where['store_id'] = $store_id;
    $where['status'] = 1;
    $where['type'] = 1;
    $where['total_amount'] = array('>', number);
    $where['start_time'] = array('<', $time);
    $where['end_time'] = array('>', $time);
    if ($page == 1) {
        $json_return['count'] = D('Coupon')->where($where)->count('id');
    }
    //$order_by = "";
    $limit = 10;
    $offset = ($page - 1) * $limit;
    $order_by = '';
    $coupon_list = M('Coupon')->getList($where, $order_by, $limit, $offset);
    $store_id_list = array();
    foreach ($coupon_list as $coupon) {
        $store_id_list[$coupon['store_id']] = $coupon['store_id'];
    }
    $store_list = M('Store')->getStoreName($store_id_list);
    $json_return['list'] = $coupon_list;
    if (count($json_return['list']) < 10) {
        $json_return['noNextPage'] = true;
    }
    json_return(0, $json_return);
}
Example #10
0
 public function load()
 {
     $action = strtolower(trim($_POST['page']));
     if (empty($action)) {
         pigcms_tips('非法访问!', 'none');
     }
     switch ($action) {
         case 'reward_list':
             $this->_reward_list();
             break;
         case 'product_list':
             $this->_product_list();
             break;
         case 'reward_create':
             $this->_reward_create();
             break;
         case 'reward_edit':
             $this->_reward_edit();
             break;
         default:
             break;
     }
     $this->display($_POST['page']);
 }
Example #11
0
 */
require_once dirname(__FILE__) . '/global.php';
if (empty($wap_user)) {
    redirect('./login.php?referer=' . urlencode($_SERVER['REQUEST_URI']));
}
//分享配置 start
$share_conf = array('title' => option('config.site_name') . '-收货地址', 'desc' => str_replace(array("\r", "\n"), array('', ''), option('config.seo_description')), 'link' => 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'imgUrl' => option('config.site_logo'), 'type' => '', 'dataUrl' => '');
import('WechatShare');
$share = new WechatShare();
$shareData = $share->getSgin($share_conf);
//分享配置 end
//店铺资料
$action = isset($_GET['action']) ? $_GET['action'] : 'all';
if ($action == 'all') {
    $address_list = M('User_address')->getMyAddress($wap_user['uid']);
    include display('my_address');
} else {
    if ($action == 'add') {
        include display('my_address_add');
    } else {
        if ($action == 'edit') {
            $address_id = isset($_GET['id']) ? $_GET['id'] : pigcms_tips('您输入的网址有误', 'none');
            $now_address = M('User_address')->getAdressById('', $wap_user['uid'], $address_id);
            if (empty($now_address)) {
                pigcms_tips('您编辑的收货地址不存在', 'none');
            }
            include display('my_address_edit');
        }
    }
}
echo ob_get_clean();
Example #12
0
 public function index()
 {
     $product_model = M('Product');
     $this->product = $product_model->get(array('product_id' => $this->id, 'status' => 1));
     if (empty($this->product) || $this->product['status'] != 1) {
         pigcms_tips('未找到相应产品', 'none');
     }
     $this->product['wx_image'] = option('config.site_url') . '/source/qrcode.php?type=good&id=' . $this->product['product_id'];
     $is_preview = $_GET['is_preview'];
     if (!is_mobile() && $this->user_session && $this->product['uid'] == $this->user_session['uid']) {
         $this->assign('is_preview', $is_preview);
     }
     // 猜你喜欢,抽取方法为同类型的热销产品
     $condition_arr = array();
     //$condition_arr['category_id'] = $this->product['category_id'];
     $condition_arr['status'] = 1;
     $condition_arr['product_id'] = array('!=', $this->product['product_id']);
     $condition_arr['store_id'] = $this->product['store_id'];
     $similar_product_list = $product_model->getSelling($condition_arr, 'sort', 'desc', 0, 6);
     //->where($condition_arr)->order('sort desc')->limit('0, 6')->select();
     // 本店铺热卖产品,抽取方法本店铺同类型热买
     //$hot_product_list = $product_model->getSelling($condition_arr, 'sales', 'desc', 0, 6);
     // 检查商品库存情况
     $product_sku_list = array();
     $property_new_list = array();
     if ($this->product['has_property']) {
         //$product_sku_list = D('Product_sku')->field('`sku_id`, `properties`, `quantity`, `price`')->where(array('product_id' => $this->id, 'quantity'=>array('!=', '0')))->order('`sku_id` ASC')->select();
         $product_sku_list = D('Product_sku')->field('`sku_id`, `properties`, `quantity`, `price`')->where(array('product_id' => $this->id))->order('`sku_id` ASC')->select();
         $sku_price_arr = $sku_property_arr = array();
         foreach ($product_sku_list as $value) {
             $sku_price_arr[] = $value['price'];
             $sku_property_arr[$value['properties']] = true;
         }
         $property_list = D('')->field('`pp`.`pid`,`pp`.`name`')->table(array('Product_to_property' => 'ptp', 'Product_property' => 'pp'))->where("`ptp`.`product_id`='" . $this->id . "' AND `pp`.`pid`=`ptp`.`pid`")->order('`ptp`.`pigcms_id` ASC')->select();
         if (!empty($property_list)) {
             $property_value_list = D('')->field('`ppv`.`vid`,`ppv`.`value`,`ppv`.`pid`, `ppv`.`image`')->table(array('Product_to_property_value' => 'ptpv', 'Product_property_value' => 'ppv'))->where("`ptpv`.`product_id`='" . $this->id . "' AND `ppv`.`vid`=`ptpv`.`vid`")->order('`ptpv`.`pigcms_id` ASC')->select();
             if (!empty($property_value_list)) {
                 foreach ($property_value_list as $value) {
                     $propertyValueList[$value['pid']][] = array('vid' => $value['vid'], 'value' => $value['value'], 'image' => getAttachmentUrl($value['image']));
                 }
                 foreach ($property_list as $value) {
                     $property_new_list[] = array('pid' => $value['pid'], 'name' => $value['name'], 'image' => getAttachmentUrl($value['image']), 'values' => $propertyValueList[$value['pid']]);
                 }
                 if (count($property_new_list) == 1) {
                     foreach ($property_new_list[0]['values'] as $key => $value) {
                         $tmpKey = $property_new_list[0]['pid'] . ':' . $value['vid'];
                         if (empty($sku_property_arr[$tmpKey])) {
                             unset($property_new_list[0]['values'][$key]);
                         }
                     }
                 }
                 $returnArr['sku_list'] = $product_sku_list;
                 $returnArr['property_list'] = $property_new_list;
             }
         }
     }
     // 抽出店铺
     $store = M('Store')->getStore($this->product['store_id']);
     if (empty($store) || $store['status'] != 1) {
         pigcms_tips('未找到相应的店铺或已关闭', 'none');
     }
     $store_contact = array();
     if ($this->product['supplier_id']) {
         $store_contact = M('Store_contact')->get($this->product['supplier_id']);
     } else {
         $store_contact = M('Store_contact')->get($this->product['store_id']);
     }
     // 设置浏览记录,只记录产品的product_id,只记录最近5条记录
     $history_product_list = $_COOKIE['history_product_list'];
     if (empty($history_product_list)) {
         setcookie('history_product_list', $this->id, $_SERVER['REQUEST_TIME'] + 86400 * 365, '/');
     } else {
         $tmp_product_list = explode(',', $history_product_list);
         array_unshift($tmp_product_list, $this->id);
         $tmp_product_list = array_slice($tmp_product_list, 0, 6);
         $tmp_product_list = array_unique($tmp_product_list);
         $tmp_product_list = array_slice($tmp_product_list, 0, 5);
         $product_id_str = join(',', $tmp_product_list);
         setcookie('history_product_list', $product_id_str, $_SERVER['REQUEST_TIME'] + 86400 * 365, '/');
     }
     // 更改浏览次数
     M('Product')->analytics(array('product_id' => $this->id));
     // 主营分类
     $sale_category = M('Store')->getSaleCategory($this->product['store_id'], $this->product['uid']);
     // 检查是否已经收藏
     $user_collect = array('click' => 'userCollect', 'title' => '收藏');
     if (!empty($this->user_session)) {
         $collect = D('User_collect')->where(array('type' => 1, 'user_id' => $this->user_session['uid'], 'dataid' => $this->id))->find();
         if (!empty($collect)) {
             $user_collect = array('click' => 'cancelCollect', 'title' => '取消收藏');
         }
     }
     // 查看本产品是否参与活动
     $reward = '';
     if ($this->product['source_product_id'] == 0) {
         $reward = M('Reward')->getRewardByProduct($this->product);
     }
     // 查找产品的图片
     $product_image_list = M('Product_image')->getImages($this->id);
     // 查找评论TAG数量
     $where = array();
     $where['type'] = 'PRODUCT';
     $where['relation_id'] = $this->id;
     $comment_tag_count_list = M('Comment_tag')->getCountList($where);
     // 评论满意,一般,不满意数量,以及满意百分比
     $comment_type_count = M('Comment')->getCountList($where);
     $satisfaction_pre = '100%';
     if ($comment_type_count['total'] > 0) {
         $satisfaction_pre = round($comment_type_count['t3'] / $comment_type_count['total'] * 100) . '%';
     }
     $comment_type_count['satisfaction_pre'] = $satisfaction_pre;
     // 查找系统评论TAG
     $product_category_tag_list = array();
     $product_category = M('Product_category')->getCategory($this->product['category_id']);
     if (!empty($product_category['tag_str'])) {
         $where = array();
         $where['id'] = array('in', explode(',', $product_category['tag_str']));
         $product_category_tag_list = M('System_tag')->geNameList($where);
     }
     // 店铺信息下面的评论
     $where = array();
     $where = array();
     $where['type'] = 'PRODUCT';
     $where['relation_id'] = $this->id;
     $where['status'] = 1;
     $where['delete_flg'] = 0;
     $comment_list = M('Comment')->getSimiplyList($where);
     // 最新动态
     $sns_list = M('Financial_record')->sns();
     $this->assign('imUrl', getImUrl($_SESSION['user']['uid'], $store['store_id']));
     $this->assign('product', $this->product);
     $this->assign('product_image_list', $product_image_list);
     $this->assign('similar_product_list', $similar_product_list);
     $this->assign('comment_type_count', $comment_type_count);
     $this->assign('comment_tag_count_list', $comment_tag_count_list);
     $this->assign('product_category_tag_list', $product_category_tag_list);
     $this->assign('store', $store);
     $this->assign('store_contact', $store_contact);
     $this->assign('property_list', $property_new_list);
     $this->assign('product_sku_list', $product_sku_list);
     $this->assign('sale_category', $sale_category);
     $this->assign('user_collect', $user_collect);
     $this->assign('reward', $reward);
     $this->assign('sns_list', $sns_list);
     $this->assign('comment_list', $comment_list);
     $this->display();
 }
Example #13
0
     }
 }
 $flag1 = true;
 /*if (!empty($tmp_store['drp_limit_share'])) { //分享满多少
       $flag1 = true;
   }*/
 //if (!empty($tmp_store['drp_limit_condition'])) { // 两个条件必须满足才可分销
 if (!($flag && $flag1)) {
     if (!empty($tmp_store['drp_limit_buy']) && !empty($tmp_store['drp_limit_share'])) {
         pigcms_tips('亲,还差一步哦,在本店消费满 ' . $tmp_store['drp_limit_buy'] . '元,同时分享本店 ' . $tmp_store['drp_limit_share'] . '次,即可申请成为本店分销商。', 'none');
     } else {
         if (!empty($tmp_store['drp_limit_buy'])) {
             pigcms_tips('亲,还差一步哦,在本店消费满 ' . $tmp_store['drp_limit_buy'] . '元,即可申请成为本店分销商。', 'none');
         } else {
             if (!empty($tmp_store['drp_limit_share'])) {
                 pigcms_tips('亲,还差一步哦,分享本店 ' . $tmp_store['drp_limit_buy'] . '次,即可申请成为本店分销商。', 'none');
             }
         }
     }
 }
 /*} else {
       if (!($flag || $flag1)) {
           if (!empty($tmp_store['drp_limit_buy']) && !empty($tmp_store['drp_limit_share'])) {
               pigcms_tips('亲,还差一步哦,在本店消费满 ' . $tmp_store['drp_limit_buy'] . '元,或分享本店 ' . $tmp_store['drp_limit_share'] . '次,即可申请成为本店分销商。', 'none');
           } else if (!empty($tmp_store['drp_limit_buy'])) {
               pigcms_tips('亲,还差一步哦,在本店消费满 ' . $tmp_store['drp_limit_buy'] . '元,即可申请成为本店分销商。', 'none');
           } else if (!empty($tmp_store['drp_limit_share'])) {
               pigcms_tips('亲,还差一步哦,分享本店 ' . $tmp_store['drp_limit_buy'] . '次,即可申请成为本店分销商。', 'none');
           }
       }
   }*/
Example #14
0
 * 分销商品分享
 * User: pigcms_21
 * Date: 2015/7/9
 * Time: 13:54
 */
require_once dirname(__FILE__) . '/global.php';
$product_id = isset($_GET['id']) ? $_GET['id'] : pigcms_tips('您输入的网址有误', 'none');
$product_model = M('Product');
$user = M('User');
$product = $product_model->get(array('product_id' => $product_id, 'uid' => $_SESSION['wap_user']['uid']));
$store = M('Store')->wap_getStore($product['supplier_id']);
if (empty($store)) {
    pigcms_tips('您访问的店铺不存在', 'none');
}
if (empty($product)) {
    pigcms_tips('您访问的商品不存在', 'none');
}
$source_product = $product_model->get(array('product_id' => $product['source_product_id']), 'cost_price');
$original_product = $product_model->get(array('product_id' => $product['original_product_id']), 'sales,drp_seller_qty,drp_profit');
$profit = $product['price'] - $source_product['cost_price'];
if ($profit < 0) {
    $profit = 0;
}
$profit = !empty($profit) ? number_format($profit, 2, '.', '') : '0.00';
$sales = !empty($original_product['sales']) ? $original_product['sales'] : 0;
$drp_seller_qty = !empty($original_product['drp_seller_qty']) ? $original_product['drp_seller_qty'] : 0;
$drp_profit = !empty($original_product['drp_profit']) ? number_format($original_product['drp_profit'], 2, '.', '') : '0.00';
$avater = $user->getAvatarById($_SESSION['wap_user']['uid']);
$username = !empty($_SESSION['wap_user']['nickname']) ? $_SESSION['wap_user']['nickname'] : '游客';
//分享配置 start
/*$share_conf 	= array(
Example #15
0
 public function __construct()
 {
     parent::__construct();
     $open_store = true;
     if (!empty($_GET['sessid'])) {
         $_SESSION['sync_store'] = true;
         $user = M('User');
         $userinfo = $user->checkUser(array('session_id' => trim($_GET['sessid'])));
         if (!empty($userinfo)) {
             $_SESSION['user'] = $userinfo;
         } else {
             pigcms_tips('该用户不存在!');
         }
         if (!empty($_GET['store_id'])) {
             $tmp_store = M('Store')->getStoreById($_GET['store_id'], $userinfo['uid']);
             if ($tmp_store) {
                 if (empty($tmp_store['logo'])) {
                     $tmp_store['logo'] = 'default_shop_2.jpg';
                 }
                 $_SESSION['store'] = $tmp_store;
             } else {
                 pigcms_tips('该店铺不存在!');
             }
         }
         setcookie('session', serialize($_SESSION), $_SERVER['REQUEST_TIME'] + 10000000, '/');
     }
     if (empty($_SESSION['user'])) {
         if (!empty($_COOKIE['session'])) {
             $_SESSION = unserialize($_COOKIE['session']);
         } else {
             redirect('./account.php');
         }
     }
     if (empty($_SESSION['store']['store_id'])) {
         //选择的店铺session过期
         $open_store = false;
     }
     $store_info = M('Store')->getStoreById($_SESSION['store']['store_id'], $_SESSION['store']['uid']);
     if (!empty($_SESSION['store']['drp_supplier_id'])) {
         if (empty($store_info['drp_approve'])) {
             //未审核店铺不能打开
             $open_store = false;
         }
     }
     if (empty($_SESSION['store']['drp_approve'])) {
         $_SESSION['store']['drp_approve'] = $store_info['drp_approve'];
     }
     $this->store_session = $_SESSION['store'];
     $this->assign('store_session', $_SESSION['store']);
     $this->user_session = $_SESSION['user'];
     $this->assign('user_session', $_SESSION['user']);
     $this->assign('open_store', $open_store);
     //是否能打开店铺
     $this->assign('store_select', url('store:select'));
     //店铺打不开跳转地址
     //是否启用分销
     $open_store_drp = option('config.open_store_drp');
     if (!$this->checkFx(true) && !$open_store_drp) {
         $this->assign('enabled_drp', false);
         $this->enabled_drp = false;
     } else {
         $this->assign('enabled_drp', true);
         $this->enabled_drp = true;
     }
 }
Example #16
0
 public function store()
 {
     if (IS_POST) {
         $store = M('Store');
         $name = isset($_POST['name']) ? trim($_POST['name']) : '';
         if (isset($_POST['logo'])) {
             $logo = getAttachment($_POST['logo']);
             //str_replace(array(option('config.site_url').'/upload/images/','./upload/images/'),'',trim($_POST['logo']));
         } else {
             $logo = '';
         }
         $intro = isset($_POST['intro']) ? trim($_POST['intro']) : '';
         $linkman = isset($_POST['linkman']) ? trim($_POST['linkman']) : '';
         $qq = isset($_POST['qq']) ? trim($_POST['qq']) : '';
         $mobile = isset($_POST['mobile']) ? trim($_POST['mobile']) : '';
         $open_service = isset($_POST['open_service']) ? intval(trim($_POST['open_service'])) : 0;
         $data = array();
         if ($name) {
             $data['name'] = $name;
         }
         if ($logo) {
             $data['logo'] = $logo;
         }
         $data['intro'] = $intro;
         $data['linkman'] = $linkman;
         $data['qq'] = $qq;
         $data['tel'] = $mobile;
         $data['open_service'] = $open_service;
         if ($_SESSION['store']['name'] != $name) {
             $data['edit_name_count'] = $_SESSION['store']['edit_name_count'] + 1;
             //店铺名称修改次数
         }
         $where = array();
         $where['store_id'] = $this->store_session['store_id'];
         if ($store->setting($where, $data)) {
             $_SESSION['store']['name'] = $name;
             $_SESSION['store']['logo'] = $_POST['logo'];
             $_SESSION['store']['edit_name_count'] += 1;
         }
         json_return(0, url('store:index'));
     }
     $id = $_GET['id'] + 0;
     if (!empty($id)) {
         $store = M('Store')->getStoreById($id, $_SESSION['user']['uid']);
         if (empty($store)) {
             pigcms_tips('未找到相应的店铺', 'none');
         }
         $_SESSION['store'] = $store;
     }
     $this->display();
 }
Example #17
0
 public function info()
 {
     $weixin_bind_type = M('Weixin_bind')->get_account_type_Bydata($this->weixin_bind_info);
     if ($weixin_bind_type['errcode']) {
         pigcms_tips($weixin_bind_type['errmsg']);
     } else {
         $this->weixin_bind_info['service_type_txt'] = $weixin_bind_type['errmsg'];
     }
     $this->assign('weixin_bind', $this->weixin_bind_info);
     $this->display();
 }
Example #18
0
 /**
  * 搜索产品页
  */
 function goods()
 {
     $id = $_GET['id'];
     $keyword = $_GET['keyword'];
     $start_price = $_GET['start_price'];
     $end_price = $_GET['end_price'];
     $page = max(1, $_GET['page']);
     $order = $_GET['order'];
     $sort = $_GET['sort'];
     $limit = 20;
     $WebUserInfo = $this->user_location;
     if (empty($keyword)) {
         pigcms_tips('请输入搜索关键词');
     }
     if ($order == 'juli') {
         if (!$WebUserInfo['long']) {
             $order = "";
         }
     }
     // 产品分类
     if (!empty($id)) {
         // 顶级分类和子分类
         $product_category_model = M('Product_category');
         $category_detail = $product_category_model->getCategory($id);
         // 目前产品分类只支持两级
         $cid = $category_detail['cat_id'];
         // 当访问的不是首分类时,修正为父级分类ID
         if ($category_detail['cat_fid'] != 0) {
             $cid = $category_detail['cat_fid'];
         }
         // 父类分类
         $f_category = array();
         $s_category = array();
         // 搜索分类id
         $search_cat_id_arr = array();
         $s_category = D('Product_category')->where(array('cat_fid' => $cid))->order('cat_sort desc, cat_id asc')->select();
         if ($cid == $category_detail['cat_id']) {
             $f_category = $category_detail;
             foreach ($s_category as $tmp) {
                 $search_cat_id_arr[] = $tmp['cat_id'];
             }
             $search_cat_id_arr[] = $cid;
         } else {
             $f_category = $product_category_model->getCategory($cid);
         }
     } else {
         $s_category = D('Product_category')->where(array('cat_fid' => 0))->order('cat_sort desc, cat_id asc')->select();
     }
     // 修正排序
     $order_arr = array('sort', 'sales', 'price', 'juli');
     $sort_arr = array('desc', 'asc');
     if (!in_array($order, $order_arr)) {
         $order = 'sort';
     }
     if (!in_array($sort, $sort_arr)) {
         $sort = 'asc';
     }
     if (!empty($start_price) && !empty($end_price) && $start_price > $end_price) {
         $tmp_price = $start_price;
         $start_price = $end_price;
         $end_price = $tmp_price;
     }
     $where_sql = "`status` = 1 AND `name` like '%" . $keyword . "%'";
     $where_sql2[] = "  `p`.`name` like '%" . $keyword . "%'";
     if (!empty($start_price)) {
         $where_sql .= " AND `price` >= '" . $start_price . "'";
         $where_sql2[] = "  `p`.`price` >= '" . $start_price . "'";
     }
     if (!empty($end_price)) {
         $where_sql .= " AND `price` <= '" . $end_price . "'";
         $where_sql2[] = "  p.`price` <= '" . $end_price . "'";
     }
     if (!empty($id)) {
         if (empty($search_cat_id_arr)) {
             $where_sql .= " AND `category_id` = '" . $id . "'";
             $where_sql2[] = "  `p`.`category_id` = '" . $id . "'";
         } else {
             $where_sql .= " AND `category_id` in (" . join(',', $search_cat_id_arr) . ")";
             $where_sql2[] = " `p`.`category_id` in (" . join(',', $search_cat_id_arr) . ")";
         }
     }
     // 不出现分销
     $where_sql .= " AND `supplier_id` = '0'";
     //$where_sql2 .= " AND p.`supplier_id` = '0'";
     if ($order == 'juli') {
         if ($where_sql2) {
             $where_sql2 = implode(" and ", $where_sql2);
         }
         $count = M('Product')->getSellingBydistanceCount($where_sql2);
     } else {
         $count = D('Product')->where($where_sql)->count('product_id');
     }
     $product_list = array();
     $store_list = array();
     $pages = '';
     $total_pages = 0;
     if ($count > 0) {
         $total_pages = ceil($count / $limit);
         $page = min($page, $total_pages);
         $offset = ($page - 1) * $limit;
         if ($order == 'juli') {
             $orders = " juli ";
             $product_list = M('Product')->getSellingBydistance($where_sql2, $orders, $sort, $offset, $limit);
         } else {
             $product_list = M('Product')->getSelling($where_sql, $order, $sort, $offset, $limit);
         }
         // 查找店铺
         $store_id_list = array();
         foreach ($product_list as $product) {
             $store_id_list[$product['store_id']] = $product['store_id'];
         }
         $store_list = M('Store')->getStoreName($store_id_list);
         // 分页
         import('source.class.user_page');
         $user_page = new Page($count, $limit, $page);
         $pages = $user_page->show();
     }
     // 默认搜索条件
     $param = array();
     $param['keyword'] = $keyword;
     if (!empty($start_price)) {
         $param['start_price'] = $start_price;
     }
     if (!empty($end_price)) {
         $param['end_price'] = $end_price;
     }
     if (!empty($id)) {
         $param['id'] = $id;
     }
     // 分类搜索
     $param_category = $param;
     if (!empty($f_category)) {
         $param_category['id'] = $f_category['cat_id'];
     }
     //unset($param_category['id']);
     // 当前搜索条件
     $param_search = $param;
     if ($order != 'sort') {
         $param_search['order'] = $order;
         $param_search['sort'] = $sort;
     }
     // 更改下次排序
     $sort = $sort == 'asc' ? 'desc' : 'asc';
     // 热销搜索条件
     $param_sales = $param;
     $param_sales['order'] = 'sales';
     $param_sales['sort'] = $sort;
     // 价格搜索条件
     $param_price = $param;
     $param_price['order'] = 'price';
     $param_price['sort'] = $sort;
     // 距离搜索条件
     $param_distance = $param;
     $param_distance['order'] = "juli";
     $param_distance['sort'] = $sort;
     ///////////////
     $store_id_list = array();
     foreach ($product_list as &$product) {
         $store_id_list[$product['store_id']] = $product['store_id'];
     }
     //$store_list = M('Store')->getStoreName($store_id_list);
     $store_contact_info = M('store_contact')->get_store_contact_info($store_id_list);
     //////////////
     //获取树
     $count = $count ? $count : 0;
     $this->assign('param', $param);
     $this->assign('params', $param);
     $this->assign('searchKeyword', $keyword);
     $this->assign('cid', $id);
     $this->assign('WebUserInfo', $WebUserInfo);
     $this->assign('f_category', $f_category);
     $this->assign('s_category', $s_category);
     $this->assign('product_list', $product_list);
     $this->assign('store_list', $store_list);
     $this->assign('pages', $pages);
     $this->assign('param_search', $param_search);
     $this->assign('param_distance', $param_distance);
     $this->assign('param_sales', $param_sales);
     $this->assign('param_price', $param_price);
     $this->assign('store_contact_info', $store_contact_info);
     $this->assign('param_category', $param_category);
     $this->assign('product_count', $count);
     $this->assign('page_arr', array('current_page' => $page, 'total_pages' => $total_pages));
     $this->display();
 }
Example #19
0
     if (!empty($_SESSION['wap_drp_store'])) {
         $where['store_id'] = array('!=', $_SESSION['wap_drp_store']['store_id']);
     }
     $where['name'] = isset($_POST['name']) ? trim($_POST['name']) : '';
     $where['status'] = 1;
     if ($store->checkStoreExist($where)) {
         echo false;
     } else {
         echo true;
     }
     exit;
 } else {
     if (strtolower($_GET['a']) == 'reset_pwd') {
         //重置为初始密码
         if (empty($_SESSION['wap_drp_store'])) {
             pigcms_tips('您没有权限访问,<a href="./home.php?id=' . $_COOKIE['wap_store_id'] . '">返回首页</a>', 'none');
         }
         $user = M('User');
         $store = $_SESSION['wap_drp_store'];
         $user_info = $user->checkUser(array('uid' => $store['uid']));
         if (D('User')->where(array('uid' => $user_info['uid']))->data(array('password' => md5($user_info['phone'])))->save()) {
             redirect('./drp_ucenter.php');
         } else {
             redirect('./drp_store.php?a=account');
         }
     } else {
         if (IS_GET && $_GET['a'] == 'logout') {
             $store_id = $_SESSION['wap_drp_store']['store_id'];
             unset($_SESSION['wap_drp_store']);
             redirect('./ucenter.php?id=' . $store_id);
         }
Example #20
0
    }
    //首页推荐商品
    $product_list = M('Product')->getSelling('quantity>0 AND status=1 AND is_recommend = 1', '', '', 0, 4);
    //D('Product')->where('quantity>0 AND status=1 AND is_recommend = 1')->limit('4')->select();
    //首页推荐活动
    $active_list = D('Activity_recommend')->order("is_rec desc,ucount desc")->limit(4)->select();
    $activity = M('activity');
    foreach ($active_list as $k => $value) {
        $active_list[$k]["url"] = $activity->createUrl($value, $value['model'], '1');
        $active_list[$k]["image"] = getAttachmentUrl($value['image']);
    }
} else {
    if (empty($config['platform_mall_index_page'])) {
        pigcms_tips('请管理员在管理后台【系统设置】=》【站点配置】=》【平台商城配置】选取微页面', 'none');
    }
    //首页的微杂志
    $homePage = D('Wei_page')->where(array('page_id' => $config['platform_mall_index_page']))->find();
    if (empty($homePage)) {
        pigcms_tips('您访问的店铺没有首页', 'none');
    }
}
$imUrl = getImUrl($_SESSION['wap_user']['uid'], $store_id);
$is_have_activity = option('config.is_have_activity');
//分享配置 start
$share_conf = array('title' => option('config.site_name'), 'desc' => str_replace(array("\r", "\n"), array('', ''), option('config.seo_description')), 'link' => option('config.wap_site_url'), 'imgUrl' => option('config.site_logo'), 'type' => '', 'dataUrl' => '');
import('WechatShare');
$share = new WechatShare();
$shareData = $share->getSgin($share_conf);
//分享配置 end
include display('index');
echo ob_get_clean();
Example #21
0
 function delete()
 {
     $sql = 'DELETE FROM ' . $this->table;
     if (empty($this->where)) {
         pigcms_tips('为了保证数据库的安全,没有条件的删除不允许执行', 'none');
     }
     $sql .= ' WHERE ' . $this->where;
     $this->clear_data();
     return $this->execute($sql);
 }
Example #22
0
        $token = htmlspecialchars($_GET['token']);
        $return['wecha_id'] = $_SESSION['openid'];
        $return['token'] = $token;
        $return['sex'] = $_SESSION['wap_user']['sex'];
        $return['issub'] = isSub($_SESSION['openid']);
        $return['portrait'] = $_SESSION['wap_user']['avatar'];
        $return['wechaname'] = $return['truename'] = $_SESSION['wap_user']['nickname'];
        $return['province'] = $_SESSION['wap_user']['province'];
        $return['city'] = $_SESSION['wap_user']['city'];
        $postData = array('option' => array('where' => array('wecha_id' => $return['wecha_id'], 'token' => $token), 'order' => 'id DESC', 'limit' => '1'), 'data' => $return, 'model' => 'Userinfo', 'token' => $token, 'debug' => true);
        $postData['sign'] = getSign($postData, $salt);
        $result = api_curl_post($apiUrl . 'index.php?g=Home&m=Auth&a=insert', $postData);
        if ($result['status'] == 0) {
            header('Location:' . $apiUrl . 'index.php?g=Home&m=Auth&a=oauth2&token=' . $token . '&wechat_id=' . $return['wecha_id']);
        } else {
            pigcms_tips($result['message'], 'none');
        }
        break;
}
function getSign($data, $salt)
{
    foreach ($data as $key => $value) {
        if (is_array($value)) {
            $validate[$key] = getSign($value, $salt);
        } else {
            $validate[$key] = $value;
        }
    }
    $validate['salt'] = $salt;
    sort($validate, SORT_STRING);
    return sha1(implode($validate));
Example #23
0
function require_file($load_file)
{
    if (file_exists($load_file)) {
        return require $load_file;
    } else {
        $file = str_replace(PIGCMS_PATH, '', $load_file);
        pigcms_tips(PIGCMS_PATH . $file . ' 文件不存在。', 'none');
    }
}
Example #24
0
        return false;
    }
}
function change_login_qrcode($qrcode_id, $wap_user)
{
    $database_login_qrcode = D('Login_qrcode');
    $condition_login_qrcode['id'] = $qrcode_id;
    $data_login_qrcode['uid'] = $wap_user['uid'];
    if ($database_login_qrcode->where($condition_login_qrcode)->data($data_login_qrcode)->save()) {
        return true;
    } else {
        return false;
    }
}
require_once dirname(__FILE__) . '/global.php';
$qrcode_id = $_GET['qrcode_id'];
if (empty($qrcode_id)) {
    pigcms_tips('登录失败!请重新扫码。', $config['wap_site_url']);
}
if (!check_login_qrcode($qrcode_id)) {
    pigcms_tips('二维码已失效!请重新扫码。', $config['wap_site_url']);
}
if (!empty($wap_user)) {
    if (change_login_qrcode($qrcode_id, $wap_user)) {
        pigcms_tips('登录成功!电脑端正在等待跳转', $config['wap_site_url']);
    } else {
        pigcms_tips('登录失败!请重新扫码。', $config['wap_site_url']);
    }
} else {
    redirect('./login.php?referer=' . urlencode('./weixin_bind.php?qrcode_id=' . $qrcode_id));
}
Example #25
0
 public function store_select()
 {
     if (empty($_GET['store_id'])) {
         pigcms_tips('非法访问!');
     }
     $store = M('Store')->getStoreById($_GET['store_id'], $this->user_session['uid']);
     if ($store) {
         $_SESSION['tmp_store_id'] = $store['store_id'];
         if (empty($store['logo'])) {
             $store['logo'] = 'default_shop_2.jpg';
         }
         $_SESSION['store'] = $store;
         redirect(url('store:index'));
     } else {
         pigcms_tips('该店铺不存在!');
     }
 }
Example #26
0
<?php

//狗扑源码社区 www.gope.cn
require_once dirname(__FILE__) . '/global.php';
$cat_id = isset($_GET['id']) ? $_GET['id'] : pigcms_tips('您输入的网址有误', 'none');
$database_product_category = D('Product_category');
$now_cat = $database_product_category->where(array('cat_id' => $cat_id))->find();
$first_cat_list = $database_product_category->field('`cat_id`,`cat_name`')->where(array('cat_fid' => 0))->order('`cat_sort` DESC')->select();
$two_cat_list = $database_product_category->field('`cat_id`,`cat_name`')->where(array('cat_fid' => $cat_id))->order('`cat_sort` DESC')->select();
$product_list = D('Product')->field('`product_id`,`name`,`image`,`price`,`original_price`,`sales`')->where(array('category_fid' => $cat_id))->order('`product_id` DESC')->limit(10)->select();
include display('category');
echo ob_get_clean();
Example #27
0
 public function load()
 {
     parent::__construct();
     $action = strtolower(trim($_GET['action']));
     if (empty($action)) {
         pigcms_tips('非法访问!', 'none');
     }
     switch ($action) {
         case 'cartone':
             //购物车第一步
             $this->_cartOne();
             break;
         case 'carttwo':
             //购物车第二步
             $this->_cartTwo();
             break;
         case 'cartthree':
             //购物车第三步
             $this->_cartThree();
             break;
     }
     $this->assign('step', $action);
     $this->display($_GET['action']);
 }
Example #28
0
 public function comments_load()
 {
     if (empty($_POST['page'])) {
         pigcms_tips('非法访问!', 'none');
     }
     if ($_POST['page'] == 'create_content') {
         $cat_list = M('Product_category')->getAllCategory();
         $this->assign('cat_list', $cat_list);
     }
     if ($_POST['page'] == 'edit_content') {
         $this->_edit_content($_GET['id']);
     }
     //商品分组列表
     if ($_POST['page'] == 'category_content') {
         $group_list = M('Product_group')->get_list($this->store_session['store_id']);
         $this->assign('group_list', $group_list);
     }
     //商品分组编辑
     if ($_POST['page'] == 'category_edit') {
         $now_group = M('Product_group')->get_group($this->store_session['store_id'], $_POST['group_id']);
         if (!empty($now_group)) {
             if ($now_group['has_custom']) {
                 $customField = M('Custom_field')->get_field($this->store_session['store_id'], 'good_cat', $now_group['group_id']);
                 $this->assign('customField', json_encode($customField));
             }
             $this->assign('now_group', $now_group);
         } else {
             exit('当前分组不存在!');
         }
     }
     if ($_POST['page'] == 'comment_goods_content') {
         $this->_comment_goods_list();
     }
     if ($_POST['page'] == 'comment_store_content') {
         $this->_comment_store_list();
     }
     $this->display($_POST['page']);
 }
Example #29
0
<?php

/**
 *  订单信息
 */
require_once dirname(__FILE__) . '/global.php';
//setcookie('pigcms_sessionid','',$_SERVER['REQUEST_TIME']-10000000,'/');
$store_id = isset($_GET['id']) ? $_GET['id'] : pigcms_tips('您输入的网址有误', 'none');
if (empty($wap_user)) {
    redirect('./login.php?referer=' . urlencode($_SERVER['REQUEST_URI']));
}
//店铺资料
$now_store = M('Store')->wap_getStore($store_id);
if (empty($now_store)) {
    pigcms_tips('您访问的店铺不存在', 'none');
}
setcookie('wap_store_id', $now_store['store_id'], $_SERVER['REQUEST_TIME'] + 10000000, '/');
//当前页面的地址
$now_url = $config['wap_site_url'] . '/ucenter.php?id=' . $now_store['store_id'];
//会员中心配置
$now_ucenter = D('Ucenter')->where(array('store_id' => $now_store['store_id']))->find();
if (empty($now_ucenter)) {
    $now_ucenter['page_title'] = $config['ucenter_page_title'];
    $now_ucenter['bg_pic'] = $config['site_url'] . '/upload/images/' . $config['ucenter_bg_pic'];
    $now_ucenter['show_level'] = $config['ucenter_show_level'];
    $now_ucenter['show_point'] = $config['ucenter_show_point'];
} else {
    $now_ucenter['bg_pic'] = trim($now_ucenter['bg_pic'], '.');
}
//会员中心的自定义字段
if ($now_ucenter['has_custom']) {
Example #30
0
<?php

/**
 *  评论
 */
require_once dirname(__FILE__) . '/global.php';
$product_id = isset($_REQUEST['id']) ? $_REQUEST['id'] : pigcms_tips('您输入的网址有误', 'none');
//获取评论并分页 ajax
function get_pinlun_list($product_id)
{
    require_once dirname(__FILE__) . '/global.php';
    $page = $_GET['page'] + 0;
    $id = $_GET['id'];
    $type = $_GET['type'];
    $tab = $_GET['tab'];
    $has_image = $_GET['has_image'];
    if (empty($id)) {
        echo json_encode(array('status' => false, 'msg' => '参数错误'));
        exit;
    }
    $type_arr = array('PRODUCT', 'STORE');
    if (!in_array($type, $type_arr)) {
        echo json_encode(array('status' => false, 'msg' => '参数错误'));
        exit;
    }
    $where = array();
    $where['type'] = $type;
    if (!empty($has_image)) {
        $where['has_image'] = 1;
    }
    $where['relation_id'] = $id;