123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- <?php
- /**
- * AgentManModel.php UTF-8
- * 渠道结算信息
- *
- * @date : 2018/5/10 17:32
- *
- * @license 这不是一个自由软件,未经授权不许任何使用和传播。
- * @author : wuyonghong <wyh@huosdk.com>
- * @version : HUOSDK 8.0
- */
- namespace huo\model\agent;
- use huo\model\common\CommonModel;
- class AgentManModel extends CommonModel {
- protected $name = 'agent_man';
- /**
- * 获取渠道ID
- *
- * @param int $agent_id
- * @param string $type alipay wxpay bank
- *
- * @return bool|int
- */
- public function getInfoByAgentAndType($agent_id, $type) {
- if (empty($agent_id) || empty($type)) {
- return false;
- }
- $_map['agent_id'] = $agent_id;
- $_map['type'] = $type;
- $_rdata = $this->where($_map)->find();
- if (is_object($_rdata)) {
- $_rdata = $_rdata->toArray();
- }
- return $_rdata;
- }
- /**
- * 获取渠道ID
- *
- * @param int $agent_id
- *
- * @return bool|int
- */
- public function getInfoByAgent($agent_id) {
- if (empty($agent_id)) {
- return false;
- }
- $_map['agent_id'] = $agent_id;
- $_rdata = $this->where($_map)->select();
- if (is_object($_rdata)) {
- $_rdata = $_rdata->toArray();
- }
- return $_rdata;
- }
- /**
- * 添加结算信息
- *
- * @param $data
- *
- * @return bool|string
- */
- public function addData($data) {
- if (empty($data)) {
- return false;
- }
- if ($_obj = self::create($data, true)) {
- return $_obj->id;
- } else {
- return false;
- }
- }
- /**
- * 更新结算信息
- *
- * @param $am_data
- * @param $am_id
- *
- * @return bool
- */
- public function updateData($am_data, $am_id) {
- $_map['id'] = $am_id;
- $_data = $am_data;
- $_rs = self::update($_data, $_map, true);
- if (false == $_rs) {
- return false;
- } else {
- return true;
- }
- }
- }
|