Example #1
0
 /**
  * 模板管理
  */
 public function waybill_manageOp()
 {
     $model_store_extend = Model('store_extend');
     $model_express = Model('express');
     $model_store_waybill = Model('store_waybill');
     $store_extend_info = $model_store_extend->getStoreExtendInfo(array('store_id' => $_SESSION['store_id']), 'express');
     $store_express = $store_extend_info['express'];
     $express_list = $model_express->getExpressListByID($store_express);
     $store_waybill_list = $model_store_waybill->getStoreWaybillListWithWaybillInfo($_SESSION['store_id'], $store_express);
     $store_waybill_list = array_under_reset($store_waybill_list, 'express_id');
     if (!empty($express_list)) {
         foreach ($express_list as $key => $value) {
             if (!empty($store_waybill_list[$value['id']])) {
                 $express_list[$key]['waybill_name'] = $store_waybill_list[$value['id']]['waybill_name'];
                 $express_list[$key]['store_waybill_id'] = $store_waybill_list[$value['id']]['store_waybill_id'];
                 $express_list[$key]['is_default_text'] = $store_waybill_list[$value['id']]['is_default'] ? '是' : '否';
                 $express_list[$key]['waybill_image_url'] = getWaybillImageUrl($store_waybill_list[$value['id']]['waybill_image']);
                 $express_list[$key]['waybill_width'] = $store_waybill_list[$value['id']]['waybill_width'];
                 $express_list[$key]['waybill_height'] = $store_waybill_list[$value['id']]['waybill_height'];
                 $express_list[$key]['bind'] = true;
             } else {
                 $express_list[$key]['waybill_name'] = '未绑定';
                 $express_list[$key]['bind'] = false;
             }
         }
     }
     Tpl::output('express_list', $express_list);
     $this->profile_menu('waybill_manage');
     Tpl::showpage('store_waybill.manage');
 }
Example #2
0
    /**
     * 返回一级分类列表
     */
    private function _get_root_class() {
		$model_goods_class = Model('goods_class');
        $model_mb_category = Model('mb_category');

        $goods_class_array = ($nav = F('goods_class'))? $nav :H('goods_class',true,'file');

		$class_list = $model_goods_class->getClassList(array('gc_parent_id' => 0), 'gc_id,gc_name');
        //$mb_categroy = $model_mb_category->getLinkList(array());
        $mb_categroy = array_under_reset($mb_categroy, 'gc_id');
        foreach ($class_list as $key => $value) {
            if(!empty($mb_categroy[$value['gc_id']])) {
                $class_list[$key]['image'] = UPLOAD_SITE_URL.DS.ATTACH_MOBILE.DS.'category'.DS.$mb_categroy[$value['gc_id']]['gc_thumb'];
            } else {
                $class_list[$key]['image'] = '';
            }

            $class_list[$key]['text'] = '';
            $child_class_string = $goods_class_array[$value['gc_id']]['child'];
            $child_class_array = explode(',', $child_class_string);
            foreach ($child_class_array as $child_class) {
                $class_list[$key]['text'] .= $goods_class_array[$child_class]['gc_name'] . '/';
            }
            $class_list[$key]['text'] = rtrim($class_list[$key]['text'], '/');
        }

        output_data(array('class_list' => $class_list));
    }
Example #3
0
 public function get_theme_listOp()
 {
     $result = '';
     $data_count = intval($_GET['data_count']);
     if ($data_count <= 0) {
         $data_count = 2;
     }
     $model = Model();
     $theme_list = $model->table('circle_theme')->field('*, is_recommend*rand()*10000 + has_affix*rand() as rand')->where(array('circle_status' => 1, 'is_closed' => 0))->where(array('has_affix' => 1))->order('rand desc')->limit($data_count)->select();
     if (!empty($theme_list)) {
         $theme_list = array_under_reset($theme_list, 'theme_id');
         $themeid_array = array_keys($theme_list);
         // 附件
         $affix_list = $model->table('circle_affix')->where(array('theme_id' => array('in', $themeid_array), 'affix_type' => 1))->group('theme_id')->select();
         if (!empty($affix_list)) {
             $affix_list = array_under_reset($affix_list, 'theme_id');
         }
         foreach ($theme_list as $key => $val) {
             if (isset($affix_list[$val['theme_id']])) {
                 $theme_list[$key]['affix'] = themeImageUrl($affix_list[$val['theme_id']]['affix_filethumb']);
             }
         }
     }
     if ($this->data_type === 'json') {
         $result = json_encode($theme_list);
     } else {
         Tpl::output('theme_list', $theme_list);
         ob_start();
         Tpl::showpage('api_theme_list', 'null_layout');
         $result = ob_get_clean();
     }
     $this->return_result($result);
 }
Example #4
0
 /**
  * 相册列表
  */
 public function class_listOp()
 {
     $model = Model();
     // 相册总数量
     $where = array();
     if ($_GET['class_name'] != '') {
         $where['ac_name'] = array('like', '%' . trim($_GET['class_name']) . '%');
     }
     if ($_GET['user_name'] != '') {
         $where['member_name'] = array('like', '%' . trim($_GET['user_name']) . '%');
     }
     $ac_list = $model->table('sns_albumclass,member')->field('sns_albumclass.*,member.member_name')->on('sns_albumclass.member_id = member.member_id')->join('left')->where($where)->page('10')->select();
     if (!empty($ac_list)) {
         $acid_array = array();
         foreach ($ac_list as $val) {
             $acid_array[] = $val['ac_id'];
         }
         // 相册中商品数量
         $ap_count = $model->cls()->table('sns_albumpic')->field('count(ap_id) as count,ac_id')->where(array('ac_id' => array('in', $acid_array)))->group('ac_id')->select();
         $ap_count = array_under_reset($ap_count, 'ac_id', 1);
         foreach ($ac_list as $key => $val) {
             if (isset($ap_count[$val['ac_id']])) {
                 $ac_list[$key]['count'] = $ap_count[$val['ac_id']]['count'];
             } else {
                 $ac_list[$key]['count'] = 0;
             }
         }
     }
     Tpl::output('showpage', $model->showpage(2));
     Tpl::output('ac_list', $ac_list);
     Tpl::showpage('sns_malbum.classlist');
 }
 /**
  * 活动管理
  */
 public function bundling_listOp()
 {
     $model_bundling = Model('p_bundling');
     // 查询添加
     $where = '';
     if ($_GET['bundling_name'] != '') {
         $where['bl_name'] = array('like', '%' . trim($_GET['bundling_name']) . '%');
     }
     if ($_GET['store_name'] != '') {
         $where['store_name'] = array('like', '%' . trim($_GET['store_name']) . '%');
     }
     if (is_numeric($_GET['state'])) {
         $where['bl_state'] = $_GET['state'];
     }
     $bundling_list = $model_bundling->getBundlingList($where);
     $bundling_list = array_under_reset($bundling_list, 'bl_id');
     Tpl::output('show_page', $model_bundling->showpage(2));
     if (!empty($bundling_list)) {
         $blid_array = array_keys($bundling_list);
         $bgoods_array = $model_bundling->getBundlingGoodsList(array('bl_id' => array('in', $blid_array)), 'bl_id,goods_id,count(*) as count', 'bl_appoint desc', 'bl_id');
         $bgoods_array = array_under_reset($bgoods_array, 'bl_id');
         foreach ($bundling_list as $key => $val) {
             $bundling_list[$key]['goods_id'] = $bgoods_array[$val['bl_id']]['goods_id'];
             $bundling_list[$key]['count'] = $bgoods_array[$val['bl_id']]['count'];
         }
     }
     Tpl::output('list', $bundling_list);
     // 状态数组
     $state_array = array(0 => Language::get('bundling_state_0'), 1 => Language::get('bundling_state_1'));
     Tpl::output('state_array', $state_array);
     // 输出自营店铺IDS
     Tpl::output('flippedOwnShopIds', array_flip(model('store')->getOwnShopIds()));
     Tpl::showpage('promotion_bundling.list');
 }
