array(array('neq', '/Uploads'), array('neq', ''), array('exp', 'IS NOT NULL'), 'AND'), 'shopimg_id' => 0 ); $list = $this->getSelect($map, 'id,shopimg,shopimg_id,merchantid'); if ($list) { $arr = array(); foreach ($list as $value) { $save['shopimg_id'] = $this->addImage($value['shopimg'], $value['merchantid']); $this->updateOrder(array('id' => $value['id']), $save); $arr[] = $save; } } } protected function addImage($path, $merchant_id) { $time = time(); $menu = explode('/', $path); $catalog = $menu; $catalog = array_splice($catalog, $menu[count($menu) - 1], 1); $item = array( 'merchant_id' => $merchant_id, 'path' => $path, 'add_time' => $time, //varchar(20) DEFAULT NULL, 'storage_type' => 1, //tinyint(1) DEFAULT '1', 'source_type' => 1, //tinyint(1) DEFAULT '1', 'name' => $menu[count($menu) - 1], //varchar(100) DEFAULT '', 'original_name' => $menu[count($menu) - 1], //varchar(255) DEFAULT '', 'size' => 0, //varchar(20) DEFAULT '', 'from_name' => '设置门头照', //varchar(50) DEFAULT NULL, 'from_type_id' => 18, //tinyint(3) DEFAULT '0', 'user_type' => 3, //tinyint(1) DEFAULT '0' 'catalog' => implode('/', $catalog), //varchar(255) DEFAULT NULL, ); $id = M('image_gallery')->add($item); return $id; } /** * 获取当前门店的配置数据 * @param $param * merchantid * @return mixed */ public function getStoreListToCredit($where, $field, $desc, $page, $limit) { $list = $this->alias('s') ->join('ls_store_config as sc on sc.store_id = s.id', 'LEFT') ->field($field) ->where($where) ->order($desc) ->page($page, $limit) ->select(); $total = $this->alias('s') ->join('ls_store_config as sc on sc.store_id = s.id', 'LEFT') ->where($where) ->count(); $result['list'] = $list; $result['total'] = $total; return $result; } }