---
# System prepended metadata

title: Untitled

---

## 5/22教材問題處理

## 1.顧問登入
https://event.clue.com.tw/Teacher/?_index_0.RLIx

## 2.進入Dally schedule

## 3.點擊時間表上 
Client: ""Match按鈕"" click me to match material

## 4.進入 _getClassData API 撈取資料 
https://event.clue.com.tw/Teacher/?_getClassData.RLTl&run_page=1
legacy-tp-php\192.168.1.66\API\Teacher\getClassData.php

## 4-1.條件參數 : $aJWT['a'] == "GETSTUDENTTEST2" 

### 會依序比對以下資料表

```
client_trial 會員升級事件紀錄表
status=4為Obs，6為Trial，8為升級完成

session_appointment 學生上課預約紀錄(無顧問)
client_basic        會員基礎表
client_servicerec   會員合約等級表
cfg_event           課程類型表

session_rec1 顧問歷史上課紀錄
session_rec2 學生歷史上課紀錄
```

特定條件案例(Lucy)處理，行數 : 1363

API最後return 資料:
```
$aData['aRecSn'] = $aRecSn;
$aData['aRemind'] = $aRemind;
$aData['aFullMaterial'] = $aFullMaterial;
$aData['aCheckMaterial'] = $aCheckMaterial;
$aData['aMaterial'] = $aMaterial;
$aData['aStudent'] = $aClient;
$aData['sAllUids'] = $sAllUids;
$aData['aJWT'] = $aJWT;

$aData['a3MonthFullMaterial'] = $a3MonthFullMaterial;
$aData['nSpecial'] = $nSpecial;
$aData['nLow'] = $nLow;


$aReturn['aData'] = $aData;
$aReturn['nStatus'] = 1;
```

## 5.點擊時間表上，Material Bank: "MORE按鈕"

## 6.進入_teacher_schedule_today_0_act0 API，撈取資料比對 (教材標記紅字、綠字)

會將_getClassData資料帶入，比對今日課程、可用教材、老師資料
https://event.clue.com.tw/Teacher/?_teacher_schedule_today_0_act0.RLTs&run_page=1


6-1.這段開始 _teacher_schedule_today_0_act0 API
if ($aJWT['a'] == 'GETMATERIAL') 

6-2.猜測抓取非顧問個人教材，這段開始
if($nIfPersonal === 1) 

6-3.公用教材抓取

```
$sSQL = 'SELECT nId,
                nRid,
                nFid,
                nCid,
                sTopic,
                sName0,
                nAuthor,
                sType0,
                nCreateTime
FROM		CLIENT_MATERIAL
WHERE		nType1 = 0
AND		nRid IN (SELECT nId FROM CLIENT_MATERIAL_RANK WHERE nSn = :nLevelFromCfglevel)
AND		nStatus = 1
AND		nOnline = 1
ORDER BY nRid ASC';
```

6-4.資料while迴圈內，做字串處理
```
$aData[$aRows['nId']] = $aRows;
$aData[$aRows['nId']]['sNameClass'] = '';
$aData[$aRows['nId']]['nBlock'] = 0;
$LPaName = explode('_',$aRows['sName0']);
if(count($LPaName) > 4)
{
    $sNameCut = $LPaName[4];
    $LPaName = explode(',',$sNameCut);

    $LPsOnlyName = $LPaName[0];
    $aData[$aRows['nId']]['sNameCut'] = $LPaName[0];
    for($i=1;$i<=3;$i++)
    {
        if(empty($LPaName[$i])) break;
        $aData[$aRows['nId']]['sNameCut'] .= ','.$LPaName[$i];
    }				
}
else
{
    $LPsOnlyName = $aRows['sName0'];
    $aData[$aRows['nId']]['sNameCut'] = $aRows['sName0'];
}

```
6-5.這些資料帶出，與getClassData API，運算的json資料比對，這兩個物件
sMaterials
s3MonthMaterials
再標記為紅字教材

6-6.再將以上資料與TEACHER_DATA資料整理，response
