| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346 | <?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');class Common {var $ci;function __construct(){$this->ci = &get_instance();	}    /*分类*/    function _typeclass($classid,$en=3,$num=900,$order=NULL)    {	$this->ci->load->_model('Model_typeclass','typeclass');    $where = "classid = '$classid'";	if($en == '2')	{		$where .= " and spare != '0' and spare != '' and spare != 'null'";	}	if($en == '1')	{		$where .= " and ae != ''";	}    $result = $this->ci->typeclass->find_all($where,'*',$order,0,$num);    return $result;	}	/*分类2 这个是按照要求部分花型不显示出来*/	function _typeclassyc($classid,$num=900,$order=NULL)    {	$this->ci->load->_model('Model_typeclass','typeclass');    $where = "classid = '$classid'";	$where .= " and id != 105 and id != 107 and id != 112 and id != 114 and id != 115 and id != 116 and id != 117 and id != 118 and id != 119 and id != 120 and id != 121 and id != 122 and id != 123 and id != 124 and id != 125 and id != 292 and id != 63 and id != 289 and id != 290 and id != 181 and id != 273 and id != 148 and id != 38 and id != 291 and id != 55 and id != 271 and id != 285 and id != 186 and id != 187 and id != 188 and id != 189 and id != 53 and id != 67";    $result = $this->ci->typeclass->find_all($where,'*',$order,0,$num);    return $result;	}	/*店铺*/    function _shop($type,$num=900,$order=NULL)    {	$this->ci->load->_model('Model_shop','shop');    $where = '1=1';	if($type)	{	    $where .= " and type = '$type'";	}    $result = $this->ci->shop->find_all($where,'*',$order,0,$num);    return $result;	}	/*USER店铺*/    function _usershop($num=100,$order=NULL)    {	$this->ci->load->_model('Model_shop','shop');    $user = $this->ci->user->get_api($_SESSION['api']);	$usersp = explode('|',trim($user['shop'],'|'));$sid = '';	// foreach ($usersp as $v) 	// {	// 	$sid .= " id = ".$v." or";	// }    // $result = $this->ci->shop->find_all(rtrim($sid,'or'),'*',$order,0,$num);	$where = " status = 0 ";		$where .= " and id in  (".implode(",",$usersp).") ";	    $result = $this->ci->shop->find_all($where,'*',$order,0,$num);    return $result;	}	/*仓库*/    function _warehouse($classid,$num=100,$order='px asc')    {	$this->ci->load->_model('Model_warehouse','warehouse');	$this->ci->load->_model('Model_user','user');	$this->ci->load->library('session');	$user = $this->ci->user->get_api($_SESSION['api']);	$where = "id != 2 and id != 14 and id != 11 and id != 15 and id != 10 and id != 1 and id != 4";    $result = $this->ci->warehouse->find_all($where,'*',$order,0,$num);    return $result;	}	/*独立站仓库*/    function _dlzwarehouse($classid,$num=100,$order='px asc')    {	$this->ci->load->_model('Model_warehouse','warehouse');    $where = "id != 2 and id != 7 and id != 8 and id != 9 and id != 14 and id != 11 and id != 15 and id != 10 and id != 1 and id != 4";    $result = $this->ci->warehouse->find_all($where,'*',$order,0,$num);    return $result;	}	/*快递*/    function _express($num=100,$ae,$order=NULL)    {	$this->ci->load->_model('Model_express','express');    $where = "off != '1'";	if($ae == 'smt')	{		$where .= " and aecode != 'Others'";	}    $result = $this->ci->express->find_all($where,'*',$order,0,$num);    return $result;	}	/*翔文快递*/    function _xwexpress($num=100,$order=NULL)    {	$this->ci->load->_model('Model_express','express');    $where = "off != '1' and servicename like '%翔文%'"; //and ((id > 42 and id < 50) or id = 55 or id = 61 or id = 65)";    $result = $this->ci->express->find_all($where,'*',$order,0,$num);    return $result;	}	/*供应商*/    function _purchase($classid,$num=100,$order=NULL)    {	$this->ci->load->_model('Model_purchase','purchase');    $where = "1 = 1";    $result = $this->ci->purchase->find_all($where,'*',$order,0,$num);    return $result;	}	/*国家*/	function _country($num=500,$order=NULL)    {	$this->ci->load->_model('Model_country','country');    $where = "1 = 1";    $result = $this->ci->country->find_all($where,'*',$order,0,$num);    return $result;	}	/*海关申报*/	function _customsdeclaration($num=500,$order=NULL)    {	$this->ci->load->_model('Model_customsdeclaration','customsdeclaration');    $where = "1 = 1";    $result = $this->ci->customsdeclaration->find_all($where,'*',$order,0,$num);    return $result;	}	/*仓库产品位置*/	function _whlabelwz($num=100,$order=NULL)    {	$this->ci->load->_model('Model_whlabelwz','whlabelwz');    $where = "1 = 1";    $result = $this->ci->whlabelwz->find_all($where,'*',$order,0,$num);    return $result;	}	/*IOSS*/	function _ioss($num=500,$order=NULL)    {	$this->ci->load->_model('Model_ioss','ioss');    $where = "1 = 1";    $result = $this->ci->ioss->find_all($where,'*',$order,0,$num);    return $result;	}	/*email*/	function _email($num=500,$shop,$order=NULL)    {	$this->ci->load->_model('Model_email','email');    $where = "1 = 1";	if($shop)	{		$where .= "shop = '$shop'";	}    $result = $this->ci->email->find_all($where,'*',$order,0,$num);    return $result;	}	/*品牌*/    function _brand($num=100,$order=NULL)    {	$this->ci->load->_model('Model_brand','brand');    $where = "1 = 1";    $result = $this->ci->brand->find_all($where,'*',$order,0,$num);    return $result;	}	/*备货类型*/    function _whlabel_type($num=100,$order=NULL)    {	$this->ci->load->_model('Modelwhlabel_type','whlabel_type');    $where = "1 = 1";    $result = $this->ci->whlabel_type->find_all($where,'*',$order,0,$num);    return $result;	}	/*公司名称*/    function _whlabel_company($num=100,$order=NULL)    {	$this->ci->load->_model('Model_company','company');    $where = "1 = 1";    $result = $this->ci->company->find_all($where,'*',$order,0,$num);    return $result;	}}/*通用类对象*/function get_common(){	return new Common();}/*分类*/function typeclass($classid,$en=3,$num=900,$order='sequence asc'){	$com = &get_common();	return $com->_typeclass($classid,$en,$num,$order);}/*分类2 这个是按照要求部分花型不显示出来*/function typeclassyc($classid,$num=900,$order='sequence asc'){	$com = &get_common();	return $com->_typeclassyc($classid,$num,$order);}/*店铺*/function shop($type=269,$num=900,$order='id asc'){	$com = &get_common();	return $com->_shop($type,$num,$order);}/*USER店铺*/function usershop($num=100,$order='px asc'){	$com = &get_common();	return $com->_usershop($num,$order);}/*仓库*/function warehouse($num=900,$order='id asc'){	$com = &get_common();	return $com->_warehouse($num,$order);}/*独立站仓库*/function dlzwarehouse($num=20,$order='id asc'){	$com = &get_common();	return $com->_warehouse($num,$order);}/*快递*/function express($num=20,$ae=1,$order='idsort desc'){	$com = &get_common();	return $com->_express($num,$ae,$order);}/*翔文快递*/function xwexpress($num=20,$order='idsort desc'){	$com = &get_common();	return $com->_xwexpress($num,$order);}/*供应商*/function purchase($num=20,$order='id asc'){	$com = &get_common();	return $com->_purchase($num,$order);}/*国家*/function country($num=500,$order='name asc'){	$com = &get_common();	return $com->_country($num,$order);}/*海关申报*/function customsdeclaration($num=500,$order='px asc'){	$com = &get_common();	return $com->_customsdeclaration($num,$order);}/*仓库产品位置*/function whlabelwz($num=100,$order='id asc'){	$com = &get_common();	return $com->_whlabelwz($num,$order);}/*IOSS*/function ioss($num=500,$order='id asc'){	$com = &get_common();	return $com->_ioss($num,$order);}/*email*/function email($num=500,$shop='',$order='id asc'){	$com = &get_common();	return $com->_email($num,$shop,$order);}/*品牌*/function brand($num=500,$order='id asc'){	$com = &get_common();	return $com->_brand($num,$order);}/*备货类型*/function whlabel_type($num=500,$order='id asc'){	$com = &get_common();	return $com->_whlabel_type($num,$order);}/*公司*/function company($num=500,$order='id asc'){	$com = &get_common();	return $com->_whlabel_company($num,$order);}/*载入编辑器*/function load_editor($id='content',$top = '0px',$height='300px',$content='<p><br></p>'){	/**return '<script type="text/plain" id="'.$id.'" style="width:'.$width.';height:'.$height.';">'.$content.'</script><script charset="utf-8" src="'.base_url().'/style/NEWUM/umeditor.config.js"></script><script charset="utf-8" src="'.base_url().'/style/NEWUM/umeditor.min.js"></script><script charset="utf-8" src="'.base_url().'/style/NEWUM/lang/zh-cn/zh-cn.js"></script><script>var um = UM.getEditor("'.$id.'"); </script>'**/$content = str_replace("'","'",$content);return "<div style='margin-top:$top;'><div id='tool-".$id."' style='border-bottom: 1px solid #ccc;'></div>    <div id='".$id."' style='min-height:$height;'></div>	</div><textarea name='Editorcontent' class='none'>$content</textarea><link href='/style/Editor/Editor.css' rel='stylesheet' type='text/css' /><script charset='utf-8' src='/style/Editor/Editor.js'></script><script>const { createEditor, createToolbar } = window.wangEditorconst editorConfig = {    placeholder: '输入内容...',    onChange(editor) {      const html = editor.getHtml()	  $('textarea[name=$id]').val(html);      console.log('editor content', html)    },	MENU_CONF: {}}editorConfig.MENU_CONF['uploadImage'] = {      server: '/img/textimg',	   fieldName: 'upfile',      timeout: 10 * 1000, // 5s      maxFileSize: 10 * 1024 * 1024, // 10M    }const editor = createEditor({    selector: '#".$id."',    html: $('textarea[name=Editorcontent]').val(),    config: editorConfig,    mode: 'default', // or 'simple'})const toolbarConfig = { excludeKeys: [         'blockquote',//引用		 'code',//行内代码		 'sup',//上标		 'sub',//下标         'bulletedList',//序号        'numberedList',//序号		'uploadVideo',//上传视频		'codeBlock',		'insertTable',//表格		'divider',//分割线		'undo',//撤销		'redo',//重做		'fullScreen',//全屏      ]}const toolbar = createToolbar({    editor,    selector: '#tool-".$id."',    config: toolbarConfig,    mode: 'default', // or 'simple'})$('#w-e-textarea-1').css('min-height','$height');</script>";;}function p($arr){    echo "<pre>";print_r($arr);echo "<pre>";    exit;}/* End of file Common.php *//* Location: ./app/libraries/Common.php */
 |