CMSOrderPay.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. /**
  3. * Created by 上海互教教育科技有限公司.
  4. * User: 刘红伟
  5. * Date: 2016/7/19
  6. * Email: 454303753@qq.com
  7. * File:CMSOrder.php
  8. */
  9. class CMSOrderPay extends CActiveRecord{
  10. public function getDbConnection() {
  11. return Yii::app()->db251;
  12. }
  13. public static function model($className = __CLASS__){
  14. return parent::model($className);
  15. }
  16. public function tableName(){
  17. return "order_pay";
  18. }
  19. public function primaryKey(){
  20. return array('id');
  21. }
  22. public function getPageList($school_id){
  23. $data = array();
  24. $criteria = new CDbCriteria();
  25. $criteria->select = 't.*,t2.pay_money,t2.pay_time';
  26. $criteria->join = ' join order_pay t2 on t.id=t2.order_id'; //连接表
  27. $criteria->addCondition('t.school_id=:school_id');
  28. $criteria->params[':school_id'] = $school_id;
  29. $total = $this->count($criteria);
  30. $pager = new CPagination($total);
  31. $criteria->order = 't.id desc';
  32. $pager->pageSize = 12;
  33. $pager->applyLimit($criteria);
  34. $data['result'] = $this->findAll($criteria);
  35. $data['page'] = $pager;
  36. $data['page_total'] = $total;
  37. return $data;
  38. }
  39. public function getPageByOrderIdList($school_id,$order_ids=array(),$status=-1){
  40. $data = array();
  41. $criteria = new CDbCriteria();
  42. $criteria->addCondition('school_id=:school_id');
  43. $criteria->params[':school_id'] = $school_id;
  44. if($order_ids)
  45. {
  46. $criteria->addInCondition('id',$order_ids);
  47. }
  48. if($status>-1)
  49. {
  50. $criteria->addCondition('status=:status');
  51. $criteria->params[':status'] = $status;
  52. }
  53. $total = $this->count($criteria);
  54. $pager = new CPagination($total);
  55. $criteria->order = 'id desc';
  56. $pager->pageSize = 12;
  57. $pager->applyLimit($criteria);
  58. $data['result'] = $this->findAll($criteria);
  59. $data['page'] = $pager;
  60. $data['page_total'] = $total;
  61. return $data;
  62. }
  63. public function getOrderPay($order_ids=array(),$status=1){
  64. $criteria = new CDbCriteria();
  65. if($order_ids)
  66. {
  67. $criteria->addInCondition('order_id',$order_ids);
  68. }
  69. // $criteria->addCondition('order_id',$order_ids);
  70. return $this->findAll($criteria);
  71. }
  72. }