123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647 |
- <?php
- /**
- * 测试队列任务脚本入口文件
- * Created by PhpStorm.
- * User: phperstar
- * Date: 2018/6/10
- * Time: 下午4:49
- */
- namespace Jobs\Controller;
- use Jobs\Dao\DCloudUsers;
- use Jobs\Dao\DUsersTestify;
- use Jobs\Model\MTopic\Push\MPush;
- use Jobs\Model\Middleware;
- use Jobs\Dao\DCloudUsersCategory;
- use Jobs\Dao\DUsersCategory;
- use Jobs\Dao\DGoodsSku;
- use Jobs\Dao\DGoods;
- use Jobs\Model\Test\K3Handle;
- use Jobs\Dao\DOrder;
- use Jobs\Model\MTopic\Finance\MReceivable;
- use Mall\Framework\Db\Db;
- class Test
- {
- /**
- * php ./Public/www/index.php --c=Test --a=Test
- */
- public function test()
- {
- $objMReceivable = new MReceivable();
- $params = [
- 'userCenterId' => 35,
- 'enterpriseId' => 64,
- 'id' => 9,
- 'type' => 5,
- ];
- $objMReceivable->createReceivable($params);
- }
- public function testk3()
- {
- //K/3 Cloud 业务站点地址
- $cloudUrl = "http://123.206.51.139/k3cloud/";
- //登陆参数
- $data = array(
- '597be128163613',//帐套Id
- '秦统业',//用户名
- 'Cwb20141222',//密码
- 2052//语言标识
- );
- //定义记录Cloud服务端返回的Session
- $cookie_jar = tempnam('./tmp','CloudSession');
- $post_content = self::create_postdata($data);
- //$result = invoke_login($cloudUrl,$post_content,$cookie_jar);
- $loginurl = $cloudUrl.'Kingdee.BOS.WebApi.ServicesStub.AuthService.ValidateUser.common.kdsvc';
- $result = self::invoke_post($loginurl,$post_content,$cookie_jar,TRUE);
- header("Content-type: text/html; charset=gb2312");
- //echo '<pre>';print_r('登陆请求数据:');
- //echo '<pre>';print_r($post_content);
- //echo '<pre>';print_r('登陆返回结果:');
- //echo '<pre>';print_r($result);
- unset($post_content);
- unset($result);
- unset($data);
- /*$data = array(
- 'FormId'=>'STK_Inventory',//业务对象表单Id(必录)
- 'TopRowCount'=>0, // 最多允许查询的数量,0或者不要此属性表示不限制
- 'Limit'=>10,
- 'StartRow'=>0,
- 'OrderString'=>'FID ASC',
- 'FieldKeys'=>'FMaterialId,FMaterialId.FNumber,FStockName,FMaterialName,FBaseQty,FStockStatusId,FStockOrgId.FNumber',//字段keys,字符串类型用逗号分隔,比如"key1,key2..."(必录)
- 'FilterString'=>"FMaterialId=147946",//过滤(非必录)
- );*/
- /*$k3GoodsInfo = '{"FormId":"STK_Inventory","FieldKeys":"FMaterialId.FNumber,FMaterialName,FStockUnitId.FName,FBaseQty",
- "FilterString":"FMaterialId=147946 and ( FStockName = \'菏泽G1库\' or FStockName = \'绿源冷库\' or FStockName = \'绿源冷库3号库\' )",
- "OrderString":"","TopRowCount":"0","StartRow":"0","Limit":"100"}';*/
- $data = array(
- 'FormId'=>'STK_Inventory',//业务对象表单Id(必录)
- 'TopRowCount'=>0, // 最多允许查询的数量,0或者不要此属性表示不限制
- 'Limit'=>100,
- 'StartRow'=>0,
- 'OrderString'=>'',
- 'FieldKeys'=>'FMaterialId,FMaterialId.FNumber,FStockName,FMaterialName,FBaseQty,FStockStatusId,FStockOrgId.FNumber',//字段keys,字符串类型用逗号分隔,比如"key1,key2..."(必录)
- 'FilterString'=>"FMaterialId.FNumber ='0602070004' and (FStockName = '菏泽G1库' or FStockName = '绿源冷库' or FStockName = '绿源冷库3号库') and FStockOrgId.FNumber='101' ",//过滤(非必录)
- );
- //定义记录Cloud服务端返回的Session
- $post_content = self::create_postdata([$data]);
- $url = $cloudUrl.'Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.ExecuteBillQuery.common.kdsvc';
- $result = self::invoke_post($url,$post_content,$cookie_jar,false);
- header("Content-type: text/html; charset=gb2312");
- //echo '<pre>';print_r('及时库存请求数据:');
- //echo '<pre>';print_r($post_content);
- //echo '<pre>';print_r('及时库存返回结果:');
- echo '<pre>';var_dump(json_decode($result, true));
- $k3Weight = 0.00;
- $resultArray = json_decode($result, true);
- if(!empty($resultArray)){
- foreach ($resultArray as $key => $value){
- $k3Weight += $value[4];
- }
- }
- var_dump($k3Weight);
- return $k3Weight;
- }
- public function testk4()
- {
- //K/3 Cloud 业务站点地址
- $cloudUrl = "http://123.206.51.139/k3cloud/";
- //登陆参数
- $data = array(
- '597be128163613',//帐套Id
- '秦统业',//用户名
- 'Cwb20141222',//密码
- 2052//语言标识
- );
- //定义记录Cloud服务端返回的Session
- $cookie_jar = tempnam('./tmp','CloudSession');
- $post_content = self::create_postdata($data);
- //$result = invoke_login($cloudUrl,$post_content,$cookie_jar);
- $loginurl = $cloudUrl.'Kingdee.BOS.WebApi.ServicesStub.AuthService.ValidateUser.common.kdsvc';
- $result = self::invoke_post($loginurl,$post_content,$cookie_jar,true);
- header("Content-type: text/html; charset=gb2312");
- echo '<pre>';print_r('登陆请求数据:');
- echo '<pre>';print_r($post_content);
- echo '<pre>';print_r('登陆返回结果:');
- echo '<pre>';print_r($result);
- unset($post_content);
- unset($result);
- unset($data);
- /*$data = array(
- 'FormId'=>'STK_Inventory',//业务对象表单Id(必录)
- 'TopRowCount'=>0, // 最多允许查询的数量,0或者不要此属性表示不限制
- 'Limit'=>10,
- 'StartRow'=>0,
- 'OrderString'=>'FID ASC',
- 'FieldKeys'=>'FMaterialId,FMaterialId.FNumber,FStockName,FMaterialName,FBaseQty,FStockStatusId,FStockOrgId.FNumber',//字段keys,字符串类型用逗号分隔,比如"key1,key2..."(必录)
- 'FilterString'=>"FMaterialId=147946",//过滤(非必录)
- );*/
- /*$k3GoodsInfo = '{"FormId":"STK_Inventory","FieldKeys":"FMaterialId.FNumber,FMaterialName,FStockUnitId.FName,FBaseQty",
- "FilterString":"FMaterialId=147946 and ( FStockName = \'菏泽G1库\' or FStockName = \'绿源冷库\' or FStockName = \'绿源冷库3号库\' )",
- "OrderString":"","TopRowCount":"0","StartRow":"0","Limit":"100"}';*/
- $data = '{"Model":{"FNumber":"xyc2218","FCreateOrgId":{"FNumber":"101"},"FUseOrgId":{"FNumber":"101"},"FName":"u5218u5e05uff08u4ebfu6210u98dfu54c1u5185u90e8u5458u5de5uff09","FTEL":"18114640037","FADDRESS":"u5c71u4e1cu7701u6d4eu5357u5e02u5386u4e0bu533au6d4bu8bd5u5730u5740","FSALDEPTID":{"FNumber":"0020"},"FSALGROUPID":{"FNumber":"16"},"FSELLER":{"FNumber":"0020"},"FCustTypeId":{"FNumber":"KHLB001_SYS"},"FTRADINGCURRID":{"FNumber":"PRE001"},"F_PAEZ_Assistant3":{"FNumber":"0101"},"F_PAEZ_Assistant5":{"FNumber":"01"}},"Creator":"u4ebfu6210u5546u57ce"}';
- //定义记录Cloud服务端返回的Session
- $post_content = self::create_postdata(["BD_Customer",$data]);
- $url = $cloudUrl.'Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save.common.kdsvc';
- $result = self::invoke_post($url,$post_content,$cookie_jar,false);
- //header("Content-type: text/html; charset=gb2312");
- //echo '<pre>';print_r('及时库存请求数据:');
- echo '<pre>';print_r($post_content);
- //echo '<pre>';print_r('及时库存返回结果:');
- //file_put_contents('/tmp/11.log',var_export($result,true),FILE_APPEND);
- V($result);
- }
- // 采购入库单
- public function testk5()
- {
- //K/3 Cloud 业务站点地址
- $cloudUrl = "http://123.206.51.139/k3cloud/";
- //登陆参数
- $data = array(
- '597be128163613',//帐套Id
- '秦统业',//用户名
- 'Cwb20141222',//密码
- 2052//语言标识
- );
- //定义记录Cloud服务端返回的Session
- $cookie_jar = tempnam('./tmp','CloudSession');
- $post_content = self::create_postdata($data);
- //$result = invoke_login($cloudUrl,$post_content,$cookie_jar);
- $loginurl = $cloudUrl.'Kingdee.BOS.WebApi.ServicesStub.AuthService.ValidateUser.common.kdsvc';
- $result = self::invoke_post($loginurl,$post_content,$cookie_jar,TRUE);
- header("Content-type: text/html; charset=gb2312");
- //echo '<pre>';print_r('登陆请求数据:');
- //echo '<pre>';print_r($post_content);
- //echo '<pre>';print_r('登陆返回结果:');
- //echo '<pre>';print_r($result);
- unset($post_content);
- unset($result);
- unset($data);
- /*$data = array(
- 'FormId'=>'STK_Inventory',//业务对象表单Id(必录)
- 'TopRowCount'=>0, // 最多允许查询的数量,0或者不要此属性表示不限制
- 'Limit'=>10,
- 'StartRow'=>0,
- 'OrderString'=>'FID ASC',
- 'FieldKeys'=>'FMaterialId,FMaterialId.FNumber,FStockName,FMaterialName,FBaseQty,FStockStatusId,FStockOrgId.FNumber',//字段keys,字符串类型用逗号分隔,比如"key1,key2..."(必录)
- 'FilterString'=>"FMaterialId=147946",//过滤(非必录)
- );*/
- /*$k3GoodsInfo = '{"FormId":"STK_Inventory","FieldKeys":"FMaterialId.FNumber,FMaterialName,FStockUnitId.FName,FBaseQty",
- "FilterString":"FMaterialId=147946 and ( FStockName = \'菏泽G1库\' or FStockName = \'绿源冷库\' or FStockName = \'绿源冷库3号库\' )",
- "OrderString":"","TopRowCount":"0","StartRow":"0","Limit":"100"}';*/
- $data = array(
- 'FormId'=>'STK_InStock',//业务对象表单Id(必录)
- 'TopRowCount'=>0, // 最多允许查询的数量,0或者不要此属性表示不限制
- 'Limit'=>1,
- 'StartRow'=>0,
- 'OrderString'=>'FBillNo desc',
- 'FieldKeys'=>'FMaterialId.FNumber,FID,FDate,FBillNo,FDocumentStatus,FMaterialId,FStockStatusid,FMaterialName',//字段keys,字符串类型用逗号分隔,比如"key1,key2..."(必录)
- 'FilterString'=>"FMaterialId.FNumber ='01110101010001',FDocumentStatus = 'c'",//过滤(非必录)
- );
- //定义记录Cloud服务端返回的Session
- $post_content = self::create_postdata([$data]);
- $url = $cloudUrl.'Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.ExecuteBillQuery.common.kdsvc';
- $result = self::invoke_post($url,$post_content,$cookie_jar,false);
- header("Content-type: text/html; charset=gb2312");
- //echo '<pre>';print_r('及时库存请求数据:');
- //echo '<pre>';print_r($post_content);
- //echo '<pre>';print_r('及时库存返回结果:');
- V(json_decode($result, true));
- }
- // 销售退货单
- public function testk6()
- {
- //K/3 Cloud 业务站点地址
- $cloudUrl = "http://123.206.51.139/k3cloud/";
- //登陆参数
- $data = array(
- '597be128163613',//帐套Id
- '秦统业',//用户名
- 'Cwb20141222',//密码
- 2052//语言标识
- );
- //定义记录Cloud服务端返回的Session
- $cookie_jar = tempnam('./tmp','CloudSession');
- $post_content = self::create_postdata($data);
- //$result = invoke_login($cloudUrl,$post_content,$cookie_jar);
- $loginurl = $cloudUrl.'Kingdee.BOS.WebApi.ServicesStub.AuthService.ValidateUser.common.kdsvc';
- $result = self::invoke_post($loginurl,$post_content,$cookie_jar,TRUE);
- header("Content-type: text/html; charset=gb2312");
- //echo '<pre>';print_r('登陆请求数据:');
- //echo '<pre>';print_r($post_content);
- //echo '<pre>';print_r('登陆返回结果:');
- //echo '<pre>';print_r($result);
- unset($post_content);
- unset($result);
- unset($data);
- /*$data = array(
- 'FormId'=>'STK_Inventory',//业务对象表单Id(必录)
- 'TopRowCount'=>0, // 最多允许查询的数量,0或者不要此属性表示不限制
- 'Limit'=>10,
- 'StartRow'=>0,
- 'OrderString'=>'FID ASC',
- 'FieldKeys'=>'FMaterialId,FMaterialId.FNumber,FStockName,FMaterialName,FBaseQty,FStockStatusId,FStockOrgId.FNumber',//字段keys,字符串类型用逗号分隔,比如"key1,key2..."(必录)
- 'FilterString'=>"FMaterialId=147946",//过滤(非必录)
- );*/
- /*$k3GoodsInfo = '{"FormId":"STK_Inventory","FieldKeys":"FMaterialId.FNumber,FMaterialName,FStockUnitId.FName,FBaseQty",
- "FilterString":"FMaterialId=147946 and ( FStockName = \'菏泽G1库\' or FStockName = \'绿源冷库\' or FStockName = \'绿源冷库3号库\' )",
- "OrderString":"","TopRowCount":"0","StartRow":"0","Limit":"100"}';*/
- $data = array(
- 'FormId'=>'STK_InStock',//业务对象表单Id(必录)
- 'TopRowCount'=>0, // 最多允许查询的数量,0或者不要此属性表示不限制
- 'Limit'=>1,
- 'StartRow'=>0,
- 'OrderString'=>'FBillNo desc',
- 'FieldKeys'=>'FMaterialId.FNumber,FID,FDate,FBillNo,FDocumentStatus,FMaterialId,FStockStatusid,FMaterialName',//字段keys,字符串类型用逗号分隔,比如"key1,key2..."(必录)
- 'FilterString'=>"FMaterialId.FNumber ='01110101010001',FDocumentStatus = 'c'",//过滤(非必录)
- );
- //定义记录Cloud服务端返回的Session
- $post_content = self::create_postdata([$data]);
- $url = $cloudUrl.'Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.ExecuteBillQuery.common.kdsvc';
- $result = self::invoke_post($url,$post_content,$cookie_jar,false);
- header("Content-type: text/html; charset=gb2312");
- //echo '<pre>';print_r('及时库存请求数据:');
- //echo '<pre>';print_r($post_content);
- //echo '<pre>';print_r('及时库存返回结果:');
- V(json_decode($result, true));
- }
- //构造Web API请求格式
- public function create_postdata($args) {
- $postdata = array(
- 'format'=>1,
- 'useragent'=>'ApiClient',
- 'rid'=>self::create_guid(),
- 'parameters'=>$args,
- 'timestamp'=>date('Y-m-d'),
- 'v'=>'1.0'
- );
- return json_encode($postdata);
- }
- public function create_guid() {
- $charid = strtoupper(md5(uniqid(mt_rand(), true)));
- $hyphen = chr(45);// "-"
- $uuid = chr(123)// "{"
- .substr($charid, 0, 8).$hyphen
- .substr($charid, 8, 4).$hyphen
- .substr($charid,12, 4).$hyphen
- .substr($charid,16, 4).$hyphen
- .substr($charid,20,12)
- .chr(125);// "}"
- return $uuid;
- }
- public function invoke_post($url,$post_content,$cookie_jar,$isLogin)
- {
- $ch = curl_init($url);
- $this_header = array(
- 'Content-Type: application/json',
- 'Content-Length: '.strlen($post_content)
- );
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
- curl_setopt($ch, CURLOPT_HTTPHEADER, $this_header);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $post_content);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- if($isLogin){
- curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_jar);
- }
- else{
- curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_jar);
- }
- curl_setopt($ch, CURLOPT_TIMEOUT, 30);
- $result = curl_exec($ch);
- curl_close($ch);
- return $result;
- }
- public static function s_put_txt()
- {
- $objDOrder = new DOrder('pifabbc');
- $orderData = $objDOrder->query('SELECT order_id,buyer_id,order_no,order_status,created_at,pay_money,payment_type from ns_order');
- foreach ($orderData as $key => $value){
- $buyerids[] = $value['buyer_id'];
- $orderData[$value['order_id']] = $value;
- }
- $objDusersCategory = new DUsersCategory('pifabbc');
- $infos = $objDusersCategory ->query('SELECT
- t.id,
- t.user_id as user_id,
- t.contact_phone,
- t.legal_person,
- r.referee_name,
- g.group_name,
- c.id as category_id,
- c.category_name,
- c.pid,
- t.check_status,
- t.company_address,
- t.detail_address,
- t.erp_no
- FROM
- cloud_users_testify AS t,
- cloud_referee AS r,
- cloud_referee_group AS g,
- cloud_users_category AS c
- WHERE
- t.referrer_no = r.referee_no
- AND t.referrer_group_no = g.group_no
- AND t.category_id = c.id and t.user_id in ('.implode(',', $buyerids).')');
- if (!empty($infos)){
- foreach ($infos as $key => $value) {
- if ($value['pid'] != 0) {
- $data = self::s_handle($value);
- }
- $info = array_merge($value, $data);
- $data_file = implode(',', $info);
- $userData[$value['user_id']] = $data_file;
- }
- }
- foreach ($orderData as $key => $value){
- $content = $userData[$value['user_id']].','.implode(',', $value);
- file_put_contents('order.txt',$content . PHP_EOL,FILE_APPEND) ;
- unset($content);
- }
- // $data_file = implode(',', $file);
- //
- // file_put_contents('cat.txt', $data_file);
- }
- public static function s_handle(&$info_value)
- {
- $objDusersCategory = new DUsersCategory();
- $id = $info_value['pid'];
- $detail = $objDusersCategory->get($id);
- if (!empty($detail)) {
- $info_value[] = $detail['category_name'];
- $info_value['pid'] = $detail['pid'];
- self::s_handle($info_value);
- }
- return $info_value;
- }
- //php ./Jobs/Public/www/index.php --c=Test --a=userErpReset
- public static function userErpReset(){
- $objectDCloudUsers = new DCloudUsers();
- $objectDUsersTestify = new DUsersTestify();
- $fileName = 'k3id.txt';
- /*
- * 逐行读取TXT文件
- */
- $file = fopen($fileName,'r');
- $content = array();
- if(!$file){
- return 'file open fail';
- }else{
- $i = 0;
- while (!feof($file)){
- $content = mb_convert_encoding(fgets($file),"UTF-8","GBK,ASCII,ANSI,UTF-8");
- //print_r($content);
- $data = explode(',',$content);
- $info = $objectDUsersTestify -> get(['erp_no' => $data[1]]);
- if (empty($info)){
- echo 0;
- continue;
- }else{
- $res = $objectDUsersTestify ->update(['k3_id'=>$data[0]],['erp_no' => $data[1]]);
- echo $res;
- }
- }
- // fclose($file);
- // $content = array_filter($content); //数组去空
- }
- // return $content;
- }
- //php ./Jobs/Public/www/index.php --c=Test --a=resetErpNo
- public static function resetErpNo(){
- $log ='';
- $objectDCloudUsers = new DCloudUsers();
- $objectDUsersTestify = new DUsersTestify();
- $sql = "select *from cloud_users_testify WHERE SUBSTR(erp_no,1,3) !='xyc'";
- $data = $objectDUsersTestify ->query($sql);
- $log .= 'ID,客户新编号,客户旧编号,客户推荐人编码,客户推荐人组织编码,客户推荐人电话'.PHP_EOL;
- $K3Handle = new K3Handle();
- foreach($data as $value){
- $id = $value['id'];
- //V($value);
- if(!$value['erp_no']){
- continue;
- }
- $erp_no = 'xyc'.$value['user_id'];
- $res = $objectDUsersTestify -> update(['erp_no'=>$erp_no],['id'=>$id]);
- $res = $K3Handle ->store($value,$erp_no);
- if ($res['code'] !=200){
- continue;
- }
- $log .= $id.','.$erp_no.','.$value['erp_no']?:'空'.','.$value['referrer_no'].','.$value['referrer_group_no'].','.$value['referrer_phone'].PHP_EOL;
- }
- file_put_contents('update_erp_no.txt',$log,FILE_APPEND);
- }
- //php ./Jobs/Public/www/index.php --c=Test --a=export
- public static function export(){
- $objDOrder = new DOrder('pifabbc');
- $orderData = $objDOrder->query('SELECT sum(pay_money) as order_money ,count(order_id) as total_count,buyer_id from ns_order where order_status <>5 group by buyer_id');
- $a =[];
- foreach ($orderData as $key => $value){
- //$buyerids[] = $value['buyer_id'];
- $a[$value['buyer_id']] = $value;
- }
- $objDusersCategory = new DUsersCategory('pifabbc');
- $infos = $objDusersCategory ->query('SELECT
- t.id,
- t.user_id as user_id,
- t.contact_phone,
- t.legal_person,
- r.referee_name,
- g.group_name,
- c.id as category_id,
- c.category_name,
- c.pid,
- t.check_status,
- t.company_address,
- t.detail_address,
- t.erp_no
- FROM
- cloud_users_testify AS t,
- cloud_referee AS r,
- cloud_referee_group AS g,
- cloud_users_category AS c
- WHERE
- t.referrer_no = r.referee_no
- AND t.referrer_group_no = g.group_no
- AND t.category_id = c.id and t.user_id ');
- $user =[];
- if (!empty($infos)){
- foreach ($infos as $key => $value) {
- if ($value['pid'] != 0) {
- $data = self::s_handle($value);
- }
- $user[$value['user_id']] = $data;
- }
- }
- foreach ($user as $key => $value){
- echo 1 .'//';
- echo ($key);
- // $orderMoney = $objDOrder->query("SELECT sum('pay_money') as order_money ,count('order_id') as total_count from ns_order where order_status <>5 and buyer_id = $key");
- $lastTime = $objDOrder->query("SELECT created_at from ns_order where order_status <>5 and buyer_id = $key ORDER by order_id DESC limit 0,1");
- if (isset($a[$key])){
- $content = implode(',', $value).','.'总金额:'.$a[$key]['order_money']?:0;
- $content .= ',订单数:'.$a[$key]['total_count']?:0 ;
- $content .= ',最后下单时间:'.$lastTime[0]['created_at']?:0 ;
- }else{
- $content = implode(',', $value);
- }
- file_put_contents('export.txt',$content . PHP_EOL,FILE_APPEND) ;
- unset($content);
- }
- }
- public function ce(){
- $objDOrder = new DOrder('pifabbc');
- $lastTime = $objDOrder->query("SELECT created_at from ns_order where order_status <>5 and buyer_id = 4739 ORDER by order_id DESC limit 0,1");
- V($lastTime);
- }
- public function jpush()
- {
- $swResult = Middleware::getInstance('ThirdPartyService')->sendSwoole('Jpush', 'broadcastPush', ['alias'=>['7581'],'content'=>'优鲜供应链新版即将发布']);
- if( !$swResult['state'] ){
- V( $swResult['data']);
- }else{
- V($swResult['data']);
- }
- }
- }
|