123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912 |
- <?php
- /**
- * lionfish 商城系统
- *
- *
- * @author fish
- *
- */
- namespace Seller\Controller;
- class ConfigindexController extends CommonController{
-
- protected function _initialize(){
- parent::_initialize();
-
- //'pinjie' => '拼团介绍',
- }
-
- public function navigat()
- {
- $_GPC = I('request.');
-
- $pindex = max(1, intval($_GPC['page']));
- $psize = 20;
- $condition = "";
-
- if (!empty($_GPC['keyword'])) {
- $condition .= ' and navname like "%'.trim($_GPC['keyword']).'%"';
- }
- if (isset($_GPC['enabled']) && $_GPC['enabled'] >= 0) {
-
- $condition .= ' and enabled = ' . $_GPC['enabled'];
- } else {
- $_GPC['enabled'] = -1;
- }
- $list = M()->query('SELECT * FROM ' . C('DB_PREFIX'). "lionfish_comshop_navigat
- WHERE 1 " . $condition . ' order by displayorder desc, id desc limit ' . (($pindex - 1) * $psize) . ',' . $psize);
-
- $total = M('lionfish_comshop_navigat')->where('1 '. $condition )->count();
- $pager = pagination2($total, $pindex, $psize);
-
- $this->_GPC = $_GPC;
-
- $this->list = $list;
- $this->display();
- }
- public function slider()
- {
-
- $condition = ' type="slider" ';
- $pindex = I('request.page', 1);
- $psize = 20;
- $keyword = I('request.keyword');
- $this->keyword = $keyword;
-
-
- if (!empty($keyword)) {
- $condition .= ' and advname like '.'"%' . $keyword . '%"';
- }
- $enabled = I('request.enabled');
-
- if (!empty($enabled) && $enabled >= 0) {
- $condition .= ' and enabled = ' . $enabled;
- } else {
- $enabled = -1;
- }
- $this->enabled = $enabled;
-
-
-
- $list = M()->query('SELECT id,advname,thumb,link,type,displayorder,enabled FROM ' .
- C('DB_PREFIX'). "lionfish_comshop_adv \r\n
- WHERE " . $condition . ' order by displayorder desc, id desc limit ' . (($pindex - 1) * $psize) . ',' . $psize);
-
-
- $total = M('lionfish_comshop_adv')->where($condition)->count();
- $pager = pagination2($total, $pindex, $psize);
-
- $this->list = $list;
- $this->pager = $pager;
- $this->display();
- }
- public function category()
- {
- $condition = ' type="slider" ';
- $pindex = I('request.page', 1);
- $psize = 20;
- $keyword = I('request.keyword');
- $this->keyword = $keyword;
- if (!empty($keyword)) {
- $condition .= ' and advname like '.'"%' . $keyword . '%"';
- }
- $enabled = I('request.enabled',-1);
- if (!empty($enabled) && $enabled >= 0) {
- $condition .= ' and enabled = ' . $enabled;
- } else {
- $enabled = -1;
- }
- $this->enabled = $enabled;
- $list = M()->query('SELECT id,cate_id,advname,thumb,link,type,displayorder,enabled FROM ' .
- C('DB_PREFIX'). "lionfish_comshop_adv_category \r\n
- WHERE " . $condition . ' order by displayorder desc, id desc limit ' . (($pindex - 1) * $psize) . ',' . $psize);
- if( !empty($list) )
- {
- foreach( $list as $key => $val )
- {
- $cate_info = M('lionfish_comshop_goods_category')->field('id,name')->where("id=".$val['cate_id'])->find();
- $val['cate_name'] = '无分类';
- if( !empty($cate_info) )
- {
- $val['cate_name'] = $cate_info['name'];
- }
- $list[$key] = $val;
- }
- }
- $total = M('lionfish_comshop_adv')->where($condition)->count();
- $pager = pagination2($total, $pindex, $psize);
- $this->list = $list;
- $this->pager = $pager;
- $this->display();
- }
- //
- public function addnavigat()
- {
- $_GPC = I('request.');
- $id = intval($_GPC['id']);
-
- $category = D('Seller/GoodsCategory')->getFullCategory(false, true);
- $this->category = $category;
-
- if (!empty($id)) {
- // $category = D('Seller/GoodsCategory')->getFullCategory(false, true);
- // $this->category = $category;
- $item = M('lionfish_comshop_navigat')->where( array('id' => $id) )->find();
- if($item['type']==6) {
- $couponinfo = M('lionfish_comshop_coupon')->field('id, voucher_title')->where('id in( ' . $item['link'] . ' ) ')->select();
- $this->couponinfo = $couponinfo;
- }
- $this->item = $item;
- }
- if (IS_POST) {
- $data = $_GPC['data'];
- if($data['type']==3 || $data['type']==4){
- $data['link'] = $data['cid'];
- }
- if($data['type']==6){
- $coupon_id_list = $_GPC['coupon_id'];
- $data['link'] = implode(',', $coupon_id_list);
- }
- D('Seller/Adv')->navigat_update($data);
- show_json(1, array('url' => $_SERVER['HTTP_REFERER']));
- }
- $this->display();
- }
- public function changenavigat()
- {
- $_GPC = I('request.');
- $id = intval($_GPC['id']);
- //ids
- if (empty($id)) {
- $id = ((is_array($_GPC['ids']) ? implode(',', $_GPC['ids']) : 0));
- }
- if (empty($id)) {
- show_json(0, array('message' => '参数错误'));
- }
- $type = trim($_GPC['type']);
- $value = trim($_GPC['value']);
- if (!(in_array($type, array('enabled', 'displayorder')))) {
- show_json(0, array('message' => '参数错误'));
- }
-
- $items = M('lionfish_comshop_navigat')->field('id')->where('id in( ' . $id . ' ) ')->select();
- foreach ($items as $item) {
- M('lionfish_comshop_navigat')->where( array('id' => $item['id']) )->save( array($type => $value) );
- }
- show_json(1, array('url' => $_SERVER['HTTP_REFERER']));
- }
- public function deletenavigat()
- {
-
- $_GPC = I('request.');
- $id = intval($_GPC['id']);
- //ids
- if (empty($id)) {
- $id = ((is_array($_GPC['ids']) ? implode(',', $_GPC['ids']) : 0));
- }
- if (empty($id)) {
- show_json(0, array('message' => '参数错误'));
- }
-
- $items = M('lionfish_comshop_navigat')->field('id')->where( 'id in( ' . $id . ' )' )->select();
- foreach ($items as $item) {
- M('lionfish_comshop_navigat')->where( array('id' => $item['id']) )->delete();
- }
- show_json(1, array('url' => $_SERVER['HTTP_REFERER']));
- }
- //
-
- public function addslider()
- {
- $_GPC = I('request.');
- $id = I('request.id');
- if (!empty($id)) {
- $item = M('lionfish_comshop_adv')->where( array('id' => $id) )->find();
- if($item['linktype']==6&&$item['link']) {
- $couponinfo = M('lionfish_comshop_coupon')->field('id, voucher_title')->where('id in( ' . $item['link'] . ' ) ')->select();
- $this->couponinfo = $couponinfo;
- }
- $this->item = $item;
- }
- if (IS_POST) {
- $data = I('request.data');
- if($data['linktype']==6){
- $coupon_id_list = $_GPC['coupon_id'];
- $data['link'] = implode(',', $coupon_id_list);
- }
-
- D('Seller/Adv')->update($data);
- show_json(1, array('url' => $_SERVER['HTTP_REFERER']));
- }
- $this->display();
- }
- public function addcategory()
- {
- $_GPC = I('request.');
- $id = I('request.id');
- if (!empty($id)) {
- $item = M('lionfish_comshop_adv_category')->where( array('id' => $id) )->find();
- if($item['linktype']==6&&$item['link']) {
- $couponinfo = M('lionfish_comshop_coupon')->field('id, voucher_title')->where('id in( ' . $item['link'] . ' ) ')->select();
- $this->couponinfo = $couponinfo;
- }
- $this->item = $item;
- }
- if (IS_POST) {
- $data = I('request.data');
- if($data['linktype']==6){
- $coupon_id_list = $_GPC['coupon_id'];
- $data['link'] = implode(',', $coupon_id_list);
- }
- D('Seller/Adv')->updatecagetory($data);
- show_json(1, array('url' => $_SERVER['HTTP_REFERER']));
- }
- $goods_category_list = M('lionfish_comshop_goods_category')->field('id,name')->where("pid=0 and cate_type='normal' ")->select();
- $this->goods_category_list = $goods_category_list;
- $this->display();
- }
- public function changecategory()
- {
- $id = I('request.id');
- //ids
- if (empty($id)) {
- $ids = I('request.ids');
- $id = ((is_array($ids) ? implode(',', $ids) : 0));
- }
- if (empty($id)) {
- show_json(0, array('message' => '参数错误'));
- }
- $type = I('request.type');
- $value = I('request.value');
- if (!(in_array($type, array('enabled', 'displayorder')))) {
- show_json(0, array('message' => '参数错误'));
- }
- $items = M('lionfish_comshop_adv_category')->where( array('id' => array('in', $id)) )->select();
- foreach ($items as $item) {
- M('lionfish_comshop_adv_category')->where( array('id' => $item['id']) )->save( array($type => $value) );
- }
- show_json(1 , array('url' => $_SERVER['HTTP_REFERER']));
- }
- public function changeslider()
- {
- $id = I('request.id');
- //ids
- if (empty($id)) {
- $ids = I('request.ids');
-
- $id = ((is_array($ids) ? implode(',', $ids) : 0));
- }
- if (empty($id)) {
- show_json(0, array('message' => '参数错误'));
- }
- $type = I('request.type');
- $value = I('request.value');
- if (!(in_array($type, array('enabled', 'displayorder')))) {
- show_json(0, array('message' => '参数错误'));
- }
- $items = M('lionfish_comshop_adv')->where( array('id' => array('in', $id)) )->select();
-
- foreach ($items as $item) {
-
- M('lionfish_comshop_adv')->where( array('id' => $item['id']) )->save( array($type => $value) );
- }
- show_json(1 , array('url' => $_SERVER['HTTP_REFERER']));
- }
- public function delete()
- {
-
- $id = I('request.id');
- //ids
- if (empty($id)) {
- $ids = I('request.ids');
-
- $id = ((is_array($ids) ? implode(',', $ids) : 0));
- }
- if (empty($id)) {
- show_json(0, array('message' => '参数错误'));
- }
-
- $items = M('lionfish_comshop_adv')->where( array('id' => array('in', $id)) )->select();
-
- foreach ($items as $item) {
- M('lionfish_comshop_adv')->where( array('id' => $item['id']) )->delete();
- }
- show_json(1 , array('url' => $_SERVER['HTTP_REFERER']));
- }
- public function deletecategory()
- {
- $id = I('request.id');
- //ids
- if (empty($id)) {
- $ids = I('request.ids');
- $id = ((is_array($ids) ? implode(',', $ids) : 0));
- }
- if (empty($id)) {
- show_json(0, array('message' => '参数错误'));
- }
- $items = M('lionfish_comshop_adv_category')->where( array('id' => array('in', $id)) )->select();
- foreach ($items as $item) {
- M('lionfish_comshop_adv_category')->where( array('id' => $item['id']) )->delete();
- }
- show_json(1 , array('url' => $_SERVER['HTTP_REFERER']));
- }
-
-
- /**
- * 公告管理
- */
- public function notice()
- {
- $pindex = I('request.page',1);
- $psize = 20;
- $keyword = I('request.keyword','','trim');
- $this->keyword = $keyword;
-
- if (!empty($keyword)) {
-
- $condition .= ' and content like "%'.$keyword.'%" ';
- }
- $enabled = I('request.enabled',-1);
-
- if (isset($enabled) && $enabled >= 0) {
-
- $condition .= ' and enabled = ' . $enabled;
- } else {
- $enabled = -1;
- }
- $this->enabled = $enabled;
-
-
-
- $list = M()->query('SELECT id,content,displayorder,enabled FROM ' .
- C('DB_PREFIX')."lionfish_comshop_notice
- WHERE 1=1 " . $condition . ' order by displayorder desc, id desc
- limit ' . (($pindex - 1) * $psize) . ',' . $psize);
-
- $total = M('lionfish_comshop_notice')->where( "1=1 ".$condition )->count();
- $pager = pagination2($total, $pindex, $psize);
-
- $this->list = $list;
- $this->pager = $pager;
- $this->display();
- }
- /**
- * 添加公告
- */
- public function addnotice()
- {
-
- $id = I('request.id');
- if (!empty($id)) {
- $item = M('lionfish_comshop_notice')->where( array('id' => $id) )->find();
- $this->item = $item;
- }
- if (IS_POST) {
- $data = I('request.data');
- D('Seller/Notice')->update($data);
-
- show_json(1, array('url' => $_SERVER['HTTP_REFERER']));
- }
-
- $this->display();
- }
- /**
- * 改变公告状态
- */
- public function changenotice()
- {
-
- $id = I('request.id');
- //ids
- if (empty($id)) {
- $ids = I('request.ids');
- $id = ((is_array($ids) ? implode(',', $ids) : 0));
- }
- if (empty($id)) {
- show_json(0, array('message' => '参数错误'));
- }
- $type = I('request.type');
- $value = I('request.value');
- if (!(in_array($type, array('enabled', 'displayorder')))) {
- show_json(0, array('message' => '参数错误'));
- }
- $items = M('lionfish_comshop_notice')->where( array('id' => array('in', $id)) )->select();
-
- foreach ($items as $item) {
- M('lionfish_comshop_notice')->where( array('id' => $item['id']) )->save( array($type => $value) );
- }
- show_json(1, array('url' => $_SERVER['HTTP_REFERER']));
- }
- /**
- * 删除公告
- */
- public function deletenotice()
- {
-
- $id = I('request.id');
- if (empty($id)) {
- $ids = I('request.ids');
-
- $id = (is_array($ids) ? implode(',', $ids) : 0);
- }
- $items = M('lionfish_comshop_notice')->field('id,content')->where( array('id' => array('in',$id)) )->select();
- if (empty($item)) {
- $item = array();
- }
- foreach ($items as $item) {
- M('lionfish_comshop_notice')->where( array('id' => $item['id']) )->delete();
- }
- show_json(1, array('url' => $_SERVER['HTTP_REFERER']));
- }
-
- public function index()
- {
- if (IS_POST) {
-
- $data = I('request.parameter');
- $param = array();
- if(trim($data['wechat_apiclient_cert_pem'])) $param['wechat_apiclient_cert_pem'] = trim($data['wechat_apiclient_cert_pem']);
- if(trim($data['wechat_apiclient_key_pem'])) $param['wechat_apiclient_key_pem'] = trim($data['wechat_apiclient_key_pem']);
- if(trim($data['wechat_rootca_pem'])) $param['wechat_rootca_pem'] = trim($data['wechat_rootca_pem']);
- if(trim($data['weapp_apiclient_cert_pem'])) $param['weapp_apiclient_cert_pem'] = trim($data['weapp_apiclient_cert_pem']);
- if(trim($data['weapp_apiclient_key_pem'])) $param['weapp_apiclient_key_pem'] = trim($data['weapp_apiclient_key_pem']);
- if(trim($data['weapp_rootca_pem'])) $param['weapp_rootca_pem'] = trim($data['weapp_rootca_pem']);
- if(trim($data['app_apiclient_cert_pem'])) $param['app_apiclient_cert_pem'] = trim($data['app_apiclient_cert_pem']);
- if(trim($data['app_apiclient_key_pem'])) $param['app_apiclient_key_pem'] = trim($data['app_apiclient_key_pem']);
- if(trim($data['app_rootca_pem'])) $param['app_rootca_pem'] = trim($data['app_rootca_pem']);
-
- D('Seller/Config')->update($param);
-
- show_json(1, array('url' => $_SERVER['HTTP_REFERER']));
- }
- $data = D('Seller/Config')->get_all_config();
-
- $this->data = $data;
-
- $this->display();
- }
-
-
-
- public function noticesetting()
- {
-
- if (IS_POST) {
- $data = I('request.parameter');
-
- $data['index_notice_horn_image'] = save_media($data['index_notice_horn_image']);
-
- D('Seller/Config')->update($data);
-
- show_json(1, array('url' => $_SERVER['HTTP_REFERER']));
- }
- $data = D('Seller/Config')->get_all_config();
-
- $this->data = $data;
-
- $this->display();
- }
- public function qgtab()
- {
-
- if (IS_POST) {
- $data = I('request.parameter');
-
- $data['index_qgtab_one_select'] = save_media($data['index_qgtab_one_select']);
- $data['index_qgtab_one_selected'] = save_media($data['index_qgtab_one_selected']);
- $data['index_qgtab_two_select'] = save_media($data['index_qgtab_two_select']);
- $data['index_qgtab_two_selected'] = save_media($data['index_qgtab_two_selected']);
-
-
- D('Seller/Config')->update($data);
-
- show_json(1, array('url' => $_SERVER['HTTP_REFERER']));
- }
- $data = D('Seller/Config')->get_all_config();
-
- $this->data = $data;
- $this->display();
- }
-
-
-
- /**
- * 图片魔方
- */
- public function cube()
- {
- $_GPC = I('request.');
-
-
- $condition = '';
- $pindex = max(1, intval($_GPC['page']));
- $psize = 20;
- if (!empty($_GPC['keyword'])) {
- $_GPC['keyword'] = trim($_GPC['keyword']);
- $condition .= ' and name like "%'.$_GPC['keyword'].'%"';
- }
- if (isset($_GPC['enabled']) && $_GPC['enabled'] >= 0) {
- $_GPC['enabled'] = trim($_GPC['enabled']);
- $condition .= ' and enabled = ' . $_GPC['enabled'];
- } else {
- $_GPC['enabled'] = -1;
- }
- $list = M()->query('SELECT * FROM ' . C('DB_PREFIX'). "lionfish_comshop_cube
- WHERE 1 " . $condition . ' order by displayorder desc, id desc limit ' . (($pindex - 1) * $psize) . ',' . $psize );
-
- $total_arr = M()->query('SELECT count(1) as count FROM ' . C('DB_PREFIX'). 'lionfish_comshop_cube WHERE 1 ' . $condition );
-
- $total = $total_arr['0']['count'];
- $pager = pagination2($total, $pindex, $psize);
-
- $this->list = $list;
- $this->pager = $pager;
-
- $this->_GPC =$_GPC;
-
- $this->display();
- }
- /**
- * 添加魔方图片
- */
- public function addcube()//
- {
- $_GPC = I('request.');
- $id = intval($_GPC['id']);
- if (!empty($id)) {
-
- $item = M('lionfish_comshop_cube')->where( array('id' => $id ) )->find();
- $item['thumb'] = unserialize($item['thumb']);
- $couponinfo = array();
- if($item['thumb'] && $item['thumb']['cover']) {
- $thumb = $item['thumb'];
- $cover = $item['thumb']['cover'];
- foreach ($cover as $k => $vv) {
- if($thumb['linktype'][$k]==6&&$thumb['link'][$k]) {
- $couponinfo[] = M('lionfish_comshop_coupon')->field('id, voucher_title')->where('id in( ' . $thumb['link'][$k] . ' ) ')->select();
- } else {
- $couponinfo[] = '';
- }
- }
- }
- $this->couponinfo = $couponinfo;
- $this->item = $item;
- }
- $category = D('Seller/GoodsCategory')->getFullCategory(false, true);
- $this->category = $category;
- if ( IS_POST ) {
- $data = $_GPC['data'];
- $thumb = $cover = $link = array();
- $cover[] = $data["thumb_0"];
- $cover[] = $data["thumb_1"];
- $cover[] = $data["thumb_2"];
- $cover[] = $data["thumb_3"];
- if($data["linktype_0"]==6) {
- $coupon_id_list_0 = $_GPC['coupon_id_0'];
- $link[] = implode(',', $coupon_id_list_0);
- } else {
- $link[] = $data["link_0"];
- }
- if($data["linktype_1"]==6) {
- $coupon_id_list_1 = $_GPC['coupon_id_1'];
- $link[] = implode(',', $coupon_id_list_1);
- } else {
- $link[] = $data["link_1"];
- }
- if($data["linktype_2"]==6) {
- $coupon_id_list_2 = $_GPC['coupon_id_2'];
- $link[] = implode(',', $coupon_id_list_2);
- } else {
- $link[] = $data["link_2"];
- }
- if($data["linktype_3"]==6) {
- $coupon_id_list_3 = $_GPC['coupon_id_3'];
- $link[] = implode(',', $coupon_id_list_3);
- } else {
- $link[] = $data["link_3"];
- }
- $linktype[] = $data["linktype_0"];
- $linktype[] = $data["linktype_1"];
- $linktype[] = $data["linktype_2"];
- $linktype[] = $data["linktype_3"];
- $webview[] = $data["webview_0"];
- $webview[] = $data["webview_1"];
- $webview[] = $data["webview_2"];
- $webview[] = $data["webview_3"];
- $cateid[] = $data["cateid_0"];
- $cateid[] = $data["cateid_1"];
- $cateid[] = $data["cateid_2"];
- $cateid[] = $data["cateid_3"];
- $appid[] = $data["appid_0"];
- $appid[] = $data["appid_1"];
- $appid[] = $data["appid_2"];
- $appid[] = $data["appid_3"];
- $outlink[] = $data["outlink_0"];
- $outlink[] = $data["outlink_1"];
- $outlink[] = $data["outlink_2"];
- $outlink[] = $data["outlink_3"];
- $num = $data['num'];
- if($num==4){
- $thumb['cover'] = $cover;
- $thumb['link'] = $link;
- $thumb['linktype'] = $linktype;
- $thumb['webview'] = $webview;
- $thumb['cateid'] = $cateid;
- $thumb['appid'] = $appid;
- $thumb['outlink'] = $outlink;
- } else {
- $coverArr = array_chunk($cover, $num);
- $linkArr = array_chunk($link, $num);
- $linktypeArr = array_chunk($linktype, $num);
- $webviewArr = array_chunk($webview, $num);
- $cateidArr = array_chunk($cateid, $num);
- $appidArr = array_chunk($appid, $num);
- $outlinkArr = array_chunk($outlink, $num);
- $thumb['cover'] = $coverArr[0];
- $thumb['link'] = $linkArr[0];
- $thumb['linktype'] = $linktypeArr[0];
- $thumb['webview'] = $webviewArr[0];
- $thumb['cateid'] = $cateidArr[0];
- $thumb['appid'] = $appidArr[0];
- $thumb['outlink'] = $outlinkArr[0];
- }
- $params = array();
- $params['name'] = $data['name'];
-
- $params['displayorder'] = $data['displayorder'];
- $params['enabled'] = $data['enabled'];
- $params['name'] = $data['name'];
- $params['type'] = $data['type'];
- $params['thumb'] = serialize($thumb);
- $params['num'] = $data['num'];
- $params['linktype'] = 1;
- $params['addtime'] = time();
-
-
- if( !empty($id) && $id > 0 )
- {
- unset($params['addtime']);
-
- M('lionfish_comshop_cube')->where( array('id' => $id) )->save( $params );
-
- $id = $data['id'];
- }else{
- $id = M('lionfish_comshop_cube')->add( $params );
- }
- $url2 =U("configindex/cube");
- show_json(1, array('url' => $url2));
- }
-
- $this->display();
- }
-
- /**
- * 切换魔方图显示隐藏 排序
- */
- public function changeCube()
- {
- $_GPC = I('request.');
- $id = intval($_GPC['id']);
- //ids
- if (empty($id)) {
- $id = ((is_array($_GPC['ids']) ? implode(',', $_GPC['ids']) : 0));
- }
- if (empty($id)) {
- show_json(0, array('message' => '参数错误'));
- }
- $type = trim($_GPC['type']);
- $value = trim($_GPC['value']);
- if (!(in_array($type, array('enabled', 'displayorder')))) {
- show_json(0, array('message' => '参数错误'));
- }
-
- $items = M('lionfish_comshop_cube')->field('id')->where( 'id in( ' . $id . ' )' )->select();
-
- foreach ($items as $item) {
- M('lionfish_comshop_cube')->where( array('id' => $item['id']) )->save( array($type => $value) );
- }
- show_json(1, array('url' => $_SERVER['HTTP_REFERER']));
- }
- /**
- * 删除魔方图
- * @return [json] [description]
- */
- public function deleteCube()
- {
- $_GPC = I('request.');
-
- $id = intval($_GPC['id']);
- //ids
- if (empty($id)) {
- $id = ((is_array($_GPC['ids']) ? implode(',', $_GPC['ids']) : 0));
- }
- if (empty($id)) {
- show_json(0, array('message' => '参数错误'));
- }
- $items = M('lionfish_comshop_cube')->field('id')->where( 'id in( ' . $id . ' ) ' )->select();
- foreach ($items as $item) {
- M('lionfish_comshop_cube')->where( array('id' => $item['id'] ) )->delete();
- }
- show_json(1, array('url' => $_SERVER['HTTP_REFERER']));
- }
-
-
- /**
- * 首页视频
- * @return [Json] [description]
- */
- public function video()
- {
- $_GPC = I('request.');
-
- if ( IS_POST ) {
-
- $data = ((is_array($_GPC['parameter']) ? $_GPC['parameter'] : array()));
- $data['index_video_poster'] = save_media($data['index_video_poster']);
- $data['index_video_url'] = save_media($data['index_video_url']);
- $data['index_video_url'] = D('Seller/Goods')->check_douyin_video($data['index_video_url']);
- // var_dump($data['index_video_url']);
- // die();
-
- D('Seller/Config')->update($data);
-
- show_json(1, array('url' => $_SERVER['HTTP_REFERER']));
- }
- $data = D('Seller/Config')->get_all_config();
-
- $this->data = $data;
-
- $this->display();
- }
-
- }
- ?>
|