|
@@ -38,14 +38,18 @@ class Apipf extends Start_Controller{
|
|
|
elseif($arg == 'customer_all_data')
|
|
|
{
|
|
|
$this->_customerAllTbData();
|
|
|
+ }elseif($arg == 'day_update_c'){
|
|
|
+ $this->_dayUpdateCustomer();
|
|
|
+ }elseif($arg == 'day_u'){
|
|
|
+ $this->_dayUpdate();
|
|
|
}
|
|
|
- elseif($arg == 'tjorder')
|
|
|
- {
|
|
|
- $this->_tjOrder();
|
|
|
- }
|
|
|
- elseif($arg == 'dd_all_tb'){
|
|
|
- $this->_ddAllTb();
|
|
|
- }
|
|
|
+ // elseif($arg == 'tjorder')
|
|
|
+ // {
|
|
|
+ // $this->_tjOrder();
|
|
|
+ // }
|
|
|
+ // elseif($arg == 'dd_all_tb'){
|
|
|
+ // $this->_ddAllTb();
|
|
|
+ // }
|
|
|
else
|
|
|
{
|
|
|
exit('No direct script access allowed');
|
|
@@ -64,7 +68,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 >= 5 and more_three = 0");
|
|
|
+ $this->db->query("update crowd_customer set more_three = 1 where num >= 5 and more_three = 0 and shop in (1,2,3,4,5,6)");
|
|
|
die("No executable data available");
|
|
|
}else{
|
|
|
die("Execution conditions minute do not allow !");
|
|
@@ -81,7 +85,7 @@ 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,200);
|
|
|
+ $list = $this->customer->find_all("more_three = 1 and shop in (1,2,3,4,5,6) ","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");
|
|
@@ -166,6 +170,106 @@ class Apipf extends Start_Controller{
|
|
|
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 更新满足5的且已经同步过后的,新的订单
|
|
|
+ */
|
|
|
+ public function _dayUpdateCustomer(){
|
|
|
+ echo "<pre>";
|
|
|
+
|
|
|
+ $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 and shop in (1,2,3,4,5,6)","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");
|
|
|
+ }
|
|
|
+
|
|
|
+ $send_list = [];
|
|
|
+ foreach($list as $k=>$v){
|
|
|
+ $orderinfo = $this->getOrderList($v['email'],$v['shop'],2);
|
|
|
+ if(count($orderinfo['orders']) > 4){
|
|
|
+ $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'],
|
|
|
+ ];
|
|
|
+ }else{
|
|
|
+ $this->customer->save([
|
|
|
+ 'more_three'=>3,
|
|
|
+ 'is_tb'=>1,
|
|
|
+ ],$v['id']);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if(empty($send_list)){
|
|
|
+ die("There is no customer data to be synchronized");
|
|
|
+ }
|
|
|
+
|
|
|
+ //var_dump($send_list);
|
|
|
+ $data = [];
|
|
|
+ $customer_ids = [];
|
|
|
+ foreach($send_list as $item){
|
|
|
+ if(empty($item['orders']) || empty($item['email'])){
|
|
|
+ //直接同步更新了吧 都满足条件了 结果还没订单 就先不查询了 等有新的订单在判断一遍
|
|
|
+ $this->customer->save([
|
|
|
+ 'more_three'=>3,
|
|
|
+ 'is_tb'=>1,
|
|
|
+ ],$item['customer_id']);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if($item['brand'] == 'other'){
|
|
|
+ $this->customer->save([
|
|
|
+ 'more_three'=>3,
|
|
|
+ 'is_tb'=>1,
|
|
|
+ ],$item['customer_id']);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ $data[] = $item;
|
|
|
+ $customer_ids[] = $item['customer_id'];
|
|
|
+ }
|
|
|
+
|
|
|
+ var_dump(json_encode($customer_ids));
|
|
|
+ // var_dump($data);
|
|
|
+ // die;
|
|
|
+ if(empty($data)){
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+
|
|
|
+ var_dump(json_encode($data,JSON_UNESCAPED_UNICODE));
|
|
|
+ $url = $this->url;
|
|
|
+ $header = [];
|
|
|
+ $res = $this->sendHttp($url,$header,['data'=>$data]);
|
|
|
+ var_dump($res);
|
|
|
+
|
|
|
+ if($res['status']){
|
|
|
+ foreach($customer_ids as $k=>$v){
|
|
|
+ $this->customer->save([
|
|
|
+ 'more_three'=>3,
|
|
|
+ 'is_tb'=>1,
|
|
|
+ ],$v);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* $email 邮箱
|
|
@@ -368,21 +472,25 @@ class Apipf extends Start_Controller{
|
|
|
return $res;
|
|
|
}
|
|
|
//每日更新一回
|
|
|
- public function dayUpdate(){
|
|
|
+ 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 = [];
|
|
|
+ $customer_ids = [];
|
|
|
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;
|
|
|
+ $customer_ids[] = $v['id'];
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if(empty($list)){
|
|
|
+ var_dump(json_encode($customer_ids));
|
|
|
+ if(empty($customer_list)){
|
|
|
die("There is no data that meets the requirements today");
|
|
|
}
|
|
|
//需要执行的list
|
|
@@ -409,6 +517,15 @@ class Apipf extends Start_Controller{
|
|
|
'orders'=>$orderinfo['orders'],
|
|
|
];
|
|
|
}
|
|
|
+ if(empty($send_list)){
|
|
|
+ die("There is no queue to execute");
|
|
|
+ }
|
|
|
+ var_dump(json_encode($send_list,JSON_UNESCAPED_UNICODE));
|
|
|
+ $url = $this->url;
|
|
|
+ $header = [];
|
|
|
+ $res = $this->sendHttp($url,$header,['data'=>$send_list]);
|
|
|
+ var_dump($res);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
//判断条件
|
|
@@ -514,6 +631,7 @@ class Apipf extends Start_Controller{
|
|
|
|
|
|
|
|
|
public function _tjOrder(){
|
|
|
+ die;
|
|
|
echo "<pre>";
|
|
|
// var_dump(date("Y-m-d H:i:s"));
|
|
|
// $save_list = [];
|
|
@@ -545,6 +663,7 @@ class Apipf extends Start_Controller{
|
|
|
}
|
|
|
|
|
|
public function _ddAllTb(){
|
|
|
+ die;
|
|
|
echo "<pre>";
|
|
|
$list = $this->zzrecord_logs->find_all(" 1 = 1",'*','id asc',0,50);
|
|
|
|