1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?php
- /**
- * lionfish 商城系统
- *
- * ==========================================================================
- * @link http://www.liofis.com/
- * @copyright Copyright (c) 2015 liofis.com.
- * @license http://www.liofis.com/license.html License
- * ==========================================================================
- *
- * @author J_da
- *
- */
- namespace Seller\Model;
- class DiydataModel{
-
- public function update($data)
- {
- $sql = 'TRUNCATE '. C('DB_PREFIX'). 'lionfish_comshop_diydata';
- $rs = M()->execute($sql);
- // $rs = M('lionfish_comshop_diydata')->where( 'id > 0' )->delete();
- foreach($data as $key => $value)
- {
- $name = $value->controller;
- $value = json_encode($value);
- $ins_data = array();
- $ins_data['name'] = $name;
- $ins_data['value'] = serialize($value);
- M('lionfish_comshop_diydata')->add($ins_data);
- }
- $this->get_all_config(true);
- }
-
- public function get_all_config($is_parse = false)
- {
- // $data = S('_get_all_diy_data');
- $data = array();
- if (empty($data) || $is_parse) {
- $all_list = M('lionfish_comshop_diydata')->select();
- if (empty($all_list)) {
- $data = array();
- }else{
- $data = array();
- foreach($all_list as $val)
- {
- $data[] = json_decode(unserialize($val['value']));
- }
- }
-
- S('_get_all_diy_data', $data);
- }
- return $data;
- }
-
- }
- ?>
|