|
@@ -61,6 +61,11 @@ class Customer extends Start_Controller {
|
|
{
|
|
{
|
|
$this->_temuexcel();
|
|
$this->_temuexcel();
|
|
}
|
|
}
|
|
|
|
+ else if($arg == 'daifakehuexcel')
|
|
|
|
+ {
|
|
|
|
+ $this->_daifakehuexcel();
|
|
|
|
+ }
|
|
|
|
+
|
|
else if($arg == 'excel')//下载excel
|
|
else if($arg == 'excel')//下载excel
|
|
{
|
|
{
|
|
$this->_excel();
|
|
$this->_excel();
|
|
@@ -1795,6 +1800,7 @@ class Customer extends Start_Controller {
|
|
$ddpost['type'] = 17;
|
|
$ddpost['type'] = 17;
|
|
$this->fullorder->insert($ddpost);
|
|
$this->fullorder->insert($ddpost);
|
|
}
|
|
}
|
|
|
|
+
|
|
if ($this->db->trans_status() === FALSE)
|
|
if ($this->db->trans_status() === FALSE)
|
|
{
|
|
{
|
|
$this->db->trans_commit();
|
|
$this->db->trans_commit();
|
|
@@ -1825,8 +1831,24 @@ class Customer extends Start_Controller {
|
|
}
|
|
}
|
|
|
|
|
|
//代发客户导入
|
|
//代发客户导入
|
|
- public function _dafakehuexcel()
|
|
|
|
|
|
+ public function _daifakehuexcel()
|
|
{
|
|
{
|
|
|
|
+ $shopid = 0;
|
|
|
|
+ $user = $this->user->get_api($_SESSION['api']);
|
|
|
|
+ if($user)
|
|
|
|
+ {
|
|
|
|
+ $users = explode('|',trim($user['shop'],'|'));
|
|
|
|
+ if(count($users) == 1){
|
|
|
|
+ $shopid = $users[0];
|
|
|
|
+ }else{
|
|
|
|
+ echo json_encode(array('msg'=>"此账号不能用于该功能!",'success'=>true));exit;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(empty($shopid)){
|
|
|
|
+ echo json_encode(array('msg'=>"系统无法识别店铺!",'success'=>true));exit;
|
|
|
|
+ }
|
|
|
|
+
|
|
$dir = '/data/excel/'.date('Ymd',time()).'/';
|
|
$dir = '/data/excel/'.date('Ymd',time()).'/';
|
|
$config['upload_path'] = '.'.$dir ;
|
|
$config['upload_path'] = '.'.$dir ;
|
|
$config['file_name'] = date('Ymd_His_',time()).rand(1000,9999);
|
|
$config['file_name'] = date('Ymd_His_',time()).rand(1000,9999);
|
|
@@ -1937,27 +1959,32 @@ class Customer extends Start_Controller {
|
|
$this->db->trans_begin();
|
|
$this->db->trans_begin();
|
|
foreach ($list as $key=>$value)
|
|
foreach ($list as $key=>$value)
|
|
{
|
|
{
|
|
- $addtess = ($value['15']!='--'?$value['15'].' ':'').($value['14']!='--'?$value['14'].' ':'').$value['13'];
|
|
|
|
|
|
+ $addtess = $value[7].$value[6];
|
|
$addtess = str_replace(array('/( | | |\s)/',"'"),array(' ',"’"),$addtess);
|
|
$addtess = str_replace(array('/( | | |\s)/',"'"),array(' ',"’"),$addtess);
|
|
- $repeat = $this->customer->find_all('phone = "'.$value[11].'" and address = "'.($value['15']!='--'?$value['15'].' ':'').($value['14']!='--'?$value['14'].' ':'').$value['13'].'" and shop = 19');//判断电话地址
|
|
|
|
- $sku = $value['8'];
|
|
|
|
- $je = (isset($value['28']))?$value['28']:0;
|
|
|
|
- $value['29'] = str_replace('/','-',$value['29']);
|
|
|
|
- $dtime = strtotime($value['29']);
|
|
|
|
- $post['name'] = ($value['10'] && $value['10'] != 'NULL')?str_replace(array('/( | | |\s)/',"'"),array(' ',"’"),$value['10']):'';
|
|
|
|
- $post['email'] = $value['12'];
|
|
|
|
- if($value['20'] != '')
|
|
|
|
|
|
+ $repeat = $this->customer->find_all('phone = "'.$value[4].'" and address = "'.$addtess.'" and shop = '.$shopid);//判断电话地址
|
|
|
|
+ $sku = $value['2'];
|
|
|
|
+ $je = (isset($value['12']))?$value['12']:0;
|
|
|
|
+ if(!empty($value[13])){
|
|
|
|
+ $value['13'] = str_replace('/','-',$value['13']);
|
|
|
|
+ $dtime = strtotime($value['13']);
|
|
|
|
+ }else{
|
|
|
|
+ $dtime = time();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $post['name'] = (!empty($value[3]))?str_replace(array('/( | | |\s)/',"'"),array(' ',"’"),$value['3']):'';
|
|
|
|
+ $post['email'] = $value['5'];
|
|
|
|
+ if($value['11'] != '')
|
|
{
|
|
{
|
|
- $country = $this->country->get_ename(str_replace(array('/( | | |\s)/',"'"),array(' ',"’"),$value['20']));
|
|
|
|
|
|
+ $country = $this->country->get_ename(str_replace(array('/( | | |\s)/',"'"),array(' ',"’"),$value['11']));
|
|
$post['country'] = $country['id'];
|
|
$post['country'] = $country['id'];
|
|
}
|
|
}
|
|
$post['level'] = 4;
|
|
$post['level'] = 4;
|
|
- $post['phone'] = $value['11']?$value['11']:'';
|
|
|
|
- $post['province'] = $value['18']?$value['18']:'';
|
|
|
|
- $post['city'] = $value['17']?$value['17']:'';
|
|
|
|
|
|
+ $post['phone'] = $value['4']?$value['4']:'';
|
|
|
|
+ $post['province'] = $value['9']?$value['9']:'';
|
|
|
|
+ $post['city'] = $value['8']?$value['8']:'';
|
|
$post['address'] = $addtess;
|
|
$post['address'] = $addtess;
|
|
- $post['zipcode'] = $value['19']?$value['19']:'';
|
|
|
|
- $post['shop'] = 19;
|
|
|
|
|
|
+ $post['zipcode'] = $value['10']?$value['10']:'';
|
|
|
|
+ $post['shop'] = $shopid;
|
|
$post['source'] = 2;
|
|
$post['source'] = 2;
|
|
$post['type'] = 1;
|
|
$post['type'] = 1;
|
|
$post['count'] = '';
|
|
$post['count'] = '';
|
|
@@ -1989,8 +2016,8 @@ class Customer extends Start_Controller {
|
|
}
|
|
}
|
|
$sbsku = trim($sbsku,'-');
|
|
$sbsku = trim($sbsku,'-');
|
|
$time = time();
|
|
$time = time();
|
|
- $shop = $this->shop->read(19);
|
|
|
|
- $ddpost['orderremarks'] = isset($value['30'])?$value['30']:'';
|
|
|
|
|
|
+ $shop = $this->shop->read($shopid);
|
|
|
|
+ $ddpost['orderremarks'] = '';
|
|
$ddpost['shop'] = $shop['id'];//店铺ID
|
|
$ddpost['shop'] = $shop['id'];//店铺ID
|
|
$ddpost['user'] = $shop['shopuser'];//店铺负责人
|
|
$ddpost['user'] = $shop['shopuser'];//店铺负责人
|
|
$orderid = 0;
|
|
$orderid = 0;
|
|
@@ -1998,16 +2025,15 @@ class Customer extends Start_Controller {
|
|
$ddpost['product'] = '';//产品名称
|
|
$ddpost['product'] = '';//产品名称
|
|
$ddpost['link'] = '';//产品链接
|
|
$ddpost['link'] = '';//产品链接
|
|
$ddpost['issku'] = $sku;
|
|
$ddpost['issku'] = $sku;
|
|
- $ddpost['quantity'] = rtrim($value['3'],';');
|
|
|
|
|
|
+ $ddpost['quantity'] = rtrim($value['1'],';');
|
|
$ddpost['clientremarks'] = '';//客户备注
|
|
$ddpost['clientremarks'] = '';//客户备注
|
|
- $ddpost['paypal'] = '';//交易号
|
|
|
|
$ddpost['guarantee'] = '';//卖家保障
|
|
$ddpost['guarantee'] = '';//卖家保障
|
|
$ddpost['parameter'] = '';//属性
|
|
$ddpost['parameter'] = '';//属性
|
|
$ddpost['shippingmethod'] = '';//用户选择快递方式及运费金额
|
|
$ddpost['shippingmethod'] = '';//用户选择快递方式及运费金额
|
|
$ddpost['source'] = 2;//订单类型
|
|
$ddpost['source'] = 2;//订单类型
|
|
$ddpost['type'] = 1;//发货仓库
|
|
$ddpost['type'] = 1;//发货仓库
|
|
$ddpost['capital'] = 3;//资金支付状况,全部付款
|
|
$ddpost['capital'] = 3;//资金支付状况,全部付款
|
|
- $num = $this->fullorder->find_count('gtime = "'.date('Ymd',$dtime).'" and shop = 19');
|
|
|
|
|
|
+ $num = $this->fullorder->find_count('gtime = "'.date('Ymd',$dtime).'" and shop = '.$shopid);
|
|
$ddpost['number'] = $shop['shortname'].'-'.substr(date('ymd',$dtime),1).'-'.(substr(strval($num+1+1000),1,3));//编号
|
|
$ddpost['number'] = $shop['shortname'].'-'.substr(date('ymd',$dtime),1).'-'.(substr(strval($num+1+1000),1,3));//编号
|
|
$ddpost['orderinfo'] = preg_replace('/[^0-9]/', '', $value['0']);//订单号
|
|
$ddpost['orderinfo'] = preg_replace('/[^0-9]/', '', $value['0']);//订单号
|
|
$d = $this->fullorder->get_orderinfo($ddpost['orderinfo']);
|
|
$d = $this->fullorder->get_orderinfo($ddpost['orderinfo']);
|
|
@@ -2016,6 +2042,7 @@ class Customer extends Start_Controller {
|
|
$i++;
|
|
$i++;
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
+ $ddpost['paypal'] = $ddpost['orderinfo'];//交易号
|
|
$ddpost['insurance'] = 0;//运输保险费用
|
|
$ddpost['insurance'] = 0;//运输保险费用
|
|
$ddpost['baddress'] = '';
|
|
$ddpost['baddress'] = '';
|
|
$ddpost['saddress'] = '';
|
|
$ddpost['saddress'] = '';
|
|
@@ -2052,7 +2079,8 @@ class Customer extends Start_Controller {
|
|
$ddpost['whlabel'] = $matching['whlabel'];
|
|
$ddpost['whlabel'] = $matching['whlabel'];
|
|
$ddpost['slpx'] = $matching['wcslpx'];
|
|
$ddpost['slpx'] = $matching['wcslpx'];
|
|
$ddpost['state'] = 207;
|
|
$ddpost['state'] = 207;
|
|
- $ddpost['type'] = 17;
|
|
|
|
|
|
+ $ddpost['type'] = 13;
|
|
|
|
+
|
|
$this->fullorder->insert($ddpost);
|
|
$this->fullorder->insert($ddpost);
|
|
}
|
|
}
|
|
if ($this->db->trans_status() === FALSE)
|
|
if ($this->db->trans_status() === FALSE)
|