pay_deposit.class.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. class pay_deposit {
  3. public function __construct() {
  4. $this->pay_db = pc_base::load_model('pay_payment_model');
  5. $this->account_db = pc_base::load_model('pay_account_model');
  6. }
  7. /**
  8. * 生成流水记录
  9. * @param unknown_type
  10. */
  11. public function set_record($data){
  12. $require_items = array('userid','username','email','contactname','telephone','trade_sn','money','quantity','addtime','paytime','usernote','usernote','pay_type','pay_id','payment','ip','status');
  13. if(is_array($data)) {
  14. foreach($data as $key=>$item) {
  15. if(in_array($key,$require_items)) $info[$key] = $item;
  16. }
  17. } else {
  18. return false;
  19. }
  20. $trade_exist = $this->account_db->get_one(array('trade_sn'=>$info['trade_sn']));
  21. if($trade_exist) return $trade_exist['id'];
  22. $this->account_db->insert($info);
  23. return $this->account_db->insert_id();
  24. }
  25. /**
  26. * 获取流水记录
  27. * @param init $id 流水帐号
  28. */
  29. public function get_record($id) {
  30. $id = intval($id);
  31. $result = array();
  32. $result = $this->account_db->get_one(array('id'=>$id));
  33. $status_arr = array('succ','failed','error','timeout','cancel');
  34. return ($result && !in_array($result['status'],$status_arr)) ? $result: false;
  35. }
  36. /**
  37. * 获取充值方式信息
  38. * @param unknown_type $pay_id
  39. * @return unknown
  40. */
  41. public function get_payment($pay_id) {
  42. $pay_id = intval($pay_id);
  43. $result = array();
  44. $result = $this->pay_db->get_one(array('pay_id'=>$pay_id));
  45. return $result;
  46. }
  47. /**
  48. * 获取充值类型
  49. */
  50. public function get_paytype() {
  51. $result = $this->pay_db->select('','pay_id,name,pay_name,pay_code,pay_desc','','pay_order DESC,pay_id DESC');
  52. $info = array();
  53. foreach($result as $r) {
  54. $info[] = $r;
  55. }
  56. return $info;
  57. }
  58. }
  59. ?>