예제 #1
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 = uk86_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');
 }
예제 #2
0
 /**
  * 活动管理
  */
 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 = uk86_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 = uk86_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 => Uk86Language::uk86_get('bundling_state_0'), 1 => Uk86Language::uk86_get('bundling_state_1'));
     Tpl::output('state_array', $state_array);
     // 输出自营店铺IDS
     Tpl::output('flippedOwnShopIds', array_flip(model('store')->getOwnShopIds()));
     Tpl::showpage('promotion_bundling.list');
 }
예제 #3
0
파일: api.php 프로젝트: wangjiang988/ukshop
 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 = uk86_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 = uk86_array_under_reset($affix_list, 'theme_id');
         }
         foreach ($theme_list as $key => $val) {
             if (isset($affix_list[$val['theme_id']])) {
                 $theme_list[$key]['affix'] = uk86_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);
 }
예제 #4
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 = uk86_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'] = uk86_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');
 }
예제 #5
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 = uk86_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');
 }
예제 #6
0
 /**
  * 圈主和管理信息
  */
 protected function manageList()
 {
     $prefix = 'circle_managelist';
     $manager_list = uk86_rcache($this->c_id, $prefix);
     if (empty($manager_list)) {
         $manager_list = Model()->table('circle_member')->where(array('circle_id' => $this->c_id, 'is_identity' => array('in', array(1, 2))))->select();
         $manager_list = uk86_array_under_reset($manager_list, 'is_identity', 2);
         $manager_list[2] = uk86_array_under_reset($manager_list[2], 'member_id', 1);
         uk86_wcache($this->c_id, $manager_list, $prefix);
     }
     Tpl::output('creator', $manager_list[1][0]);
     Tpl::output('manager_list', $manager_list[2]);
 }
예제 #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 = uk86_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');
 }
예제 #8
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 = uk86_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');
 }
예제 #9
0
 /**
  * Members of the level set
  */
 public function indexOp()
 {
     $model = Model();
     if (uk86_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) {
             uk86_showMessage(L('nc_common_op_succ'));
         } else {
             uk86_showMessage(L('nc_common_op_fail'));
         }
     }
     $mld_list = $model->table('circle_mldefault')->select();
     $mld_list = uk86_array_under_reset($mld_list, 'mld_id');
     Tpl::output('mld_list', $mld_list);
     Tpl::showpage('circle_memberlevel');
 }
예제 #10
0
 /**
  * 返回一级分类列表
  */
 private function _get_root_class()
 {
     $model_goods_class = Model('goods_class');
     $model_mb_category = Model('mb_category');
     $goods_class_array = Model('goods_class')->getGoodsClassForCacheModel();
     $class_list = $model_goods_class->getGoodsClassListByParentId(0);
     $mb_categroy = $model_mb_category->getLinkList(array());
     $mb_categroy = uk86_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));
 }
예제 #11
0
 /**
  * 删除未锁定商品
  * @param unknown $condition
  */
 public function delGoodsNoLock($condition)
 {
     $condition['goods_lock'] = 0;
     $common_array = $this->getGoodsCommonList($condition, 'goods_commonid', 0);
     $common_array = uk86_array_under_reset($common_array, 'goods_commonid');
     $commonid_array = array_keys($common_array);
     return $this->delGoodsAll(array('goods_commonid' => array('in', $commonid_array)));
 }
