初始化
This commit is contained in:
17
app/controller/Index.php
Normal file
17
app/controller/Index.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
namespace app\controller;
|
||||
|
||||
use app\BaseController;
|
||||
|
||||
class Index extends BaseController
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
return '<style type="text/css">*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} a{color:#2E5CD5;cursor: pointer;text-decoration: none} a:hover{text-decoration:underline; } body{ background: #fff; font-family: "Century Gothic","Microsoft yahei"; color: #333;font-size:18px;} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.6em; font-size: 42px }</style><div style="padding: 24px 48px;"> <h1>:) </h1><p> ThinkPHP V' . \think\facade\App::version() . '<br/><span style="font-size:30px;">16载初心不改 - 你值得信赖的PHP框架</span></p><span style="font-size:25px;">[ V6.0 版本由 <a href="https://www.yisu.com/" target="yisu">亿速云</a> 独家赞助发布 ]</span></div><script type="text/javascript" src="https://e.topthink.com/Public/static/client.js"></script><think id="ee9b1aa918103c4fc"></think>';
|
||||
}
|
||||
|
||||
public function hello($name = 'ThinkPHP6')
|
||||
{
|
||||
return 'hello,' . $name;
|
||||
}
|
||||
}
|
||||
116
app/controller/Test.php
Normal file
116
app/controller/Test.php
Normal file
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\controller;
|
||||
|
||||
use Curl\Curl;
|
||||
use app\kernel\Lebolebo\Account;
|
||||
use app\kernel\Lebolebo\Curriculum;
|
||||
|
||||
class Test
|
||||
{
|
||||
public function login()
|
||||
{
|
||||
$account = new Account();
|
||||
dump($account);
|
||||
dump($account->login('13088393927','HIMIsm1yxpt4'));
|
||||
}
|
||||
public function index()
|
||||
{
|
||||
$savepath = store_path() . '/lebolebo/';
|
||||
$curl = new Curl();
|
||||
$curr = new Curriculum();
|
||||
$course = $curr->list(0);
|
||||
foreach ($course['data']['list'] as $list){
|
||||
$c = $savepath . $list['courseName'];
|
||||
is_dir($c) || mkdir($c);
|
||||
dump($curr->course($list['courseCode']));
|
||||
$detail = $curr->detail($list['id']);
|
||||
dump($detail);
|
||||
$courseCover = $c . '/courseCover' . '.png';
|
||||
is_file($courseCover) || $curl->download($detail['data']['courseCover'],$courseCover);
|
||||
$d = $curr->courseUnitList($list['courseCode']);
|
||||
$courseUnits = $d['data']['courseUnit'];
|
||||
foreach ($courseUnits as $courseUnit){
|
||||
$courseUnitName = $c . '/' . str_ireplace('/','-',$courseUnit['courseUnitName']);
|
||||
if(!is_dir($t)){
|
||||
dump($t);
|
||||
mkdir($t);
|
||||
}
|
||||
$selectByCourseUnits = $curr->selectByCourseUnits($courseUnit['courseCode'],$courseUnit['courseUnitCode']);
|
||||
foreach ($selectByCourseUnits['data'] as $selectByCourseUnit){
|
||||
$sessionName = $courseUnitName . '/' . $selectByCourseUnit['sessionName'];
|
||||
if(!is_dir($sessionName)){
|
||||
dump($sessionName);
|
||||
mkdir($sessionName,0755,true);
|
||||
}
|
||||
$t = $curr->selectByCourseSessionCode($selectByCourseUnit['courseSessionCode']);
|
||||
// 0: {type: 1, des: "PPT-HTML"}
|
||||
// 1: {type: 2, des: "讲义"}
|
||||
// 2: {type: 3, des: "课前预习"}
|
||||
// 3: {type: 4, des: "测一测"}
|
||||
// 4: {type: 5, des: "玩一玩"}
|
||||
// 5: {type: 6, des: "试一试"}
|
||||
// 6: {type: 9, des: "知识点"}
|
||||
// 7: {type: 10, des: "名人名言"}
|
||||
// 8: {type: 11, des: "录播课"}
|
||||
// 9: {type: 13, des: "教辅"}
|
||||
// 10: {type: 14, des: "备课"}
|
||||
// 11: {type: 15, des: "课程内容"}
|
||||
// 12: {type: 16, des: "课后拓展"}
|
||||
// 13: {type: 18, des: "素养目标"}
|
||||
$ts = $t['data'];
|
||||
foreach ($ts as $kk ){
|
||||
switch ($kk['resourceType']) {
|
||||
case '1':// PPT-HTML
|
||||
if(!isset($kk['content'])){
|
||||
continue;
|
||||
}
|
||||
$filename = $kk['content']['fileName'];
|
||||
$name = $kk['content']['fileUrl'];
|
||||
if(!is_file($sessionName . '/' . $filename)){
|
||||
$curl->download($name,$sessionName . '/' . $filename);
|
||||
}
|
||||
break;
|
||||
case '2':
|
||||
break;
|
||||
case '3':
|
||||
break;
|
||||
case '4':
|
||||
break;
|
||||
case '5':
|
||||
break;
|
||||
case '6':
|
||||
break;
|
||||
case '9':
|
||||
break;
|
||||
case '10':
|
||||
break;
|
||||
case '11':
|
||||
break;
|
||||
case '13':
|
||||
break;
|
||||
case '14':
|
||||
break;
|
||||
case '15':
|
||||
break;
|
||||
case '16':
|
||||
break;
|
||||
case '18':
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// break;
|
||||
}
|
||||
// dump($course);
|
||||
}
|
||||
public function __call($method,$args)
|
||||
{
|
||||
dump('没有'.$method);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user