1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- /**
- * 播播资源
- *
- * ==========================================================================
- * @link https://www.ttbobo.com/
- * @copyright Copyright (c) 2015 liofis.com.
- * @license https://www.ttbobo.com/license.html License
- * ==========================================================================
- *
- * @author fish
- *
- */
- namespace Seller\Model;
- class SpecModel{
-
-
- public function update($data,$spec_type = 'normal')
- {
-
- $ins_data = array();
- $ins_data['name'] = $data['name'];
- $ins_data['spec_type'] = $spec_type;
- $ins_data['value'] = serialize(array_filter($data['value']));
- $ins_data['addtime'] = time();
-
- $id = $data['id'];
- if( !empty($id) && $id > 0 )
- {
- M('lionfish_comshop_spec')->where( array('id' => $id) )->save($ins_data);
- $id = $data['id'];
-
- }else{
-
- M('lionfish_comshop_spec')->add($ins_data);
- $id = M('lionfish_comshop_spec')->getLastInsID();
- }
-
- }
-
- public function get_all_spec($spec_type = 'normal')
- {
-
- $specs = M('lionfish_comshop_spec')->where(' spec_type="'.$spec_type.'"')->order('id asc')->select();
-
- foreach($specs as $key => $val)
- {
- $val['value'] = unserialize($val['value']);
- if( !empty($val['value']) )
- {
- $val['value_str'] = implode('@', $val['value']);
- }else{
- $val['value_str'] = '';
- }
-
- $specs[$key] = $val;
- }
-
- return $specs;
- }
-
-
- }
- ?>
|