config.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. class Model8{
  3. public function filterData($post){
  4. $data=array(
  5. 'back_color'=>$post['back_color'],
  6. 'padding_top'=>$post['padding_top'],
  7. 'padding_bottom'=>$post['padding_bottom'],
  8. 'goods_class'=>$post['goods_class'],
  9. 'gc_id'=>isset($post['gc_id'])?$post['gc_id']:array(),
  10. 'gc'=>array_values($post['gc']),
  11. 'adv_center'=>$post['adv_center'],
  12. 'article_title_1'=>$post['article_title_1'],
  13. 'article_title_2'=>$post['article_title_2'],
  14. 'article'=>$post['article'],
  15. 'adv_right'=>$post['adv_right'],
  16. );
  17. return ds_callback(true,'',$data);
  18. }
  19. public function formatData($config){
  20. $config=json_decode($config,true);
  21. $goodsclass_model=model('goodsclass');
  22. $cate_list=array();
  23. if(isset($config['gc_id'])){
  24. $i=0;
  25. foreach($config['gc_id'] as $gc_id => $val){
  26. $temp=$goodsclass_model->getGoodsclassInfoById($gc_id);
  27. if($temp){
  28. $temp['children']=$goodsclass_model->getGoodsclassListByParentId($gc_id);
  29. foreach($temp['children'] as $k => $child){
  30. $temp['children'][$k]['children']=$goodsclass_model->getGoodsclassListByParentId($child['gc_id']);
  31. }
  32. $cate_list[intval($val['sort'])*10+$i]=$temp;
  33. }
  34. $i++;
  35. }
  36. }
  37. ksort($cate_list);
  38. $config['gc_list']=array_values($cate_list);
  39. foreach($config['adv_center'] as $key => $val){
  40. if(!$val['image']){
  41. unset($config['adv_center'][$key]);
  42. }
  43. }
  44. $config['adv_center']=array_values($config['adv_center']);
  45. foreach($config['article'] as $key => $val){
  46. if(!$val['title']){
  47. unset($config['article'][$key]);
  48. }
  49. }
  50. $config['article']=array_values($config['article']);
  51. return ds_callback(true,'',$config);
  52. }
  53. }