@@ -5,6 +5,7 @@ import android.os.Handler
55import  android.os.Looper 
66import  android.util.Base64 
77import  android.util.Log 
8+ import  com.lizongying.mytv.Utils.getDateFormat 
89import  com.lizongying.mytv.api.ApiClient 
910import  com.lizongying.mytv.api.BtraceClient 
1011import  com.lizongying.mytv.api.LiveInfo 
@@ -20,9 +21,6 @@ import com.lizongying.mytv.proto.Ysp.cn.yangshipin.omstv.common.proto.epgProgram
2021import  retrofit2.Call 
2122import  retrofit2.Callback 
2223import  retrofit2.Response 
23- import  java.text.SimpleDateFormat 
24- import  java.util.Date 
25- import  java.util.Locale 
2624import  javax.crypto.Cipher 
2725import  javax.crypto.spec.IvParameterSpec 
2826import  javax.crypto.spec.SecretKeySpec 
@@ -34,6 +32,7 @@ class Request(var context: Context) {
3432    private  var  yspBtraceService:  YSPBtraceService ?  =  null 
3533    private  var  yspProtoService:  YSPProtoService ?  =  null 
3634
35+     //  TODO onDestroy
3736    private  val  handler =  Handler (Looper .getMainLooper())
3837    private  lateinit  var  myRunnable:  MyRunnable 
3938
@@ -175,13 +174,13 @@ class Request(var context: Context) {
175174            livepid =  pid,
176175            sUrl =  " https://www.yangshipin.cn/#/tv/home?pid=$pid " 
177176            playno =  ysp?.getRand()!! ,
178-             ftime =  getCurrentDate2( ),
177+             ftime =  getDateFormat( " yyyy-MM-dd HH:mm:ss " 
179178            seq =  tvModel.seq.toString(),
180179        )
181180            ?.enqueue(object  :  Callback <Void > {
182181                override  fun  onResponse (call :  Call <Void >, response :  Response <Void >) {
183182                    if  (response.isSuccessful) {
184- //                         Log.i (TAG, "$title kvcollect success")
183+                         Log .d (TAG , " $title  kvcollect success" 
185184                    } else  {
186185                        Log .e(TAG , " $title  kvcollect status error" 
187186                        tvModel.firstSource()
@@ -238,20 +237,9 @@ class Request(var context: Context) {
238237        })
239238    }
240239
241-     private  fun  getCurrentDate (): String  {
242-         val  currentDate =  Date ()
243-         val  formatter =  SimpleDateFormat (" yyyyMMdd" Locale .CHINA )
244-         return  formatter.format(currentDate)
245-     }
246- 
247-     private  fun  getCurrentDate2 (): String  {
248-         val  currentDate =  Date ()
249-         val  formatter =  SimpleDateFormat (" yyyy-MM-dd HH:mm:ss" Locale .CHINA )
250-         return  formatter.format(currentDate)
251-     }
252- 
253-     fun  fetchProgram (tvModel :  TVViewModel ) {
254-         yspProtoService?.getProgram(tvModel.programId.value!! , getCurrentDate())
240+     fun  fetchProgram (tvViewModel :  TVViewModel ) {
241+         val  title =  tvViewModel.title.value
242+         yspProtoService?.getProgram(tvViewModel.programId.value!! , getDateFormat(" yyyyMMdd" 
255243            ?.enqueue(object  :  Callback < epgProgramModel.Response >  {
256244                override  fun  onResponse (
257245                    call :  Call <epgProgramModel.Response >,
@@ -260,13 +248,14 @@ class Request(var context: Context) {
260248                    if  (response.isSuccessful) {
261249                        val  program =  response.body()
262250                        if  (program !=  null ) {
263-                             tvModel.addProgram(program.dataListList)
251+                             tvViewModel.addProgram(program.dataListList)
252+                             Log .i(TAG , " $title  program ${program.dataListList.size} " 
264253                        }
265254                    }
266255                }
267256
268257                override  fun  onFailure (call :  Call <epgProgramModel.Response >, t :  Throwable ) {
269-                     Log .e(TAG , " Program  request failed" , t )
258+                     Log .e(TAG , " $title  program  request failed  $t " 
270259                }
271260            })
272261    }
0 commit comments