|
@@ -17,167 +17,13 @@ use app\common\model\UserAlipay;
|
|
class Withdraw extends Common
|
|
class Withdraw extends Common
|
|
{
|
|
{
|
|
protected $layout = 'default';
|
|
protected $layout = 'default';
|
|
- protected $noNeedLogin = ['getUserInfoByMobile','bindBank','mobilelogin'];
|
|
|
|
|
|
+ protected $noNeedLogin = [];
|
|
protected $noNeedRight = ['*'];
|
|
protected $noNeedRight = ['*'];
|
|
|
|
|
|
-// /**
|
|
|
|
-// * 余额提现
|
|
|
|
-// * @return string
|
|
|
|
-// */
|
|
|
|
-// public function withdraw()
|
|
|
|
-// {
|
|
|
|
-// $config = get_addon_config('withdraw');
|
|
|
|
-// $this->view->assign('addonConfig', $config);
|
|
|
|
-// $this->view->assign('title', __('Withdraw'));
|
|
|
|
-// return $this->view->fetch();
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// /**
|
|
|
|
-// * 余额日志
|
|
|
|
-// * @return string
|
|
|
|
-// */
|
|
|
|
-// public function withdrawlog()
|
|
|
|
-// {
|
|
|
|
-// $withdrawloglist = \addons\withdraw\model\Withdraw::where(['user_id' => $this->auth->id])
|
|
|
|
-// ->order('id desc')
|
|
|
|
-// ->paginate(10);
|
|
|
|
-//
|
|
|
|
-// $this->view->assign('title', __('Withdraw log'));
|
|
|
|
-// $this->view->assign('withdrawloglist', $withdrawloglist);
|
|
|
|
-// return $this->view->fetch();
|
|
|
|
-// }
|
|
|
|
|
|
|
|
-// /**
|
|
|
|
-// * 创建订单并发起支付请求
|
|
|
|
-// * @throws \think\exception\DbException
|
|
|
|
-// */
|
|
|
|
-// public function submit()
|
|
|
|
-// {
|
|
|
|
-// $money = $this->request->request('money');
|
|
|
|
-// $account = $this->request->request('account');
|
|
|
|
-// $name = $this->request->request('name');
|
|
|
|
-// $type = $this->request->request('type','alipay');
|
|
|
|
-//// $type = 'alipay';
|
|
|
|
-//
|
|
|
|
-//
|
|
|
|
-// if ($money <= 0) {
|
|
|
|
-// $this->error('提现金额不正确');
|
|
|
|
-// }
|
|
|
|
-// if ($money > $this->auth->money) {
|
|
|
|
-// $this->error('提现金额超出可提现额度');
|
|
|
|
-// }
|
|
|
|
-// if (!$account) {
|
|
|
|
-// $this->error("提现账户不能为空");
|
|
|
|
-// }
|
|
|
|
-// if (!$name) {
|
|
|
|
-// $this->error("真实姓名不能为空");
|
|
|
|
-// }
|
|
|
|
-// if (!Validate::is($account, "email") && !Validate::is($account, "/^1\d{10}$/")) {
|
|
|
|
-// $this->error("提现账户只能是手机号或Email");
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// $config = get_addon_config('withdraw');
|
|
|
|
-// if (isset($config['minmoney']) && $money < $config['minmoney']) {
|
|
|
|
-// $this->error('提现金额不能低于' . $config['minmoney'] . '元');
|
|
|
|
-// }
|
|
|
|
-// if ($config['monthlimit']) {
|
|
|
|
-// $count = \addons\withdraw\model\Withdraw::where('user_id', $this->auth->id)->whereTime('createtime', 'month')->count();
|
|
|
|
-// if ($count >= $config['monthlimit']) {
|
|
|
|
-// $this->error("已达到本月最大可提现次数");
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// Db::startTrans();
|
|
|
|
-// try {
|
|
|
|
-// $data = [
|
|
|
|
-// 'orderid' => date("YmdHis") . sprintf("%08d", $this->auth->id) . mt_rand(1000, 9999),
|
|
|
|
-// 'user_id' => $this->auth->id,
|
|
|
|
-// 'money' => $money,
|
|
|
|
-// 'type' => $type,
|
|
|
|
-// 'account' => $account,
|
|
|
|
-// 'name' => $name,
|
|
|
|
-// ];
|
|
|
|
-// \addons\withdraw\model\Withdraw::create($data);
|
|
|
|
-// \app\common\model\User::money(-$money, $this->auth->id, "提现");
|
|
|
|
-// Db::commit();
|
|
|
|
-// } catch (Exception $e) {
|
|
|
|
-// Db::rollback();
|
|
|
|
-// $this->error($e->getMessage());
|
|
|
|
-// }
|
|
|
|
-// $this->success("提现申请成功!请等待后台审核!", url("withdraw/withdrawlog"));
|
|
|
|
-// return;
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// /**
|
|
|
|
-// * 企业支付通知和回调
|
|
|
|
-// * @throws \think\exception\DbException
|
|
|
|
-// */
|
|
|
|
-// public function epay()
|
|
|
|
-// {
|
|
|
|
-// $type = $this->request->param('type');
|
|
|
|
-// $paytype = $this->request->param('paytype');
|
|
|
|
-// if ($type == 'notify') {
|
|
|
|
-// $pay = \addons\epay\library\Service::checkNotify($paytype);
|
|
|
|
-// if (!$pay) {
|
|
|
|
-// echo '签名错误';
|
|
|
|
-// return;
|
|
|
|
-// }
|
|
|
|
-// $data = $pay->verify();
|
|
|
|
-// try {
|
|
|
|
-// $payamount = $paytype == 'alipay' ? $data['total_amount'] : $data['total_fee'] / 100;
|
|
|
|
-// \addons\recharge\model\Order::settle($data['out_trade_no'], $payamount);
|
|
|
|
-// } catch (Exception $e) {
|
|
|
|
-// }
|
|
|
|
-// echo $pay->success();
|
|
|
|
-// } else {
|
|
|
|
-// $pay = \addons\epay\library\Service::checkReturn($paytype);
|
|
|
|
-// if (!$pay) {
|
|
|
|
-// $this->error('签名错误');
|
|
|
|
-// }
|
|
|
|
-// //微信支付没有返回链接
|
|
|
|
-// if ($pay === true) {
|
|
|
|
-// $this->success("请返回网站查看支付状态!", "");
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// //你可以在这里定义你的提示信息,但切记不可在此编写逻辑
|
|
|
|
-// $this->success("恭喜你!充值成功!", url("user/index"));
|
|
|
|
-// }
|
|
|
|
-// return;
|
|
|
|
-// }
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 根据手机号获取用户信息
|
|
|
|
- */
|
|
|
|
- public function getUserInfoByMobile() {
|
|
|
|
- $mobile = $this->request->request('mobile');// 手机号
|
|
|
|
- if(!$mobile) $this->error("请输入手机号!");
|
|
|
|
- $field = "id,u_id,avatar,nickname,mobile";
|
|
|
|
- $userInfo = Db::name('user')->where('mobile',$mobile)->field($field)->find();
|
|
|
|
-
|
|
|
|
- //用户钱包
|
|
|
|
- $userwallet = Db::name('user_wallet')->where('user_id',$userInfo['id'])->find();
|
|
|
|
- $userInfo['money'] = $userwallet['money'];
|
|
|
|
-
|
|
|
|
- $this->success("获取成功!",$userInfo);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 验证身份证号
|
|
|
|
- */
|
|
|
|
- public function validateCard() {
|
|
|
|
- $idcard = $this->request->request('idcard');// 身份证号
|
|
|
|
- if(!$idcard) $this->error("参数缺失!");
|
|
|
|
- // 获取用户信息
|
|
|
|
- $idcardInfo = \app\common\model\UserAuth::where(["user_id"=>$this->auth->id])->value("idcard");
|
|
|
|
- if($idcardInfo === $idcard) {
|
|
|
|
- $this->success("验证成功!");
|
|
|
|
- } else {
|
|
|
|
- $this->error("验证失败!");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
* 绑定银行卡
|
|
* 绑定银行卡
|
|
*/
|
|
*/
|
|
public function bindBank() {
|
|
public function bindBank() {
|
|
@@ -345,33 +191,7 @@ class Withdraw extends Common
|
|
$this->success("获取成功!",$res);
|
|
$this->success("获取成功!",$res);
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * 手机验证码获取用户信息
|
|
|
|
- *
|
|
|
|
- * @param string $mobile 手机号
|
|
|
|
- * @param string $captcha 验证码
|
|
|
|
- */
|
|
|
|
- public function mobilelogin()
|
|
|
|
- {
|
|
|
|
- $mobile = $this->request->request('mobile');
|
|
|
|
- $captcha = $this->request->request('captcha');
|
|
|
|
- if (!$mobile || !$captcha) {
|
|
|
|
- $this->error(__('Invalid parameters'));
|
|
|
|
- }
|
|
|
|
- if (!Validate::regex($mobile, "^1\d{10}$")) {
|
|
|
|
- $this->error(__('Mobile is incorrect'));
|
|
|
|
- }
|
|
|
|
- if (!Sms::check($mobile, $captcha, 'mobilelogin')) {
|
|
|
|
- $this->error(__('Captcha is incorrect'));
|
|
|
|
- }
|
|
|
|
- $user = \app\common\model\User::getByMobile($mobile,"u_id,is_auth");
|
|
|
|
- if ($user) {
|
|
|
|
- Sms::flush($mobile, 'mobilelogin');
|
|
|
|
- $this->success("获取成功!",$user);
|
|
|
|
- } else {
|
|
|
|
- $this->error("没有查询到用户信息!请前往app注册!");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
public function getEncryptPassword($password, $salt = '')
|
|
public function getEncryptPassword($password, $salt = '')
|
|
{
|
|
{
|
|
return md5(md5($password) . $salt);
|
|
return md5(md5($password) . $salt);
|