예제 #12
0
 /**
  * 取得商品分类详细信息
  *
  * @param array $search_param 需要的参数内容
  * @return array 数组类型的返回结果
  */
 public function getAttr($get, $default_classid)
 {
     if (!empty($get['a_id'])) {
         $attr_ids = explode('_', $get['a_id']);
     }
     $data = array();
     $model_type = Model('type');
     // 获取当前的分类内容
     $class_array = Model('goods_class')->getGoodsClassForCacheModel();
     $data['class'] = $class_array[$get['cate_id']];
     if (empty($data['class']['child']) && empty($data['class']['childchild'])) {
         // 根据属性查找商品
         if (is_array($attr_ids)) {
             // 商品id数组
             $goodsid_array = array();
             $data['sign'] = false;
             foreach ($attr_ids as $val) {
                 $where = array();
                 $where['attr_value_id'] = $val;
                 if ($data['sign']) {
                     $where['goods_id'] = array('in', $goodsid_array);
                 }
                 $goodsattrindex_list = Model('goods_attr_index')->getGoodsAttrIndexList($where, 'goods_id');
                 if (!empty($goodsattrindex_list)) {
                     $data['sign'] = true;
                     $tpl_goodsid_array = array();
                     foreach ($goodsattrindex_list as $val) {
                         $tpl_goodsid_array[] = $val['goods_id'];
                     }
                     $goodsid_array = $tpl_goodsid_array;
                 } else {
                     $data['goodsid_array'] = $goodsid_array = array();
                     $data['sign'] = false;
                     break;
                 }
             }
             if ($data['sign']) {
                 $data['goodsid_array'] = $goodsid_array;
             }
         }
     }
     $class = $class_array[$default_classid];
     if (empty($class['child']) && empty($class['childchild'])) {
         //获得分类对应的类型ID
         $type_id = $class['type_id'];
         //品牌列表
         $typebrand_list = Model('type')->getTypeBrandList(array('type_id' => $type_id), 'brand_id');
         if (!empty($typebrand_list)) {
             $brandid_array = array();
             foreach ($typebrand_list as $val) {
                 $brandid_array[] = $val['brand_id'];
             }
             $brand_array = Model('brand')->getBrandPassedList(array('brand_id' => array('in', $brandid_array)), 'brand_id,brand_name');
             $brand_array = uk86_array_under_reset($brand_array, 'brand_id');
         }
         // 被选中的品牌
         $brand_id = intval($get['b_id']);
         if ($brand_id > 0 && !empty($brand_array)) {
             $checked_brand = array();
             if (isset($brand_array[$brand_id])) {
                 $checked_brand[$brand_id]['brand_name'] = $brand_array[$brand_id]['brand_name'];
             }
         }
         //属性列表
         $model_attribute = Model('attribute');
         $attribute_list = $model_attribute->getAttributeShowList(array('type_id' => $type_id), 'attr_id,attr_name');
         $attributevalue_list = $model_attribute->getAttributeValueList(array('type_id' => $type_id), 'attr_value_id,attr_value_name,attr_id');
         $attributevalue_list = uk86_array_under_reset($attributevalue_list, 'attr_id', 2);
         $attr_array = array();
         if (!empty($attribute_list)) {
             foreach ($attribute_list as $val) {
                 $attr_array[$val['attr_id']]['name'] = $val['attr_name'];
                 $tpl_array = uk86_array_under_reset($attributevalue_list[$val['attr_id']], 'attr_value_id');
                 $attr_array[$val['attr_id']]['value'] = $tpl_array;
             }
         }
         // 被选中的属性
         if (is_array($attr_ids) && !empty($attr_array)) {
             $checked_attr = array();
             foreach ($attr_ids as $s) {
                 foreach ($attr_array as $k => $d) {
                     if (isset($d['value'][$s])) {
                         $checked_attr[$k]['attr_name'] = $d['name'];
                         $checked_attr[$k]['attr_value_id'] = $s;
                         $checked_attr[$k]['attr_value_name'] = $d['value'][$s]['attr_value_name'];
                     }
                 }
             }
         }
         if (C('fullindexer.open')) {
             $brand_array = $this->delInvalidBrand($brand_array);
             $attr_array = $this->delInvalidAttr($attr_array);
         }
     }
     return array($data, $brand_array, $attr_array, $checked_brand, $checked_attr);
 }
예제 #13
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 = uk86_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();
 }
