BusinessPackProductTask.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. //下载任务打包表
  3. /**
  4. * This is the model class for table "task".
  5. *
  6. *
  7. * @property int $id 自增id
  8. * @property string $school_id 学校id
  9. * @property string $auth_username 学校id
  10. * @property int $product_type 产品类型 1错题本 2二步 3三步 4阶段复习 5二轮 6好题本 7微产品 8假期报告 9晨读词汇 10外刊宝
  11. * @property int $subject_id 科目id
  12. * @property int $class_id 班级id
  13. * @property int $class_name 班级名称
  14. * @property string $unique_key 唯一键
  15. * @property string $product_name 产品名称
  16. * @property string $student_count 人数
  17. * @property string $pack_json 打包json参数
  18. * @property string $pack_api_url 产品接口域名
  19. * @property string $pack_status 打包状态 0打包中 1打包完成 2打包失败 3已复制
  20. * @property string $pack_exception 打包异常
  21. * @property string $pack_url 压缩包下载地址
  22. * @property int $complete_time 完成时间
  23. * @property int $status 数据状态 1正常 0无效
  24. * @property int $create_time 创建时间
  25. */
  26. class BusinessPackProductTask extends BusinessActiveRecord{
  27. public static function model($className = __CLASS__){
  28. return parent::model($className);
  29. }
  30. public function tableName(){
  31. return "pack_product_task";
  32. }
  33. public function getList($schoolId,$page=1,$pageLimit=10)
  34. {
  35. $offset=($page-1)*$pageLimit;
  36. $pages=array();
  37. $totalQuery=$this->getDbConnection()->createCommand("select count(*) as count from pack_product_task where status=1 and school_id={$schoolId}")->queryRow();
  38. $pages['total']=$totalQuery['count'];
  39. $pages['totalPage']=ceil($totalQuery['count']/$pageLimit);
  40. $pages['page']=$page;
  41. $data = $this->getDbConnection()->createCommand("
  42. select *
  43. from pack_product_task
  44. where school_id={$schoolId} and status=1
  45. order by create_time desc
  46. limit {$offset},{$pageLimit}
  47. ")->queryAll();
  48. $return['pages']=$pages;
  49. $return['dataList']=$data;
  50. return $return;
  51. }
  52. }