123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- <?php
- /**
- * lionfish 商城系统
- *
- * ==========================================================================
- * @link http://www.liofis.com/
- * @copyright Copyright (c) 2015 liofis.com.
- * @license http://www.liofis.com/license.html License
- * ==========================================================================
- *
- * @author fish
- *
- */
- namespace Seller\Model;
- class AdvModel{
-
-
- public function update($data,$type='slider')
- {
-
- $ins_data = array();
- $ins_data['advname'] = $data['advname'];
- $ins_data['thumb'] = save_media($data['thumb']);
- $ins_data['link'] = $data['link'];
- $ins_data['displayorder'] = $data['displayorder'];
- $ins_data['enabled'] = $data['enabled'];
- $ins_data['addtime'] = time();
- $ins_data['type'] = $type;
- $ins_data['linktype'] = $data['linktype'];
- $ins_data['appid'] = $data['appid'];
-
- $id = $data['id'];
- if( !empty($id) && $id > 0 )
- {
- unset($ins_data['addtime']);
-
- M('lionfish_comshop_adv')->where( array('id' => $id) )->save( $ins_data );
-
- $id = $data['id'];
-
- }else{
- $id = M('lionfish_comshop_adv')->add( $ins_data );
- }
-
-
- }
- public function updatecagetory($data,$type='slider')
- {
- $ins_data = array();
- $ins_data['advname'] = $data['advname'];
- $ins_data['thumb'] = save_media($data['thumb']);
- $ins_data['link'] = $data['link'];
- $ins_data['cate_id'] = $data['cate_id'];
- $ins_data['displayorder'] = $data['displayorder'];
- $ins_data['enabled'] = $data['enabled'];
- $ins_data['addtime'] = time();
- $ins_data['type'] = $type;
- $ins_data['linktype'] = $data['linktype'];
- $ins_data['appid'] = $data['appid'];
- $id = $data['id'];
- if( !empty($id) && $id > 0 )
- {
- //show_json(1, array('url' => $_SERVER['HTTP_REFERER']));
- $check_res = M('lionfish_comshop_adv_category')->where("cate_id=".$data['cate_id']." and id != {$id} ")->find();
- if( !empty($check_res) )
- {
- show_json(0, array('message' => '该分类下已经存在广告' ));
- }
- unset($ins_data['addtime']);
- M('lionfish_comshop_adv_category')->where( array('id' => $id) )->save( $ins_data );
- $id = $data['id'];
- }else{
- $check_res = M('lionfish_comshop_adv_category')->where("cate_id=".$data['cate_id']." ")->find();
- if( !empty($check_res) )
- {
- show_json(0, array('message' => '该分类下已经存在广告' ));
- }
- $id = M('lionfish_comshop_adv_category')->add( $ins_data );
- }
- }
-
-
- // 导航图标更新
- public function navigat_update($data)
- {
-
- $ins_data = array();
- $ins_data['navname'] = $data['navname'];
- $ins_data['appid'] = $data['appid'];
- $ins_data['thumb'] = save_media($data['thumb']);
- $ins_data['link'] = $data['link'];
- $ins_data['displayorder'] = $data['displayorder'];
- $ins_data['enabled'] = $data['enabled'];
- $ins_data['addtime'] = time();
- $ins_data['type'] = $data['type'];
-
- $id = $data['id'];
- if( !empty($id) && $id > 0 )
- {
- unset($ins_data['addtime']);
- M('lionfish_comshop_navigat')->where( array('id' => $id) )->save( $ins_data );
-
- $id = $data['id'];
- }else{
- $id = M('lionfish_comshop_navigat')->add( $ins_data );
- }
-
-
- }
-
-
- }
- ?>
|