Example #6
0
 /**
  * 圈主和管理信息
  */
 protected function manageList()
 {
     $manager_list = Model()->table('circle_member')->where(array('circle_id' => $this->c_id, 'is_identity' => array('in', array(1, 2))))->select();
     $manager_list = array_under_reset($manager_list, 'is_identity', 2);
     Tpl::output('creator', $manager_list[1][0]);
     $manager_list = array_under_reset($manager_list[2], 'member_id', 1);
     Tpl::output('manager_list', $manager_list);
 }
Example #7
0
	/**
	 * 圈子
	 */
	public function circleOp(){
		$model = Model();
		$cm_list = $model->table('circle_member')->where(array('member_id'=>$this->master_id))->order('cm_jointime desc')->select();
		if(!empty($cm_list)){
			$cm_list = array_under_reset($cm_list, 'circle_id'); $circleid_array = array_keys($cm_list);
			$circle_list = $model->table('circle')->where(array('circle_id'=>array('in', $circleid_array)))->select();
			Tpl::output('circle_list', $circle_list);
		}
		$this->profile_menu('circle');
		Tpl::showpage('sns_circle');
	}
Example #8
0
 public function account_listOp()
 {
     $model_seller = Model('seller');
     $condition = array('store_id' => $_SESSION['store_id'], 'seller_group_id' => array('gt', 0));
     $seller_list = $model_seller->getSellerList($condition);
     Tpl::output('seller_list', $seller_list);
     $model_seller_group = Model('seller_group');
     $seller_group_list = $model_seller_group->getSellerGroupList(array('store_id' => $_SESSION['store_id']));
     $seller_group_array = array_under_reset($seller_group_list, 'group_id');
     Tpl::output('seller_group_array', $seller_group_array);
     $this->profile_menu('account_list');
     Tpl::showpage('store_account.list');
 }
Example #9
0
 /**
  * Personal Center my circle group
  */
 public function my_groupOp()
 {
     $model = Model();
     $circlemember_array = $model->table('circle_member')->where(array('member_id' => $this->m_id))->select();
     if (!empty($circlemember_array)) {
         $circlemember_array = array_under_reset($circlemember_array, 'circle_id');
         Tpl::output('cm_array', $circlemember_array);
         $circleid_array = array_keys($circlemember_array);
         $circle_list = $model->table('circle')->where(array('circle_id' => array('in', $circleid_array)))->select();
         Tpl::output('circle_list', $circle_list);
     }
     $this->profile_menu('group', 'group');
     Tpl::showpage('p_center.group');
 }
Example #10
0
 function indexOp()
 {
     $model = Model('trade');
     if (!in_array($_GET['state'], array('deliverno', 'delivering', 'delivered'))) {
         $_GET['state'] = 'deliverno';
     }
     $state = str_replace(array('deliverno', 'delivering', 'delivered'), array('20,60', 30, 40), $_GET['state']);
     $condition = array();
     $condition['order.seller_id'] = $_SESSION['member_id'];
     $condition['order.order_state'] = array('in', $state);
     $order_list = $model->order_list($condition, 5);
     if (is_array($order_list)) {
         $arr_buyer_id = array();
         $arr_order_id = array();
         foreach ($order_list as $v) {
             $arr_buyer_id[] = $v['buyer_id'];
             $arr_order_id[] = $v['order_id'];
         }
         $goods_list = $model->table('order_goods')->where(array('order_id' => array('in', $arr_order_id)))->select();
         foreach ($order_list as $key => $value) {
             foreach ($goods_list as $k => $v) {
                 if ($v['order_id'] == $value['order_id']) {
                     $order_list[$key]['goods'][] = $v;
                     unset($goods_list[$k]);
                 }
             }
         }
         $arr_buyer_id = array_unique($arr_buyer_id);
         $member_list = $model->table('member')->where(array('member_id' => array('in', $arr_buyer_id)))->select();
         $member_list = array_under_reset($member_list, 'member_id');
         Tpl::output('member_array', $member_list);
         Tpl::output('order_array', $order_list);
         Tpl::output('show_page', $model->showpage());
     }
     self::profile_menu('deliver', $_GET['state']);
     Tpl::output('menu_sign', 'deliver');
     Tpl::output('menu_sign_url', 'index.php?act=deliver&op=index');
     Tpl::output('menu_sign1', $_GET['state']);
     Tpl::showpage('store_order_deliver');
 }
Example #11
0
 /**
  * Members of the level set
  */
 public function indexOp()
 {
     $model = Model();
     if (chksubmit()) {
         $insert_all = array();
         foreach ($_POST['cmld'] as $key => $val) {
             $insert_all[$key]['mld_id'] = $val['id'];
             $insert_all[$key]['mld_name'] = $val['name'];
             $insert_all[$key]['mld_exp'] = $val['exp'];
         }
         $insert_all = array_values($insert_all);
         $rs = $model->table('circle_mldefault')->insertAll($insert_all, array(), true);
         if ($rs) {
             showMessage(L('nc_common_op_succ'));
         } else {
             showMessage(L('nc_common_op_fail'));
         }
     }
     $mld_list = $model->table('circle_mldefault')->select();
     $mld_list = array_under_reset($mld_list, 'mld_id');
     Tpl::output('mld_list', $mld_list);
     Tpl::showpage('circle_memberlevel');
 }
 /**
  * 取得店铺绑定的分类
  * 
  * @param   number  $store_id   店铺id
  * @param   number  $pid        父级分类id
  * @param   number  $deep       深度
  * @return  array   二维数组
  */
 public function getGoodsClass($store_id, $pid = 0, $deep = 1)
 {
     // 读取商品分类
     $gc_list = $this->getGoodsClassList(array('gc_parent_id' => $pid), 'gc_id, gc_name, type_id');
     // 如果店铺ID不为商城店铺的话,读取绑定分类
     if (!checkPlatformStore()) {
         $gc_list = array_under_reset($gc_list, 'gc_id');
         $model_storebindclass = Model('store_bind_class');
         $gcid_array = $model_storebindclass->getStoreBindClassList(array('store_id' => $store_id), '', "class_{$deep} asc", "distinct class_{$deep}");
         if (!empty($gcid_array)) {
             $tmp_gc_list = array();
             foreach ($gcid_array as $value) {
                 if (isset($gc_list[$value["class_{$deep}"]])) {
                     $tmp_gc_list[] = $gc_list[$value["class_{$deep}"]];
                 }
             }
             $gc_list = $tmp_gc_list;
         } else {
             return array();
         }
     }
     return $gc_list;
 }
