|
@@ -59,7 +59,7 @@ class Apipf extends Start_Controller{
|
|
|
}
|
|
|
$hour = date("H");
|
|
|
$minute = date("i");
|
|
|
- $this->db->query("update crowd_customer set more_three = 1 where num >= 5 and more_three = 0");
|
|
|
+ //$this->db->query("update crowd_customer set more_three = 1,is_tb = 0 where num >= 5");
|
|
|
if($hour != 20){
|
|
|
die("Execution conditions hour do not allow");
|
|
|
}
|
|
@@ -81,8 +81,8 @@ class Apipf extends Start_Controller{
|
|
|
if($api != $this->api){
|
|
|
die("No data to be executed");
|
|
|
}
|
|
|
- $list = $this->customer->find_all("more_three = 1","id,shop,source,name,email,phone,money,num,country,province,city,street,address,address2,zipcode",'id asc',0,5);
|
|
|
- //$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);
|
|
|
+ $list = $this->customer->find_all("more_three = 1","id,shop,source,name,email,phone,money,num,country,province,city,street,address,address2,zipcode",'id asc',0,200);
|
|
|
+ //$list = $this->customer->find_all("id = 873132","id,shop,source,name,email,phone,money,num,country,province,city,street,address,address2,zipcode",'id asc',50,5);
|
|
|
if(empty($list)){
|
|
|
die("This is a request without data");
|
|
|
}
|
|
@@ -198,7 +198,6 @@ class Apipf extends Start_Controller{
|
|
|
foreach($this->filter_words as $val){
|
|
|
//判断sku中是否有这种东西
|
|
|
if (strpos(strtolower($item),$val ) !== false) {
|
|
|
-
|
|
|
$flag_jishu = true;
|
|
|
}
|
|
|
|
|
@@ -223,10 +222,16 @@ class Apipf extends Start_Controller{
|
|
|
|
|
|
if(!empty($product_arr[$key])){
|
|
|
$sku_list[] = [
|
|
|
- 'sku'=>$item,
|
|
|
+ 'sku'=>trim($item),
|
|
|
'qty'=>isset($quantity_arr[$key])?$quantity_arr[$key]:1,
|
|
|
'product_name'=>isset($product_arr[$key])?$product_arr[$key]:"",
|
|
|
];
|
|
|
+ }else{
|
|
|
+ $sku_list[] = [
|
|
|
+ 'sku'=>trim($item),
|
|
|
+ 'qty'=>isset($quantity_arr[$key])?$quantity_arr[$key]:"0",
|
|
|
+ 'product_name'=>"",
|
|
|
+ ];
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -236,8 +241,8 @@ class Apipf extends Start_Controller{
|
|
|
$tmp_data = explode("|",$item);
|
|
|
if(!empty($tmp_data[1])){
|
|
|
$goods_list[] = [
|
|
|
- 'goods_name'=>$tmp_data[1],
|
|
|
- 'qty'=>$tmp_data[2]
|
|
|
+ 'goods_name'=>isset($tmp_data[1])?$tmp_data[1]:"",
|
|
|
+ 'qty'=>isset($tmp_data[2])?$tmp_data[2]:""
|
|
|
];
|
|
|
}else{
|
|
|
continue;
|
|
@@ -253,11 +258,13 @@ class Apipf extends Start_Controller{
|
|
|
// var_dump($tmp_qty);
|
|
|
// var_dump("------------------");
|
|
|
//var_dump($jisuan_qty);
|
|
|
+
|
|
|
+
|
|
|
$order_mount = $order_mount +$v['shouldmoney']*1;//订单总金额
|
|
|
$order_num++;//下单次数
|
|
|
- $order_qty = $order_qty + $jisuan_qty;//订单产品总数
|
|
|
- if($jisuan_qty > $max_order_qty ){
|
|
|
- $max_order_qty = $jisuan_qty;
|
|
|
+ $order_qty = $order_qty + $tmp_qty;//订单产品总数
|
|
|
+ if($tmp_qty > $max_order_qty ){
|
|
|
+ $max_order_qty = $tmp_qty;
|
|
|
}
|
|
|
if($type == 1){
|
|
|
$ret_list[] = [
|
|
@@ -299,14 +306,14 @@ class Apipf extends Start_Controller{
|
|
|
|
|
|
$final_list = [];
|
|
|
foreach($ret_list as $k=>$v){
|
|
|
- $orderitems = [];
|
|
|
- foreach($v['sku_list'] as $key1 => $val1){
|
|
|
- $orderitems[] = [
|
|
|
- 'product_name'=>$val1['product_name'],
|
|
|
- 'sku'=>$val1['sku'],
|
|
|
- 'qty'=>$val1['qty'],
|
|
|
- ];
|
|
|
- }
|
|
|
+ // $orderitems = [];
|
|
|
+ // foreach($v['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'],
|
|
@@ -318,13 +325,18 @@ class Apipf extends Start_Controller{
|
|
|
//'erp_goods_name'=>array_column($goods_list,'goods_name'),
|
|
|
//'qty'=>array_column($sku_list,'qty'),
|
|
|
//'price'=>$v['shouldmoney'],
|
|
|
- 'orderitems'=>$orderitems,
|
|
|
+ 'orderitems'=>[
|
|
|
+ 'sku'=>array_column($v['sku_list'],'sku'),
|
|
|
+ 'product_name'=>array_column($v['sku_list'],'product_name'),
|
|
|
+ 'erp_goods_name'=>array_column($v['goods_list'],'goods_name'),
|
|
|
+ 'qty'=>array_column($v['sku_list'],'qty'),
|
|
|
+ ],
|
|
|
];
|
|
|
}
|
|
|
|
|
|
|
|
|
return [
|
|
|
- 'order_mount'=>$order_mount,
|
|
|
+ 'order_mount'=>sprintf("%.2f",$order_mount) ,
|
|
|
'order_num'=>$order_num,
|
|
|
'order_qty'=>$order_qty,
|
|
|
'max_order_qty'=>$max_order_qty,
|
|
@@ -503,28 +515,28 @@ class Apipf extends Start_Controller{
|
|
|
|
|
|
public function _tjOrder(){
|
|
|
echo "<pre>";
|
|
|
- var_dump(date("Y-m-d H:i:s"));
|
|
|
- $save_list = [];
|
|
|
- $list = $this->fullorder->find_all(" shop in (1,2,3,4,5,6) and source != 1 and state in (207,216) ","*",'id asc',900000,300000);
|
|
|
- foreach($list as $k=>$v){
|
|
|
- if(empty($v['fpdata'])){
|
|
|
- continue;
|
|
|
- }
|
|
|
- $r = $this->judgeCon($v);
|
|
|
- if($r){
|
|
|
- $save_list[] = [
|
|
|
- 'number'=>$v['number'],
|
|
|
- 'qty'=>$v['quantity'],
|
|
|
- 'sku'=>$v['issku']
|
|
|
- ];
|
|
|
- }
|
|
|
- }
|
|
|
- var_dump(date("Y-m-d H:i:s"));
|
|
|
- var_dump(count($save_list));
|
|
|
- foreach($save_list as $vv){
|
|
|
- $this->zzrecord_logs->insert($vv);
|
|
|
- usleep(50);
|
|
|
- }
|
|
|
+ // var_dump(date("Y-m-d H:i:s"));
|
|
|
+ // $save_list = [];
|
|
|
+ // $list = $this->fullorder->find_all(" shop in (1,2,3,4,5,6) and source != 1 and state in (207,216) ","*",'id asc',900000,300000);
|
|
|
+ // foreach($list as $k=>$v){
|
|
|
+ // if(empty($v['fpdata'])){
|
|
|
+ // continue;
|
|
|
+ // }
|
|
|
+ // $r = $this->judgeCon($v);
|
|
|
+ // if($r){
|
|
|
+ // $save_list[] = [
|
|
|
+ // 'number'=>$v['number'],
|
|
|
+ // 'qty'=>$v['quantity'],
|
|
|
+ // 'sku'=>$v['issku']
|
|
|
+ // ];
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // var_dump(date("Y-m-d H:i:s"));
|
|
|
+ // var_dump(count($save_list));
|
|
|
+ // foreach($save_list as $vv){
|
|
|
+ // $this->zzrecord_logs->insert($vv);
|
|
|
+ // usleep(50);
|
|
|
+ // }
|
|
|
die("over");
|
|
|
|
|
|
// $list = $this->fullorder->find_all(" number = 'ALIP-00211-089' ","*",'id asc',0,300000);
|
|
@@ -534,20 +546,22 @@ class Apipf extends Start_Controller{
|
|
|
|
|
|
public function _ddAllTb(){
|
|
|
echo "<pre>";
|
|
|
- $list = $this->zzrecord_logs->find_all(" 1 = 1",'*','id asc',0,60);
|
|
|
-
|
|
|
+ $list = $this->zzrecord_logs->find_all(" 1 = 1",'*','id asc',0,50);
|
|
|
+
|
|
|
$customer_list = [];
|
|
|
+ $customer_ids = [];
|
|
|
foreach($list as $k=>$v){
|
|
|
$info = $this->fullorder->get_number($v['number']);
|
|
|
if(!empty($info)){
|
|
|
$customer = $this->customer->get_email($info['email'],$info['shop']);
|
|
|
if(!empty($customer)){
|
|
|
$customer_list[] = $customer;
|
|
|
+ $customer_ids[] = $customer['id'];
|
|
|
}
|
|
|
}
|
|
|
- $this->zzrecord_logs->remove($v['id']);
|
|
|
+ $this->zzrecord_logs->remove($v['id']);
|
|
|
}
|
|
|
- // var_dump($info['number']);
|
|
|
+ var_dump(json_encode($customer_ids));
|
|
|
|
|
|
$send_list = [];
|
|
|
foreach($customer_list as $k=>$v){
|
|
@@ -571,14 +585,14 @@ class Apipf extends Start_Controller{
|
|
|
'orders'=>$orderinfo['orders'],
|
|
|
];
|
|
|
}
|
|
|
- var_dump($send_list);
|
|
|
+ //var_dump($send_list);
|
|
|
if(empty($send_list)){
|
|
|
return ;
|
|
|
}
|
|
|
$url = $this->url;
|
|
|
$header = [];
|
|
|
$res = $this->sendHttp($url,$header,['data'=>$send_list]);
|
|
|
- var_dump($res);
|
|
|
+ var_dump($res);
|
|
|
|
|
|
|
|
|
|