123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727 |
- <?php
- defined('BASEPATH') OR exit('No direct script access allowed');
- /**
- * 本类是为了处理 erp协同其他系统,通过其他系统传递的条件 返回所需信息
- */
- class Apipf extends Start_Controller{
- public function __construct(){
- parent::__construct();
- $this->load->_model('Model_logic_order','logic_order');
- $this->load->_model('Model_logic_tools','logic_tools');
- $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";
- private $key = "bpng!pjgirv6amnfr"; //加密所需要到的key
- private $iv = "k4k!94m66oojtm2w";//加密所需要到的iv
- private $api = "202503121009@ly";
- private $filter_words = ['bonus','flashsale','clearance','gift','payment difference','pack','freewig','zerocostitem','qqsfcw','22inchwig','asfreerobe'];
- private $shop_list = [
- 1=>'h',
- 2=>'as',
- 3=>'ap',
- 4=>"wk",
- 5=>"y",
- 6=>"wg",
- ];
- //定义方法的调用规则 获取URI第二段值
- public function _remap($arg,$arg_array)
- {
- if($arg == 'checkMoreThree')//添加
- {
- $this->_checkMoreThree();
- }
- 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();
- // }
- else
- {
- exit('No direct script access allowed');
- }
- }
- //检测客户是否超过3次且为传输
- public function _checkMoreThree(){
- $api = $this->input->get('api',true);
- if($api != $this->api){
- die("No data to be executed");
- }
- $hour = date("H");
- $minute = date("i");
- //$this->db->query("update crowd_customer set more_three = 1,is_tb = 0 where num >= 5");
- if($hour !=19){
- die("Execution conditions hour do not allow");
- }
- if(($minute >= 0)&&($minute <=20)){
- $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 !");
- }
-
- }
- /***
- * 上传没有给批发站没有传递的客户信息
- */
- 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 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'],1);
- 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");
- }
- $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([
- '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 ;
- }
- $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);
- }
-
- }
- }
- /**
- * 更新满足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 邮箱
- * $shop 店铺id
- * $type 1 获取全部订单列表 2 只获取昨天新增的订单列表 一般在凌晨1点执行
- */
- //要求订单必须为线下单,并且为processing或complete
- private function getOrderList($email,$shop,$type = 2){
- //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,shopify','id desc');
- //var_dump($fdata);
- $ret_list = [];
- $order_mount = 0;//订单总金额
- $order_num = 0;//下单次数
- $order_qty = 0;//订单产品总数
- $max_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])){
- if(is_numeric($quantity_arr[$key])){
- $tmp_qty = $quantity_arr[$key]*1 + $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'=>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'=>"",
- ];
- }
-
- }
- $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'=>isset($tmp_data[1])?$tmp_data[1]:"",
- 'qty'=>isset($tmp_data[2])?$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("------------------");
- //var_dump($jisuan_qty);
-
-
- $order_mount = $order_mount +$v['shouldmoney']*1;//订单总金额
- $order_num++;//下单次数
- $order_qty = $order_qty + $tmp_qty;//订单产品总数
- if($tmp_qty > $max_order_qty ){
- $max_order_qty = $tmp_qty;
- }
- if($v['shop'] == 5){
- $v['orderinfo'] = isset($v['shopify'])?$v['shopify']:$v['orderinfo'];
- }
- if($type == 1){
- $ret_list[] = [
- 'order_qty'=>$jisuan_qty,
- '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[] = [
- 'order_qty'=>$jisuan_qty,
- '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($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'],
- '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'=>[
- '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'=>sprintf("%.2f",$order_mount) ,
- 'order_num'=>$order_num,
- 'order_qty'=>$order_qty,
- 'max_order_qty'=>$max_order_qty,
- 'orders'=>$final_list,
- ];
- }
-
-
-
- private function sendHttp($url,$header,$list){
- $header = [
- 'Content-Type: application/json',
- ];
- //var_dump($list);
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
- curl_setopt($ch, CURLINFO_HEADER_OUT, TRUE);
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($list));
- // curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- // curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
- $res = curl_exec($ch);
- $res = json_decode($res,true);
- //var_dump($res);
-
- return $res;
- }
- //每日更新一回
- public function _dayUpdate(){
- $api = $this->input->get('api',true);
- if($api != $this->api){
- die("No data to be executed");
- }
- $end_time = strtotime(date("Y-m-d"));
- $start_time = $end_time - 24* 60 *60;
- $list = $this->fullorder->find_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'];
- }
- }
- }
- var_dump(json_encode($customer_ids));
- if(empty($customer_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'],
- ];
- }
- 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);
- }
- //判断条件
- private function judgeCon($info){
- $tmp_q = 0;
- $extra_price = empty($info['extra_price'])?[]:json_decode($info['extra_price'],true);
-
- $info['issku'] = strtolower($info['issku']);
- if(stripos($info['issku'],'payment difference') !== false){
- return false;
- }
- //如果有价格 说明系统已经可以按照单价进行处理了
- 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($item,'gift') !== false){
-
- // }else{
-
- // if(isset($quantity[$index])){
- // if(is_numeric($quantity[$index])){
- // $tmp_q += $quantity[$index];
- // }else{
-
- // }
-
- // }else{
- // $tmp_q += 1;
- // }
- // }
- // }
-
- foreach($issku as $index=>$item){
- $jishu_flag = true;
- foreach($this->filter_words as $val){
- //判断sku中是否有这种东西
- if (strpos($item,$val ) !== false) {
- $jishu_flag = false;
- }
-
- }
- if($jishu_flag){
- if(isset($quantity[$index])){
- if(is_numeric($quantity[$index])){
- $tmp_q += $quantity[$index];
- }else{
- // var_dump("不是数组的".$info['number']);
- // var_dump("不是数组的".$quantity[$index]);
- }
-
- }else{
- $tmp_q += 1;
- }
-
- }
-
- }
-
- }else{
- $whlabel_data = explode("|",trim($info['whlabel'],"|"));
- $check_totla = 0;
- foreach($whlabel_data as $v){
- $tmp_d_arr = explode("-",$v);
- if(isset($tmp_d_arr[1])){
- $check_totla += $tmp_d_arr[1]*1;
- }
- }
- 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;
- }
- }
- }
- }
- if($tmp_q > $check_totla){
- $tmp_q = 1;
- }
- }
- //大于等于4
- if($tmp_q >= 4){
- return true;
- }
- return false;
- }
-
-
- public function _tjOrder(){
- die;
- 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);
- // }
- die("over");
-
- // $list = $this->fullorder->find_all(" number = 'ALIP-00211-089' ","*",'id asc',0,300000);
- // $r = $this->judgeCon($list[0]);
- // var_dump($r);
- }
-
- public function _ddAllTb(){
- die;
- echo "<pre>";
- $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']);
- }
- var_dump(json_encode($customer_ids));
-
- $send_list = [];
- foreach($customer_list as $k=>$v){
- $orderinfo = $this->getOrderList($v['email'],$v['shop'],1);
- $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'],
- ];
- }
- //var_dump($send_list);
- if(empty($send_list)){
- return ;
- }
- $url = $this->url;
- $header = [];
- $res = $this->sendHttp($url,$header,['data'=>$send_list]);
- var_dump($res);
-
-
-
- }
- }
|