Example #13
0
 public function like_listOp()
 {
     $type = 'goods';
     if (isset($_GET['type'])) {
         $type = $_GET['type'];
     }
     $model_like = Model('micro_like');
     $condition = array();
     $condition['like_member_id'] = $this->member_info['member_id'];
     $type_array = self::get_channel_type($type);
     $condition['like_type'] = $type_array['type_id'];
     switch ($type) {
         case 'personal':
             Tpl::output('list', $model_like->getPersonalList($condition, 35));
             break;
         case 'album':
             Tpl::output('list', array());
             break;
         case 'store':
             $like_store_list = $model_like->getStoreList($condition, 30);
             $store_list = array();
             if (!empty($like_store_list)) {
                 $store_id = '';
                 foreach ($like_store_list as $value) {
                     $store_id .= $value['like_object_id'] . ',';
                 }
                 $store_id = rtrim($store_id, ',');
                 $model_microshop_store = Model('micro_store');
                 $store_list = $model_microshop_store->getListWithStoreInfo(array('shop_store_id' => array('in', $store_id)), null, 'microshop_sort asc');
             }
             $like_store_list = array_under_reset($like_store_list, 'like_object_id');
             Tpl::output('like_store_list', $like_store_list);
             Tpl::output('list', $store_list);
             break;
         default:
             Tpl::output('list', $model_like->getGoodsList($condition, 35));
             break;
     }
     Tpl::output('show_page', $model_like->showpage(2));
     Tpl::output('home_sign', 'like');
     Tpl::output('like_sign', $type);
     Tpl::showpage('home');
 }
Example #14
0
 /**
  * GET 用户的圈子
  */
 public function user_circlesOp()
 {
     $model = Model();
     $cm_list = $model->table('circle_member')->where(array('member_id' => $this->member_id, 'cm_state' => array('not in', array(0, 2))))->order('cm_jointime desc')->select();
     if (!empty($cm_list)) {
         $cm_list = array_under_reset($cm_list, 'circle_id');
         $circleid_array = array_keys($cm_list);
         $circle_list = $model->table('circle')->where(array('circle_id' => array('in', $circleid_array)))->select();
     }
     output_data(array('circle_list' => $circle_list));
 }
Example #15
0
 /**
  * 图片列表
  */
 public function album_pic_listOp()
 {
     $id = intval($_GET['id']);
     if ($id <= 0) {
         showMessage(Language::get('album_parameter_error'), '', 'html', 'error');
     }
     /**
      * 实例化类
      */
     $model = Model();
     $where = array();
     $where['ac_id'] = $id;
     $param['member_id'] = $this->master_id;
     $order = 'ap_id desc';
     if ($_GET['sort'] != '') {
         switch ($_GET['sort']) {
             case '0':
                 $order = 'upload_time desc';
                 break;
             case '1':
                 $order = 'upload_time asc';
                 break;
             case '2':
                 $order = 'ap_size desc';
                 break;
             case '3':
                 $order = 'ap_size asc';
                 break;
             case '4':
                 $order = 'ap_name desc';
                 break;
             case '5':
                 $order = 'ap_name asc';
                 break;
         }
     }
     $pic_list = $model->table('sns_albumpic')->where($where)->order($order)->page(36)->select();
     Tpl::output('pic_list', $pic_list);
     Tpl::output('show_page', $model->showpage());
     /**
      * 相册列表
      */
     $where = array();
     $where['member_id'] = $this->master_id;
     $class_array = $model->table('sns_albumclass')->where($where)->select();
     if (empty($class_array)) {
         showMessage(Language::get('wrong_argument'), '', '', 'error');
     }
     // 整理
     $class_array = array_under_reset($class_array, 'ac_id');
     $class_list = $class_info = array();
     foreach ($class_array as $val) {
         if ($val['ac_id'] == $id) {
             $class_info = $val;
         } else {
             $class_list[] = $val;
         }
     }
     Tpl::output('class_list', $class_list);
     Tpl::output('class_info', $class_info);
     self::profile_menu('album_pic', 'pic_list');
     Tpl::showpage('sns_album_pic_list');
 }
Example #16
0
	/**
	 * 圈子商品列表
	 */
	public function group_goodsOp(){
		// 圈子信息
		$this->circleInfo();

		// 圈主和管理信息
		$this->manageList();

		// 会员信息
		$this->memberInfo();

		// sidebar相关
		$this->sidebar();

		// 成员商品列表
		$model = Model();
		$cmid_list	= $model->table('circle_member')->field('member_id')->where(array('circle_id'=>$this->c_id, 'cm_state'=>1))->select();
		$cmid_list	= array_under_reset($cmid_list, 'member_id'); $cmid_array = array_keys($cmid_list);
		$count		= $model->table('sns_sharegoods')->where(array('share_memberid'=>array('in', $cmid_array)))->count();
		$goods_list = $model->table('sns_sharegoods,sns_goods')->join('left')->on('sns_sharegoods.share_goodsid=sns_goods.snsgoods_goodsid')
						->where(array('sns_sharegoods.share_memberid'=>array('in', $cmid_array), 'share_isshare|share_islike'=>1))->order('share_id desc')->page(20, $count)->select();
		if(!empty($goods_list)){
			if($_SESSION['is_login'] == '1'){
				foreach ($goods_list as $k=>$v){
					if (!empty($v['snsgoods_likemember'])){
						$v['snsgoods_likemember_arr'] = explode(',',$v['snsgoods_likemember']);
						$v['snsgoods_havelike'] = in_array($_SESSION['member_id'],$v['snsgoods_likemember_arr'])?1:0;
					}
					$goods_list[$k] = $v;
				}
			}
			$goods_list	= array_under_reset($goods_list, 'share_id'); $shareid_array = array_keys($goods_list);
			Tpl::output('show_page', $model->showpage('2'));
			Tpl::output('goods_list', $goods_list);
			$pic_list	= $model->cls()->table('sns_albumpic')->where(array('item_id'=>array('in', $shareid_array)))->select();
			$pic_list	= array_under_reset($pic_list, 'item_id', 2);
			Tpl::output('pic_list', $pic_list);
		}

		$this->circleSEO(L('circle_member_like_and_show_goods').$this->circle_info['circle_name']);

		// breadcrumb navigation
		$this->breadcrumd(L('site_search_goods'));
		Tpl::showpage('group.goods');
	}
