payment.model.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. /**
  3. * 支付方式
  4. *
  5. *
  6. *
  7. *
  8. */
  9. defined('InShopNC') or exit('Access Invalid!');
  10. class paymentModel extends Model {
  11. /**
  12. * 开启状态标识
  13. * @var unknown
  14. */
  15. const STATE_OPEN = 1;
  16. public function __construct() {
  17. parent::__construct('payment');
  18. }
  19. /**
  20. * 读取单行信息
  21. *
  22. * @param
  23. * @return array 数组格式的返回结果
  24. */
  25. public function getPaymentInfo($condition = array()) {
  26. return $this->where($condition)->find();
  27. }
  28. /**
  29. * 读开启中的取单行信息
  30. *
  31. * @param
  32. * @return array 数组格式的返回结果
  33. */
  34. public function getPaymentOpenInfo($condition = array()) {
  35. $condition['payment_state'] = self::STATE_OPEN;
  36. return $this->where($condition)->find();
  37. }
  38. /**
  39. * 读取多行
  40. *
  41. * @param
  42. * @return array 数组格式的返回结果
  43. */
  44. public function getPaymentList($condition = array()){
  45. return $this->where($condition)->select();
  46. }
  47. /**
  48. * 读取开启中的支付方式
  49. *
  50. * @param
  51. * @return array 数组格式的返回结果
  52. */
  53. public function getPaymentOpenList($condition = array()){
  54. $condition['payment_state'] = self::STATE_OPEN;
  55. return $this->where($condition)->key('payment_code')->select();
  56. }
  57. /**
  58. * 更新信息
  59. *
  60. * @param array $param 更新数据
  61. * @return bool 布尔类型的返回结果
  62. */
  63. public function editPayment($data, $condition){
  64. return $this->where($condition)->update($data);
  65. }
  66. /**
  67. * 读取支付方式信息by Condition
  68. *
  69. * @param
  70. * @return array 数组格式的返回结果
  71. */
  72. public function getRowByCondition($conditionfield,$conditionvalue){
  73. $param = array();
  74. $param['table'] = 'payment';
  75. $param['field'] = $conditionfield;
  76. $param['value'] = $conditionvalue;
  77. $result = Db::getRow($param);
  78. return $result;
  79. }
  80. }