|
@@ -11,6 +11,7 @@ class Apipf extends Start_Controller{
|
|
|
$this->load->_model("Model_logic_ding",'logic_ding');
|
|
|
$this->load->_model('Model_customer','customer');
|
|
|
$this->load->_model('Model_typeclass','typeclass');
|
|
|
+ $this->load->_model("Model_zzrecord_logs","zzrecord_logs");
|
|
|
|
|
|
}
|
|
|
private $url = "http://wholesale.hnwmzp.cn/syncerp/customer";
|
|
@@ -38,9 +39,9 @@ class Apipf extends Start_Controller{
|
|
|
{
|
|
|
$this->_customerAllTbData();
|
|
|
}
|
|
|
- elseif($arg == 'customer_depart_data')
|
|
|
+ elseif($arg == 'tjorder')
|
|
|
{
|
|
|
- $this->_customerDepartTbData();
|
|
|
+ $this->_tjOrder();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -59,7 +60,7 @@ class Apipf extends Start_Controller{
|
|
|
die("Execution conditions hour do not allow");
|
|
|
}
|
|
|
if(($minute >= 10)&&($minute <=40)){
|
|
|
- $this->db->query("update crowd_customer set more_three = 1 where num >= 3 and more_three = 0");
|
|
|
+ $this->db->query("update crowd_customer set more_three = 1 where num >= 5 and more_three = 0");
|
|
|
die("No executable data available");
|
|
|
}else{
|
|
|
die("Execution conditions minute do not allow !");
|
|
@@ -93,6 +94,7 @@ class Apipf extends Start_Controller{
|
|
|
'ordered_mount'=>$orderinfo['order_mount'],
|
|
|
'ordered_num'=>$orderinfo['order_num'],
|
|
|
'ordered_qty'=>$orderinfo['order_qty'],
|
|
|
+ 'max_ordered_qty'=>$orderinfo['max_order_qty'],
|
|
|
'brand'=>isset($this->shop_list[$v['shop']])?$this->shop_list[$v['shop']]:"other",
|
|
|
// 'country'=>$v['country'],
|
|
|
// 'province'=>$v['province'],
|
|
@@ -152,84 +154,7 @@ class Apipf extends Start_Controller{
|
|
|
|
|
|
}
|
|
|
}
|
|
|
- //同步已经同步过的订单客户近期订单
|
|
|
- public function _customerDepartTbData(){
|
|
|
- $api = $this->input->get('api',true);
|
|
|
- if($api != $this->api){
|
|
|
- die("No data to be executed");
|
|
|
- }
|
|
|
- $list = $this->customer->find_all("more_three = 3 and is_tb = 0","id,shop,source,name,email,phone,money,num,country,province,city,street,address,address2,zipcode",'id asc',0,100);
|
|
|
- //$list = $this->customer->find_all("id = 71015","id,shop,source,name,email,phone,money,num,country,province,city,street,address,address2,zipcode",'id asc',0,100);
|
|
|
- if(empty($list)){
|
|
|
- die("This is a request without data");
|
|
|
- }
|
|
|
-
|
|
|
- $send_list = [];
|
|
|
- foreach($list as $k=>$v){
|
|
|
- $orderinfo = $this->getOrderList($v['email'],$v['shop'],2);
|
|
|
- $send_list[] = [
|
|
|
- 'customer_id'=>$v['id'],
|
|
|
- 'name'=>$v['name'],
|
|
|
- 'email'=>$v['email'],
|
|
|
- 'telephone'=>$v['phone'],
|
|
|
- 'ordered_mount'=>$orderinfo['order_mount'],
|
|
|
- 'ordered_num'=>$orderinfo['order_num'],
|
|
|
- 'ordered_qty'=>$orderinfo['order_qty'],
|
|
|
- 'brand'=>isset($this->shop_list[$v['shop']])?$this->shop_list[$v['shop']]:"other",
|
|
|
- // 'country'=>$v['country'],
|
|
|
- // 'province'=>$v['province'],
|
|
|
- // 'city'=>$v['city'],
|
|
|
- // 'street'=>$v['street'],
|
|
|
- // 'address'=>$v['address'].$v['address2'],
|
|
|
- // 'zipcode'=>$v['zipcode']
|
|
|
- 'orders'=>$orderinfo['orders'],
|
|
|
- ];
|
|
|
- }
|
|
|
-
|
|
|
- if(empty($send_list)){
|
|
|
- die("There is no customer data to be synchronized");
|
|
|
- }
|
|
|
- $header = [];
|
|
|
- $url = $this->url;
|
|
|
-
|
|
|
- //var_dump($send_list);
|
|
|
- $data = [];
|
|
|
- $customer_ids = [];
|
|
|
- foreach($send_list as $item){
|
|
|
- if(empty($item['orders']) || empty($item['email'])){
|
|
|
- //直接同步更新了吧 都满足条件了 结果还没订单 就先不查询了 等有新的订单在判断一遍
|
|
|
- $this->customer->save([
|
|
|
- 'is_tb'=>1,
|
|
|
- ],$item['customer_id']);
|
|
|
- continue;
|
|
|
- }
|
|
|
- if($item['brand'] == 'other'){
|
|
|
- $this->customer->save([
|
|
|
- 'is_tb'=>1,
|
|
|
- ],$item['customer_id']);
|
|
|
- continue;
|
|
|
- }
|
|
|
- $data[] = $item;
|
|
|
- $customer_ids[] = $item['customer_id'];
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
- var_dump(json_encode($customer_ids));
|
|
|
- var_dump($data);
|
|
|
- if(empty($data)){
|
|
|
- return ;
|
|
|
- }
|
|
|
- $res = $this->sendHttp($url,$header,['data'=>$data]);
|
|
|
- var_dump($res);
|
|
|
- if($res['status']){
|
|
|
- foreach($customer_ids as $k=>$v){
|
|
|
- $this->customer->save([
|
|
|
- 'is_tb'=>1,
|
|
|
- ],$v);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
/**
|
|
|
* $email 邮箱
|
|
|
* $shop 店铺id
|
|
@@ -244,6 +169,7 @@ class Apipf extends Start_Controller{
|
|
|
$order_mount = 0;//订单总金额
|
|
|
$order_num = 0;//下单次数
|
|
|
$order_qty = 0;//订单产品总数
|
|
|
+ $max_order_qty = 0;
|
|
|
foreach ($fdata as $k=>$v)
|
|
|
{
|
|
|
//var_dump($v);
|
|
@@ -304,9 +230,9 @@ class Apipf extends Start_Controller{
|
|
|
}
|
|
|
|
|
|
//如果产品种类少于2种 且产品数量也小于2 直接排除
|
|
|
- if(($tmp_type <2) && ($tmp_qty < 2)){
|
|
|
- continue;
|
|
|
- }
|
|
|
+ // if(($tmp_type <2) && ($tmp_qty < 2)){
|
|
|
+ // continue;
|
|
|
+ // }
|
|
|
// var_dump($v['orderinfo']);
|
|
|
// var_dump($tmp_type);
|
|
|
// var_dump($tmp_qty);
|
|
@@ -314,162 +240,12 @@ class Apipf extends Start_Controller{
|
|
|
$order_mount = $order_mount +$v['shouldmoney']*1;//订单总金额
|
|
|
$order_num++;//下单次数
|
|
|
$order_qty = $order_qty + $jisuan_qty;//订单产品总数
|
|
|
-
|
|
|
- if($type == 1){
|
|
|
- $ret_list[] = [
|
|
|
- 'shop'=>$v['shop'],
|
|
|
- 'orderinfo'=>$v['orderinfo'],
|
|
|
- 'sku_list'=>$sku_list,
|
|
|
- 'goods_list'=>$goods_list,
|
|
|
- 'state'=>isset($typeclass[$v['state']])?$typeclass[$v['state']]['spare']:"",
|
|
|
- 'dtime'=>date('Y-m-d',$v['dtime']),
|
|
|
- 'name'=>$v['name'],
|
|
|
- 'email'=>$v['email'],
|
|
|
- 'shouldmoney'=>$v['shouldmoney'],
|
|
|
- 'shipremarks'=>$v['shipremarks']
|
|
|
- ];
|
|
|
- }else{
|
|
|
- $end_time = strtotime(date("Y-m-d"));
|
|
|
- $start_time = $end_time - 24* 60 *60;
|
|
|
- //这里只按照出库时间算
|
|
|
- if(($v['dtime'] >= $start_time)&&($v['dtime'] < $end_time)){
|
|
|
- $ret_list[] = [
|
|
|
- 'shop'=>$v['shop'],
|
|
|
- 'orderinfo'=>$v['orderinfo'],
|
|
|
- 'sku_list'=>$sku_list,
|
|
|
- 'goods_list'=>$goods_list,
|
|
|
- 'state'=>isset($typeclass[$v['state']])?$typeclass[$v['state']]['spare']:"",
|
|
|
- 'dtime'=>date('Y-m-d',$v['dtime']),
|
|
|
- 'name'=>$v['name'],
|
|
|
- 'email'=>$v['email'],
|
|
|
- 'shouldmoney'=>$v['shouldmoney'],
|
|
|
- 'shipremarks'=>$v['shipremarks']
|
|
|
- ];
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- $final_list = [];
|
|
|
- foreach($ret_list as $k=>$v){
|
|
|
- $orderitems = [];
|
|
|
- foreach($sku_list as $key1 => $val1){
|
|
|
- $orderitems[] = [
|
|
|
- 'product_name'=>$val1['product_name'],
|
|
|
- 'sku'=>$val1['sku'],
|
|
|
- 'qty'=>$val1['qty'],
|
|
|
- ];
|
|
|
- }
|
|
|
- $final_list[] = [
|
|
|
- 'shop'=>$v['shop'],
|
|
|
- 'increment_id'=>$v['orderinfo'],
|
|
|
- 'status'=>empty($v['state'])?"Complete":$v['state'],
|
|
|
- 'grand_total'=>$v['shouldmoney'],
|
|
|
- 'order_created'=>$v['dtime'],
|
|
|
- //'product_name'=>array_column($sku_list,'product_name'),
|
|
|
- //'sku'=>array_column($sku_list,'sku'),
|
|
|
- //'erp_goods_name'=>array_column($goods_list,'goods_name'),
|
|
|
- //'qty'=>array_column($sku_list,'qty'),
|
|
|
- //'price'=>$v['shouldmoney'],
|
|
|
- 'orderitems'=>$orderitems,
|
|
|
- ];
|
|
|
- }
|
|
|
- return [
|
|
|
- 'order_mount'=>$order_mount,
|
|
|
- 'order_num'=>$order_num,
|
|
|
- 'order_qty'=>$order_qty,
|
|
|
- 'orders'=>$final_list,
|
|
|
- ];
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * $email 邮箱
|
|
|
- * $shop 店铺id
|
|
|
- * $type 1 获取全部订单列表 2 只获取昨天新增的订单列表 一般在凌晨1点执行
|
|
|
- */
|
|
|
- //要求订单必须为线下单,并且为processing或complete
|
|
|
- private function getOrderListTest($email,$shop,$type = 2){
|
|
|
- echo "<pre>";
|
|
|
- //var_dump('email = "'.$email.'" and shop = "'.$shop.'" and source != 1 and state in (207,216) ');
|
|
|
- $fdata = $this->fullorder->find_all('email = "'.$email.'" and shop = "'.$shop.'" and source != 1 and state in (207,216) ','shop,orderinfo,issku,quantity,fpdata,state,product,name,email,dtime,shouldmoney,shipremarks,librarytime,source','id desc');
|
|
|
- var_dump($fdata);
|
|
|
- $ret_list = [];
|
|
|
- $order_mount = 0;//订单总金额
|
|
|
- $order_num = 0;//下单次数
|
|
|
- $order_qty = 0;//订单产品总数
|
|
|
- foreach ($fdata as $k=>$v)
|
|
|
- {
|
|
|
- //var_dump($v);
|
|
|
- $sku_list = [];
|
|
|
- $issku_arr = explode(",",trim($v['issku'],','));
|
|
|
- $quantity_arr = explode(";",trim($v['quantity'],";"));
|
|
|
- $product_arr = explode(",",trim($v['product'],";"));
|
|
|
- $tmp_type = 0;
|
|
|
- $tmp_qty = 0;
|
|
|
- $jisuan_qty = 0;//需要更新的产品的总数量上
|
|
|
- //货物的种类按照订单的原始sku种类 数量也是
|
|
|
- foreach($issku_arr as $key => $item){
|
|
|
- $flag_jishu = false;
|
|
|
- foreach($this->filter_words as $val){
|
|
|
- //判断sku中是否有这种东西
|
|
|
- if (strpos(strtolower($item),$val ) !== false) {
|
|
|
-
|
|
|
- $flag_jishu = true;
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- //var_dump($flag_jishu);
|
|
|
- if(!$flag_jishu){
|
|
|
- $tmp_type++;
|
|
|
- if(isset($quantity_arr[$key])){
|
|
|
- $tmp_qty = $quantity_arr[$key] + $tmp_qty;
|
|
|
- }else{
|
|
|
- $tmp_qty = $tmp_qty + 1;
|
|
|
- }
|
|
|
- }
|
|
|
- if(isset($quantity_arr[$key])){
|
|
|
- $jisuan_qty = $quantity_arr[$key]*1 + $jisuan_qty;
|
|
|
- }else{
|
|
|
- $jisuan_qty = $jisuan_qty + 1;
|
|
|
- }
|
|
|
-
|
|
|
- if(!empty($product_arr[$key])){
|
|
|
- $sku_list[] = [
|
|
|
- 'sku'=>$item,
|
|
|
- 'qty'=>isset($quantity_arr[$key])?$quantity_arr[$key]:1,
|
|
|
- 'product_name'=>isset($product_arr[$key])?$product_arr[$key]:"",
|
|
|
- ];
|
|
|
- }
|
|
|
-
|
|
|
+ if($jisuan_qty > $max_order_qty ){
|
|
|
+ $max_order_qty = $jisuan_qty;
|
|
|
}
|
|
|
- $goods_list = [];
|
|
|
- $fpdata_arr = explode(";",trim($v['fpdata'],";"));
|
|
|
- foreach($fpdata_arr as $key => $item){
|
|
|
- $tmp_data = explode("|",$item);
|
|
|
- if(!empty($tmp_data[1])){
|
|
|
- $goods_list[] = [
|
|
|
- 'goods_name'=>$tmp_data[1],
|
|
|
- 'qty'=>$tmp_data[2]
|
|
|
- ];
|
|
|
- }else{
|
|
|
- continue;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //如果产品种类少于2种 且产品数量也小于2 直接排除
|
|
|
- if(($tmp_type <2) && ($tmp_qty < 2)){
|
|
|
- continue;
|
|
|
- }
|
|
|
- // var_dump($v['orderinfo']);
|
|
|
- // var_dump($tmp_type);
|
|
|
- // var_dump($tmp_qty);
|
|
|
- // var_dump("------------------");
|
|
|
- $order_mount = $order_mount +$v['shouldmoney']*1;//订单总金额
|
|
|
- $order_num++;//下单次数
|
|
|
- $order_qty = $order_qty + $jisuan_qty;//订单产品总数
|
|
|
-
|
|
|
if($type == 1){
|
|
|
$ret_list[] = [
|
|
|
+ 'order_qty'=>$jisuan_qty,
|
|
|
'shop'=>$v['shop'],
|
|
|
'orderinfo'=>$v['orderinfo'],
|
|
|
'sku_list'=>$sku_list,
|
|
@@ -482,12 +258,12 @@ class Apipf extends Start_Controller{
|
|
|
'shipremarks'=>$v['shipremarks']
|
|
|
];
|
|
|
}else{
|
|
|
-
|
|
|
$end_time = strtotime(date("Y-m-d"));
|
|
|
$start_time = $end_time - 24* 60 *60;
|
|
|
//这里只按照出库时间算
|
|
|
if(($v['dtime'] >= $start_time)&&($v['dtime'] < $end_time)){
|
|
|
$ret_list[] = [
|
|
|
+ 'order_qty'=>$jisuan_qty,
|
|
|
'shop'=>$v['shop'],
|
|
|
'orderinfo'=>$v['orderinfo'],
|
|
|
'sku_list'=>$sku_list,
|
|
@@ -528,121 +304,19 @@ class Apipf extends Start_Controller{
|
|
|
'orderitems'=>$orderitems,
|
|
|
];
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
return [
|
|
|
'order_mount'=>$order_mount,
|
|
|
'order_num'=>$order_num,
|
|
|
'order_qty'=>$order_qty,
|
|
|
+ 'max_order_qty'=>$max_order_qty,
|
|
|
'orders'=>$final_list,
|
|
|
];
|
|
|
}
|
|
|
- public function _orderTbAllData(){
|
|
|
- $typeclass = $this->typeclass->find_all("classid = 29","id,classtitle,title,spare");
|
|
|
- $typeclass = array_column($typeclass,null,'id');
|
|
|
-
|
|
|
- $list = $this->customer->find_all("more_three = 2","id,shop,name,email",'id asc',0,100);
|
|
|
-
|
|
|
- foreach($list as $k=>$v){
|
|
|
- $order_list = $this->getOrder($v,$typeclass);
|
|
|
- if(empty($order_list)){
|
|
|
- continue;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- private function getOrder($v,$typeclass){
|
|
|
- $fdata = $this->fullorder->find_all('email = "'.$customer['email'].'" and shop = "'.$customer['shop'].'" and mergeid = 0 and reviewtime <= ','shop,orderinfo,issku,quantity,fpdata,state,product,name,email,dtime,shouldmoney,shipremarks','id desc');
|
|
|
- $ret_list = [];
|
|
|
- foreach ($fdata as $k=>$v)
|
|
|
- {
|
|
|
- $sku_list = [];
|
|
|
- $issku_arr = explode(",",trim($v['issku'],','));
|
|
|
- $quantity_arr = explode(";",trim($v['quantity'],";"));
|
|
|
- $product_arr = explode(",",trim($v['product'],";"));
|
|
|
- foreach($issku_arr as $key => $item){
|
|
|
- $sku_list[] = [
|
|
|
- 'sku'=>$item,
|
|
|
- 'qty'=>isset($quantity_arr[$key])?$quantity_arr[$key]:1,
|
|
|
- 'product_name'=>isset($product_arr[$key])?$product_arr[$key]:"",
|
|
|
- ];
|
|
|
- }
|
|
|
- $goods_list = [];
|
|
|
- $fpdata_arr = explode(";",trim($v['fpdata'],";"));
|
|
|
- if(!empty($tmp_data[1])){
|
|
|
- foreach($fpdata_arr as $key => $item){
|
|
|
- $tmp_data = explode("|",$item);
|
|
|
- $goods_list[] = [
|
|
|
- 'goods_name'=>$tmp_data[1],
|
|
|
- 'qty'=>$tmp_data[2]
|
|
|
- ];
|
|
|
- }
|
|
|
- }else{
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- $ret_list[] = [
|
|
|
- 'shop'=>$v['shop'],
|
|
|
- 'orderinfo'=>$v['orderinfo'],
|
|
|
- 'sku_list'=>$sku_list,
|
|
|
- 'goods_list'=>$goods_list,
|
|
|
- 'state'=>isset($typeclass[$v['state']])?$typeclass[$v['state']]['spare']:"",
|
|
|
- 'dtime'=>date('Y-m-d',$v['dtime']),
|
|
|
- 'name'=>$v['name'],
|
|
|
- 'email'=>$v['email'],
|
|
|
- 'shouldmoney'=>$v['shouldmoney'],
|
|
|
- 'shipremarks'=>$v['shipremarks']
|
|
|
- ];
|
|
|
- }
|
|
|
- return $fdata;
|
|
|
- }
|
|
|
- public function _orderTbData(){
|
|
|
- $fdata = $this->fullorder->find_all('id = 1228433','shop,orderinfo,issku,quantity,fpdata,state,product,name,email,dtime,shouldmoney,shipremarks','id desc');
|
|
|
- $ret_list = [];
|
|
|
- echo "<pre>";
|
|
|
- foreach ($fdata as $k=>$v)
|
|
|
- {
|
|
|
- var_dump($v);
|
|
|
- $sku_list = [];
|
|
|
- $issku_arr = explode(",",trim($v['issku'],','));
|
|
|
- $quantity_arr = explode(";",trim($v['quantity'],";"));
|
|
|
- $product_arr = explode(",",trim($v['product'],";"));
|
|
|
- foreach($issku_arr as $key => $item){
|
|
|
- $sku_list[] = [
|
|
|
- 'sku'=>$item,
|
|
|
- 'qty'=>isset($quantity_arr[$key])?$quantity_arr[$key]:1,
|
|
|
- 'product_name'=>isset($product_arr[$key])?$product_arr[$key]:"",
|
|
|
- ];
|
|
|
- }
|
|
|
- $goods_list = [];
|
|
|
- $fpdata_arr = explode(";",trim($v['fpdata'],";"));
|
|
|
- if(!empty($tmp_data[1])){
|
|
|
- foreach($fpdata_arr as $key => $item){
|
|
|
- $tmp_data = explode("|",$item);
|
|
|
- $goods_list[] = [
|
|
|
- 'goods_name'=>$tmp_data[1],
|
|
|
- 'qty'=>$tmp_data[2]
|
|
|
- ];
|
|
|
- }
|
|
|
- }else{
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- $ret_list[] = [
|
|
|
- 'shop'=>$v['shop'],
|
|
|
- 'orderinfo'=>$v['orderinfo'],
|
|
|
- 'sku_list'=>$sku_list,
|
|
|
- 'goods_list'=>$goods_list,
|
|
|
- 'state'=>isset($typeclass[$v['state']])?$typeclass[$v['state']]['spare']:"",
|
|
|
- 'dtime'=>date('Y-m-d',$v['dtime']),
|
|
|
- 'name'=>$v['name'],
|
|
|
- 'email'=>$v['email'],
|
|
|
- 'shouldmoney'=>$v['shouldmoney'],
|
|
|
- 'shipremarks'=>$v['shipremarks']
|
|
|
- ];
|
|
|
- }
|
|
|
- echo "<pre>";
|
|
|
- var_dump($ret_list);
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
private function sendHttp($url,$header,$list){
|
|
|
$header = [
|
|
@@ -664,7 +338,116 @@ class Apipf extends Start_Controller{
|
|
|
|
|
|
return $res;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+ //每日更新一回
|
|
|
+ public function dayUpdate(){
|
|
|
+ $end_time = strtotime(date("Y-m-d"));
|
|
|
+ $start_time = $end_time - 24* 60 *60;
|
|
|
+ $list = $this->fullorder->fina_all("dtime >= ".$start_time." and dtime < ".$end_time." and shop in (1,2,3,4,5,6) and source != 1 and state in (207,216) " );
|
|
|
+ $customer_list = [];
|
|
|
+ foreach($list as $k=>$v){
|
|
|
+ $r = $this->judgeCon($v);
|
|
|
+ if($r){
|
|
|
+ $customer = $this->customer->get_email($v['shop'],$v['email']);
|
|
|
+ if(!empty($customer)){
|
|
|
+ $customer_list[] = $customer;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(empty($list)){
|
|
|
+ die("There is no data that meets the requirements today");
|
|
|
+ }
|
|
|
+ //需要执行的list
|
|
|
+ //查找用户信息 获取用户的订单列表 然后同步
|
|
|
+ $send_list = [];
|
|
|
+ foreach($customer_list as $k=>$v){
|
|
|
+ $orderinfo = $this->getOrderList($v['email'],$v['shop'],2);
|
|
|
+ $send_list[] = [
|
|
|
+ 'customer_id'=>$v['id'],
|
|
|
+ 'name'=>$v['name'],
|
|
|
+ 'email'=>$v['email'],
|
|
|
+ 'telephone'=>$v['phone'],
|
|
|
+ 'ordered_mount'=>$orderinfo['order_mount'],
|
|
|
+ 'ordered_num'=>$orderinfo['order_num'],
|
|
|
+ 'ordered_qty'=>$orderinfo['order_qty'],
|
|
|
+ 'max_ordered_qty'=>$orderinfo['max_order_qty'],
|
|
|
+ 'brand'=>isset($this->shop_list[$v['shop']])?$this->shop_list[$v['shop']]:"other",
|
|
|
+ // 'country'=>$v['country'],
|
|
|
+ // 'province'=>$v['province'],
|
|
|
+ // 'city'=>$v['city'],
|
|
|
+ // 'street'=>$v['street'],
|
|
|
+ // 'address'=>$v['address'].$v['address2'],
|
|
|
+ // 'zipcode'=>$v['zipcode']
|
|
|
+ 'orders'=>$orderinfo['orders'],
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //判断条件
|
|
|
+ private function judgeCon($info){
|
|
|
+ $tmp_q = 0;
|
|
|
+ $extra_price = empty($info['extra_price'])?[]:json_decode($info['extra_price'],true);
|
|
|
+ //如果有价格 说明系统已经可以按照单价进行处理了
|
|
|
+ if(empty($extra_price)){
|
|
|
+ $info['issku'] = strtolower($info['issku']);
|
|
|
+ if(stripos($info['issku'],',') !== false){
|
|
|
+ $issku = explode(",",$info['issku']);
|
|
|
+ }else{
|
|
|
+ $issku = [$info['issku']];
|
|
|
+ }
|
|
|
+ if(stripos($info['quantity'],';') !== false){
|
|
|
+ $quantity = explode(";",$info['quantity']);
|
|
|
+ }else{
|
|
|
+ $quantity = [$info['quantity']];
|
|
|
+ }
|
|
|
+ foreach($issku as $index=>$item){
|
|
|
+ if(stripos($info['issku'],'gift') === false){
|
|
|
+
|
|
|
+ }else{
|
|
|
+
|
|
|
+ if(isset($quantity[$index])){
|
|
|
+ $tmp_q += $quantity[$index];
|
|
|
+ }else{
|
|
|
+ $tmp_q += 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }else{
|
|
|
+ foreach($extra_price as $k=>$v){
|
|
|
+ if(isset($v['row_total'])){
|
|
|
+ //这里不考虑礼物类是因为礼物 本身就是0 无需考虑
|
|
|
+ if($v['row_total'] >= 50){
|
|
|
+ if(isset($v['qty'])){
|
|
|
+ $tmp_q += $v['qty'];
|
|
|
+ }else{
|
|
|
+ $tmp_q += 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //大于等于4
|
|
|
+ if($tmp_q >= 4){
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public function _tjOrder(){
|
|
|
+ $list = $this->fullorder->find_all(" shop in (1,2,3,4,5,6) ","*",'id asc',0,300000);
|
|
|
+ foreach($list as $k=>$v){
|
|
|
+ $r = $this->judgeCon($v);
|
|
|
+ if($r){
|
|
|
+ $this->zzrecord_logs->insert([
|
|
|
+ 'number'=>$v['number']
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ die("over");
|
|
|
+ }
|
|
|
|
|
|
}
|