Example #17
0
 /**
  * 首页
  */
 public function indexOp()
 {
     $model = Model();
     // 热门圈子      **显示3个圈子,按推荐随机排列,推荐不够按成员数主题数降序排列**
     $circle_list = $model->table('circle')->field('*, is_hot*rand() as rand')->where(array('circle_status' => 1, 'is_hot' => 1))->order('rand desc')->limit(3)->select();
     if (!empty($circle_list)) {
         $circle_list = array_under_reset($circle_list, 'circle_id');
         $circleid_array = array_keys($circle_list);
         // 查询圈子最新主题
         foreach ($circle_list as $key => $val) {
             // 最新的两条数据
             $theme_list = $model->table('circle_theme')->where(array('circle_id' => $val['circle_id'], 'is_closed' => 0))->order('theme_id desc')->limit(2)->select();
             $circle_list[$key]['theme_list'] = $theme_list;
         }
         Tpl::output('circle_list', $circle_list);
         $now = strtotime(date('Y-m-d', time()));
         // 今天发表的主题
         $nowthemecount_array = $model->table('circle_theme')->field('count(circle_id) as count,circle_id')->group('circle_id')->where(array('theme_addtime' => array('gt', $now), 'circle_id' => array('in', $circleid_array), 'is_closed' => 0))->select();
         if (!empty($nowthemecount_array)) {
             $nowthemecount_array = array_under_reset($nowthemecount_array, 'circle_id');
             Tpl::output('nowthemecount_array', $nowthemecount_array);
         }
         // 今天新加入的成员
         $nowjoincount_array = $model->table('circle_member')->field('count(circle_id) as count,circle_id')->group('circle_id')->where(array('cm_jointime' => array('gt', $now), 'circle_id' => array('in', $circleid_array)))->select();
         if (!empty($nowjoincount_array)) {
             $nowjoincount_array = array_under_reset($nowjoincount_array, 'circle_id');
             Tpl::output('nowjoincount_array', $nowjoincount_array);
         }
     }
     // 圈子分类
     $class_list = $model->table('circle_class')->where(array('class_status' => 1, 'is_recommend' => 1))->order('class_sort asc')->select();
     Tpl::output('class_list', $class_list);
     // 推荐圈子
     $rcircle_list = $model->table('circle')->field('*, is_recommend*rand() as rand')->where(array('circle_status' => 1, 'is_recommend' => 1))->order('rand desc')->limit('20')->select();
     Tpl::output('rcircle_list', $rcircle_list);
     // 推荐话题
     $theme_list = $model->table('circle_theme')->field('*, is_recommend*rand() as rand')->where(array('has_affix' => 1, 'is_closed' => 0, 'is_recommend' => 1))->order('rand desc')->limit(8)->select();
     if (!empty($theme_list)) {
         $theme_list = array_under_reset($theme_list, 'theme_id');
         $themeid_array = array_keys($theme_list);
         // 附件
         $affix_list = $model->table('circle_affix')->where(array('theme_id' => array('in', $themeid_array), 'affix_type' => 1))->group('theme_id')->select();
         if (!empty($affix_list)) {
             $affix_list = array_under_reset($affix_list, 'theme_id');
         }
         foreach ($theme_list as $key => $val) {
             if (isset($affix_list[$val['theme_id']])) {
                 $theme_list[$key]['affix'] = themeImageUrl($affix_list[$val['theme_id']]['affix_filethumb']);
             }
         }
         Tpl::output('theme_list', $theme_list);
     }
     // 商品话题
     $gtheme_list = $model->table('circle_theme')->where(array('has_goods' => 1, 'is_closed' => 0))->order('theme_id desc')->limit(6)->select();
     if (!empty($gtheme_list)) {
         $gtheme_list = array_under_reset($gtheme_list, 'theme_id');
         $themeid_array = array_keys($gtheme_list);
         // 圈子商品
         $thg_list = $model->table('circle_thg')->where(array('theme_id' => array('in', $themeid_array), 'reply_id' => 0))->select();
         $thg_list = tidyThemeGoods($thg_list, 'theme_id', 2);
         Tpl::output('thg_list', $thg_list);
         Tpl::output('gtheme_list', $gtheme_list);
     }
     // 优秀成员
     $member_list = $model->table('circle_member')->field('*, is_recommend*rand() as rand')->where(array('is_recommend' => 1))->order('rand desc')->limit(5)->select();
     if (!empty($member_list)) {
         $member_list = array_reverse($member_list);
         $one_member = array_pop($member_list);
         $where = array();
         $where['member_id'] = $one_member['member_id'];
         $where['circle_id'] = $one_member['circle_id'];
         $one_membertheme = $model->table('circle_theme')->where($where)->order('theme_id desc')->limit(4)->select();
         Tpl::output('one_member', $one_member);
         Tpl::output('one_membertheme', $one_membertheme);
         if (!empty($member_list)) {
             $where = '';
             foreach ($member_list as $val) {
                 $where .= '( circle_member.member_id = ' . $val['member_id'] . ' and circle_member.circle_id = ' . $val['circle_id'] . ') or ';
             }
             $where = rtrim($where, 'or ');
             $more_membertheme = $model->table('circle_member,circle_theme')->join('inner')->on('circle_member.member_id = circle_theme.member_id and circle_member.circle_id = circle_theme.circle_id')->where($where)->group('circle_member.member_id,circle_member.circle_id')->select();
             Tpl::output('more_membertheme', $more_membertheme);
         }
     }
     // 最新话题/热门话题/人气回复
     $this->themeTop();
     // 首页幻灯
     $loginpic = unserialize(C('circle_loginpic'));
     Tpl::output('loginpic', $loginpic);
     $this->circleSEO();
     Tpl::showpage('index');
 }
 /**
  * 添加商品
  */
 public function add_step_twoOp()
 {
     // 实例化商品分类模型
     $model_goodsclass = Model('goods_class');
     // 是否能使用编辑器
     if (checkPlatformStore()) {
         // 平台店铺可以使用编辑器
         $editor_multimedia = true;
     } else {
         // 三方店铺需要
         $editor_multimedia = false;
         if ($this->store_grade['sg_function'] == 'editor_multimedia') {
             $editor_multimedia = true;
         }
     }
     Tpl::output('editor_multimedia', $editor_multimedia);
     $gc_id = intval($_GET['class_id']);
     // 验证商品分类是否存在且商品分类是否为最后一级
     $data = H('goods_class') ? H('goods_class') : H('goods_class', true);
     if (!isset($data[$gc_id]) || isset($data[$gc_id]['child']) || isset($data[$gc_id]['childchild'])) {
         showDialog(L('store_goods_index_again_choose_category1'));
     }
     // 三方店铺验证是否绑定了该分类
     if (!checkPlatformStore()) {
         $where['class_1|class_2|class_3'] = $gc_id;
         $where['store_id'] = $_SESSION['store_id'];
         $rs = Model('store_bind_class')->getStoreBindClassInfo($where);
         if (empty($rs)) {
             showMessage(L('store_goods_index_again_choose_category2'));
         }
     }
     // 更新常用分类信息
     $goods_class = $model_goodsclass->getGoodsClassLineForTag($gc_id);
     Tpl::output('goods_class', $goods_class);
     Model('goods_class_staple')->autoIncrementStaple($goods_class, $_SESSION['member_id']);
     // 获取类型相关数据
     if ($goods_class['type_id'] > 0) {
         $typeinfo = Model('type')->getAttr($goods_class['type_id'], $_SESSION['store_id'], $gc_id);
         list($spec_json, $spec_list, $attr_list, $brand_list) = $typeinfo;
         Tpl::output('sign_i', count($spec_list));
         Tpl::output('spec_list', $spec_list);
         Tpl::output('attr_list', $attr_list);
         Tpl::output('brand_list', $brand_list);
     }
     // 实例化店铺商品分类模型
     $store_goods_class = Model('my_goods_class')->getClassTree(array('store_id' => $_SESSION['store_id'], 'stc_state' => '1'));
     Tpl::output('store_goods_class', $store_goods_class);
     // 小时分钟显示
     $hour_array = array('00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23');
     Tpl::output('hour_array', $hour_array);
     $minute_array = array('05', '10', '15', '20', '25', '30', '35', '40', '45', '50', '55');
     Tpl::output('minute_array', $minute_array);
     // 关联版式
     $plate_list = Model('store_plate')->getPlateList(array('store_id' => $_SESSION['store_id']), 'plate_id,plate_name,plate_position');
     $plate_list = array_under_reset($plate_list, 'plate_position', 2);
     Tpl::output('plate_list', $plate_list);
     Tpl::output('item_id', '');
     Tpl::output('menu_sign', 'add_goods_stpe2');
     Tpl::showpage('store_goods_add.step2');
 }
