|
@@ -16,7 +16,7 @@ class Apipf extends Start_Controller{
|
|
|
private $key = "bpng!pjgirv6amnfr"; //加密所需要到的key
|
|
|
private $iv = "k4k!94m66oojtm2w";//加密所需要到的iv
|
|
|
private $api = "202503121009@ly";
|
|
|
- private $filter_words = ['bonus','flashsale','clearance','giftpack'];
|
|
|
+ private $filter_words = ['bonus','flashsale','clearance','giftpack','gift'];
|
|
|
|
|
|
//定义方法的调用规则 获取URI第二段值
|
|
|
public function _remap($arg,$arg_array)
|
|
@@ -65,11 +65,16 @@ class Apipf extends Start_Controller{
|
|
|
* 上传没有给批发站没有传递的客户信息
|
|
|
*/
|
|
|
public function _customerAllTbData(){
|
|
|
+ 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 = 1","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);
|
|
|
+
|
|
|
|
|
|
$send_list = [];
|
|
|
foreach($list as $k=>$v){
|
|
@@ -97,7 +102,18 @@ class Apipf extends Start_Controller{
|
|
|
}
|
|
|
$header = [];
|
|
|
$url = "";
|
|
|
+
|
|
|
+ var_dump($send_list);
|
|
|
+ die;
|
|
|
foreach($send_list as $item){
|
|
|
+ if(empty($item['orders'])){
|
|
|
+ //直接同步更新了吧 都满足条件了 结果还没订单 就先不查询了 等有新的订单在判断一遍
|
|
|
+ $this->customer->save([
|
|
|
+ 'more_three'=>3,
|
|
|
+ 'is_tb'=>1,
|
|
|
+ ],$item['customer_id']);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
// $res = $this->sendHttp($url,$header,$item);
|
|
|
// if($res){
|
|
|
// $this->customer->save([
|
|
@@ -120,13 +136,16 @@ class Apipf extends Start_Controller{
|
|
|
*/
|
|
|
//要求订单必须为线下单,并且为processing或complete
|
|
|
public function getOrderList($email,$shop,$type = 2){
|
|
|
- $fdata = $this->fullorder->find_all('email = "'.$email.'" and shop = "'.$shop.'" and source in (2,3) and state in (207,216) ','shop,orderinfo,issku,quantity,fpdata,state,product,name,email,dtime,shouldmoney,shipremarks,librarytime','id desc');
|
|
|
+ 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'],";"));
|
|
@@ -136,18 +155,23 @@ class Apipf extends Start_Controller{
|
|
|
$jisuan_qty = 0;//需要更新的产品的总数量上
|
|
|
//货物的种类按照订单的原始sku种类 数量也是
|
|
|
foreach($issku_arr as $key => $item){
|
|
|
- foreach($this->filter_words as $v){
|
|
|
+ $flag_jishu = false;
|
|
|
+ foreach($this->filter_words as $val){
|
|
|
//判断sku中是否有这种东西
|
|
|
- if (strpos(strtolower($item),$v ) === false) {
|
|
|
- $tmp_type++;
|
|
|
- if(isset($quantity_arr[$key])){
|
|
|
- $tmp_qty = $quantity_arr[$key] + $tmp_qty;
|
|
|
- }else{
|
|
|
- $tmp_qty = $tmp_qty + 1;
|
|
|
- }
|
|
|
+ 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{
|
|
@@ -162,22 +186,26 @@ class Apipf extends Start_Controller{
|
|
|
}
|
|
|
$goods_list = [];
|
|
|
$fpdata_arr = explode(";",trim($v['fpdata'],";"));
|
|
|
- if(!empty($tmp_data[1])){
|
|
|
- foreach($fpdata_arr as $key => $item){
|
|
|
-
|
|
|
- $tmp_data = explode("|",$item);
|
|
|
+ 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;
|
|
|
}
|
|
|
- }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;//订单产品总数
|