Ejemplo n.º 1
0
 public function search(Request $request)
 {
     $musicname = Input::get('musicname');
     $singer = Input::get('singer');
     //拼接数据   进行urlencode
     $encode_music = urlencode($musicname) . '$$' . urlencode($singer);
     $url = 'http://box.zhangmen.baidu.com/x?op=12&count=1&title=' . $encode_music;
     //接口 获取数据
     $return_url_xml = tools\Curl::get($url);
     //解析xml
     // $xml_object=simplexml_load_string($return_url_xml,'SimpleXMLElement',LIBXML_NOCDATA);
     $xml_object = simplexml_load_string($return_url_xml, null, LIBXML_NOCDATA);
     // var_dump($xml);
     $xml_array = tools\ShareFun::object_to_array($xml_object);
     $new_array = array();
     for ($i = 0; $i < $xml_array['count']; $i++) {
         $encode = $xml_array['url'][$i]['encode'];
         $decode = $xml_array['url'][$i]['decode'];
         $lrcid = $xml_array['url'][$i]['lrcid'];
         $arr[$i] = explode("/", $encode);
         $ck[$i] = count($arr[$i]);
         // $ck=count($arr[]);
         for ($k = 0; $k < $ck[$i]; $k++) {
             $arr[$i][$ck[$i] - 1] = $decode;
         }
         $new_array[$i] = implode("/", $arr[$i]);
     }
     return view('index.music.index')->with('name', $musicname)->with('data', $new_array);
 }
Ejemplo n.º 2
0
 public function mobile_excel()
 {
     //excel标题
     $GLOBALS['title'] = '惠付订单 ' . date('Y-m-d');
     $stime = date("Y-m-d 00:00:00", strtotime("-1 day"));
     $etime = date('Y-m-d 00:00:00');
     $db = DB::connection('mysql_ali')->select("select A.Mobile,A.CreateTime,A.`Status`,A.StatusDesc,A.productSize,A.TradeId,A.SellID,A.FinishTime,B.OrderID,B.channelName,p.provinceName FROM sellorder A LEFT JOIN base_mobile_location m ON LEFT(A.Mobile,7) = m.telPrefix7 LEFT JOIN base_province p ON p.provinceId = m.provinceId LEFT JOIN (select TradeID,OrderID,channelName from  operatororder where ID in(select max(A.ID) from operatororder A where  A.TradeID in (select TradeId FROM sellorder  where SellID=110054 and CreateTime>='{$stime}' and CreateTime<'{$etime}') group by A.TradeID)) B on A.TradeId=B.TradeID where SellID=110054 and CreateTime>='{$stime}' and CreateTime<'{$etime}';");
     //object转为数组
     $db = tools\ShareFun::object_to_array($db);
     $data = array(array(' ', '订购手机号码', '创建时间', '订单状态', '状态码描述', '流量规格', '交易ID', '渠道编号', '订单完成时间', '运营商订单ID', '使用运营商通道', '省份'));
     //循环拼接数据
     for ($i = 0; $i < count($db); $i++) {
         array_push($data, array('', $db[$i]['Mobile'], $db[$i]['CreateTime'], $db[$i]['Status'], $db[$i]['StatusDesc'], $db[$i]['productSize'], $db[$i]['TradeId'], $db[$i]['SellID'], $db[$i]['FinishTime'], $db[$i]['OrderID'], $db[$i]['channelName'], $db[$i]['provinceName']));
     }
     Excel::create($GLOBALS['title'], function ($excel) use($data) {
         $excel->sheet('Sheetname', function ($sheet) use($data) {
             $sheet->fromArray($data);
         });
     })->store('xls', public_path('file'));
     $mail = '*****@*****.**';
     $data = '';
     TestController::email($mail, $data);
 }