Example #19
0
 /**
  * 话题列表
  */
 public function theme_listOp()
 {
     $model = Model();
     if (chksubmit()) {
         if (!empty($_POST['check_theme_id']) && is_array($_POST['check_theme_id'])) {
             foreach ($_POST['check_theme_id'] as $t_id) {
                 $theme_info = $model->table('circle_theme')->where(array('theme_id' => $t_id))->find();
                 if (empty($theme_info)) {
                     continue;
                 }
                 // 删除附件
                 $affix_list = $model->table('circle_affix')->where(array('theme_id' => $t_id))->select();
                 if (!empty($affix_list)) {
                     foreach ($affix_list as $val) {
                         @unlink(themeImagePath($val['affix_filename']));
                         @unlink(themeImagePath($val['affix_filethumb']));
                     }
                     $model->table('circle_affix')->where(array('theme_id' => $t_id))->delete();
                 }
                 // 删除商品
                 $model->table('circle_thg')->where(array('theme_id' => $t_id))->delete();
                 // 删除赞表相关
                 $model->table('circle_like')->where(array('theme_id' => $t_id))->delete();
                 // 删除回复
                 $model->table('circle_threply')->where(array('theme_id' => $t_id))->delete();
                 // 更新圈子主题数量
                 $model->table('circle')->update(array('circle_id' => $theme_info['circle_id'], 'circle_thcount' => array('exp', 'circle_thcount-1')));
                 // The recycle bin add delete records
                 $param = array();
                 $param['theme_id'] = $t_id;
                 $param['op_id'] = 0;
                 $param['op_name'] = L('cirlce_administrator');
                 $param['type'] = 'admintheme';
                 Model('circle_recycle')->saveRecycle($param, $theme_info);
                 // 删除话题
                 $model->table('circle_theme')->delete($t_id);
                 // Experience
                 if (intval($theme_info['theme_exp']) > 0) {
                     $param = array();
                     $param['member_id'] = $theme_info['member_id'];
                     $param['member_name'] = $theme_info['member_name'];
                     $param['circle_id'] = $theme_info['circle_id'];
                     $param['itemid'] = $t_id;
                     $param['type'] = 'delRelease';
                     $param['exp'] = $theme_info['theme_exp'];
                     Model('circle_exp')->saveExp($param);
                 }
             }
         }
         showMessage(L('nc_common_op_succ'), 'index.php?act=circle_theme&op=theme_list');
     }
     $where = array();
     if ($_GET['searchname'] != '') {
         $where['theme_name'] = array('like', '%' . $_GET['searchname'] . '%');
     }
     if ($_GET['classname'] != '') {
         $where['circle_name'] = array('like', '%' . $_GET['classname'] . '%');
     }
     if ($_GET['searchtop'] != '' && in_array($_GET['searchtop'], array(0, 1))) {
         $where['is_stick'] = intval($_GET['searchtop']);
     }
     if ($_GET['searchcream'] != '' && in_array($_GET['searchcream'], array(0, 1))) {
         $where['is_digest'] = intval($_GET['searchcream']);
     }
     if ($_GET['searchrecommend'] != '' && in_array($_GET['searchrecommend'], array(0, 1))) {
         $where['is_recommend'] = intval($_GET['searchrecommend']);
     }
     $theme_list = $model->table('circle_theme')->where($where)->order('theme_id desc')->page(10)->select();
     if (!empty($theme_list)) {
         $theme_list = array_under_reset($theme_list, 'theme_id');
         $themeid_array = array_keys($theme_list);
         // 附件
         $affix_list = $model->table('circle_affix')->where(array('theme_id' => array('in', $themeid_array), 'affix_type' => 1))->group('theme_id')->select();
         if (!empty($affix_list)) {
             $affix_list = array_under_reset($affix_list, 'theme_id');
         }
         foreach ($theme_list as $key => $val) {
             if (isset($affix_list[$val['theme_id']])) {
                 $theme_list[$key]['affix'] = themeImageUrl($affix_list[$val['theme_id']]['affix_filethumb']);
             }
         }
     }
     Tpl::output('theme_list', $theme_list);
     Tpl::output('page', $model->showpage(2));
     Tpl::showpage('circle_theme.list');
 }
Example #20
0
 /**
  * 购买记录
  */
 public function groupbuy_orderOp()
 {
     $group_id = intval($_GET['group_id']);
     if ($group_id > 0) {
         if (!$_GET['is_vr']) {
             //获取购买记录
             $model_order = Model('order');
             $condition = array();
             $condition['goods_type'] = 2;
             $condition['promotions_id'] = $group_id;
             $order_goods_list = $model_order->getOrderGoodsList($condition, '*', 0, 10);
             Tpl::output('order_goods_list', $order_goods_list);
             Tpl::output('show_page', $model_order->showpage());
             if (!empty($order_goods_list)) {
                 $orderid_array = array();
                 foreach ($order_goods_list as $value) {
                     $orderid_array[] = $value['order_id'];
                 }
                 $order_list = $model_order->getNormalOrderList(array('order_id' => array('in', $orderid_array)), '', 'order_id,buyer_name,add_time');
                 $order_list = array_under_reset($order_list, 'order_id');
                 Tpl::output('order_list', $order_list);
             }
         } else {
             $model_order = Model('vr_order');
             $condition = array();
             $condition['order_promotion_type'] = 1;
             $condition['promotions_id'] = $group_id;
             $order_goods_list = $model_order->getOrderAndOrderGoodsSalesRecordList($condition, '*', 10);
             Tpl::output('order_goods_list', $order_goods_list);
             Tpl::output('show_page', $model_order->showpage());
         }
     }
     Tpl::showpage('groupbuy_order', 'null_layout');
 }
Example #21
0
 /**
  * 取得店铺绑定的分类
  *
  * @param   number  $store_id   店铺id
  * @param   number  $pid        父级分类id
  * @param   number  $deep       深度
  * @return  array   二维数组
  */
 public function getGoodsClass($store_id, $pid = 0, $deep = 1)
 {
     // 读取商品分类 by 33 hao .com 批量添加分类修改
     $gc_list_o = $gc_list = $this->getGoodsClassListByParentId($pid);
     // 如果不是自营店铺或者自营店铺未绑定全部商品类目,读取绑定分类
     if (!checkPlatformStoreBindingAllGoodsClass()) {
         $gc_list = array_under_reset($gc_list, 'gc_id');
         $model_storebindclass = Model('store_bind_class');
         $gcid_array = $model_storebindclass->getStoreBindClassList(array('store_id' => $store_id, 'state' => array('in', array(1, 2))), '', "class_{$deep} asc", "distinct class_{$deep}");
         if (!empty($gcid_array)) {
             $tmp_gc_list = array();
             foreach ($gcid_array as $value) {
                 if ($value["class_{$deep}"] == 0) {
                     return $gc_list_o;
                 }
                 if (isset($gc_list[$value["class_{$deep}"]])) {
                     $tmp_gc_list[] = $gc_list[$value["class_{$deep}"]];
                 }
             }
             $gc_list = $tmp_gc_list;
         } else {
             return array();
         }
     }
     return $gc_list;
 }