예제 #14
0
 /**
  * 编辑话题
  */
 public function edit_themeOp()
 {
     $model = Model();
     // 验证话题
     $this->checkThemeSelf();
     if (uk86_chksubmit()) {
         /**
          * 验证
          */
         $obj_validate = new Uk86Validate();
         $validate_arr[] = array("input" => $_POST["name"], "require" => "true", "message" => Uk86Language::uk86_get('nc_name_not_null'));
         $validate_arr[] = array("input" => $_POST["name"], "validator" => 'Length', "min" => 4, "max" => 30, "message" => Uk86Language::uk86_get('nc_name_min_max_length'));
         $validate_arr[] = array("input" => $_POST["themecontent"], "require" => "true", "message" => Uk86Language::uk86_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" => Uk86Language::uk86_get('circle_contentleast'));
         }
         $obj_validate->validateparam = $validate_arr;
         $error = $obj_validate->uk86_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 = uk86_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');
     }
 }
예제 #15
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 = uk86_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');
 }
예제 #16
0
 public function ajax_load_sns_infoOp()
 {
     //我的足迹
     $goods_list = Model('goods_browse')->getViewedGoodsList($_SESSION['member_id'], 20);
     $viewed_goods = array();
     if (is_array($goods_list) && !empty($goods_list)) {
         foreach ($goods_list as $key => $val) {
             $goods_id = $val['goods_id'];
             $val['url'] = uk86_urlShop('goods', 'index', array('goods_id' => $goods_id));
             $val['goods_image'] = uk86_thumb($val, 240);
             $viewed_goods[$goods_id] = $val;
         }
     }
     Tpl::output('viewed_goods', $viewed_goods);
     //我的圈子
     $model = Model();
     $circlemember_array = $model->table('circle_member')->where(array('member_id' => $_SESSION['member_id']))->select();
     if (!empty($circlemember_array)) {
         $circlemember_array = uk86_array_under_reset($circlemember_array, 'circle_id');
         $circleid_array = array_keys($circlemember_array);
         $circle_list = $model->table('circle')->where(array('circle_id' => array('in', $circleid_array)))->limit(6)->select();
         Tpl::output('circle_list', $circle_list);
     }
     //好友动态
     $model_fd = Model('sns_friend');
     $fields = 'member.member_id,member.member_name,member.member_avatar';
     $follow_list = $model_fd->listFriend(array('limit' => 15, 'friend_frommid' => "{$_SESSION['member_id']}"), $fields, '', 'detail');
     $member_ids = array();
     $follow_list_new = array();
     if (is_array($follow_list)) {
         foreach ($follow_list as $v) {
             $follow_list_new[$v['member_id']] = $v;
             $member_ids[] = $v['member_id'];
         }
     }
     $tracelog_model = Model('sns_tracelog');
     //条件
     $condition = array();
     $condition['trace_memberid'] = array('in', $member_ids);
     $condition['trace_privacy'] = 0;
     $condition['trace_state'] = 0;
     $tracelist = Model()->table('sns_tracelog')->where($condition)->field('count(*) as _count,trace_memberid')->group('trace_memberid')->limit(5)->select();
     $tracelist_new = array();
     $follow_list = array();
     if (!empty($tracelist)) {
         foreach ($tracelist as $k => $v) {
             $tracelist_new[$v['trace_memberid']] = $v['_count'];
             $follow_list[] = $follow_list_new[$v['trace_memberid']];
         }
     }
     Tpl::output('tracelist', $tracelist_new);
     Tpl::output('follow_list', $follow_list);
     Tpl::showpage('member_home.sns_info', 'null_layout');
 }
예제 #17
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 = uk86_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 = uk86_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 = uk86_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');
 }
예제 #18
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 (!uk86_checkPlatformStoreBindingAllGoodsClass()) {
         $gc_list = uk86_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;
 }
