1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845 |
- <?php
- /**
- * lionfish 商城系统
- *
- *
- * @author fish
- *
- */
- namespace Home\Controller;
- class IndexController extends CommonController {
- protected function _initialize()
- {
-
- parent::_initialize();
-
- }
- public function index_share()
- {
- $item = M('lionfish_comshop_config')->where( array('name' => 'shop_index_share_title') )->find();
-
- echo json_encode( array('code'=>0, 'title' =>$item['value']) );
- die();
- }
-
- public function test_sql()
- {
- include ROOT_PATH .'Data/sql.php';
- /**
- $res = check_db_field_exist( 'oscshop_lionfish_community_head_commiss_order','fen_type' );
- if( !$res )
- {
- $sql_content ="
- ALTER TABLE `oscshop_lionfish_community_head_commiss_order` ADD `fen_type` TINYINT(1) NULL DEFAULT '0' COMMENT '0,按照比例计算的,1按照实际金额计算的' AFTER `type`;
- ";
- M()->execute($sql_content);
- }
- **/
- echo 3;die();
- }
-
- //$filePath = ROOT_PATH.'64df107ec8374b0bc0d8cb1c9a06d819.jpeg';
-
- public function test()
- {
- echo get_client_ip();
- die();
- $order_info = D('Home/SzyOrder')->getOrderGoodsByOrderId( $order_id );
-
- var_dump( $order_info );
- die();
-
- }
- public function diy_page()
- {
- $startadv = array();
- return $startadv;
-
- }
-
- public function spike_index()
- {
-
- }
-
- public function load_spike_data()
- {
-
- }
-
- public function index_info()
- {
-
- $gpc = I('request.');
-
- $item = M('lionfish_comshop_config')->where( array('name' => 'shop_index_share_title') )->find();
-
- $communityId = $gpc['communityId'];
- $is_community = D('Seller/Communityhead')->is_community($communityId);
-
- $postion = M('lionfish_community_head')->field('lat,lon')->where( array('id' => $communityId) )->find();
-
- //...lionfish_comshop_adv
- $params = array();
- $params[':uniacid'] = $uniacid;
- $params[':type'] = 'slider';
- $params[':enabled'] = 1;
-
- /** 调用滑动广告 **/
- $slider_list = M('lionfish_comshop_adv')->where( array('enabled' => 1,'type' => 'slider') )->order('displayorder desc, id desc')->select();
-
- if(!empty($slider_list))
- {
- foreach($slider_list as $key => $val)
- {
- $val['image'] = tomedia($val['thumb']);
- $val['link'] = htmlspecialchars_decode( $val['link'] );
- $slider_list[$key] = $val;
- }
- }else{
- $slider_list = array();
- }
- // 公告列表
-
- $notice_list = M('lionfish_comshop_notice')->where( array('enabled' => 1) )->order('displayorder desc, addtime desc')->select();
-
- /** 调用导航图标 **/
-
- $nav_list = M('lionfish_comshop_adv')->where( array('enabled' => 1,'type' => 'nav') )->order('displayorder desc, id desc')->select();
-
-
- if(!empty($nav_list))
- {
- foreach($nav_list as $key => $val)
- {
- $val['image'] = tomedia($val['thumb']);
- $val['name'] = $val['advname'];
- $val['link'] = htmlspecialchars_decode($val['link']);
- $nav_list[$key] = $val;
- }
- }else{
- $nav_list = array();
- }
-
- /**
- 调用分类
- **/
- $gid = isset($gpc['gid']) ? intval($gpc['gid']) : 0;
- $category_list = D('Home/GoodsCategory')->get_all_goods_category('normal', -1);
- // 过滤分类
- $cateidArr = array();
- foreach ($category_list as $k => $v) {
- $cateidArr[] = $v['id'];
- }
- $new_category_list = array();
- foreach ($category_list as $k => $v) {
- if($v['is_show']==1) {
- if($v['pid']==0) {
- $new_category_list[] = $v;
- } else {
- if(in_array($v['pid'], $cateidArr)) {
- $new_category_list[] = $v;
- }
- }
- }
- }
- $category_list = $new_category_list;
-
- $shop_index_share_image = D('Home/Front')->get_config_by_name('shop_index_share_image');
-
- if( !empty($shop_index_share_image) )
- {
- $shop_index_share_image = tomedia($shop_index_share_image);
- }
-
- $index_loading_image = D('Home/Front')->get_config_by_name('loading');
-
- if( !empty($index_loading_image) )
- {
- $index_loading_image = tomedia($index_loading_image);
- }
-
- $index_bottom_image = D('Home/Front')->get_config_by_name('index_bottom_image');
-
- if( !empty($index_bottom_image) )
- {
- $index_bottom_image = tomedia($index_bottom_image);
- }
- $index_list_top_image = D('Home/Front')->get_config_by_name('index_list_top_image');
-
- if( !empty($index_list_top_image) )
- {
- $index_list_top_image = tomedia($index_list_top_image);
- }
-
- $index_list_top_image_on = D('Home/Front')->get_config_by_name('index_list_top_image_on');
-
-
- $common_header_backgroundimage = D('Home/Front')->get_config_by_name('index_header_backgroundimage');
- if( !empty($common_header_backgroundimage) )
- {
- $common_header_backgroundimage = tomedia($common_header_backgroundimage);
- }
-
-
- $open_diy_index_page = D('Home/Front')->get_config_by_name('open_diy_index_page');
-
-
- $is_show_index_lead_image = D('Home/Front')->get_config_by_name('is_show_index_lead_image');
- $index_lead_image = '';
- if($is_show_index_lead_image == 1){
- $index_lead_image = D('Home/Front')->get_config_by_name('index_lead_image');
- if( !empty($index_lead_image) )
- {
- $index_lead_image = tomedia($index_lead_image);
- }
- }
-
-
- $diypage = array();
- if($open_diy_index_page == 1)
- {
- $diypage = $this->diy_page();
- }
- $shoname = D('Home/Front')->get_config_by_name('shoname');
-
- $theme = D('Home/Front')->get_config_by_name('index_list_theme_type');
-
-
- $spike_data = array();
- $nav_bg_color = D('Home/Front')->get_config_by_name('nav_bg_color');
- $order_notify_switch = D('Home/Front')->get_config_by_name('order_notify_switch');
-
-
-
-
-
- $rushtime = D('Home/Pingoods')->get_min_time();
-
- $comming_goods_total = D('Home/Pingoods')->get_comming_goods_count();
- $index_share_switch = D('Home/Front')->get_config_by_name('index_share_switch');
- $is_show_list_count = D('Home/Front')->get_config_by_name('is_show_list_count');
- $is_show_list_timer = D('Home/Front')->get_config_by_name('is_show_list_timer');
- $index_change_cate_btn = D('Home/Front')->get_config_by_name('index_change_cate_btn');
-
-
- $is_comunity_rest = D('Seller/Communityhead')->is_community_rest($communityId);
-
-
-
- $index_top_img_bg_open = D('Home/Front')->get_config_by_name('index_top_img_bg_open');
- $index_top_font_color = D('Home/Front')->get_config_by_name('index_top_font_color');
- $index_service_switch = D('Home/Front')->get_config_by_name('index_service_switch');
- $index_switch_search = D('Home/Front')->get_config_by_name('index_switch_search');
- $is_show_new_buy = D('Home/Front')->get_config_by_name('is_show_new_buy');
-
-
- //抢购自定义
- $index_qgtab_bottom_color = D('Home/Front')->get_config_by_name('index_qgtab_bottom_color');
- $index_qgtab_one_select = D('Home/Front')->get_config_by_name('index_qgtab_one_select');
- $index_qgtab_one_selected = D('Home/Front')->get_config_by_name('index_qgtab_one_selected');
- $index_qgtab_two_select = D('Home/Front')->get_config_by_name('index_qgtab_two_select');
- $index_qgtab_two_selected = D('Home/Front')->get_config_by_name('index_qgtab_two_selected');
- $qgtab = array();
- $qgtab['bottom_color'] = $index_qgtab_bottom_color;
- if(!empty($index_qgtab_one_select)) {
- $qgtab['one_select'] = tomedia($index_qgtab_one_select);
- }
- if(!empty($index_qgtab_one_selected)) {
- $qgtab['one_selected'] = tomedia($index_qgtab_one_selected);
- }
- if(!empty($index_qgtab_two_select)) {
- $qgtab['two_select'] = tomedia($index_qgtab_two_select);
- }
- if(!empty($index_qgtab_two_selected)) {
- $qgtab['two_selected'] = tomedia($index_qgtab_two_selected);
- }
-
-
- $notice_setting = array();
- $index_notice_horn_image = D('Home/Front')->get_config_by_name('index_notice_horn_image');
- if(!empty($index_notice_horn_image)) {
- $notice_setting['horn'] = tomedia($index_notice_horn_image);
- }
- $notice_setting['font_color'] = D('Home/Front')->get_config_by_name('index_notice_font_color');
- $notice_setting['background_color'] = D('Home/Front')->get_config_by_name('index_notice_background_color');
-
- //前端隐藏 团长信息
- $index_hide_headdetail_address = D('Home/Front')->get_config_by_name('index_hide_headdetail_address');
-
- if( empty($index_hide_headdetail_address) )
- {
- $index_hide_headdetail_address = 0;
- }
- $is_show_spike_buy = D('Home/Front')->get_config_by_name('is_show_spike_buy');
- $hide_community_change_btn = D('Home/Front')->get_config_by_name('hide_community_change_btn');
- $hide_top_community = D('Home/Front')->get_config_by_name('hide_index_top_communityinfo');
- $index_type_first_name = D('Home/Front')->get_config_by_name('index_type_first_name');
-
-
- $index_qgtab_text = array();
- $index_qgtab_text[] = D('Home/Front')->get_config_by_name('index_qgtab_text_going');
- $index_qgtab_text[] = D('Home/Front')->get_config_by_name('index_qgtab_text_future');
- $ishow_index_copy_text = D('Home/Front')->get_config_by_name('ishow_index_copy_text');
-
- $index_communityinfo_showtype = D('Home/Front')->get_config_by_name('index_communityinfo_showtype');
-
- // 魔方图
- $cube = array();
-
- $cube = M('lionfish_comshop_cube')->where( array('enabled' => 1) )->order('displayorder desc, addtime desc')->select();
- if(!empty($cube)) {
- foreach ($cube as $k => $cubeItem) {
- $thumb = unserialize($cubeItem['thumb']);
- if(!empty($thumb['cover']) && is_array($thumb['cover'])) {
- foreach ($thumb['cover'] as &$coverItem) {
- if($coverItem) $coverItem = tomedia($coverItem);
- }
- }
- if( !empty($thumb['link']) )
- {
- foreach($thumb['link'] as $kk => $links)
- {
- $thumb['link'][$kk] = htmlspecialchars_decode($links);
- }
- }
- if( !empty($thumb['webview']) )
- {
- foreach($thumb['webview'] as $kkk => $webview)
- {
- $thumb['webview'][$kkk] = htmlspecialchars_decode($webview);
- }
- }
- if( !empty($thumb['outlink']) )
- {
- foreach($thumb['outlink'] as $kkkk => $outlink)
- {
- $thumb['outlink'][$kkkk] = htmlspecialchars_decode($outlink);
- }
- }
- $cubeItem['thumb'] = $thumb;
- $cube[$k] = $cubeItem;
- }
- }
-
- //秒杀设置begin
- $seckill_is_open = D('Home/Front')->get_config_by_name('seckill_is_open');
- $seckill_is_show_index = D('Home/Front')->get_config_by_name('seckill_is_show_index');
- $scekill_show_time = D('Home/Front')->get_config_by_name('scekill_show_time');
- $seckill_bg_color = D('Home/Front')->get_config_by_name('seckill_bg_color');
-
- $hide_community_change_word = D('Home/Front')->get_config_by_name('hide_community_change_word');
-
- if( empty($seckill_bg_color) )
- {
- $seckill_bg_color = '#25d6e6';
- }
-
- if( empty($seckill_is_open) )
- {
- $seckill_is_open = 0;
- }
- if( empty($seckill_is_show_index) )
- {
- $seckill_is_show_index = 0;
- }
-
- $scekill_time_arr = array();
-
- if( $seckill_is_open == 1 )
- {
- if( $seckill_is_show_index == 1 )
- {
- if( isset($scekill_show_time) && !empty($scekill_show_time) )
- {
- $scekill_show_time_arr = unserialize($scekill_show_time);
-
- foreach($scekill_show_time_arr as $vv)
- {
- if( $vv != 25 )
- {
- $scekill_time_arr[] = $vv;
- }
- }
- }
- }
- }else{
- $seckill_is_show_index = 0;
- }
- //整点秒杀结束
-
- //返回顶部按钮
- $ishow_index_gotop = D('Home/Front')->get_config_by_name('ishow_index_gotop');
-
- $ishow_index_pickup_time = D('Home/Front')->get_config_by_name('ishow_index_pickup_time');
- // 视频
- $index_video_arr = array();
- $index_video_enabled = D('Home/Front')->get_config_by_name('index_video_enabled');
- $index_video_arr['enabled'] = $index_video_enabled;
- if($index_video_enabled==1) {
- $index_video_poster = D('Home/Front')->get_config_by_name('index_video_poster');
- $index_video_url = D('Home/Front')->get_config_by_name('index_video_url');
- if($index_video_poster){
- $index_video_arr['poster'] = tomedia($index_video_poster);
- }
- if($index_video_url){
- $index_video_arr['url'] = tomedia($index_video_url);
- }
- }
-
- // 抢购时间显示
- $index_qgtab_counttime = D('Home/Front')->get_config_by_name('index_qgtab_counttime');
- $hide_index_type = D('Home/Front')->get_config_by_name('hide_index_type');
- // 公众号关注组件
- $show_index_wechat_oa = D('Home/Front')->get_config_by_name('show_index_wechat_oa');
- $ishide_index_goodslist = D('Home/Front')->get_config_by_name('ishide_index_goodslist');
- $can_index_notice_alert = D('Home/Front')->get_config_by_name('can_index_notice_alert');
- //是否开启预售活动==begin
- $show_presale_index_goods = D('Home/Front')->get_config_by_name('isopen_presale');
- $show_presale_index_goods = !isset($show_presale_index_goods) || empty($show_presale_index_goods) ? 0 : 1;
- $presale_index_info = [];
- $presale_index_info['show_presale_index_goods'] = $show_presale_index_goods;
- $presale_index_info['goods_list'] = [];
- if( $show_presale_index_goods == 1 )
- {
- //1、获取封面
- $presale_index_coming_img = D('Home/Front')->get_config_by_name('presale_index_coming_img');
- if( isset($presale_index_coming_img) && !empty($presale_index_coming_img) )
- {
- $presale_index_info['presale_index_coming_img'] = tomedia($presale_index_coming_img);
- }
- //2、获取首页显示的商品。后台没有定义就显示5条最多
- $presale_result = D('Home/PresaleGoods')->getIndexPresaleGoods(1);
- if( $presale_result['code'] == 0 && !empty($presale_result['list']) )
- {
- $presale_index_info['goods_list'] = $presale_result['list'];
- }
- }
- //首页预售活动end
- //是否开启礼品卡 begin
- $virtualcard_info = [];
- $isopen_virtualcard = D('Home/Front')->get_config_by_name('isopen_virtualcard');
- $isopen_virtualcard = !isset($isopen_virtualcard) ? 0 : $isopen_virtualcard;
- $virtualcard_info['isopen_virtualcard'] = $isopen_virtualcard;
- $virtualcard_info['goods_list'] = [];
- if( $isopen_virtualcard == 1 )
- {
- //入口封面图
- $virtualcard_index_coming_img = D('Home/Front')->get_config_by_name('virtualcard_index_coming_img');
- $virtualcard_info['virtualcard_index_coming_img'] = empty($virtualcard_index_coming_img) ? '' : tomedia( tomedia($virtualcard_index_coming_img) );
- //礼品卡商品
- $virtualcard_result = D('Seller/VirtualCard')->getIndexVirturalCardGoods(1);
- if( $virtualcard_result['code'] == 0 && !empty($virtualcard_result['list']) )
- {
- $virtualcard_info['goods_list'] = $virtualcard_result['list'];
- }
- }
- //是否开启礼品卡 end
- echo json_encode(array('code'=>0,
- 'category_list' =>$category_list,
- 'spike_data' => array(),
- 'shop_index_share_image' => $shop_index_share_image,
- 'index_loading_image' => $index_loading_image,
- 'index_bottom_image' => $index_bottom_image,
- 'title' =>$item['value'],'shoname'=>$shoname,
- 'slider_list' => $slider_list,
- 'nav_list' => $nav_list,
- 'open_diy_index_page' => $open_diy_index_page,
- 'diypage' => $diypage,
- 'notice_list' => $notice_list ,
- 'index_list_top_image' => $index_list_top_image,
- 'is_community' => $is_community,
- 'index_lead_image' => $index_lead_image,
- 'theme' => $theme,
- 'common_header_backgroundimage' => $common_header_backgroundimage,
- 'nav_bg_color' => $nav_bg_color,
- 'order_notify_switch' => $order_notify_switch,
- 'is_quan' => $is_quan,
- 'index_list_top_image_on' => $index_list_top_image_on,
- 'postion' => $postion,
- 'rushtime' => $rushtime,
- 'comming_goods_total' => $comming_goods_total,
- 'index_share_switch' => $index_share_switch,
- 'is_show_list_count' => $is_show_list_count,
- 'is_show_list_timer' => $is_show_list_timer,
- 'is_comunity_rest' => $is_comunity_rest,
- 'index_change_cate_btn' => $index_change_cate_btn,
- 'index_top_img_bg_open' => $index_top_img_bg_open,
- 'index_top_font_color' => $index_top_font_color,
- 'index_service_switch' => $index_service_switch,
- 'index_switch_search' => $index_switch_search,
- 'is_show_new_buy' => $is_show_new_buy,
- 'qgtab' => $qgtab,
- 'notice_setting' => $notice_setting,
- 'index_hide_headdetail_address' => $index_hide_headdetail_address,
- 'is_show_spike_buy' => $is_show_spike_buy,
- 'hide_community_change_btn' => $hide_community_change_btn,
- 'hide_top_community' => $hide_top_community,
- 'index_type_first_name' => $index_type_first_name,
- 'index_qgtab_text' => $index_qgtab_text,
- 'ishow_index_copy_text' => $ishow_index_copy_text,
- 'index_communityinfo_showtype' => $index_communityinfo_showtype,
- 'cube' => $cube,
- 'seckill_is_open'=> $seckill_is_open,//是否开启整点秒杀功能
- 'seckill_is_show_index' => $seckill_is_show_index,//是否显示再首页上
- 'scekill_time_arr' => $scekill_time_arr,//整点秒杀的时间点数组, 0 点表示:0:00-0:59, 1 表示:1:00-1:59
- 'seckill_bg_color' => $seckill_bg_color,
- 'hide_community_change_word' => $hide_community_change_word,
- 'ishow_index_gotop' => $ishow_index_gotop,
- 'ishow_index_pickup_time' => $ishow_index_pickup_time,
- 'index_video_arr' => $index_video_arr,
- 'index_qgtab_counttime' => $index_qgtab_counttime,
- 'hide_index_type' => $hide_index_type,
- 'show_index_wechat_oa' => $show_index_wechat_oa,
- 'ishide_index_goodslist' => $ishide_index_goodslist,
- 'can_index_notice_alert' => $can_index_notice_alert,
- 'presale_index_info' => $presale_index_info,//首页预售商品信息
- 'virtualcard_info' => $virtualcard_info,//礼品卡首页信息
- )
- );
- die();
- }
-
- public function get_group_info()
- {
-
-
- $group_name = D('Home/Front')->get_config_by_name('group_name');
- $owner_name = D('Home/Front')->get_config_by_name('owner_name');
- $commiss_diy_name = D('Home/Front')->get_config_by_name('commiss_diy_name');
- $delivery_ziti_name = D('Home/Front')->get_config_by_name('delivery_ziti_name');
- $delivery_tuanzshipping_name = D('Home/Front')->get_config_by_name('delivery_tuanzshipping_name');
- $delivery_express_name = D('Home/Front')->get_config_by_name('delivery_express_name');
-
- // 下单页面
- $placeorder_tuan_name = D('Home/Front')->get_config_by_name('placeorder_tuan_name');
- $placeorder_trans_name = D('Home/Front')->get_config_by_name('placeorder_trans_name');
- $localtown_modifypickingname = D('Home/Front')->get_config_by_name('localtown_modifypickingname');
- $placeorder_tuan_name = $placeorder_tuan_name?$placeorder_tuan_name:"配送费";
- $placeorder_trans_name = $placeorder_trans_name?$placeorder_trans_name:"快递费";
- $localtown_modifypickingname = $localtown_modifypickingname?$localtown_modifypickingname:"包装费";
-
-
- $data = array(
- 'group_name'=>$group_name,
- 'owner_name'=>$owner_name,
- 'commiss_diy_name'=>$commiss_diy_name,
- 'delivery_ziti_name'=>$delivery_ziti_name,
- 'delivery_tuanzshipping_name'=>$delivery_tuanzshipping_name,
- 'delivery_express_name'=>$delivery_express_name,
- 'placeorder_tuan_name'=>$placeorder_tuan_name,
- 'placeorder_trans_name'=>$placeorder_trans_name,
- 'localtown_modifypickingname'=>$localtown_modifypickingname
- );
-
- echo json_encode(array('code'=>0, 'data' =>$data));
- }
-
- public function get_nav_bg_color()
- {
-
- $nav_bg_color = D('Home/Front')->get_config_by_name('nav_bg_color');
- $nav_font_color = D('Home/Front')->get_config_by_name('nav_font_color');
- echo json_encode(array('code'=>0, 'data' => $nav_bg_color, 'nav_font_color' => $nav_font_color));
- }
-
- public function get_auth_bg()
- {
- $auth_bg_image = D('Home/Front')->get_config_by_name('auth_bg_image');
- if( !empty($auth_bg_image) )
- {
- $auth_bg_image = tomedia($auth_bg_image);
- }
- echo json_encode(array('code'=>0, 'data' =>$auth_bg_image));
- }
-
- /**
- * 获取导航图标 lionfish_comshop_navigat
- */
- public function get_navigat()
- {
- $list = M('lionfish_comshop_navigat')->field('id,navname,thumb,link,type,appid')->where("enabled=1")->order('displayorder desc')->select();
-
- if( !empty($list) )
- {
- foreach ($list as $key => &$val) {
- $val['thumb'] = tomedia($val['thumb']);
- $val['link'] = htmlspecialchars_decode($val['link']);
- }
- }
-
- $result = array('code' =>0,'data' => $list);
- echo json_encode($result);
- die();
- }
-
- /**
- * 获取tabbar
- */
- public function get_tabbar()
- {
-
- $list = D('Home/Front')->get_config_by_name('wepro_tabbar_list');
-
- /**
-
- $param['wepro_tabbar_list'] = array();
- $param['wepro_tabbar_list']['t1'] = trim($data['wepro_tabbar_text1']);
- $param['wepro_tabbar_list']['t2'] = trim($data['wepro_tabbar_text2']);
- $param['wepro_tabbar_list']['t3'] = trim($data['wepro_tabbar_text3']);
- $param['wepro_tabbar_list']['s1'] = save_media($data['wepro_tabbar_selectedIconPath1']);
- $param['wepro_tabbar_list']['s2'] = save_media($data['wepro_tabbar_selectedIconPath2']);
- $param['wepro_tabbar_list']['s3'] = save_media($data['wepro_tabbar_selectedIconPath3']);
- $param['wepro_tabbar_list']['i1'] = save_media($data['wepro_tabbar_iconPath1']);
- $param['wepro_tabbar_list']['i2'] = save_media($data['wepro_tabbar_iconPath2']);
- $param['wepro_tabbar_list']['i3'] = save_media($data['wepro_tabbar_iconPath3']);
-
- **/
-
- $list = unserialize(htmlspecialchars_decode($list));
-
- $open_tabbar_type = D('Home/Front')->get_config_by_name('open_tabbar_type');
- $open_tabbar_out_weapp = D('Home/Front')->get_config_by_name('open_tabbar_out_weapp');
- $tabbar_out_appid = D('Home/Front')->get_config_by_name('tabbar_out_appid');
- $tabbar_out_link = D('Home/Front')->get_config_by_name('tabbar_out_link');
-
- $tabbar_out_type = D('Home/Front')->get_config_by_name('tabbar_out_type');
-
- $wepro_tabbar_selectedColor = D('Home/Front')->get_config_by_name('wepro_tabbar_selectedColor');
- $wepro_tabbar_bgColor = D('Home/Front')->get_config_by_name('wepro_tabbar_bgColor');
-
- if( !empty($list) )
- {
- if(!empty($list['i1'])) $list['i1'] = tomedia($list['i1']);
- if(!empty($list['i2'])) $list['i2'] = tomedia($list['i2']);
- if(!empty($list['i3'])) $list['i3'] = tomedia($list['i3']);
- if(!empty($list['i4'])) $list['i4'] = tomedia($list['i4']);
- if(!empty($list['i5'])) $list['i5'] = tomedia($list['i5']);
- if(!empty($list['s1'])) $list['s1'] = tomedia($list['s1']);
- if(!empty($list['s2'])) $list['s2'] = tomedia($list['s2']);
- if(!empty($list['s3'])) $list['s3'] = tomedia($list['s3']);
- if(!empty($list['s4'])) $list['s4'] = tomedia($list['s4']);
- if(!empty($list['s5'])) $list['s5'] = tomedia($list['s5']);
- }
-
-
- $result = array(
- 'code' => 0,
- 'data' => $list,
- 'open_tabbar_type' => $open_tabbar_type,
- 'open_tabbar_out_weapp' => $open_tabbar_out_weapp,
- 'tabbar_out_appid' => $tabbar_out_appid,
- 'tabbar_out_link' => $tabbar_out_link,
- 'tabbar_out_type' => $tabbar_out_type,
- 'wepro_tabbar_selectedColor' => $wepro_tabbar_selectedColor,
- 'wepro_tabbar_bgColor' => $wepro_tabbar_bgColor
- );
- echo json_encode($result);
- die();
- }
-
-
- public function get_community_config()
- {
-
-
- $tx_map_key = D('Home/Front')->get_config_by_name('tx_map_key');
- $shoname = D('Home/Front')->get_config_by_name('shoname');
- $shop_index_share_title = D('Home/Front')->get_config_by_name('shop_index_share_title');
-
- echo json_encode( array('code' => 0, 'tx_map_key' => $tx_map_key , 'shoname' => $shoname ,'shop_index_share_title' => $shop_index_share_title) );
- die();
-
- }
-
-
- public function load_history_community()
- {
- $gpc = I('request.');
-
- $token = $gpc['token'];
-
- $weprogram_token = M('lionfish_comshop_weprogram_token')->field('member_id')->where( array('token' => $token) )->find();
-
-
- if( empty($weprogram_token) || empty($weprogram_token['member_id']) )
- {
- echo json_encode( array('code' => 2) );
- die();
- }
- $member_id = $weprogram_token['member_id'];
-
- $data = D('Home/Front')->get_history_community($member_id);
-
-
- if( empty($data) )
- {
- echo json_encode(array('code' => 1));
- die();
- }
- else {
- echo json_encode(array('code' => 0, 'list' => $data));
- die();
- }
-
- }
- /**
- * 切换、添加历史社区
- */
- public function switch_history_community(){
- $gpc = I('request.');
-
- $token = $gpc['token'];
- $head_id = $gpc['head_id'];
-
-
- $weprogram_token = M('lionfish_comshop_weprogram_token')->field('member_id')->where( array('token' => $token) )->find();
-
- if( empty($weprogram_token) || empty($weprogram_token['member_id']) )
- {
- echo json_encode( array('code' => 2) );
- die();
- }
- $member_id = $weprogram_token['member_id'];
-
- $data = D('Home/Front')->update_history_community($member_id, $head_id);
- //删除 community_id
- M('lionfish_comshop_car')->where( "token='{$token}' and community_id!='{$head_id}' " )->delete();
-
- if( empty($data) )
- {
- echo json_encode(array('code' => 1));
- die();
- }
- else {
- echo json_encode(array('code' => 0, 'list' => $data));
- die();
- }
- }
-
- public function get_community_info()
- {
- $gpc = I('request.');
-
- $where = " and state=1 and enable=1 ";
-
- $community_id = $gpc['community_id'];
- if($community_id == 'undefined')
- {
- $community_id = 0;
- }
-
- $data = D('Home/Front')->get_community_byid($community_id , $where);
-
- $hide_community_change_btn = D('Home/Front')->get_config_by_name('hide_community_change_btn');
-
-
- $open_danhead_model = D('Home/Front')->get_config_by_name('open_danhead_model');
-
- if( empty($open_danhead_model) )
- {
- $open_danhead_model = 0;
- }
-
- $default_head_info = array();
-
- if( $open_danhead_model == 1 )
- {
-
- $default_head = M('lionfish_community_head')->field('id')->where( array('is_default' => 1) )->find();
-
- if( !empty($default_head) )
- {
- $default_head_info = D('Home/Front')->get_community_byid($default_head['id'], $where);
- }
- }
-
-
- echo json_encode(array('code' => 0, 'data' => $data, 'open_danhead_model' => $open_danhead_model,'default_head_info' => $default_head_info, 'hide_community_change_btn' => $hide_community_change_btn));
- die();
- }
-
- public function load_gps_community()
- {
- $gpc = I('request.');
-
- $longitude = $gpc['longitude'];
- $latitude = $gpc['latitude'];
- $pageNum = $gpc['pageNum'];
- $city_id = $gpc['city_id'] ? $gpc['city_id'] : 0;
-
-
- $per_page = 10;
- $offset = ($pageNum - 1) * $per_page;
-
- $limit = "{$offset},{$per_page}";
-
- $token = $gpc['token'];
- $keyword = $gpc['inputValue'];
-
- $weprogram_token = M('lionfish_comshop_weprogram_token')->field('member_id')->where( array('token' => $token) )->find();
-
- if( empty($weprogram_token) || empty($weprogram_token['member_id']) )
- {
- //echo json_encode( array('code' => 2) );
- //die();
- }
- $member_id = $weprogram_token['member_id'];
-
- $data = array();
- $open_danhead_model = D('Home/Front')->get_config_by_name('open_danhead_model');
- if( $open_danhead_model == 1 )
- {
- $default_head = M('lionfish_community_head')->field('id')->where( array('is_default' => 1) )->find();
- if( !empty($default_head) )
- {
- $data = D('Home/Front')->get_community_byid($default_head['id'], $where);
- }
- } else {
- $data = D('Home/Front')->get_gps_area_info($longitude,$latitude,$limit,$keyword,$city_id,0);
- }
-
- //前端隐藏 团长信息
- $index_hide_headdetail_address = D('Home/Front')->get_config_by_name('index_hide_headdetail_address');
-
- if( empty($index_hide_headdetail_address) )
- {
- $index_hide_headdetail_address = 0;
- }
-
- if( empty($data) )
- {
- echo json_encode(array('code'=>1,'index_hide_headdetail_address' => $index_hide_headdetail_address));
- die();
- }else{
- echo json_encode(array('code'=>0, 'list' => $data,'index_hide_headdetail_address' => $index_hide_headdetail_address));
- die();
- }
- }
-
- public function addhistory_community()
- {
- $gpc = I('request.');
-
- $token = $gpc['token'];
- $head_id = $gpc['community_id'];
-
-
- $weprogram_token = M('lionfish_comshop_weprogram_token')->field('member_id')->where( array('token' => $token) )->find();
-
- if( empty($weprogram_token) || empty($weprogram_token['member_id']) )
- {
- echo json_encode( array('code' => 2) );
- die();
- }
- $member_id = $weprogram_token['member_id'];
-
- D('Seller/Community')->in_community_history($member_id,$head_id);
-
- echo json_encode( array('code' => 0) );
- die();
- }
-
- /**
- 获取已经过期的往期团购
- **/
-
- public function load_over_gps_goodslist()
- {
- $gpc = I('request.');
-
- $head_id = $gpc['head_id'];
- $pageNum = $gpc['pageNum'];
- $per_page = 10;
- $gid = $gpc['gid'];
- $offset = ($pageNum - 1) * $per_page;
- $limit = "{$offset},{$per_page}";
- if($head_id == 'undefined') $head_id = '';
- $is_only_express = $gpc['is_only_express'];
- $is_open_only_express = 0;
- if($is_only_express==1) {
- $is_open_only_express = D('Home/Front')->get_config_by_name('is_open_only_express');
- }
- if($gid == 'undefined' || $gid =='' || $gid =='null' || $gid ==0)
- {
- $gid = 0;
- }
-
- if( !empty($gid) && $gid > 0)
- {
- $gids = D('Home/GoodsCategory')->get_index_goods_category($gid,'normal','','',1);
- $gidArr = array();
- $gidArr[] = $gid;
-
- foreach ($gids as $key => $val) {
- $gidArr[] = $val['id'];
- }
-
- $gid = implode(',', $gidArr);
- }
-
- $token = $gpc['token'];
-
- $weprogram_token = M('lionfish_comshop_weprogram_token')->field('member_id')->where( array('token' => $token) )->find();
-
-
- if( empty($weprogram_token) || empty($weprogram_token['member_id']) )
- {
- //echo json_encode( array('code' => 2) );
- //die();
- }
- $member_id = $weprogram_token['member_id'];
-
- $now_time = time();
-
- $where = " g.grounding =1 and g.type ='normal' ";
-
- $is_index_show = isset($gpc['is_index_show']) ? $gpc['is_index_show'] : 0;
- if($is_index_show==1) {
- $where .= " and g.is_index_show = 1";
- }
- if($is_open_only_express==1 && $is_only_express==1) {
- $where .= " and gc.is_only_express =1 ";
- }
-
- $where .= " and gc.end_time <= {$now_time} and gc.is_new_buy=0 ";
-
-
- $community_goods = D('Home/Pingoods')->get_new_community_index_goods($head_id, $gid, 'g.*,gc.begin_time,gc.end_time,gc.big_img,gc.labelname,gc.video,gc.pick_up_type,gc.pick_up_modify ', $where,$offset,$per_page);
-
- if( !empty($community_goods) )
- {
- $list = array();
- $today_time = time();
- foreach($community_goods as $val)
- {
- $tmp_data = array();
- $tmp_data['actId'] = $val['id'];
- $goodsname = htmlspecialchars_decode($val['goodsname']);
- $tmp_data['spuName'] = $goodsname;
- $tmp_data['spuCanBuyNum'] = $val['total'];
- $tmp_data['spuDescribe'] = $val['subtitle'];
- $tmp_data['actEnd'] = time()>$val['end_time'];
- $tmp_data['end_time'] = $val['end_time'];
- $tmp_data['soldNum'] = $val['seller_count'] + $val['sales'];
-
- $tmp_data['begin_time'] = date('Y-m-d', $val['begin_time']);
-
- if($val['pick_up_type'] == 0)
- {
- $val['pick_up_modify'] = date('Y-m-d', $today_time);
- }else if( $val['pick_up_type'] == 1 ){
- $val['pick_up_modify'] = date('Y-m-d', $today_time+86400);
- }else if( $val['pick_up_type'] == 2 )
- {
- $val['pick_up_modify'] = date('Y-m-d', $today_time+86400*2);
- }
-
- $tmp_data['pick_up_modify'] = $val['pick_up_modify'];
-
-
- $productprice = $val['productprice'];
- $tmp_data['marketPrice'] = explode('.', $productprice);
-
- if( !empty($val['big_img']) )
- {
- $tmp_data['bigImg'] = tomedia($val['big_img']);
- }
-
- $good_image = D('Home/Pingoods')->get_goods_images($val['id']);
- if( !empty($good_image) )
- {
- $tmp_data['skuImage'] = tomedia($good_image['image']);
- }
- $price_arr = D('Home/Pingoods')->get_goods_price($val['id'], $member_id);
- $price = $price_arr['price'];
-
- $tmp_data['actPrice'] = explode('.', $price);
- $tmp_data['skuList']= D('Home/Pingoods')->get_goods_options($val['id'], $member_id);
-
-
- // 商品角标
- $label_id = unserialize($val['labelname']);
- if($label_id){
- $label_info = D('Home/Pingoods')->get_goods_tags($label_id);
- if($label_info){
- if($label_info['type'] == 1){
- $label_info['tagcontent'] = tomedia($label_info['tagcontent']);
- } else {
- $label_info['len'] = mb_strlen($label_info['tagcontent'], 'utf-8');
- }
- }
- $tmp_data['label_info'] = $label_info;
- }
- $tmp_data['is_video'] = empty($val['video']) ? false : true;
-
- $list[] = $tmp_data;
- }
- $is_member_level_buy = 0;
- $is_vip_card_member = 0;
- $is_open_vipcard_buy = D('Home/Front')->get_config_by_name('is_open_vipcard_buy');
- $is_open_vipcard_buy = !empty($is_open_vipcard_buy) && $is_open_vipcard_buy ==1 ? 1:0;
- $is_open_fullreduction = D('Home/Front')->get_config_by_name('is_open_fullreduction');
- $full_money = D('Home/Front')->get_config_by_name('full_money');
- $full_reducemoney = D('Home/Front')->get_config_by_name('full_reducemoney');
- if(empty($full_reducemoney) || $full_reducemoney <= 0)
- {
- $is_open_fullreduction = 0;
- }
- echo json_encode(array('code' => 0, 'list' => $list , 'cur_time' => time(), 'is_vip_card_member' => $is_vip_card_member,'is_member_level_buy' => $is_member_level_buy, 'full_reducemoney' => $full_reducemoney, 'full_money' => $full_money,'is_open_vipcard_buy' => $is_open_vipcard_buy, 'is_open_fullreduction' => $is_open_fullreduction ));
- die();
- }else{
- echo json_encode( array('code' => 1) );
- die();
- }
-
- }
- public function load_gps_goodslist()
- {
- $gpc = I('request.');
-
- $token = $gpc['token'];
- $head_id = $gpc['head_id'];
- $is_only_express = $gpc['is_only_express'];
- $is_open_only_express = 0;
- if($is_only_express==1) {
- $is_open_only_express = D('Home/Front')->get_config_by_name('is_open_only_express');
- }
-
- if($head_id == 'undefined') $head_id = '';
- $pageNum = $gpc['pageNum'];
- $gid = $gpc['gid'];
- $keyword = $gpc['keyword'];
-
- $is_random = isset($gpc['is_random']) ? $gpc['is_random'] : 0;
- $is_video = isset($gpc['is_video']) ? $gpc['is_video'] : 0;
- $per_page = isset($gpc['per_page']) ? $gpc['per_page'] : 10;
- $cate_info = '';
-
- if($gid == 'undefined' || $gid =='' || $gid =='null' || $gid ==0)
- {
- $gid = 0;
- } else {
- $cate_info = M('lionfish_comshop_goods_category')->field('banner,name')->where( array('id' => $gid ) )->find();
- if(!empty($cate_info['banner'])) $cate_info['banner'] = tomedia($cate_info['banner']);
- }
-
- if( !empty($gid) && $gid > 0)
- {
- $gids = D('Home/GoodsCategory')->get_index_goods_category($gid,'normal','','',1);
- $gidArr = array();
- $gidArr[] = $gid;
-
- foreach ($gids as $key => $val) {
- $gidArr[] = $val['id'];
- }
-
- $gid = implode(',', $gidArr);
- }
- //$per_page = 10;
- $offset = ($pageNum - 1) * $per_page;
- $limit = "{$offset},{$per_page}";
-
- $weprogram_token = M('lionfish_comshop_weprogram_token')->field('member_id')->where( array('token' => $token) )->find();
- $is_member_level_buy = 0;
- $is_vip_card_member = 0;
- $is_open_vipcard_buy = D('Home/Front')->get_config_by_name('is_open_vipcard_buy');
- $is_open_vipcard_buy = !empty($is_open_vipcard_buy) && $is_open_vipcard_buy ==1 ? 1:0;
-
- if( empty($weprogram_token) || empty($weprogram_token['member_id']) )
- {
- //echo json_encode( array('code' => 2) );
- //die();
- }else{
- $member_id = $weprogram_token['member_id'];
- $is_vip_card_member = 0;
-
- //member_id
- if( $member_id > 0 )
- {
- $member_info = M('lionfish_comshop_member')->where( array('member_id' => $member_id ) )->find();
-
- if( !empty($is_open_vipcard_buy) && $is_open_vipcard_buy == 1 )
- {
-
- $now_time = time();
-
- if( $member_info['card_id'] >0 && $member_info['card_end_time'] > $now_time )
- {
- $is_vip_card_member = 1;//还是会员
- }else if( $member_info['card_id'] >0 && $member_info['card_end_time'] < $now_time ){
- $is_vip_card_member = 2;//已过期
- }
- }
-
- if($is_vip_card_member != 1 && $member_info['level_id'] >0 )
- {
- $is_member_level_buy = 1;
- }
- }
-
- }
-
- $member_id = $weprogram_token['member_id'];
-
- //整点秒杀begin
- $is_seckill = isset($gpc['is_seckill']) ? 1:0;
- $seckill_time = isset($gpc['seckill_time']) ? intval($gpc['seckill_time']):0;
- //整点秒杀end
-
- $now_time = time();
- if($is_seckill ==1)
- {
- $where = " g.grounding =1 and g.is_seckill =1 and g.type ='normal' ";
- }else
- {
- $where = " g.grounding =1 and g.is_seckill =0 and g.type ='normal' ";
- }
-
- //head_id
- if( !empty($keyword) )
- {
- $where .= " and g.goodsname like '%{$keyword}%' ";
- }
-
- //$where .= " and g.is_index_show = 1 and gc.begin_time <={$now_time} and gc.end_time > {$now_time} ";
-
- if($is_seckill ==1)
- {
- $bg_time = strtotime( date('Y-m-d').' '.$seckill_time.':00:00' );
-
- $ed_time = $bg_time + 3600;
-
- if($gid == 0 && $keyword == ''){
- $where .= " and gc.begin_time >={$bg_time} and gc.begin_time <{$ed_time} ";
- } else {
- $where .= " and gc.begin_time >={$bg_time} and gc.begin_time <{$ed_time} ";
- }
-
- } else {
- if($gid == 0 && $keyword == ''){
- $where .= " and g.is_index_show = 1 and gc.begin_time <={$now_time} and gc.end_time > {$now_time} ";
- } else {
- $where .= " and gc.begin_time <={$now_time} and gc.end_time > {$now_time} ";
- }
- }
-
- if($is_seckill ==1)
- {
-
- }else{
- $where .= " and gc.is_new_buy=0 and gc.is_spike_buy = 0 ";
- }
-
- if( $is_video == 1 )
- {
- $where .= " and gc.video !='' ";
- }
- if($is_open_only_express==1 && $is_only_express==1) {
- $where .= " and gc.is_only_express =1 ";
- }
-
-
- $index_sort_method = D('Home/Front')->get_config_by_name('index_sort_method');
- if( empty($index_sort_method) )
- {
- $order_sort = 'g.istop DESC, g.settoptime DESC,g.index_sort desc,g.id desc ';
- }
-
- if( $index_sort_method == 1 )
- {
- $order_sort = 'g.index_sort desc,g.id desc ';
- }
-
- if($is_random == 1)
- {
- $community_goods = D('Home/Pingoods')->get_new_community_index_goods($head_id,$gid,'g.*,gc.begin_time,gc.end_time,gc.big_img,gc.is_take_fullreduction,gc.labelname,gc.video,gc.pick_up_type,gc.pick_up_modify,gc.oneday_limit_count, gc.total_limit_count, gc.one_limit_count,gc.goods_start_count ', $where,$offset,$per_page,$order_sort,' rand() ');
- }else{
- $community_goods = D('Home/Pingoods')->get_new_community_index_goods($head_id,$gid,'g.*,gc.begin_time,gc.end_time,gc.big_img,gc.is_take_fullreduction,gc.labelname,gc.video,gc.pick_up_type,gc.pick_up_modify,gc.oneday_limit_count, gc.total_limit_count, gc.one_limit_count,gc.goods_start_count ', $where,$offset,$per_page,$order_sort);
- }
-
- if( !empty($community_goods) )
- {
- $is_open_fullreduction = D('Home/Front')->get_config_by_name('is_open_fullreduction');
- $full_money = D('Home/Front')->get_config_by_name('full_money');
- $full_reducemoney = D('Home/Front')->get_config_by_name('full_reducemoney');
-
- $is_open_vipcard_buy = D('Home/Front')->get_config_by_name('is_open_vipcard_buy');
-
- $is_open_vipcard_buy = !empty($is_open_vipcard_buy) && $is_open_vipcard_buy == 1 ? 1:0;
-
-
- if(empty($full_reducemoney) || $full_reducemoney <= 0)
- {
- $is_open_fullreduction = 0;
- }
-
- $cart= D('Home/Car');
-
- $list = array();
- $copy_text_arr = array();
- $today_time = strtotime( date('Y-m-d').' 00:00:00' );
-
-
- foreach($community_goods as $val)
- {
- $tmp_data = array();
- $tmp_data['actId'] = $val['id'];
- $goodsname = htmlspecialchars_decode($val['goodsname']);
- $tmp_data['spuName'] = $goodsname;
- $tmp_data['spuCanBuyNum'] = $val['total'];
- $tmp_data['spuDescribe'] = $val['subtitle'];
- $tmp_data['end_time'] = $val['end_time'];
- $tmp_data['is_take_vipcard'] = $val['is_take_vipcard'];
- $tmp_data['soldNum'] = $val['seller_count'] + $val['sales'];
- $tmp_data['oneday_limit_count'] = $val['oneday_limit_count'];
- $tmp_data['total_limit_count'] = $val['total_limit_count'];
- $tmp_data['one_limit_count'] = $val['one_limit_count'];
- $tmp_data['goods_start_count'] = $val['goods_start_count'];
-
-
- $tmp_data['begin_time'] = date('Y-m-d', $val['begin_time']);
-
- if($val['pick_up_type'] == 0)
- {
- $val['pick_up_modify'] = date('Y-m-d', $today_time);
- }else if( $val['pick_up_type'] == 1 ){
- $val['pick_up_modify'] = date('Y-m-d', $today_time+86400);
- }else if( $val['pick_up_type'] == 2 )
- {
- $val['pick_up_modify'] = date('Y-m-d', $today_time+86400*2);
- }
-
- $tmp_data['pick_up_modify'] = $val['pick_up_modify'];
-
-
- $productprice = $val['productprice'];
- $tmp_data['marketPrice'] = explode('.', $productprice);
- if( !empty($val['big_img']) )
- {
- $tmp_data['bigImg'] = tomedia($val['big_img']);
- }
-
-
- $good_image = D('Home/Pingoods')->get_goods_images($val['id']);
- if( !empty($good_image) )
- {
- $tmp_data['skuImage'] = tomedia($good_image['image']);
- }
- $price_arr = D('Home/Pingoods')->get_goods_price($val['id'], $member_id);
- $price = $price_arr['price'];
-
- if( $pageNum == 1 )
- {
- $copy_text_arr[] = array('goods_name' => $val['goodsname'], 'price' => $price);
- }
-
- $tmp_data['actPrice'] = explode('.', $price);
- $tmp_data['card_price'] = $price_arr['card_price'];
-
- $tmp_data['levelprice'] = $price_arr['levelprice']; // 会员等级价格
- $tmp_data['is_mb_level_buy'] = $price_arr['is_mb_level_buy']; //是否 会员等级 可享受
-
- //$tmp_data['skuList']= D('Home/Pingoods')->get_goods_options($val['id'], $member_id);
- $tmp_data['skuList']= D('Home/Pingoods')->get_goods_options_carquantity($val['id'], $member_id, $head_id ,$token);
- if( !empty($tmp_data['skuList']) )
- {
- $tmp_data['car_count'] = 0;
- }else{
-
- $car_count = $cart->get_wecart_goods($val['id'],"",$head_id ,$token);
-
- if( empty($car_count) )
- {
- $tmp_data['car_count'] = 0;
- }else{
- $tmp_data['car_count'] = $car_count;
- }
-
- }
-
- if($is_open_fullreduction == 0)
- {
- $tmp_data['is_take_fullreduction'] = 0;
- }else if($is_open_fullreduction == 1){
- $tmp_data['is_take_fullreduction'] = $val['is_take_fullreduction'];
- }
-
-
- // 商品角标
- $label_id = unserialize($val['labelname']);
- if($label_id){
- $label_info = D('Home/Pingoods')->get_goods_tags($label_id);
- if($label_info){
- if($label_info['type'] == 1){
- $label_info['tagcontent'] = tomedia($label_info['tagcontent']);
- } else {
- $label_info['len'] = mb_strlen($label_info['tagcontent'], 'utf-8');
- }
- }
- $tmp_data['label_info'] = $label_info;
- }
-
- $tmp_data['is_video'] = empty($val['video']) ? false : true;
-
- $list[] = $tmp_data;
- }
-
-
- $is_show_list_timer = D('Home/Front')->get_config_by_name('is_show_list_timer');
- $index_list_theme_type = D('Home/Front')->get_config_by_name('index_list_theme_type');
- // 3*3是也关闭
- if($index_list_theme_type>=2) $is_show_list_timer==0;
- $is_show_cate_tabbar = D('Home/Front')->get_config_by_name('is_show_cate_tabbar');
- echo json_encode(array('code' => 0,'now_time' => time(), 'list' => $list ,'is_show_cate_tabbar' => $is_show_cate_tabbar,'is_vip_card_member' => $is_vip_card_member,'is_member_level_buy' => $is_member_level_buy , 'copy_text_arr' => $copy_text_arr, 'cur_time' => time() ,'full_reducemoney' => $full_reducemoney,'full_money' => $full_money,'is_open_vipcard_buy' => $is_open_vipcard_buy,'is_open_fullreduction' => $is_open_fullreduction,'is_show_list_timer'=>$is_show_list_timer , 'cate_info' => $cate_info, 'is_show_cate_tabbar'=>$is_show_cate_tabbar ));
- die();
-
- }else{
- $is_show_cate_tabbar = D('Home/Front')->get_config_by_name('is_show_cate_tabbar');
-
- echo json_encode( array('code' => 1 , 'cate_info' => $cate_info , 'is_show_cate_tabbar'=>$is_show_cate_tabbar ) );
- die();
- }
- }
-
- public function get_index_category()
- {
- $gpc = I('request.');
-
- $gid = $gpc['gid'];
-
- $hot_list = M('lionfish_comshop_goods_category')->where( array('is_hot' => 1) )->order('sort_order desc')->select();
-
- $need_data = array();
- foreach($hot_list as $key => $cate)
- {
- $need_data[$key]['id'] = $cate['id'];
- $need_data[$key]['name'] = $cate['name'];
- $need_data[$key]['sort_order'] = $cate['sort_order'];
- }
- $result = array('code' =>0,'data' => $need_data);
- echo json_encode($result);
- die();
- }
- /**
- * 获取首页公告
- */
- public function get_index_notice()
- {
-
- $list = M('lionfish_comshop_notice')->where( array('enabled' => 1) )->order('displayorder desc, addtime desc')->limit(1)->select();
-
- $result = array('code' =>0,'data' => $list);
- echo json_encode($result);
- die();
- }
-
- /**
- * 即将抢购商品
- */
- public function load_comming_goodslist()
- {
- $gpc = I('request.');
-
- $head_id = $gpc['head_id'];
- $pageNum = $gpc['pageNum'];
- $per_page = 10;
- $gid = $gpc['gid'];
- $offset = ($pageNum - 1) * $per_page;
- $limit = "{$offset},{$per_page}";
- if($head_id == 'undefined') $head_id = '';
- $is_only_express = $gpc['is_only_express'];
- $is_open_only_express = 0;
- if($is_only_express==1) {
- $is_open_only_express = D('Home/Front')->get_config_by_name('is_open_only_express');
- }
- if($gid == 'undefined' || $gid =='' || $gid =='null' || $gid ==0)
- {
- $gid = 0;
- }
-
- if( !empty($gid) && $gid > 0)
- {
- $gids = D('Home/GoodsCategory')->get_index_goods_category($gid,'normal','','',1);
- $gidArr = array();
- $gidArr[] = $gid;
-
- foreach ($gids as $key => $val) {
- $gidArr[] = $val['id'];
- }
-
- $gid = implode(',', $gidArr);
- }
-
- $token = $gpc['token'];
-
- $weprogram_token = M('lionfish_comshop_weprogram_token')->field('member_id')->where( array('token' => $token) )->find();
-
-
- if( empty($weprogram_token) || empty($weprogram_token['member_id']) )
- {
- //echo json_encode( array('code' => 2) );
- //die();
- }
- $member_id = $weprogram_token['member_id'];
-
- $now_time = time();
-
- $where = " g.grounding =1 and g.type ='normal' ";
-
- $is_index_show = isset($gpc['is_index_show']) ? $gpc['is_index_show'] : 0;
- if($is_index_show==1) {
- $where .= " and g.is_index_show = 1";
- }
- if($is_open_only_express==1 && $is_only_express==1) {
- $where .= " and gc.is_only_express =1 ";
- }
-
- $where .= "and gc.begin_time > {$now_time} ";
-
-
- $community_goods = D('Home/Pingoods')->get_new_community_index_goods($head_id, $gid, 'g.*,gc.begin_time,gc.end_time,gc.big_img,gc.labelname,gc.video,gc.pick_up_type,gc.pick_up_modify,gc.is_take_fullreduction ', $where,$offset,$per_page);
-
- if( !empty($community_goods) )
- {
- $is_open_fullreduction = D('Home/Front')->get_config_by_name('is_open_fullreduction');
- $full_money = D('Home/Front')->get_config_by_name('full_money');
- $full_reducemoney = D('Home/Front')->get_config_by_name('full_reducemoney');
-
- if(empty($full_reducemoney) || $full_reducemoney <= 0)
- {
- $is_open_fullreduction = 0;
- }
-
- $list = array();
- foreach($community_goods as $val)
- {
- $tmp_data = array();
- $tmp_data['actId'] = $val['id'];
- $tmp_data['spuName'] = $val['goodsname'];
- $tmp_data['spuCanBuyNum'] = $val['total'];
- $tmp_data['spuDescribe'] = $val['subtitle'];
- $tmp_data['end_time'] = $val['end_time'];
- $tmp_data['soldNum'] = $val['seller_count'] + $val['sales'];
-
- $productprice = $val['productprice'];
- $tmp_data['marketPrice'] = explode('.', $productprice);
- if( !empty($val['big_img']) )
- {
- $tmp_data['bigImg'] = tomedia($val['big_img']);
- }
-
- $good_image = D('Home/Pingoods')->get_goods_images($val['id']);
- if( !empty($good_image) )
- {
- $tmp_data['skuImage'] = tomedia($good_image['image']);
- }
- $price_arr = D('Home/Pingoods')->get_goods_price($val['id'],$member_id);
- $price = $price_arr['price'];
-
- $tmp_data['actPrice'] = explode('.', $price);
-
- $tmp_data['skuList']= D('Home/Pingoods')->get_goods_options($val['id'],$member_id);
-
- if($is_open_fullreduction == 0)
- {
- $tmp_data['is_take_fullreduction'] = 0;
- }else if($is_open_fullreduction == 1){
- $tmp_data['is_take_fullreduction'] = $val['is_take_fullreduction'];
- }
-
- $list[] = $tmp_data;
- }
- echo json_encode(array('code' => 0, 'list' => $list , 'cur_time' => time() ,'full_reducemoney' => $full_reducemoney,'full_money' => $full_money,'is_open_fullreduction' => $is_open_fullreduction ));
- die();
- }else{
- echo json_encode( array('code' => 1) );
- die();
- }
-
- }
- public function get_community_position()
- {
- $_GPC = I('request.');
- $communityId = $_GPC['communityId'];
-
- $postion = M('lionfish_community_head')->field('lat,lon')->where( array('id' => $communityId ) )->find();
- echo json_encode(array('code' => 0, 'postion' => $postion));
- die();
- }
-
- public function load_spikebuy_goodslist()
- {
- $_GPC = I('request.');
-
- $head_id = $_GPC['head_id'];
- $pageNum = $_GPC['pageNum'];
-
- $per_page = 10000;
- $offset = ($pageNum - 1) * $per_page;
- $limit = "{$offset},{$per_page}";
-
- $token = $_GPC['token'];
-
- $weprogram_token = M('lionfish_comshop_weprogram_token')->field('member_id')->where( array('token' => $token) )->find();
-
-
- if( empty($weprogram_token) || empty($weprogram_token['member_id']) )
- {
- //echo json_encode( array('code' => 2) );
- //die();
- }
- $member_id = $weprogram_token['member_id'];
-
- $now_time = time();
-
- $where = " g.grounding =1 ";
- //head_id
-
- if( !empty($head_id) && $head_id >0 )
- {
- $params = array();
- $params['uniacid'] = $_W['uniacid'];
- $params['head_id'] = $head_id;
- $sql_goods_ids = "select pg.goods_id from ".C('DB_PREFIX')."lionfish_community_head_goods as pg,"
- .C('DB_PREFIX')."lionfish_comshop_good_common as g where pg.goods_id = g.goods_id and g.is_spike_buy = 1 and pg.head_id = {$head_id} order by pg.id desc ";
- $goods_ids_arr = M()->query($sql_goods_ids);
-
- $ids_arr = array();
- foreach($goods_ids_arr as $val){
- $ids_arr[] = $val['goods_id'];
- }
-
- $goods_ids_nolimit_ids = "select pg.id from ".C('DB_PREFIX')."lionfish_comshop_goods as pg,"
- .C('DB_PREFIX')."lionfish_comshop_good_common as g where pg.id = g.goods_id and g.is_spike_buy = 1 and pg.is_all_sale=1 order by pg.id desc ";
- $goods_ids_nolimit_arr = M()->query($goods_ids_nolimit_ids);
-
- if( !empty($goods_ids_nolimit_arr) )
- {
- foreach($goods_ids_nolimit_arr as $val){
- $ids_arr[] = $val['id'];
- }
- }
-
- $ids_str = implode(',',$ids_arr);
-
- if( !empty($ids_str) )
- {
- $where .= " and g.id in ({$ids_str})";
- } else{
- $where .= " and 0 ";
- }
- }else{
- //echo json_encode( array('code' => 1) );
- //die();
- $where .= " and gc.is_spike_buy = 1";
- }
-
- $where .= " and gc.begin_time <={$now_time} and gc.end_time > {$now_time} ";
-
- $index_sort_method = D('Home/Front')->get_config_by_name('index_sort_method');
-
- if( empty($index_sort_method) )
- {
- $index_sort_method = 0;
- }
-
- $order_sort = 'g.istop DESC, g.settoptime DESC,g.index_sort desc,g.id desc ';
-
- if( $index_sort_method == 1 )
- {
- $order_sort = 'g.index_sort desc,g.id desc ';
- }
-
- $community_goods = D('Home/Pingoods')->get_community_index_goods('g.*,gc.begin_time,gc.end_time,gc.big_img,gc.is_take_fullreduction,gc.labelname,gc.oneday_limit_count, gc.total_limit_count, gc.one_limit_count,gc.goods_start_count ', $where,$offset,$per_page,$order_sort);
-
-
- if( !empty($community_goods) )
- {
- $is_show_spike_buy_time = D('Home/Front')->get_config_by_name('is_show_spike_buy_time');
- $is_open_fullreduction = D('Home/Front')->get_config_by_name('is_open_fullreduction');
- $full_money = D('Home/Front')->get_config_by_name('full_money');
- $full_reducemoney = D('Home/Front')->get_config_by_name('full_reducemoney');
-
- if(empty($full_reducemoney) || $full_reducemoney <= 0)
- {
- $is_open_fullreduction = 0;
- }
-
- $cart= D('Home/Car');
-
- $list = array();
- foreach($community_goods as $val)
- {
- $tmp_data = array();
- $tmp_data['actId'] = $val['id'];
- $goodsname = htmlspecialchars_decode($val['goodsname']);
- $tmp_data['spuName'] = $goodsname;
- $tmp_data['spuCanBuyNum'] = $val['total'];
- $tmp_data['spuDescribe'] = $val['subtitle'];
- $tmp_data['end_time'] = $val['end_time'];
- $tmp_data['soldNum'] = $val['seller_count'] + $val['sales'];
- $tmp_data['oneday_limit_count'] = $val['oneday_limit_count'];
- $tmp_data['total_limit_count'] = $val['total_limit_count'];
- $tmp_data['one_limit_count'] = $val['one_limit_count'];
- $tmp_data['goods_start_count'] = $val['goods_start_count'];
- $productprice = $val['productprice'];
- $tmp_data['marketPrice'] = explode('.', $productprice);
- if( !empty($val['big_img']) )
- {
- $tmp_data['bigImg'] = tomedia($val['big_img']);
- }
-
- $good_image = D('Home/Pingoods')->get_goods_images($val['id']);
- if( !empty($good_image) )
- {
- $tmp_data['skuImage'] = tomedia($good_image['image']);
- }
- $price_arr = D('Home/Pingoods')->get_goods_price($val['id'], $member_id);
- $price = $price_arr['price'];
-
- $tmp_data['actPrice'] = explode('.', $price);
-
- //$tmp_data['skuList']= D('Home/Pingoods')->get_goods_options($val['id'], $member_id);
- $tmp_data['skuList']= D('Home/Pingoods')->get_goods_options_carquantity($val['id'], $member_id, $head_id ,$token);
- if( !empty($tmp_data['skuList']) )
- {
- $tmp_data['car_count'] = 0;
- }else{
-
- $car_count = $cart->get_wecart_goods($val['id'],"",$head_id ,$token);
-
- if( empty($car_count) )
- {
- $tmp_data['car_count'] = 0;
- }else{
- $tmp_data['car_count'] = $car_count;
- }
- }
-
- $list[] = $tmp_data;
- }
- echo json_encode(array('code' => 0, 'list' => $list, 'is_show_spike_buy_time'=>$is_show_spike_buy_time ));
- die();
- }else{
- echo json_encode( array('code' => 1) );
- die();
- }
-
- }
-
-
- public function load_new_buy_goodslist()
- {
- $_GPC = I('request.');
-
- $head_id = $_GPC['head_id'];
- $pageNum = $_GPC['pageNum'];
-
- $per_page = 10;
- $offset = ($pageNum - 1) * $per_page;
- $limit = "{$offset},{$per_page}";
-
- $token = $_GPC['token'];
-
- $weprogram_token = M('lionfish_comshop_weprogram_token')->field('member_id')->where( array('token' => $token) )->find();
-
-
- if( empty($weprogram_token) || empty($weprogram_token['member_id']) )
- {
- //echo json_encode( array('code' => 2) );
- //die();
- }
- $member_id = $weprogram_token['member_id'];
-
- $now_time = time();
-
- $where = " g.grounding =1 ";
- //head_id
-
- if( !empty($head_id) && $head_id >0 )
- {
- $params = array();
- $params['uniacid'] = $_W['uniacid'];
- $params['head_id'] = $head_id;
- $sql_goods_ids = "select pg.goods_id from ".C('DB_PREFIX')."lionfish_community_head_goods as pg,"
- .C('DB_PREFIX')."lionfish_comshop_good_common as g where pg.goods_id = g.goods_id and g.is_new_buy = 1 and pg.head_id = {$head_id} order by pg.id desc ";
- $goods_ids_arr = M()->query($sql_goods_ids);
-
- $ids_arr = array();
- foreach($goods_ids_arr as $val){
- $ids_arr[] = $val['goods_id'];
- }
-
- $goods_ids_nolimit_ids = "select pg.id from ".C('DB_PREFIX')."lionfish_comshop_goods as pg,"
- .C('DB_PREFIX')."lionfish_comshop_good_common as g where pg.id = g.goods_id and g.is_new_buy = 1 and pg.is_all_sale=1 order by pg.id desc ";
- $goods_ids_nolimit_arr = M()->query($goods_ids_nolimit_ids);
-
- if( !empty($goods_ids_nolimit_arr) )
- {
- foreach($goods_ids_nolimit_arr as $val){
- $ids_arr[] = $val['id'];
- }
- }
-
- $ids_str = implode(',',$ids_arr);
-
- if( !empty($ids_str) )
- {
- $where .= " and g.id in ({$ids_str})";
- } else{
- $where .= " and 0 ";
- }
- }else{
- //echo json_encode( array('code' => 1) );
- //die();
- $where .= " and gc.is_new_buy = 1";
- }
-
- $where .= " and gc.begin_time <={$now_time} and gc.end_time > {$now_time} ";
-
- $index_sort_method = D('Home/Front')->get_config_by_name('index_sort_method');
-
- if( empty($index_sort_method) )
- {
- $index_sort_method = 0;
- }
-
- $order_sort = 'g.istop DESC, g.settoptime DESC,g.index_sort desc,g.id desc ';
-
- if( $index_sort_method == 1 )
- {
- $order_sort = 'g.index_sort desc,g.id desc ';
- }
-
- $community_goods = D('Home/Pingoods')->get_community_index_goods('g.*,gc.begin_time,gc.end_time,gc.big_img,gc.is_take_fullreduction,gc.labelname,gc.oneday_limit_count, gc.total_limit_count, gc.one_limit_count,gc.goods_start_count ', $where,$offset,$per_page,$order_sort);
-
-
- if( !empty($community_goods) )
- {
- $is_open_fullreduction = D('Home/Front')->get_config_by_name('is_open_fullreduction');
- $full_money = D('Home/Front')->get_config_by_name('full_money');
- $full_reducemoney = D('Home/Front')->get_config_by_name('full_reducemoney');
-
- if(empty($full_reducemoney) || $full_reducemoney <= 0)
- {
- $is_open_fullreduction = 0;
- }
-
- $cart= D('Home/Car');
-
- $list = array();
- foreach($community_goods as $val)
- {
- $tmp_data = array();
- $tmp_data['actId'] = $val['id'];
- $goodsname = htmlspecialchars_decode($val['goodsname']);
- $tmp_data['spuName'] = $goodsname;
- $tmp_data['spuCanBuyNum'] = $val['total'];
- $tmp_data['spuDescribe'] = $val['subtitle'];
- $tmp_data['end_time'] = $val['end_time'];
- $tmp_data['soldNum'] = $val['seller_count'] + $val['sales'];
- $tmp_data['oneday_limit_count'] = $val['oneday_limit_count'];
- $tmp_data['total_limit_count'] = $val['total_limit_count'];
- $tmp_data['one_limit_count'] = $val['one_limit_count'];
- $tmp_data['goods_start_count'] = $val['goods_start_count'];
- $productprice = $val['productprice'];
- $tmp_data['marketPrice'] = explode('.', $productprice);
- if( !empty($val['big_img']) )
- {
- $tmp_data['bigImg'] = tomedia($val['big_img']);
- }
-
- $good_image = D('Home/Pingoods')->get_goods_images($val['id']);
- if( !empty($good_image) )
- {
- $tmp_data['skuImage'] = tomedia($good_image['image']);
- }
- $price_arr = D('Home/Pingoods')->get_goods_price($val['id'], $member_id);
- $price = $price_arr['price'];
-
- $tmp_data['actPrice'] = explode('.', $price);
-
- //$tmp_data['skuList']= D('Home/Pingoods')->get_goods_options($val['id'], $member_id);
- $tmp_data['skuList']= D('Home/Pingoods')->get_goods_options_carquantity($val['id'], $member_id, $head_id ,$token);
- if( !empty($tmp_data['skuList']) )
- {
- $tmp_data['car_count'] = 0;
- }else{
-
- $car_count = $cart->get_wecart_goods($val['id'],"",$head_id ,$token);
-
- if( empty($car_count) )
- {
- $tmp_data['car_count'] = 0;
- }else{
- $tmp_data['car_count'] = $car_count;
- }
- }
-
- $list[] = $tmp_data;
- }
- echo json_encode(array('code' => 0, 'list' => $list ));
- die();
- }else{
- echo json_encode( array('code' => 1) );
- die();
- }
-
- }
-
- /**
- * 条件搜索商品
- */
- public function load_condition_goodslist()
- {
- $_GPC = I('request.');
-
- $head_id = $_GPC['head_id'];
-
- if($head_id == 'undefined')
- $head_id = '';
-
- $pageNum = $_GPC['pageNum'];
- $per_page = 10;
- $offset = ($pageNum - 1) * $per_page;
- $limit = "{$offset},{$per_page}";
- $gid = $_GPC['gid']; //分类id
- $keyword = $_GPC['keyword'];
- $good_ids = $_GPC['good_ids'];
- $type = $_GPC['type']; //空:关键词搜索,1:指定分类,2:指定多个商品
-
- $token = $_GPC['token'];
-
-
- $weprogram_token = M('lionfish_comshop_weprogram_token')->field('member_id')->where( array('token' => $token) )->find();
-
- if( empty($weprogram_token) || empty($weprogram_token['member_id']) )
- {
- //echo json_encode( array('code' => 2) );
- //die();
- }
-
- $member_id = $weprogram_token['member_id'];
-
- $now_time = time();
-
-
- $where = " g.grounding =1 and g.is_seckill =0 and g.type ='normal' ";
-
- if( !empty($head_id) && $head_id >0 )
- {
- $params = array();
- $params['uniacid'] = $_W['uniacid'];
- $params['head_id'] = $head_id;
- $goods_ids_arr = array();
- if(!empty($keyword) && $type==0) {
- $sql_goods_ids = "select pg.goods_id from ".C('DB_PREFIX')."lionfish_community_head_goods as pg,"
- .C('DB_PREFIX')."lionfish_comshop_goods as g
- where pg.goods_id = g.id and g.goodsname like '%{$keyword}%' and pg.head_id = {$head_id} order by pg.id desc ";
-
- $goods_ids_arr = M()->query($sql_goods_ids);
-
- }
- if($type==1){
- $sql_goods_ids = "select pg.goods_id from ".C('DB_PREFIX')."lionfish_community_head_goods as pg,"
- .C('DB_PREFIX')."lionfish_comshop_goods_to_category as g where pg.goods_id = g.goods_id and g.cate_id = {$gid} and pg.head_id = {$head_id} order by pg.id desc ";
-
- $goods_ids_arr = M()->query($sql_goods_ids);
- }
- if($type == 2){
- $goods_ids_arr = M()->query('SELECT goods_id FROM ' . C('DB_PREFIX'). "lionfish_community_head_goods
- WHERE head_id={$head_id} order by id desc ");
- }
- $ids_arr = array();
- foreach($goods_ids_arr as $val){
- $ids_arr[] = $val['goods_id'];
- }
- if(!empty($keyword) && $type==0) {
- $goods_ids_nolimit_arr = M()->query('SELECT id FROM ' . C('DB_PREFIX'). "lionfish_comshop_goods
- WHERE is_all_sale=1 and goodsname like '%{$keyword}%' " );
- }
- if($type==1){
- $goods_ids_nolimit_sql = "select pg.id from ".C('DB_PREFIX')."lionfish_comshop_goods as pg, "
- .C('DB_PREFIX')."lionfish_comshop_goods_to_category as g where pg.id = g.goods_id and g.cate_id = {$gid} and pg.is_all_sale=1 ";
-
- $goods_ids_nolimit_arr = M()->query($goods_ids_nolimit_sql);
- }
- if($type==2){
- $goods_ids_nolimit_arr = M()->query('SELECT id FROM ' . C('DB_PREFIX') . "lionfish_comshop_goods
- WHERE is_all_sale=1 ");
- }
-
- if( !empty($goods_ids_nolimit_arr) )
- {
- foreach($goods_ids_nolimit_arr as $val){
- $ids_arr[] = $val['id'];
- }
- }
- if($type==2){
- $good_ids_arr = explode(',',$good_ids);
- $new_ids_arr = array();
- if(count($good_ids_arr)>0){
- foreach ($good_ids_arr as $val) {
- if(in_array($val, $ids_arr)){
- $new_ids_arr[] = $val;
- }
- }
- }
- $ids_arr = $new_ids_arr;
- }
-
- $ids_str = implode(',',$ids_arr);
- if( !empty($ids_str) )
- {
- $where .= " and g.id in ({$ids_str})";
- } else{
- $where .= " and 0 ";
- }
- }else{
- //echo json_encode( array('code' => 1) );
- //die();
- }
- if(empty($head_id) && $type == 0 && !empty($keyword)) {
- $where .= " and g.goodsname like '%{$keyword}%'";
- }
-
- if($type==1) {
- $where .= " and gc.is_new_buy=0 and gc.is_spike_buy = 0 ";
- }
-
- //$where .= " and gc.begin_time <= {$now_time} and gc.end_time > {$now_time} and g.total > 0 ";
- $community_goods = D('Home/Pingoods')->get_community_index_goods('g.*,gc.begin_time,gc.end_time,gc.big_img,gc.is_take_fullreduction,gc.labelname,gc.oneday_limit_count, gc.total_limit_count, gc.one_limit_count,gc.goods_start_count ', $where,$offset,$per_page);
- if( !empty($community_goods) )
- {
- $is_open_fullreduction = D('Home/Front')->get_config_by_name('is_open_fullreduction');
- $full_money = D('Home/Front')->get_config_by_name('full_money');
- $full_reducemoney = D('Home/Front')->get_config_by_name('full_reducemoney');
-
- if(empty($full_reducemoney) || $full_reducemoney <= 0)
- {
- $is_open_fullreduction = 0;
- }
-
- $list = array();
- foreach($community_goods as $val)
- {
- $tmp_data = array();
- $tmp_data['actId'] = $val['id'];
- $goodsname = htmlspecialchars_decode($val['goodsname']);
- $tmp_data['spuName'] = $goodsname;
- $tmp_data['spuCanBuyNum'] = $val['total'];
- $tmp_data['spuDescribe'] = $val['subtitle'];
- $tmp_data['end_time'] = $val['end_time'];
- $tmp_data['soldNum'] = $val['seller_count'] + $val['sales'];
- $tmp_data['oneday_limit_count'] = $val['oneday_limit_count'];
- $tmp_data['total_limit_count'] = $val['total_limit_count'];
- $tmp_data['one_limit_count'] = $val['one_limit_count'];
- $tmp_data['goods_start_count'] = $val['goods_start_count'];
- $productprice = $val['productprice'];
- $tmp_data['marketPrice'] = explode('.', $productprice);
- if( !empty($val['big_img']) )
- {
- $tmp_data['bigImg'] = tomedia($val['big_img']);
- }
-
- $good_image = D('Home/Pingoods')->get_goods_images($val['id']);
- if( !empty($good_image) )
- {
- $tmp_data['skuImage'] = tomedia($good_image['image']);
- }
- $price_arr = D('Home/Pingoods')->get_goods_price($val['id'], $member_id);
- $price = $price_arr['price'];
-
- $tmp_data['actPrice'] = explode('.', $price);
- /**
- $tmp_data['skuList'] = array(
- array('spec' => 'xl','canBuyNum' => 100,'spuName' => 1, 'actPrice' => array(1,2), 'marketPrice' => array(2,3),'skuImage' => tomedia($good_image['image'])),
- array('spec' => 'x2','canBuyNum' => 200, 'spuName' => 2, 'actPrice' => array(1,2), 'marketPrice' => array(2,3),'skuImage' => tomedia($good_image['image']))
- );
- **/
- //$tmp_data['skuList']= D('Home/Pingoods')->get_goods_options($val['id'], $member_id);
- $tmp_data['skuList']= D('Home/Pingoods')->get_goods_options_carquantity($val['id'], $member_id, $head_id ,$token);
- if( !empty($tmp_data['skuList']) )
- {
- $tmp_data['car_count'] = 0;
- }else{
- if(!empty($head_id) && $head_id > 0){
- $car_count = D('Home/Car')->get_wecart_goods($val['id'],"",$head_id ,$token);
- if( empty($car_count) )
- {
- $tmp_data['car_count'] = 0;
- }else{
- $tmp_data['car_count'] = $car_count;
- }
- }
- }
-
-
- if($is_open_fullreduction == 0)
- {
- $tmp_data['is_take_fullreduction'] = 0;
- }else if($is_open_fullreduction == 1){
- $tmp_data['is_take_fullreduction'] = $val['is_take_fullreduction'];
- }
-
- $list[] = $tmp_data;
- }
- echo json_encode(array('code' => 0, 'list' => $list , 'cur_time' => time() ,'full_reducemoney' => $full_reducemoney,'full_money' => $full_money,'is_open_fullreduction' => $is_open_fullreduction ));
- die();
- }else{
- echo json_encode( array('code' => 1) );
- die();
- }
-
- }
-
-
- public function get_newauth_bg()
- {
-
- $newauth_bg_image = D('Home/Front')->get_config_by_name('newauth_bg_image');
- if( !empty($newauth_bg_image) )
- {
- $newauth_bg_image = tomedia($newauth_bg_image);
- }
- $newauth_cancel_image = D('Home/Front')->get_config_by_name('newauth_cancel_image');
- if( !empty($newauth_cancel_image) )
- {
- $newauth_cancel_image = tomedia($newauth_cancel_image);
- }
- $newauth_confirm_image = D('Home/Front')->get_config_by_name('newauth_confirm_image');
- if( !empty($newauth_confirm_image) )
- {
- $newauth_confirm_image = tomedia($newauth_confirm_image);
- }
- echo json_encode(
- array(
- 'code'=>0,
- 'data' => array(
- 'newauth_bg_image'=>$newauth_bg_image,
- 'newauth_confirm_image'=>$newauth_confirm_image,
- 'newauth_cancel_image'=>$newauth_cancel_image
- )
- )
- );
- }
-
- /**
- 进入小程序初始加载方法,
- 以后有类似需要参数,都在这里初始化
- **/
- public function get_firstload_msg()
- {
- $_GPC = I('request.');
- $token = isset($_GPC['token']) ? $_GPC['token'] : '';
- $new_head_id = 0;
- $default_head_info = array();
- //是否强制手机
- $isparse_formdata = 0;
-
- if( !empty($token) )
- {
- $weprogram_token = M('lionfish_comshop_weprogram_token')->field('member_id')->where( array('token' => $token) )->find();
-
- $community_history = M('lionfish_community_history')->field('head_id')->where( array('member_id' => $weprogram_token['member_id'] ) )->order('addtime desc')->find();
-
-
- if( !empty($community_history) )
- {
- $cur_community_info = M('lionfish_community_head')->field('id')->where( array('id' => $community_history['head_id'] ) )->find();
-
- if( !empty($cur_community_info) )
- {
- $new_head_id = $cur_community_info['id'];
- $default_head_info = D('Home/Front')->get_community_byid($new_head_id);
- }
- }
- //是否强制手机
- $is_get_formdata = D('Home/Front')->get_config_by_name('is_get_formdata');
- if( isset($is_get_formdata) && $is_get_formdata == 1 )
- {
- $now_member_info = M('lionfish_comshop_member')->where( array('member_id' => $weprogram_token['member_id'] ))->find();
- if( $now_member_info['is_apply_state'] != 1 && $now_member_info['is_write_form'] != 1 )
- {
- $isparse_formdata = 1;
- }
- }
- }
- $skin = D('Home/Front')->get_config_by_name('skin');
- $common_header_backgroundimage = D('Home/Front')->get_config_by_name('common_header_backgroundimage');
- if( !empty($common_header_backgroundimage) )
- {
- $common_header_backgroundimage = tomedia($common_header_backgroundimage);
- }
- $goods_sale_unit = D('Home/goods')->get_sale_unit();
- echo json_encode( array('code' => 0,'new_head_id' => $new_head_id,'isparse_formdata' => $isparse_formdata , 'default_head_info' => $default_head_info, 'skin'=>$skin, 'common_header_backgroundimage'=>$common_header_backgroundimage, 'goods_sale_unit'=>$goods_sale_unit ) );
- die();
- }
-
- /**
- * 加载分类详情页
- * @return [type] [description]
- */
- public function load_cate_goodslist()
- {
- $_GPC = I('request.');
-
- $head_id = $_GPC['head_id'];
- if($head_id == 'undefined')
- $head_id = '';
- $pid = $_GPC['gid'];
-
- $token = $_GPC['token'];
-
- $weprogram_token = M('lionfish_comshop_weprogram_token')->field('member_id')->where( array('token' => $token) )->find();
-
- $member_id = $weprogram_token['member_id'];
-
-
- // vip身份
- $is_vip_card_member = 0;
- $is_open_vipcard_buy = D('Home/Front')->get_config_by_name('is_open_vipcard_buy');
- $is_open_vipcard_buy = !empty($is_open_vipcard_buy) && $is_open_vipcard_buy ==1 ? 1:0;
-
- $member_id = $weprogram_token['member_id'];
- $is_vip_card_member = 0;
- if( $member_id > 0 )
- {
-
- $member_info = M('lionfish_comshop_member')->where( array('member_id' => $member_id ) )->find();
-
- if( !empty($is_open_vipcard_buy) && $is_open_vipcard_buy == 1 )
- {
- $now_time = time();
- if( $member_info['card_id'] >0 && $member_info['card_end_time'] > $now_time )
- {
- $is_vip_card_member = 1;//还是会员
- }else if( $member_info['card_id'] >0 && $member_info['card_end_time'] < $now_time ){
- $is_vip_card_member = 2;//已过期
- }
- }
- }
-
- if($pid == 'undefined' || $pid =='')
- {
- echo json_encode(
- array(
- 'code' => 1,
- 'data'=> array(),
- 'msg' => '分类id错误'
- )
- );
- die();
- }
- $is_open_fullreduction = D('Home/Front')->get_config_by_name('is_open_fullreduction');
- $full_money = D('Home/Front')->get_config_by_name('full_money');
- $full_reducemoney = D('Home/Front')->get_config_by_name('full_reducemoney');
- $is_open_vipcard_buy = D('Home/Front')->get_config_by_name('is_open_vipcard_buy');
- $is_open_vipcard_buy = !empty($is_open_vipcard_buy) && $is_open_vipcard_buy == 1 ? 1:0;
- $is_show_vipcard_price = D('Home/Front')->get_config_by_name('is_show_vipcard_price');
- if( $is_open_vipcard_buy == 1 )
- {
- if( !empty($is_show_vipcard_price) && $is_show_vipcard_price == 1 ) $is_open_vipcard_buy = 0;
- }
-
- if(empty($full_reducemoney) || $full_reducemoney <= 0) $is_open_fullreduction = 0;
- $cateList = $cateArr = array();
-
- $parent_cate = M('lionfish_comshop_goods_category')->field('id,banner,name')->where( array('cate_type' =>'normal','id' => $pid ) )->find();
-
- if($parent_cate){
-
- $cate_info = M('lionfish_comshop_goods_category')->field('id,banner,name,logo')->where( array('cate_type' =>'normal','pid' => $parent_cate['id'] ) )->order('sort_order desc, id desc')->select();
-
- if($cate_info){
- $cateArr = array_merge(array($parent_cate), $cate_info);
- }else {
- $cateArr[] = $parent_cate;
- }
- foreach ($cateArr as $key => $val) {
- $gid = $val['id'];
- $cate_info = array();
- $cate_info['name'] = $val['name'];
- $cate_info['banner'] = $val['banner'] && !empty($val['banner']) ? tomedia($val['banner']) : '';
- $cate_info['logo'] = $val['logo'] && !empty($val['logo']) ? tomedia($val['logo']) : '';
- $now_time = time();
- $where = " g.grounding =1 ";
- if( !empty($head_id) && $head_id >0 )
- {
-
- $sql_goods_ids = "select pg.goods_id from ".C('DB_PREFIX')."lionfish_community_head_goods as pg,"
- .C('DB_PREFIX')."lionfish_comshop_goods_to_category as g
- where pg.goods_id = g.goods_id and g.cate_id={$gid} and pg.head_id = {$head_id}
- order by pg.id desc ";
- $goods_ids_arr = M()->query($sql_goods_ids);
-
-
- $ids_arr = array();
- foreach($goods_ids_arr as $val){
- $ids_arr[] = $val['goods_id'];
- }
- $goods_ids_nolimit_sql = "select pg.id from ".C('DB_PREFIX')."lionfish_comshop_goods as pg,"
- .C('DB_PREFIX')."lionfish_comshop_goods_to_category as g where pg.id = g.goods_id and g.cate_id={$gid}
- and pg.is_all_sale=1 ";
- $goods_ids_nolimit_arr = M()->query($goods_ids_nolimit_sql);
-
- if( !empty($goods_ids_nolimit_arr) )
- {
- foreach($goods_ids_nolimit_arr as $val){
- $ids_arr[] = $val['id'];
- }
- }
-
-
- $ids_str = implode(',',$ids_arr);
-
- if( !empty($ids_str) )
- {
- $where .= " and g.id in ({$ids_str})";
- } else{
- $where .= " and 0 ";
- }
- }else{
- $goods_ids_nohead_sql = "select pg.id from ".C('DB_PREFIX')."lionfish_comshop_goods as pg," .C('DB_PREFIX')."lionfish_comshop_goods_to_category as g
- where pg.id = g.goods_id and g.cate_id = {$gid} ";
- $goods_ids_nohead_arr = M()->query($goods_ids_nohead_sql);
- $ids_arr = array();
- if( !empty($goods_ids_nohead_arr) )
- {
- foreach($goods_ids_nohead_arr as $val){
- $ids_arr[] = $val['id'];
- }
- }
-
- $ids_str = implode(',',$ids_arr);
-
- if( !empty($ids_str) )
- {
- $where .= " and g.id in ({$ids_str})";
- } else{
- $where .= " and 0 ";
- }
- }
-
- // $where .= " and gc.begin_time <={$now_time} and gc.end_time > {$now_time} ";
- $where .= " and gc.begin_time <={$now_time} ";
- $where .= " and gc.is_new_buy=0 and gc.is_spike_buy = 0 and g.is_seckill = 0 ";
-
- $community_goods = '';
- $community_goods = D('Home/Pingoods')->get_community_index_goods('g.*,gc.begin_time,gc.end_time,gc.big_img,gc.is_take_fullreduction,gc.labelname,gc.video,gc.oneday_limit_count, gc.total_limit_count, gc.one_limit_count,gc.goods_start_count ', $where, 0, 10000);
- $list = $cart = array();
- if( !empty($community_goods) )
- {
- $cart= D('Home/Car');
-
- foreach($community_goods as $val)
- {
- $tmp_data = array();
- $tmp_data['actId'] = $val['id'];
- $goodsname = htmlspecialchars_decode($val['goodsname']);
- $tmp_data['spuName'] = $goodsname;
- $tmp_data['spuCanBuyNum'] = $val['total'];
- $tmp_data['spuDescribe'] = $val['subtitle'];
- $tmp_data['end_time'] = $val['end_time'];
- $tmp_data['is_take_vipcard'] = $val['is_take_vipcard'];
- $tmp_data['soldNum'] = $val['seller_count'] + $val['sales'];
- $tmp_data['actEnd'] = time()>$val['end_time'];
- $tmp_data['oneday_limit_count'] = $val['oneday_limit_count'];
- $tmp_data['total_limit_count'] = $val['total_limit_count'];
- $tmp_data['one_limit_count'] = $val['one_limit_count'];
- $tmp_data['goods_start_count'] = $val['goods_start_count'];
-
- $productprice = $val['productprice'];
- $tmp_data['marketPrice'] = explode('.', $productprice);
- if( !empty($val['big_img']) )
- {
- $tmp_data['bigImg'] = tomedia($val['big_img']);
- }
-
- $good_image = D('Home/Pingoods')->get_goods_images($val['id']);
- if( !empty($good_image) )
- {
- $tmp_data['skuImage'] = tomedia($good_image['image']);
- }
- $price_arr = D('Home/Pingoods')->get_goods_price($val['id'], $member_id);
- $price = $price_arr['price'];
-
- $tmp_data['actPrice'] = explode('.', $price);
- $tmp_data['card_price'] = $price_arr['card_price'];
- $tmp_data['skuList']= D('Home/Pingoods')->get_goods_options($val['id'],$member_id);
-
- if( !empty($tmp_data['skuList']) )
- {
- $tmp_data['car_count'] = 0;
- }else{
- $car_count = $cart->get_wecart_goods($val['id'],"",$head_id ,$token);
- if( empty($car_count) )
- {
- $tmp_data['car_count'] = 0;
- }else{
- $tmp_data['car_count'] = $car_count;
- }
- }
-
- if($is_open_fullreduction == 0)
- {
- $tmp_data['is_take_fullreduction'] = 0;
- }else if($is_open_fullreduction == 1){
- $tmp_data['is_take_fullreduction'] = $val['is_take_fullreduction'];
- }
- // 商品角标
- $label_id = unserialize($val['labelname']);
- if($label_id){
- $label_info = D('Home/Pingoods')->get_goods_tags($label_id);
- if($label_info){
- if($label_info['type'] == 1){
- $label_info['tagcontent'] = tomedia($label_info['tagcontent']);
- } else {
- $label_info['len'] = mb_strlen($label_info['tagcontent'], 'utf-8');
- }
- }
- $tmp_data['label_info'] = $label_info;
- }
- $tmp_data['is_video'] = empty($val['video']) ? false : true;
- $list[] = $tmp_data;
- }
- }
- $cateList[] = array('cate_info'=>$cate_info, 'list'=>$list);
- }
- }
-
- $is_show_cate_tabbar = D('Home/Front')->get_config_by_name('is_show_cate_tabbar');
- // 客服按钮
- $user_service_switch = D('Home/Front')->get_config_by_name('user_service_switch');
- $theme = D('Home/Front')->get_config_by_name('index_list_theme_type');
- echo json_encode(
- array(
- 'code' => 0,
- 'list' => $cateList,
- 'is_vip_card_member' => $is_vip_card_member,
- 'cur_time' => time(),
- 'full_reducemoney' => $full_reducemoney,
- 'full_money' => $full_money,
- 'is_open_vipcard_buy' => $is_open_vipcard_buy,
- 'is_open_fullreduction' => $is_open_fullreduction,
- 'is_show_cate_tabbar' => $is_show_cate_tabbar,
- 'user_service_switch' => $user_service_switch,
- 'theme' => $theme
- )
- );
- die();
- }
- public function load_gps_goodslist_new()
- {
- $gpc = I('request.');
-
- $token = $gpc['token'];
- $head_id = $gpc['head_id'];
- $is_only_express = $gpc['is_only_express'];
- $is_open_only_express = 0;
- if($is_only_express==1) {
- $is_open_only_express = D('Home/Front')->get_config_by_name('is_open_only_express');
- }
-
- if($head_id == 'undefined') $head_id = '';
- $pageNum = $gpc['pageNum'];
- $gid = $gpc['gid'];
- $keyword = $gpc['keyword'];
-
- $is_random = isset($gpc['is_random']) ? $gpc['is_random'] : 0;
- $is_video = isset($gpc['is_video']) ? $gpc['is_video'] : 0;
- $per_page = isset($gpc['per_page']) ? $gpc['per_page'] : 10;
- $cate_info = '';
-
- if($gid == 'undefined' || $gid =='' || $gid =='null' || $gid ==0)
- {
- $gid = 0;
- } else {
- $cate_info = M('lionfish_comshop_goods_category')->field('banner,name')->where( array('id' => $gid ) )->find();
- if(!empty($cate_info['banner'])) $cate_info['banner'] = tomedia($cate_info['banner']);
- }
-
- if( !empty($gid) && $gid > 0)
- {
- $gids = D('Home/GoodsCategory')->get_index_goods_category($gid,'normal','','',1);
- $gidArr = array();
- $gidArr[] = $gid;
-
- foreach ($gids as $key => $val) {
- $gidArr[] = $val['id'];
- }
-
- $gid = implode(',', $gidArr);
- }
- $offset = ($pageNum - 1) * $per_page;
- $limit = "{$offset},{$per_page}";
-
- $weprogram_token = M('lionfish_comshop_weprogram_token')->field('member_id')->where( array('token' => $token) )->find();
- $is_member_level_buy = 0;
- $is_vip_card_member = 0;
- $is_open_vipcard_buy = D('Home/Front')->get_config_by_name('is_open_vipcard_buy');
- $is_open_vipcard_buy = !empty($is_open_vipcard_buy) && $is_open_vipcard_buy ==1 ? 1:0;
-
- if( empty($weprogram_token) || empty($weprogram_token['member_id']) )
- {
- //echo json_encode( array('code' => 2) );
- //die();
- }else{
- $member_id = $weprogram_token['member_id'];
- $is_vip_card_member = 0;
-
- //member_id
- if( $member_id > 0 )
- {
- $member_info = M('lionfish_comshop_member')->where( array('member_id' => $member_id ) )->find();
-
- if( !empty($is_open_vipcard_buy) && $is_open_vipcard_buy == 1 )
- {
-
- $now_time = time();
-
- if( $member_info['card_id'] >0 && $member_info['card_end_time'] > $now_time )
- {
- $is_vip_card_member = 1;//还是会员
- }else if( $member_info['card_id'] >0 && $member_info['card_end_time'] < $now_time ){
- $is_vip_card_member = 2;//已过期
- }
- }
-
- if($is_vip_card_member != 1 && $member_info['level_id'] >0 )
- {
- $is_member_level_buy = 1;
- }
- }
-
- }
-
- $member_id = $weprogram_token['member_id'];
-
- //整点秒杀begin
- $is_seckill = isset($gpc['is_seckill']) ? 1:0;
- $seckill_time = isset($gpc['seckill_time']) ? intval($gpc['seckill_time']):0;
- //整点秒杀end
-
- $now_time = time();
- if($is_seckill ==1)
- {
- $where = " g.grounding =1 and g.is_seckill =1 and g.type ='normal' ";
- }else
- {
- $where = " g.grounding =1 and g.is_seckill =0 and g.type ='normal' ";
- }
-
- //head_id
- if( !empty($keyword) )
- {
- $where .= " and g.goodsname like '%{$keyword}%' ";
- }
-
- if($is_seckill ==1)
- {
- $bg_time = strtotime( date('Y-m-d').' '.$seckill_time.':00:00' );
-
- $ed_time = $bg_time + 3600;
-
- if($gid == 0 && $keyword == ''){
- $where .= " and gc.begin_time >={$bg_time} and gc.begin_time <{$ed_time} ";
- } else {
- $where .= " and gc.begin_time >={$bg_time} and gc.begin_time <{$ed_time} ";
- }
-
- } else {
- if($gid == 0 && $keyword == ''){
- $where .= " and g.is_index_show = 1 ";
- }
- }
-
- if($is_seckill ==1)
- {
-
- }else{
- $where .= " and gc.is_new_buy=0 and gc.is_spike_buy = 0 ";
- }
-
- if( $is_video == 1 )
- {
- $where .= " and gc.video !='' ";
- }
- if($is_open_only_express==1 && $is_only_express==1) {
- $where .= " and gc.is_only_express =1 ";
- }
- $now_time = time();
- $where .= " and gc.begin_time <={$now_time} ";
-
- $index_sort_method = D('Home/Front')->get_config_by_name('index_sort_method');
- if( empty($index_sort_method) )
- {
- $order_sort = 'g.istop DESC, g.settoptime DESC,g.index_sort desc,g.id desc ';
- }
-
- if( $index_sort_method == 1 )
- {
- $order_sort = 'g.index_sort desc,g.id desc ';
- }
-
- if($is_random == 1)
- {
- $community_goods = D('Home/Pingoods')->get_new_community_index_goods($head_id,$gid,'g.*,gc.begin_time,gc.end_time,gc.big_img,gc.is_take_fullreduction,gc.labelname,gc.video,gc.pick_up_type,gc.pick_up_modify,gc.oneday_limit_count, gc.total_limit_count, gc.one_limit_count,gc.goods_start_count ', $where,$offset,$per_page,$order_sort,' rand() ');
- }else{
- $community_goods = D('Home/Pingoods')->get_new_community_index_goods($head_id,$gid,'g.*,gc.begin_time,gc.end_time,gc.big_img,gc.is_take_fullreduction,gc.labelname,gc.video,gc.pick_up_type,gc.pick_up_modify,gc.oneday_limit_count, gc.total_limit_count, gc.one_limit_count,gc.goods_start_count ', $where,$offset,$per_page,$order_sort);
- }
-
- if( !empty($community_goods) )
- {
- $is_open_fullreduction = D('Home/Front')->get_config_by_name('is_open_fullreduction');
- $full_money = D('Home/Front')->get_config_by_name('full_money');
- $full_reducemoney = D('Home/Front')->get_config_by_name('full_reducemoney');
-
- $is_open_vipcard_buy = D('Home/Front')->get_config_by_name('is_open_vipcard_buy');
-
- $is_open_vipcard_buy = !empty($is_open_vipcard_buy) && $is_open_vipcard_buy == 1 ? 1:0;
-
-
- if(empty($full_reducemoney) || $full_reducemoney <= 0)
- {
- $is_open_fullreduction = 0;
- }
-
- $cart= D('Home/Car');
-
- $list = array();
- $copy_text_arr = array();
- $today_time = strtotime( date('Y-m-d').' 00:00:00' );
-
-
- foreach($community_goods as $val)
- {
- $tmp_data = array();
- $tmp_data['actId'] = $val['id'];
- $goodsname = htmlspecialchars_decode($val['goodsname']);
- $tmp_data['spuName'] = $goodsname;
- $tmp_data['spuCanBuyNum'] = $val['total'];
- $tmp_data['spuDescribe'] = $val['subtitle'];
- $tmp_data['end_time'] = $val['end_time'];
- $tmp_data['actEnd'] = time()>$val['end_time'];
- $tmp_data['is_take_vipcard'] = $val['is_take_vipcard'];
- $tmp_data['soldNum'] = $val['seller_count'] + $val['sales'];
- $tmp_data['oneday_limit_count'] = $val['oneday_limit_count'];
- $tmp_data['total_limit_count'] = $val['total_limit_count'];
- $tmp_data['one_limit_count'] = $val['one_limit_count'];
- $tmp_data['goods_start_count'] = $val['goods_start_count'];
- $tmp_data['begin_time'] = date('Y-m-d', $val['begin_time']);
-
- if($val['pick_up_type'] == 0)
- {
- $val['pick_up_modify'] = date('Y-m-d', $today_time);
- }else if( $val['pick_up_type'] == 1 ){
- $val['pick_up_modify'] = date('Y-m-d', $today_time+86400);
- }else if( $val['pick_up_type'] == 2 )
- {
- $val['pick_up_modify'] = date('Y-m-d', $today_time+86400*2);
- }
-
- $tmp_data['pick_up_modify'] = $val['pick_up_modify'];
-
-
- $productprice = $val['productprice'];
- $tmp_data['marketPrice'] = explode('.', $productprice);
- if( !empty($val['big_img']) )
- {
- $tmp_data['bigImg'] = tomedia($val['big_img']);
- }
-
-
- $good_image = D('Home/Pingoods')->get_goods_images($val['id']);
- if( !empty($good_image) )
- {
- $tmp_data['skuImage'] = tomedia($good_image['image']);
- }
- $price_arr = D('Home/Pingoods')->get_goods_price($val['id'], $member_id);
- $price = $price_arr['price'];
-
- if( $pageNum == 1 )
- {
- $copy_text_arr[] = array('goods_name' => $val['goodsname'], 'price' => $price);
- }
-
- $tmp_data['actPrice'] = explode('.', $price);
- $tmp_data['card_price'] = $price_arr['card_price'];
-
- $tmp_data['levelprice'] = $price_arr['levelprice']; // 会员等级价格
- $tmp_data['is_mb_level_buy'] = $price_arr['is_mb_level_buy']; //是否 会员等级 可享受
-
- //$tmp_data['skuList']= D('Home/Pingoods')->get_goods_options($val['id'], $member_id);
- $tmp_data['skuList']= D('Home/Pingoods')->get_goods_options_carquantity($val['id'], $member_id, $head_id ,$token);
- if( !empty($tmp_data['skuList']) )
- {
- $tmp_data['car_count'] = 0;
- }else{
-
- $car_count = $cart->get_wecart_goods($val['id'],"",$head_id ,$token);
-
- if( empty($car_count) )
- {
- $tmp_data['car_count'] = 0;
- }else{
- $tmp_data['car_count'] = $car_count;
- }
-
- }
-
- if($is_open_fullreduction == 0)
- {
- $tmp_data['is_take_fullreduction'] = 0;
- }else if($is_open_fullreduction == 1){
- $tmp_data['is_take_fullreduction'] = $val['is_take_fullreduction'];
- }
-
-
- // 商品角标
- $label_id = unserialize($val['labelname']);
- if($label_id){
- $label_info = D('Home/Pingoods')->get_goods_tags($label_id);
- if($label_info){
- if($label_info['type'] == 1){
- $label_info['tagcontent'] = tomedia($label_info['tagcontent']);
- } else {
- $label_info['len'] = mb_strlen($label_info['tagcontent'], 'utf-8');
- }
- }
- $tmp_data['label_info'] = $label_info;
- }
-
- $tmp_data['is_video'] = empty($val['video']) ? false : true;
-
- $list[] = $tmp_data;
- }
-
-
- $is_show_list_timer = D('Home/Front')->get_config_by_name('is_show_list_timer');
- $is_show_cate_tabbar = D('Home/Front')->get_config_by_name('is_show_cate_tabbar');
- echo json_encode(array('code' => 0,'now_time' => time(), 'list' => $list ,'is_show_cate_tabbar' => $is_show_cate_tabbar,'is_vip_card_member' => $is_vip_card_member,'is_member_level_buy' => $is_member_level_buy , 'copy_text_arr' => $copy_text_arr, 'cur_time' => time() ,'full_reducemoney' => $full_reducemoney,'full_money' => $full_money,'is_open_vipcard_buy' => $is_open_vipcard_buy,'is_open_fullreduction' => $is_open_fullreduction,'is_show_list_timer'=>$is_show_list_timer , 'cate_info' => $cate_info, 'is_show_cate_tabbar'=>$is_show_cate_tabbar ));
- die();
-
- }else{
- $is_show_cate_tabbar = D('Home/Front')->get_config_by_name('is_show_cate_tabbar');
-
- echo json_encode( array('code' => 1 , 'cate_info' => $cate_info , 'is_show_cate_tabbar'=>$is_show_cate_tabbar ) );
- die();
- }
- }
- /**
- * 图片广告
- * @return [json] [description]
- */
- public function get_advimg(){
- $data = M('lionfish_comshop_advimg')->order('id desc')->find();
- if(!empty($data)) {
- if(!empty($data['enabled'])){
- $data['thumb'] = tomedia($data['thumb']);
- $data['pos'] = explode(',', $data['pos']);
- echo json_encode( array('code' => 0, 'data' => $data ) );
- die();
- }else{
- echo json_encode( array('code' => 1, 'msg' => "广告图片已关闭" ) );
- die();
- }
- }
- echo json_encode( array('code' => 1, 'msg' => "无广告图片" ) );
- die();
- }
- public function get_diy_info()
- {
- $index_diy_json = D('Home/Front')->get_config_by_name('index_diy_json');
-
- if($index_diy_json) {
- $data = unserialize($index_diy_json);
- $diyData = htmlspecialchars_decode($data['value']);
- if(!$diyData) {
- $newdata = D('Seller/Diydata')->get_all_config();
- if(!empty($newdata)) $diyJson = $newdata;
- if(!empty($diyJson)) {
- foreach($diyJson as $k=>$v) {
- $v->host = $this->staticHost();
- if($v->type=="RICH_TEXT") {
- $v->html= $this->replaceRichtextImgSrc($v->html);
- }
- $diyJson[$k] = $v;
- }
- }
- if($data) {
- $global = json_decode(htmlspecialchars_decode($data["global"]));
- // var_dump($global);die();
- }
- } else {
- $diyDataJson = json_decode($diyData, true);
- $diyJson = $diyDataJson['value'];
- $global = $diyDataJson['global'];
- if(!empty($diyJson)) {
- foreach($diyJson as $k=>$v) {
- $v['host'] = $this->staticHost();
- if($v['type']=="RICH_TEXT") {
- $v['html'] = $this->replaceRichtextImgSrc($v['html']);
- }
- $diyJson[$k] = $v;
- }
- }
- }
- echo json_encode( array('code' => 0, 'global' => $global, 'diyJson' => $diyJson ) );
- die();
- } else {
- echo json_encode( array('code' => 1, 'msg' => 'DIY页面未设置' ) );
- die();
- }
- }
- public function staticHost() {
- $port = isset($_SERVER['SERVER_PORT']) ? $_SERVER['SERVER_PORT'] : '80';
- $host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '';
- return "https://" . $host;
- }
- public function replaceRichtextImgSrc($html) {
- $pattern = "/<[img|IMG].*?src=[\'|\"](.*?(?:[\.gif|\.jpg|\.png|\.jpeg]))[\'|\"].*?[\/]?>/i";
- $result = preg_replace_callback($pattern, function ($ma) {
- $newUrl = $ma[1];
- $port = isset($_SERVER['SERVER_PORT']) ? $_SERVER['SERVER_PORT'] : '80';
- $host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '';
- if (strpos($ma[1], 'http') == false) {
- $newUrl = "https://" . $host . $newUrl;
- }
- return str_replace($ma[1], tomedia($newUrl), $ma[0]);
- }, $html);
- return $result;
- }
- }
|