Example #22
0
 /**
  * 画报详细页
  */
 public function picture_detailOp()
 {
     $picture_id = intval($_GET['picture_id']);
     if ($picture_id <= 0) {
         showMessage(Language::get('wrong_argument'), '', '', 'error');
     }
     $model_picture = Model('cms_picture');
     $picture_detail = $model_picture->getOne(array('picture_id' => $picture_id));
     if (empty($picture_detail)) {
         showMessage(Language::get('picture_not_exist'), CMS_SITE_URL, '', 'error');
     }
     if (intval($picture_detail['picture_state']) !== self::ARTICLE_STATE_PUBLISHED) {
         if ($this->publisher_type !== self::ARTICLE_TYPE_ADMIN) {
             if (empty($_SESSION['member_id']) || $_SESSION['member_id'] != $this->publisher_id) {
                 showMessage(Language::get('picture_not_exist'), CMS_SITE_URL, '', 'error');
             }
         }
     }
     $model_picture_image = Model('cms_picture_image');
     $picture_image_list = $model_picture_image->getList(array('image_picture_id' => $picture_id), NULL);
     Tpl::output('picture_image_list', $picture_image_list);
     $conition = array();
     $conition['picture_state'] = self::ARTICLE_STATE_PUBLISHED;
     $conition['picture_id'] = array('lt', $picture_id);
     $pre_picture = $model_picture->getList($conition, null, 'picture_id desc', '*', 1);
     Tpl::output('pre_picture', $pre_picture[0]);
     $conition['picture_id'] = array('gt', $picture_id);
     $next_picture = $model_picture->getList($conition, null, 'picture_id asc', '*', 1);
     Tpl::output('next_picture', $next_picture[0]);
     //计数加1
     $model_picture->modify(array('picture_click' => array('exp', 'picture_click+1')), array('picture_id' => $picture_id));
     //标签
     $model_tag = Model('cms_tag');
     $cms_tag_list = $model_tag->getList(TRUE, null, 'tag_sort asc', '', 10);
     $cms_tag_list = array_under_reset($cms_tag_list, 'tag_id');
     Tpl::output('cms_tag_list', $cms_tag_list);
     //分享
     $this->get_share_app_list();
     //seo
     Tpl::output('seo_title', $picture_detail['picture_title']);
     Tpl::output('picture_detail', $picture_detail);
     Tpl::output('detail_object_id', $picture_id);
     Tpl::showpage('picture_detail');
 }
 /**
  * 批量加关注
  */
 public function batch_addfollowOp()
 {
     // 验证参数
     if (trim($_GET['ids']) == '') {
         showDialog(Language::get('wrong_argument'), '', 'error');
     }
     $ids = explode(',', trim($_GET['ids']));
     if (empty($ids)) {
         showDialog(Language::get('wrong_argument'), '', 'error');
     }
     // 实例化模型
     $model = Model();
     $member_info = $model->table('member')->find($_SESSION['member_id']);
     if (empty($member_info)) {
         showDialog(Language::get('snsfriend_member_error'), '', 'error');
     }
     // 将被关注会员列表
     $pm_array = $model->table('member')->where(array('member_id' => array('in', $ids)))->select();
     // 查询是否已经关注
     $gz_array = $model->table('sns_friend')->where(array('friend_frommid' => $_SESSION['member_id'], 'friend_tomid' => array('in', $ids)))->select();
     $gz_array = array_under_reset($gz_array, 'friend_tomid', 1);
     // 查询对方是否关注我
     $bgz_array = $model->table('sns_friend')->where(array('friend_frommid' => array('in', $ids), 'friend_tomid' => $_SESSION['member_id']))->select();
     $bgz_array = array_under_reset($bgz_array, 'friend_frommid', 1);
     if (!empty($pm_array)) {
         $insert_array = array();
         foreach ($pm_array as $val) {
             if (isset($gz_array[$val['member_id']])) {
                 // 已关注跳出循环
                 continue;
             }
             if ($val['member_id'] == $_SESSION['member_id']) {
                 // 不关注自己
                 continue;
             }
             $insert = array();
             $insert['friend_frommid'] = $member_info['member_id'];
             $insert['friend_frommname'] = $member_info['member_name'];
             $insert['friend_frommavatar'] = $member_info['member_avatar'];
             $insert['friend_tomid'] = $val['member_id'];
             $insert['friend_tomname'] = $val['member_name'];
             $insert['friend_tomavatar'] = $val['member_avatar'];
             $insert['friend_addtime'] = time();
             if (isset($bgz_array[$val['member_id']])) {
                 $insert['friend_followstate'] = 2;
                 $model->table('sns_friend')->update(array('friend_followstate' => 2, 'friend_id' => $bgz_array[$val['member_id']]['friend_id']));
             } else {
                 $insert['friend_followstate'] = 1;
             }
             $insert_array[] = $insert;
         }
         // 插入
         $model->table('sns_friend')->insertAll($insert_array);
     }
     showDialog(Language::get('snsfriend_follow_succ'), '', 'succ');
 }
 /**
  * 根据商品id查询套餐数据
  * @param unknown $goods_id
  */
 public function getBundlingCacheByGoodsId($goods_id)
 {
     $array = $this->_rGoodsBundlingCache($goods_id);
     if (empty($array)) {
         $bundling_array = array();
         $b_goods_array = array();
         // 根据商品id查询bl_id
         $b_g_list = $this->getBundlingGoodsList(array('goods_id' => $goods_id, 'bl_appoint' => 1), 'bl_id');
         if (!empty($b_g_list)) {
             $b_id_array = array();
             foreach ($b_g_list as $val) {
                 $b_id_array[] = $val['bl_id'];
             }
             // 查询套餐列表
             $bundling_list = $this->getBundlingOpenList(array('bl_id' => array('in', $b_id_array)));
             // 整理
             if (!empty($bundling_list)) {
                 foreach ($bundling_list as $val) {
                     $bundling_array[$val['bl_id']]['id'] = $val['bl_id'];
                     $bundling_array[$val['bl_id']]['name'] = $val['bl_name'];
                     $bundling_array[$val['bl_id']]['cost_price'] = 0;
                     $bundling_array[$val['bl_id']]['price'] = $val['bl_discount_price'];
                     $bundling_array[$val['bl_id']]['freight'] = $val['bl_freight'];
                 }
                 $blid_array = array_keys($bundling_array);
                 $b_goods_list = $this->getBundlingGoodsList(array('bl_id' => array('in', $blid_array)));
                 if (!empty($b_goods_list) && count($b_goods_list) > 1) {
                     $goodsid_array = array();
                     foreach ($b_goods_list as $val) {
                         $goodsid_array[] = $val['goods_id'];
                     }
                     $goods_list = Model('goods')->getGoodsList(array('goods_id' => array('in', $goodsid_array)), 'goods_id,goods_name,goods_price,goods_image');
                     $goods_list = array_under_reset($goods_list, 'goods_id');
                     foreach ($b_goods_list as $val) {
                         if (isset($goods_list[$val['goods_id']])) {
                             $k = intval($val['goods_id']) == $goods_id ? 0 : $val['goods_id'];
                             // 排序当前商品放到最前面
                             $b_goods_array[$val['bl_id']][$k]['id'] = $val['goods_id'];
                             $b_goods_array[$val['bl_id']][$k]['image'] = thumb($goods_list[$val['goods_id']], 240);
                             $b_goods_array[$val['bl_id']][$k]['name'] = $goods_list[$val['goods_id']]['goods_name'];
                             $b_goods_array[$val['bl_id']][$k]['shop_price'] = ncPriceFormat($goods_list[$val['goods_id']]['goods_price']);
                             $b_goods_array[$val['bl_id']][$k]['price'] = ncPriceFormat($val['bl_goods_price']);
                             $bundling_array[$val['bl_id']]['cost_price'] += $goods_list[$val['goods_id']]['goods_price'];
                         }
                     }
                 }
             }
         }
         $array = array('bundling_array' => serialize($bundling_array), 'b_goods_array' => serialize($b_goods_array));
         $this->_wGoodsBundlingCache($goods_id, $array);
     }
     return $array;
 }