예제 #19
0
 /**
  * 搜索会员
  */
 public function member_searchOp()
 {
     $cm_list = Model('circle_member')->getSuperList(array(), 'member_id');
     $where = array();
     if (!empty($_GET['name'])) {
         $where['member_name'] = array('like', '%' . trim($_GET['name']) . '%');
     }
     if (!empty($cm_list)) {
         $cm_list = uk86_array_under_reset($cm_list, member_id);
         $memberid_array = array_keys($cm_list);
         $where['member_id'] = array('not in', $memberid_array);
     }
     $member_list = Model('member')->getMemberList($where, 'member_id,member_name');
     echo json_encode($member_list);
     die;
 }
예제 #20
0
 /**
  * 添加商品
  */
 public function add_step_twoOp()
 {
     // 实例化商品分类模型
     $model_goodsclass = Model('goods_class');
     // 现暂时改为从匿名“自营店铺专属等级”中判断
     $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 = Model('goods_class')->getGoodsClassForCacheModel();
     if (!isset($data[$gc_id]) || isset($data[$gc_id]['child']) || isset($data[$gc_id]['childchild'])) {
         showDialog(L('store_goods_index_again_choose_category1'));
     }
     // 如果不是自营店铺或者自营店铺未绑定全部商品类目,读取绑定分类
     if (!uk86_checkPlatformStoreBindingAllGoodsClass()) {
         //商品分类  by uk86.cn 支持批量显示分类
         $model_bind_class = Model('store_bind_class');
         $goods_class = Model('goods_class')->getGoodsClassForCacheModel();
         $where['store_id'] = $_SESSION['store_id'];
         $class_2 = $goods_class[$gc_id]['gc_parent_id'];
         $class_1 = $goods_class[$class_2]['gc_parent_id'];
         $where['class_1'] = $class_1;
         $where['class_2'] = $class_2;
         $where['class_3'] = $gc_id;
         $bind_info = $model_bind_class->getStoreBindClassInfo($where);
         if (empty($bind_info)) {
             $where['class_3'] = 0;
             $bind_info = $model_bind_class->getStoreBindClassInfo($where);
             if (empty($bind_info)) {
                 $where['class_2'] = 0;
                 $where['class_3'] = 0;
                 $bind_info = $model_bind_class->getStoreBindClassInfo($where);
                 if (empty($bind_info)) {
                     $where['class_1'] = 0;
                     $where['class_2'] = 0;
                     $where['class_3'] = 0;
                     $bind_info = Model('store_bind_class')->getStoreBindClassInfo($where);
                     if (empty($bind_info)) {
                         showDialog(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']);
     // 获取类型相关数据
     $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('store_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')->getStorePlateList(array('store_id' => $_SESSION['store_id']), 'plate_id,plate_name,plate_position');
     $plate_list = uk86_array_under_reset($plate_list, 'plate_position', 2);
     Tpl::output('plate_list', $plate_list);
     //店铺楼层
     $floor_model = Model();
     $condition['store_id'] = $_SESSION['store_id'];
     $floors = $floor_model->table('store_floor')->where($condition)->select();
     Tpl::output("store_floors", $floors);
     //是否为自营店铺
     $is_own_shop = Model('store')->where(array('store_id' => $_SESSION['store_id']))->field('is_own_shop')->find();
     Tpl::output('is_own_shop', intval($is_own_shop['is_own_shop']));
     Tpl::showpage('store_goods_add.step2');
 }
예제 #21
0
 /**
  * 根据商品编号查询是否有可用限时折扣活动,如果有返回限时折扣活动,没有返回null
  * @param string $goods_string 商品编号字符串,例:'1,22,33'
  * @return array $xianshi_goods_list
  *
  */
 public function getXianshiGoodsListByGoodsString($goods_string)
 {
     $xianshi_goods_list = $this->_getXianshiGoodsListByGoods($goods_string);
     $xianshi_goods_list = uk86_array_under_reset($xianshi_goods_list, 'goods_id');
     return $xianshi_goods_list;
 }
예제 #22
0
 /**
  * 编辑话题
  */
 public function edit_themeOp()
 {
     // 身份验证
     $rs = $this->checkIdentity('cm');
     if (!empty($rs)) {
         uk86_showMessage($rs);
     }
     $t_id = intval($_GET['t_id']);
     if ($t_id <= 0) {
         uk86_showMessage(L('wrong_argument'));
     }
     Tpl::output('t_id', $t_id);
     $model = Model();
     if (uk86_chksubmit()) {
         // 主题分类
         $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'] = $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' => $t_id, 'reply_id' => 0))->delete();
             // 插入话题商品
             if (!empty($_POST['goods'])) {
                 $goods_insert = array();
                 foreach ($_POST['goods'] as $key => $val) {
                     $p = array();
                     $p['theme_id'] = $t_id;
                     $p['reply_id'] = 0;
                     $p['circle_id'] = $this->c_id;
                     $p['goods_id'] = $key;
                     $p['goods_name'] = $val['name'];
                     $p['goods_price'] = $val['price'];
                     $p['goods_image'] = $val['image'];
                     $p['store_id'] = $val['storeid'];
                     $goods_insert[] = $p;
                 }
                 $rs = $model->table('circle_thg')->insertAll($goods_insert);
                 $has_goods = 1;
             }
             // 更新话题信息
             $affixe_count = $model->table('circle_affix')->where(array('affix_type' => 1, 'theme_id' => $t_id))->count();
             if ($affixe_count > 0) {
                 $has_affix = 1;
             }
             if ($has_goods || $has_affix) {
                 $update = array();
                 $update['theme_id'] = $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'] = $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' => $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'] = $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_common_op_succ'), CIRCLE_SITE_URL . '/index.php?act=theme&op=theme_detail&c_id=' . $this->c_id . '&t_id=' . $t_id, 'succ');
         } else {
             showDialog(L('nc_common_op_fail'));
         }
     }
     // 圈子信息
     $this->circleInfo();
     // 圈主和管理信息
     $this->manageList();
     // 会员信息
     $this->memberInfo();
     // 话题信息
     $this->theme_info = $model->table('circle_theme')->where(array('theme_id' => $t_id, 'circle_id' => $this->c_id))->find();
     if (empty($this->theme_info)) {
         uk86_showMessage(L('wrong_argument'));
     }
     Tpl::output('theme_info', $this->theme_info);
     // 话题商品
     $goods_list = $model->table('circle_thg')->where(array('theme_id' => $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' => $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 = uk86_array_under_reset($thclass_list, 'thclass_id');
     Tpl::output('thclass_list', $thclass_list);
     // Read permissions
     $readperm = $this->readPermissions($this->cm_info);
     Tpl::output('readperm', $readperm);
     // breadcrumb navigation
     $this->breadcrumd(L('nc_edit_theme'));
     if ($this->theme_info['theme_special'] == 1) {
         $poll_info = $model->table('circle_thpoll')->find($t_id);
         Tpl::output('poll_info', $poll_info);
         $option_list = $model->table('circle_thpolloption')->where(array('theme_id' => $t_id))->order('pollop_sort asc')->select();
         Tpl::output('option_list', $option_list);
         Tpl::showpage('group_manage_edit_themepoll');
     } else {
         Tpl::showpage('group_manage_edit_theme');
     }
 }
예제 #23
0
 /**
  * 话题列表
  */
 public function theme_listOp()
 {
     $model = Model();
     if (uk86_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(uk86_themeImagePath($val['affix_filename']));
                         @unlink(uk86_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);
                 }
             }
         }
         uk86_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 = uk86_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 = uk86_array_under_reset($affix_list, 'theme_id');
         }
         foreach ($theme_list as $key => $val) {
             if (isset($affix_list[$val['theme_id']])) {
                 $theme_list[$key]['affix'] = uk86_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');
 }
예제 #24
0
 /**
  * 批量加关注
  */
 public function batch_addfollowOp()
 {
     // 验证参数
     if (trim($_GET['ids']) == '') {
         showDialog(Uk86Language::uk86_get('wrong_argument'), '', 'error');
     }
     $ids = explode(',', trim($_GET['ids']));
     if (empty($ids)) {
         showDialog(Uk86Language::uk86_get('wrong_argument'), '', 'error');
     }
     // 实例化模型
     $model = Model();
     $member_info = $model->table('member')->find($_SESSION['member_id']);
     if (empty($member_info)) {
         showDialog(Uk86Language::uk86_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 = uk86_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 = uk86_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(Uk86Language::uk86_get('snsfriend_follow_succ'), '', 'succ');
 }
예제 #25
0
 /**
  * 图片列表
  */
 public function album_pic_listOp()
 {
     $id = intval($_GET['id']);
     if ($id <= 0) {
         uk86_showMessage(Uk86Language::uk86_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)) {
         uk86_showMessage(Uk86Language::uk86_get('wrong_argument'), '', '', 'error');
     }
     // 整理
     $class_array = uk86_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');
 }
예제 #26
0
 /**
  * 根据商品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 = uk86_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'] = uk86_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'] = uk86_ncPriceFormat($goods_list[$val['goods_id']]['goods_price']);
                             $b_goods_array[$val['bl_id']][$k]['price'] = uk86_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;
 }
예제 #27
0
 /**
  * 设置关联版式
  */
 public function edit_plateOp()
 {
     if (uk86_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 = uk86_array_under_reset($plate_list, 'plate_position', 2);
     Tpl::output('plate_list', $plate_list);
     Tpl::showpage('store_goods_list.edit_plate', 'null_layout');
 }
예제 #28
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 = uk86_array_under_reset($comment_quote_list, 'comment_id');
         }
         Tpl::output('comment_quote_list', $comment_quote_list);
         Tpl::showpage('comment_list', 'null_layout');
     }
 }
예제 #29
0
 /**
  * 首页
  */
 public function indexOp()
 {
     $model = Model();
     //我的圈子,话题,和回复数
     $my_counts['circle_count'] = $model->table('circle_member')->where(array('member_id' => $_SESSION['member_id']))->count();
     $my_counts['theme_count'] = $model->table('circle_theme')->where(array('member_id' => $_SESSION['member_id']))->count();
     $my_counts['threply_count'] = $model->table('circle_threply')->where(array('member_id' => $_SESSION['member_id']))->count();
     Tpl::output('circle_counts', $my_counts);
     // 热门圈子      **显示3个圈子,按推荐随机排列,推荐不够按成员数主题数降序排列**
     $circle_list = $model->table('circle')->field('*, is_hot*rand() as rand')->where(array('circle_status' => 1, 'is_hot' => 1, 'is_official' => 0))->order('rand desc')->limit(4)->select();
     if (!empty($circle_list)) {
         $circle_list = uk86_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')->find();
             $circle_list[$key]['theme_list'] = $theme_list;
         }
         Tpl::output('circle_list', $circle_list);
         //var_dump($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 = uk86_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 = uk86_array_under_reset($nowjoincount_array, 'circle_id');
         				Tpl::output('nowjoincount_array', $nowjoincount_array);
         			}*/
     }
     //官方圈子及其活动
     $official_list = $model->table('circle')->field('circle_id')->where(array('circle_status' => 1, 'is_official' => 1))->select();
     if (!empty($official_list)) {
         $arr = array();
         foreach ($official_list as $official) {
             array_push($arr, intval($official['circle_id']));
         }
         $condition['is_closed'] = 0;
         $condition['has_affix'] = 1;
         $condition['circle_id'] = array("in", $arr);
         $condition['is_shut'] = 0;
         $official_theme_list = $model->table('circle_theme')->where($condition)->limit(8)->order('theme_addtime desc')->select();
         if (!empty($official_theme_list)) {
             foreach ($official_theme_list as $key => $official_theme) {
                 $affix = $model->table('circle_affix')->where(array('theme_id' => $official_theme['theme_id'], 'affix_type' => 1))->find();
                 $official_theme_list[$key]['affix'] = $affix;
                 unset($affix);
             }
         }
         Tpl::output('official_theme_list', $official_theme_list);
     }
     // 圈子分类
     $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, 'is_official' => 0))->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, 'is_official' => 0))->order('rand desc')->limit(8)->select();
     if (!empty($theme_list)) {
         $theme_list = uk86_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 = uk86_array_under_reset($affix_list, 'theme_id');
         }
         foreach ($theme_list as $key => $val) {
             if (isset($affix_list[$val['theme_id']])) {
                 $theme_list[$key]['affix'] = uk86_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();
     //var_dump($gtheme_list);
     if (!empty($gtheme_list)) {
         $gtheme_list = uk86_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);
         //var_dump($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();
     //有附件图片的热门话题(非官方)
     $hot_theme_list_with_img = $model->table('circle_theme')->where(array('is_closed' => 0, 'has_affix' => 1, 'is_official' => 0))->limit(5)->order('theme_browsecount desc')->select();
     if (!empty($hot_theme_list_with_img)) {
         $hot_theme_list_with_img = uk86_array_under_reset($hot_theme_list_with_img, 'theme_id');
         $themeid_array2 = array_keys($hot_theme_list_with_img);
         // 附件
         $affix_list2 = $model->table('circle_affix')->where(array('theme_id' => array('in', $themeid_array2), 'affix_type' => 1))->group('theme_id')->select();
         if (!empty($affix_list2)) {
             $affix_list2 = uk86_array_under_reset($affix_list2, 'theme_id');
         }
         foreach ($hot_theme_list_with_img as $key => $val) {
             if (isset($affix_list2[$val['theme_id']])) {
                 $hot_theme_list_with_img[$key]['affix'] = uk86_themeImageUrl($affix_list2[$val['theme_id']]['affix_filethumb']);
             }
         }
         Tpl::output('hot_theme_list_with_img', $hot_theme_list_with_img);
     }
     //无附件图片的热门话题(非官方)
     $hotThemeListWithoutImg = $model->table('circle_theme')->where(array('is_closed' => 0, 'has_affix' => 0, 'is_official' => 0))->limit(6)->order('theme_browsecount desc')->select();
     Tpl::output('hot_theme_list_without_img', $hotThemeListWithoutImg);
     //var_dump($hotThemeListWithoutImg);
     // 首页幻灯
     $loginpic = unserialize(C('circle_loginpic'));
     Tpl::output('loginpic', $loginpic);
     $this->circleSEO();
     Tpl::setLayout('null_layout');
     Tpl::showpage('circle_index');
 }
예제 #30
0
 /**
  * 处理goods类型内容
  */
 private function _initMbSpecialItemGoodsData($item_data, $item_type)
 {
     $goods_id_string = '';
     if (!empty($item_data['item'])) {
         foreach ($item_data['item'] as $value) {
             $goods_id_string .= $value . ',';
         }
         $goods_id_string = rtrim($goods_id_string, ',');
         //查询商品信息
         $condition['goods_id'] = array('in', $goods_id_string);
         $model_goods = Model('goods');
         $goods_list = $model_goods->getGoodsList($condition, 'goods_id,goods_name,goods_promotion_price,goods_image');
         $goods_list = uk86_array_under_reset($goods_list, 'goods_id');
         //整理商品数据
         $new_goods_list = array();
         foreach ($item_data['item'] as $value) {
             if (!empty($goods_list[$value])) {
                 $new_goods_list[] = $goods_list[$value];
             }
         }
         $item_data['item'] = $new_goods_list;
     }
     return $item_data;
 }