123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- <?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;
- use Think\Model;
- class SolitaireModel {
-
- public function updatedo($data, $uniacid = 0,$addtype=0, $appstate =1)
- {
-
-
- $id = $data['data']['id'];
-
-
- $ins_data = array();
- $ins_data['uniacid'] = 0;
-
- $ins_data['head_id'] = $data['head_dan_id'];
- $ins_data['solitaire_name'] = $data['data']['solitaire_name'];
- $ins_data['images_list'] = serialize( $data['images_list'] );
- $ins_data['addtype'] = $addtype;
- $ins_data['appstate'] = $appstate;
- $ins_data['state'] = $data['data']['state'] ;
- $ins_data['begin_time'] = strtotime( $data['time']['start']);
- $ins_data['end_time'] = strtotime($data['time']['end']);
- $ins_data['content'] = htmlspecialchars( $data['data']['content'] );
-
- $ins_data['addtime'] = time();
-
-
- if( !empty($id) && $id > 0 )
- {
- unset($ins_data['addtime']);
-
- M('lionfish_comshop_solitaire')->where( array('id' => $id ))->save( $ins_data );
-
- //shagnp shuju
- $limit_goods_str = $data['goods_list'];
-
- $limit_goods_list = explode(',', $limit_goods_str );
-
- if( !empty($limit_goods_list) )
- {
-
- M('lionfish_comshop_solitaire_goods')->where( 'id not in (' . $limit_goods_str.') and soli_id = '.$id )->delete();
-
- foreach( $limit_goods_list as $goods_id )
- {
- //新增 goods_ids
- $cai_data = array();
- $cai_data['uniacid'] = $_W['uniacid'];
- $cai_data['soli_id'] = $id;
-
- $cai_data['goods_id'] = $goods_id;
- $cai_data['addtime'] = time();
-
- $insid = M('lionfish_comshop_solitaire_goods')->add( $cai_data );
-
- }
- }
- }else{
- foreach( $data['head_id_list'] as $head_dan_id )
- {
- $ins_data['head_id'] = $head_dan_id;
-
- $id = M('lionfish_comshop_solitaire')->add( $ins_data );
-
- //判断商品是否存在,先删除一次不存在的, limit_goods_list
- $limit_goods_str = $data['goods_list'];
-
- $limit_goods_list = explode(',', $limit_goods_str );
-
- if( !empty($limit_goods_list) )
- {
-
- foreach( $limit_goods_list as $goods_id )
- {
- //新增 goods_ids
- $cai_data = array();
- $cai_data['uniacid'] = 0;
- $cai_data['soli_id'] = $id;
-
- $cai_data['goods_id'] = $goods_id;
- $cai_data['addtime'] = time();
-
- $insid = M('lionfish_comshop_solitaire_goods')->add( $cai_data );
-
- }
- }
- }
-
- }
- }
-
- }
- ?>
|