Example #25
0
 /**
  * 文章侧栏
  */
 private function get_article_sidebar()
 {
     $model_tag = Model('cms_tag');
     $model_article = Model('cms_article');
     //标签
     $cms_tag_list = $model_tag->getList(TRUE, null, 'tag_sort asc', '', 10);
     $cms_tag_list = array_under_reset($cms_tag_list, 'tag_id');
     Tpl::output('cms_tag_list', $cms_tag_list);
     //推荐文章(图文)
     $condition = array();
     $condition['article_commend_image_flag'] = 1;
     $article_commend_image_list = $model_article->getList($condition, 5, 'article_id desc', '*', 3);
     Tpl::output('article_commend_image_list', $article_commend_image_list);
     //推荐文章
     $this->get_article_comment();
 }
 /**
  * 选择商品
  */
 public function choosed_goodsOp()
 {
     $gid = $_GET['gid'];
     if ($gid <= 0) {
         $data = array('result' => 'false', 'msg' => '参数错误');
         $this->_echoJson($data);
     }
     // 验证商品是否存在
     $goods_info = Model('goods')->getGoodsInfo(array('goods_id' => $gid, 'store_id' => $_SESSION['store_id']), 'goods_id,goods_name,goods_image,goods_price,store_id,gc_id');
     if (empty($goods_info)) {
         $data = array('result' => 'false', 'msg' => '参数错误');
         $this->_echoJson($data);
     }
     $model_booth = Model('p_booth');
     // 验证套餐时候过期
     $booth_info = $model_booth->getBoothQuotaInfo(array('store_id' => $_SESSION['store_id'], 'booth_quota_endtime' => array('gt', TIMESTAMP)), 'booth_quota_id');
     if (empty($booth_info)) {
         $data = array('result' => 'false', 'msg' => '套餐过期请重新购买套餐');
         $this->_echoJson($data);
     }
     // 验证已添加商品数量,及选择商品是否已经被添加过
     $bootgoods_info = $model_booth->getBoothGoodsList(array('store_id' => $_SESSION['store_id']), 'goods_id');
     // 已添加商品总数
     if (count($bootgoods_info) >= C('promotion_booth_goods_sum')) {
         $data = array('result' => 'false', 'msg' => '只能添加' . C('promotion_booth_goods_sum') . '个商品');
         $this->_echoJson($data);
     }
     // 商品是否已经被添加
     $bootgoods_info = array_under_reset($bootgoods_info, 'goods_id');
     if (isset($bootgoods_info[$gid])) {
         $data = array('result' => 'false', 'msg' => '商品已经添加,请选择其他商品');
         $this->_echoJson($data);
     }
     // 保存到推荐展位商品表
     $insert = array();
     $insert['store_id'] = $_SESSION['store_id'];
     $insert['goods_id'] = $goods_info['goods_id'];
     $insert['gc_id'] = $goods_info['gc_id'];
     $model_booth->addBoothGoods($insert);
     $this->recordSellerLog('添加推荐展位商品,商品id:' . $goods_info['goods_id']);
     // 输出商品信息
     $goods_info['goods_image'] = thumb($goods_info);
     $goods_info['url'] = urlShop('goods', 'index', array('goods_id' => $goods_info['goods_id']));
     $goods_class = Model('goods_class')->getGoodsClassInfo(array('gc_id' => $goods_info['gc_id']), 'gc_name');
     $goods_info['gc_name'] = $goods_class['gc_name'];
     $goods_info['result'] = 'true';
     $this->_echoJson($goods_info);
 }
Example #27
0
 /**
  * 评论列表
  **/
 public function comment_listOp()
 {
     $page_count = 5;
     $order = 'comment_id desc';
     if ($_GET['comment_all'] === 'all') {
         $page_count = 10;
         $order = 'comment_up desc, comment_id desc';
     }
     $comment_object_id = intval($_GET['comment_object_id']);
     $comment_type = 0;
     switch ($_GET['type']) {
         case 'article':
             $comment_type = self::ARTICLE;
             break;
         case 'picture':
             $comment_type = self::PICTURE;
             break;
     }
     if ($comment_object_id > 0 && $comment_type > 0) {
         $condition = array();
         $condition["comment_object_id"] = $comment_object_id;
         $condition["comment_type"] = $comment_type;
         $model_cms_comment = Model('cms_comment');
         $comment_list = $model_cms_comment->getListWithUserInfo($condition, $page_count, $order);
         Tpl::output('comment_list', $comment_list);
         if ($_GET['comment_all'] === 'all') {
             Tpl::output('show_page', $model_cms_comment->showpage(2));
         }
         $comment_quote_id = '';
         $comment_quote_list = array();
         if (!empty($comment_list)) {
             foreach ($comment_list as $value) {
                 if (!empty($value['comment_quote'])) {
                     $comment_quote_id .= $value['comment_quote'] . ',';
                 }
             }
         }
         if (!empty($comment_quote_id)) {
             $comment_quote_list = $model_cms_comment->getListWithUserInfo(array('comment_id' => array('in', $comment_quote_id)));
         }
         if (!empty($comment_quote_list)) {
             $comment_quote_list = array_under_reset($comment_quote_list, 'comment_id');
         }
         Tpl::output('comment_quote_list', $comment_quote_list);
         Tpl::showpage('comment_list', 'null_layout');
     }
 }
Example #28
0
 /**
  * 根据商品编号查询是否有可用抢购活动,如果有返回抢购活动,没有返回null
  * @param string $goods_string 商品编号字符串,例:'1,22,33'
  * @return array $groupbuy_list
  *
  */
 public function getGroupbuyListByGoodsCommonIDString($goods_commonid_string)
 {
     $groupbuy_list = $this->_getGroupbuyListByGoodsCommon($goods_commonid_string);
     $groupbuy_list = array_under_reset($groupbuy_list, 'goods_commonid');
     return $groupbuy_list;
 }
 /**
  * 设置关联版式
  */
 public function edit_plateOp()
 {
     if (chksubmit()) {
         $common_id = $this->checkRequestCommonId($_POST['commonid']);
         $commonid_array = explode(',', $common_id);
         $where = array('goods_commonid' => array('in', $commonid_array), 'store_id' => $_SESSION['store_id']);
         $update = array();
         $update['plateid_top'] = intval($_POST['plate_top']) > 0 ? intval($_POST['plate_top']) : '';
         $update['plateid_bottom'] = intval($_POST['plate_bottom']) > 0 ? intval($_POST['plate_bottom']) : '';
         $return = Model('goods')->editGoodsCommon($update, $where);
         if ($return) {
             // 添加操作日志
             $this->recordSellerLog('设置关联版式,平台货号:' . $common_id);
             showDialog(L('nc_common_op_succ'), 'reload', 'succ');
         } else {
             showDialog(L('nc_common_op_fail'), 'reload');
         }
     }
     $common_id = $this->checkRequestCommonId($_GET['commonid']);
     // 关联版式
     $plate_list = Model('store_plate')->getStorePlateList(array('store_id' => $_SESSION['store_id']), 'plate_id,plate_name,plate_position');
     $plate_list = array_under_reset($plate_list, 'plate_position', 2);
     Tpl::output('plate_list', $plate_list);
     Tpl::showpage('store_goods_list.edit_plate', 'null_layout');
 }
