You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
1.9 KiB

<?php
namespace app\base\logic\user;
use app\base\model\user\UserAlipay;
use think\App;
class Alipay extends Base
{
/**
* 获取用户支付宝信息
* @date 2022-12-27
*/
public function getAlipay()
{
$alipay_model = new UserAlipay();
// 获取用户信息
$alipay = $alipay_model->getOneData([
['user_id', '=', $this->userId]
], 'id,user_id,account,name');
// 为空时重新组合数组
if (empty($alipay)) {
$alipay = [
'id' => '',
'account' => '',
'name' => ''
];
}
return sendSuccessArray([
// 支付宝信息
'alipay' => $alipay
]);
}
/**
* 更新用户支付宝信息
* @param string $param['account'] 支付宝账号
* @param string $param['name'] 支付宝姓名
* @date 2021-10-29
*/
public function updateAlipay($param)
{
$alipay_model = new UserAlipay();
// gengxin信息
$data = [
'uid' => $this->mid,
'user_agent' => $this->userAgent,
'user_id' => $this->userId,
'account' => $param['account'],
'name' => $param['name']
];
$res = $alipay_model->updateInfo($data);
if (!$res) {
return sendErrorArray(3001, '更新用户支付宝信息失败');
}
return sendSuccessArray([], '信息保存成功');
}
/**
* 是否绑定支付宝
* @date 2022-03-02
*/
public function isBindAliPay()
{
$alipay_model = new UserAlipay();
// 是否绑定支付宝 0--未绑定 1--已绑定
$is_bind_ali_pay = $alipay_model->isBindAliPay();
return sendSuccessArray([
// 是否绑定支付宝
'is_bind_ali_pay' => $is_bind_ali_pay
]);
}
}