初始化代码
This commit is contained in:
71
application/api/controller/Pay.php
Normal file
71
application/api/controller/Pay.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use think\Controller;
|
||||
|
||||
class Pay extends Common
|
||||
{
|
||||
//充值可选金额列表
|
||||
public function get_can_recharge_list()
|
||||
{
|
||||
$reslut = model('CanRecharge')->get_can_recharge_list();
|
||||
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
//用户充值
|
||||
public function create_pay_order()
|
||||
{
|
||||
$crid = input('crid', 0);
|
||||
$pay_type = input('pay_type', 0); //1支付宝 2微信
|
||||
$custom_amount = input('custom_amount', 0); //自定义充值金额
|
||||
$key_name = "api:pay:create_pay_order:uid:".$this->uid;
|
||||
redis_lock_exit($key_name);
|
||||
$reslut = model('UserRecharge')->create_pay_order($this->uid, $crid, $pay_type, $custom_amount);
|
||||
redis_unlock($key_name);
|
||||
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
//购买会员
|
||||
public function pay_vip_order(){
|
||||
$uid = $this->uid;
|
||||
$pay_type = input('pay_type', 0);
|
||||
$vid = input('vid', 0);
|
||||
$key_name = "api:pay:pay_vip_order:uid:".$this->uid;
|
||||
redis_lock_exit($key_name);
|
||||
// $reslut = model('UserRecharge')->pay_vip_order($uid, $vid, $pay_type);
|
||||
$reslut = model('Vip')->pay_vip_order($uid, $vid);
|
||||
redis_unlock($key_name);
|
||||
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
//更换邀请人
|
||||
public function update_user_inviter(){
|
||||
$uid = $this->uid;
|
||||
$user_id = input('user_id', 0);
|
||||
$pay_type = input('pay_type', 0);
|
||||
$sms_code = input('sms_code', '');
|
||||
$key_name = "api:pay:update_user_inviter:uid:".$this->uid;
|
||||
redis_lock_exit($key_name);
|
||||
// $reslut = model('UserRecharge')->update_user_inviter($uid, $user_id, $sms_code, $pay_type);
|
||||
$reslut = model('Vip')->update_user_inviter($uid, $user_id, $sms_code);
|
||||
redis_unlock($key_name);
|
||||
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
|
||||
}
|
||||
|
||||
//购买爵位
|
||||
public function pay_nobility()
|
||||
{
|
||||
$uid = $this->uid;
|
||||
$pay_type = input('pay_type', 0);
|
||||
$lid = input('lid', 0);
|
||||
$key_name = "api:pay:pay_vip_order:uid:".$this->uid;
|
||||
redis_lock_exit($key_name);
|
||||
// $reslut = model('UserRecharge')->pay_vip_order($uid, $vid, $pay_type);
|
||||
$reslut = model('UserRecharge')->pay_nobility_order($uid, $lid, $pay_type);
|
||||
redis_unlock($key_name);
|
||||
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user