123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- <?php
- // +----------------------------------------------------------------------
- // | Niucloud-admin 企业快速开发的saas管理平台
- // +----------------------------------------------------------------------
- // | 官方网址:https://www.niucloud.com
- // +----------------------------------------------------------------------
- // | niucloud团队 版权所有 开源版本可自由商用
- // +----------------------------------------------------------------------
- // | Author: Niucloud Team
- // +----------------------------------------------------------------------
- namespace app\service\api\member;
- use app\model\member\MemberCashOutAccount;
- use core\base\BaseApiService;
- /**
- * 会员提现账户服务层
- */
- class MemberCashOutAccountService extends BaseApiService
- {
- public function __construct()
- {
- parent::__construct();
- $this->model = new MemberCashOutAccount();
- }
- /**
- * 会员提现账户列表
- * @param array $where
- * @return array
- */
- public function getPage(array $where = [])
- {
- $where['member_id'] = $this->member_id;
- $field = 'account_id,member_id,account_type,bank_name,realname,account_no';
- $search_model = $this->model->where($where)->field($field)->order('create_time desc');
- return $this->pageQuery($search_model);
- }
- /**
- * 提现账户详情
- * @param int $account_id
- * @return array
- */
- public function getInfo(int $account_id)
- {
- $field = 'account_id,member_id,account_type,bank_name,realname,account_no, transfer_payment_code';
- return $this->model->where([['account_id', '=', $account_id], ['member_id', '=', $this->member_id]])->field($field)->findOrEmpty()->toArray();
- }
- /**
- * 获取首条信息
- * @param array $where
- * @param string $order_field
- * @param string $order
- * @return array
- */
- public function getFirstInfo(array $where, $order_field = 'create_time', string $order = 'desc'){
- $where[] = ['member_id', '=', $this->member_id];
- $field = 'account_id,member_id,account_type,bank_name,realname,account_no';
- return $this->model->where($where)->order($order_field, $order)->field($field)->findOrEmpty()->toArray();
- }
- /**
- * 添加提现账号
- * @param array $data
- * @return int
- */
- public function add(array $data)
- {
- $data['member_id'] = $this->member_id;
- $data['create_time'] = time();
- $res = $this->model->create($data);
- return $res->account_id;
- }
- /**
- * 修改提现账户
- * @param int $account_id
- * @param array $data
- * @return true
- */
- public function edit(int $account_id, array $data)
- {
- $data['update_time'] = time();
- $this->model->update($data, [ [ 'member_id', '=', $this->member_id ], ['account_id', '=', $account_id] ]);
- return true;
- }
- /**
- * 删除
- * @param int $account_id
- * @return true
- */
- public function del(int $account_id)
- {
- $where = [
- ['member_id', '=', $this->member_id],
- ['account_id', '=', $account_id]
- ];
- $this->model->where($where)->delete();
- return true;
- }
- }
|