AgentManModel.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <?php
  2. /**
  3. * AgentManModel.php UTF-8
  4. * 渠道结算信息
  5. *
  6. * @date : 2018/5/10 17:32
  7. *
  8. * @license 这不是一个自由软件,未经授权不许任何使用和传播。
  9. * @author : wuyonghong <wyh@huosdk.com>
  10. * @version : HUOSDK 8.0
  11. */
  12. namespace huo\model\agent;
  13. use huo\model\common\CommonModel;
  14. class AgentManModel extends CommonModel {
  15. protected $name = 'agent_man';
  16. /**
  17. * 获取渠道ID
  18. *
  19. * @param int $agent_id
  20. * @param string $type alipay wxpay bank
  21. *
  22. * @return bool|int
  23. */
  24. public function getInfoByAgentAndType($agent_id, $type) {
  25. if (empty($agent_id) || empty($type)) {
  26. return false;
  27. }
  28. $_map['agent_id'] = $agent_id;
  29. $_map['type'] = $type;
  30. $_rdata = $this->where($_map)->find();
  31. if (is_object($_rdata)) {
  32. $_rdata = $_rdata->toArray();
  33. }
  34. return $_rdata;
  35. }
  36. /**
  37. * 获取渠道ID
  38. *
  39. * @param int $agent_id
  40. *
  41. * @return bool|int
  42. */
  43. public function getInfoByAgent($agent_id) {
  44. if (empty($agent_id)) {
  45. return false;
  46. }
  47. $_map['agent_id'] = $agent_id;
  48. $_rdata = $this->where($_map)->select();
  49. if (is_object($_rdata)) {
  50. $_rdata = $_rdata->toArray();
  51. }
  52. return $_rdata;
  53. }
  54. /**
  55. * 添加结算信息
  56. *
  57. * @param $data
  58. *
  59. * @return bool|string
  60. */
  61. public function addData($data) {
  62. if (empty($data)) {
  63. return false;
  64. }
  65. if ($_obj = self::create($data, true)) {
  66. return $_obj->id;
  67. } else {
  68. return false;
  69. }
  70. }
  71. /**
  72. * 更新结算信息
  73. *
  74. * @param $am_data
  75. * @param $am_id
  76. *
  77. * @return bool
  78. */
  79. public function updateData($am_data, $am_id) {
  80. $_map['id'] = $am_id;
  81. $_data = $am_data;
  82. $_rs = self::update($_data, $_map, true);
  83. if (false == $_rs) {
  84. return false;
  85. } else {
  86. return true;
  87. }
  88. }
  89. }