feat: 修改了用户提现和余额相关的API
This commit is contained in:
parent
4c6d4ff7c9
commit
5a602cc59a
@ -33,7 +33,7 @@ class ProductController extends BaseApiController{
|
|||||||
$this->request->__set('store_id',$store_id);
|
$this->request->__set('store_id',$store_id);
|
||||||
return $this->dataLists(new StoreProductLists());
|
return $this->dataLists(new StoreProductLists());
|
||||||
}else{
|
}else{
|
||||||
return $this->dataLists();
|
return $this->data(['lists'=>[]]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ use app\api\service\UserTokenService;
|
|||||||
use app\api\validate\UserValidate;
|
use app\api\validate\UserValidate;
|
||||||
use app\common\enum\PayEnum;
|
use app\common\enum\PayEnum;
|
||||||
use app\common\logic\PaymentLogic;
|
use app\common\logic\PaymentLogic;
|
||||||
|
use app\common\model\store_extract\StoreExtract;
|
||||||
use app\common\model\user\User;
|
use app\common\model\user\User;
|
||||||
use app\common\model\user\UserAddress;
|
use app\common\model\user\UserAddress;
|
||||||
use app\common\model\user_ship\UserShip;
|
use app\common\model\user_ship\UserShip;
|
||||||
@ -67,7 +68,6 @@ class UserController extends BaseApiController
|
|||||||
public function info()
|
public function info()
|
||||||
{
|
{
|
||||||
return $this->success('success', UserLogic::info($this->userId));
|
return $this->success('success', UserLogic::info($this->userId));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// #[
|
// #[
|
||||||
@ -168,7 +168,6 @@ class UserController extends BaseApiController
|
|||||||
return $this->success('发送成功');
|
return $this->success('发送成功');
|
||||||
}
|
}
|
||||||
return $this->fail('发送失败');
|
return $this->fail('发送失败');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//报备
|
//报备
|
||||||
@ -180,7 +179,6 @@ class UserController extends BaseApiController
|
|||||||
return $this->success('发送成功', [], 1, 1);
|
return $this->success('发送成功', [], 1, 1);
|
||||||
}
|
}
|
||||||
return $this->fail('发送失败');
|
return $this->fail('发送失败');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -245,7 +243,6 @@ class UserController extends BaseApiController
|
|||||||
'get_number' => $GetNumber
|
'get_number' => $GetNumber
|
||||||
];
|
];
|
||||||
return $this->success('ok', $res);
|
return $this->success('ok', $res);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -260,13 +257,13 @@ class UserController extends BaseApiController
|
|||||||
} else {
|
} else {
|
||||||
return $this->dataLists(new UserSignLogLists());
|
return $this->dataLists(new UserSignLogLists());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户信息
|
* 用户信息
|
||||||
*/
|
*/
|
||||||
public function other_user_info(){
|
public function other_user_info()
|
||||||
|
{
|
||||||
$mobile = $this->request->get('mobile');
|
$mobile = $this->request->get('mobile');
|
||||||
if ($mobile) {
|
if ($mobile) {
|
||||||
$user = User::where('mobile', $mobile)->field('id,avatar,real_name,nickname,mobile,user_ship,purchase_funds,label_id')->find();
|
$user = User::where('mobile', $mobile)->field('id,avatar,real_name,nickname,mobile,user_ship,purchase_funds,label_id')->find();
|
||||||
@ -290,4 +287,64 @@ class UserController extends BaseApiController
|
|||||||
return $this->success('ok', []);
|
return $this->success('ok', []);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提现信息
|
||||||
|
*/
|
||||||
|
public function cash_info()
|
||||||
|
{
|
||||||
|
$info = User::where('id', $this->userId)->field('id,now_money')->find();
|
||||||
|
$info['notes'] = '提现金额需大于1元,提现到微信零钱,并财务审核,审核通过后,提现金额将自动到账';
|
||||||
|
return $this->data($info);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提交提现申请
|
||||||
|
*/
|
||||||
|
public function cash_application()
|
||||||
|
{
|
||||||
|
$money = $this->request->post('money');
|
||||||
|
$find = User::where('id', $this->userId)->find();
|
||||||
|
if ($find &&$money > $find['now_money']) {
|
||||||
|
return $this->fail('提现金额不能大于余额');
|
||||||
|
}
|
||||||
|
if ($money < 1) {
|
||||||
|
return $this->fail('提现金额不能小于1元');
|
||||||
|
}
|
||||||
|
$data['uid'] = $this->userId;
|
||||||
|
$data['create_time'] = time();
|
||||||
|
$data['status'] = 0;
|
||||||
|
$data['extract_price'] =$money;
|
||||||
|
$data['balance'] =bcsub($find['now_money'],$money,2);
|
||||||
|
$data['before_balance'] =$find['now_money'];
|
||||||
|
$data['extract_type'] = 'wx';
|
||||||
|
$res = StoreExtract::create($data);
|
||||||
|
if ($res) {
|
||||||
|
User::where('id', $this->userId)->dec('now_money', $money)->update();
|
||||||
|
return $this->success('申请成功,等待审核');
|
||||||
|
} else {
|
||||||
|
return $this->success('申请失败');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提现申请记录
|
||||||
|
*/
|
||||||
|
public function cash_record()
|
||||||
|
{
|
||||||
|
$list = StoreExtract::where('uid', $this->userId)->order('id desc')
|
||||||
|
->field('id,extract_price price,status,pay_status,create_time')
|
||||||
|
->select()->each(function ($item) {
|
||||||
|
if($item->status==-1){
|
||||||
|
$item->status_name='未通过';
|
||||||
|
}elseif($item->status==0){
|
||||||
|
$item->status_name='审核中';
|
||||||
|
}elseif($item->status==1){
|
||||||
|
$item->status_name='已通过';
|
||||||
|
}
|
||||||
|
$item->title='申请提现'.$item->price.'元';
|
||||||
|
$item->pay_status_name=$item->status==1?'已打款':'未打款';
|
||||||
|
|
||||||
|
})->toArray();
|
||||||
|
return $this->data($list);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -129,6 +129,8 @@ class UserLogic extends BaseLogic
|
|||||||
$share_name=SystemStore::where('id',4)->value('abbreviation');
|
$share_name=SystemStore::where('id',4)->value('abbreviation');
|
||||||
}
|
}
|
||||||
$data['share_name']= $share_name.'No.'.preg_replace('/4/','*', $data['id']);
|
$data['share_name']= $share_name.'No.'.preg_replace('/4/','*', $data['id']);
|
||||||
|
|
||||||
|
$data['system_store_id']=SystemStoreStaff::where('uid',$uid)->value('store_id');
|
||||||
}else{
|
}else{
|
||||||
$data = [];
|
$data = [];
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user