Example #30
0
 /**
  * 编辑话题
  */
 public function edit_themeOp()
 {
     $model = Model();
     // 验证话题
     $this->checkThemeSelf();
     if (chksubmit()) {
         /**
          * 验证
          */
         $obj_validate = new Validate();
         $validate_arr[] = array("input" => $_POST["name"], "require" => "true", "message" => Language::get('nc_name_not_null'));
         $validate_arr[] = array("input" => $_POST["name"], "validator" => 'Length', "min" => 4, "max" => 30, "message" => Language::get('nc_name_min_max_length'));
         $validate_arr[] = array("input" => $_POST["themecontent"], "require" => "true", "message" => Language::get('nc_content_not_null'));
         if (intval(C('circle_contentleast')) > 0) {
             $validate_arr[] = array("input" => $_POST["themecontent"], "validator" => 'Length', "min" => intval(C('circle_contentleast')), "message" => Language::get('circle_contentleast'));
         }
         $obj_validate->validateparam = $validate_arr;
         $error = $obj_validate->validate();
         if ($error != '') {
             showDialog($error, '', 'error');
         }
         // 主题分类
         $thclass_id = intval($_POST['thtype']);
         $thclass_name = '';
         if ($thclass_id > 0) {
             $thclass_info = $model->table('circle_thclass')->find($thclass_id);
             $thclass_name = $thclass_info['thclass_name'];
         }
         $model = Model();
         $update = array();
         $update['theme_id'] = $this->t_id;
         $update['theme_name'] = circleCenterCensor($_POST['name']);
         $update['theme_content'] = circleCenterCensor($_POST['themecontent']);
         $update['thclass_id'] = $thclass_id;
         $update['thclass_name'] = $thclass_name;
         $update['theme_editname'] = $_SESSION['member_name'];
         $update['theme_edittime'] = time();
         $update['theme_readperm'] = intval($_POST['readperm']);
         $rs = $model->table('circle_theme')->update($update);
         if ($rs) {
             $has_goods = 0;
             // 存在商品标记
             $has_affix = 0;
             // 存在附件标记
             // 删除原有商品
             $goods_list = Model()->table('circle_thg')->where(array('theme_id' => $this->t_id, 'reply_id' => 0))->delete();
             // 插入话题商品
             if (!empty($_POST['goods'])) {
                 $goods_insert = array();
                 foreach ($_POST['goods'] as $key => $val) {
                     $p = array();
                     $p['theme_id'] = $this->t_id;
                     $p['reply_id'] = 0;
                     $p['circle_id'] = $this->c_id;
                     $p['goods_id'] = $val['id'];
                     $p['goods_name'] = $val['name'];
                     $p['goods_price'] = $val['price'];
                     $p['goods_image'] = $val['image'];
                     $p['store_id'] = $val['storeid'];
                     $p['thg_type'] = $val['type'];
                     $p['thg_url'] = $val['type'] == 1 ? $val['uri'] : '';
                     $goods_insert[] = $p;
                 }
                 $rs = $model->table('circle_thg')->insertAll($goods_insert);
                 $has_goods = 1;
             }
             // 更新话题附件
             $model->table('circle_affix')->where(array('affix_type' => 1, 'member_id' => $_SESSION['member_id'], 'theme_id' => 0))->update(array('theme_id' => $this->t_id, 'circle_id' => $this->c_id));
             // 更新话题信息
             $affixe_count = $model->table('circle_affix')->where(array('affix_type' => 1, 'member_id' => $_SESSION['member_id'], 'theme_id' => $this->t_id))->count();
             if ($affixe_count > 0) {
                 $has_affix = 1;
             }
             if ($has_goods || $has_affix) {
                 $update = array();
                 $update['theme_id'] = $this->t_id;
                 $update['has_goods'] = $has_goods;
                 $update['has_affix'] = $has_affix;
                 $model->table('circle_theme')->update($update);
             }
             // Special theme
             if ($_GET['sp'] == 1) {
                 // Update the vote
                 $update = array();
                 $update['theme_id'] = $this->t_id;
                 $update['poll_multiple'] = intval($_POST['multiple']);
                 $update['poll_startime'] = time();
                 $update['poll_endtime'] = intval($_POST['days']) != 0 ? time() + intval($_POST['days']) * 60 * 60 * 12 : 0;
                 $update['poll_days'] = intval($_POST['days']);
                 $model->table('circle_thpoll')->update($update);
                 // Update the voting options
                 if (!empty($_POST['polloption'])) {
                     $insert_array = array();
                     foreach ($_POST['polloption'] as $key => $val) {
                         $option_info = $model->table('circle_thpolloption')->where(array('pollop_id' => $key, 'theme_id' => $this->t_id))->find();
                         if (!empty($option_info)) {
                             $update = array();
                             $update['pollop_id'] = $key;
                             $update['pollop_option'] = $val;
                             $update['pollop_sort'] = $_POST['pollsort'][$key];
                             $model->table('circle_thpolloption')->update($update);
                         } else {
                             if ($val == '') {
                                 continue;
                             }
                             $i = array();
                             $i['theme_id'] = $this->t_id;
                             $i['pollop_option'] = $val;
                             $i['pollop_sort'] = $_POST['pollsort'][$key];
                             $insert_array[] = $i;
                         }
                     }
                     if (!empty($insert_array)) {
                         $model->table('circle_thpolloption')->insertAll($insert_array);
                     }
                 }
             }
             showDialog(L('nc_deit_op_succ'), CIRCLE_SITE_URL . '/index.php?act=theme&op=theme_detail&c_id=' . $this->c_id . '&t_id=' . $this->t_id, 'succ');
         } else {
             showDialog(L('nc_deit_op_fail'));
         }
     }
     // 圈子信息
     $this->circleInfo();
     // 圈主和管理信息
     $this->manageList();
     // 会员信息
     $this->memberInfo();
     // 话题商品
     $goods_list = $model->table('circle_thg')->where(array('theme_id' => $this->t_id, 'reply_id' => 0))->select();
     $goods_list = tidyThemeGoods($goods_list, 'themegoods_id');
     Tpl::output('goods_list', $goods_list);
     // 话题附件
     $affix_list = $model->table('circle_affix')->where(array('affix_type' => 1, 'theme_id' => $this->t_id))->select();
     Tpl::output('affix_list', $affix_list);
     // 话题分类
     $where = array();
     $where['circle_id'] = $this->c_id;
     $where['thclass_status'] = 1;
     $thclass_list = $model->table('circle_thclass')->where($where)->select();
     $thclass_list = array_under_reset($thclass_list, 'thclass_id');
     Tpl::output('thclass_list', $thclass_list);
     // Members of the information
     $this->memberInfo();
     // Read Permission
     $readperm = $this->readPermissions($this->cm_info);
     Tpl::output('readperm', $readperm);
     $this->circleSEO(L('nc_edit_theme'));
     // breadcrumb navigation
     $this->breadcrumd(L('nc_edit_theme'));
     if ($this->theme_info['theme_special'] == 1) {
         $poll_info = $model->table('circle_thpoll')->find($this->t_id);
         Tpl::output('poll_info', $poll_info);
         $option_list = $model->table('circle_thpolloption')->where(array('theme_id' => $this->t_id))->order('pollop_sort asc')->select();
         Tpl::output('option_list', $option_list);
         Tpl::showpage('theme.edit_themepoll');
     } else {
         Tpl::showpage('theme.edit_theme');
     }
 }