feat: 增加用户余额和购买资金字段,优化支付通知逻辑,限制充值会员不能前端设置

This commit is contained in:
mkm 2024-06-15 16:07:50 +08:00
parent 98683fcc52
commit bfbd01fcc1
3 changed files with 16 additions and 4 deletions

View File

@ -15,6 +15,7 @@ namespace app\admin\logic\user;
use app\common\enum\user\UserTerminalEnum;
use app\common\logic\BaseLogic;
use app\common\model\store_finance_flow\StoreFinanceFlow;
use app\common\model\user\User;
use app\common\model\user\UserAddress;
use app\common\model\user\UserRecharge;
@ -148,7 +149,7 @@ class UserLogic extends BaseLogic
{
$field = [
'id', 'account', 'nickname', 'avatar', 'real_name',
'sex', 'mobile', 'create_time', 'login_time', 'channel'
'sex', 'mobile', 'create_time', 'login_time', 'channel','now_money','purchase_funds'
];
$user = User::where(['id' => $userId])->field($field)
@ -156,6 +157,7 @@ class UserLogic extends BaseLogic
$user['channel'] = UserTerminalEnum::getTermInalDesc($user['channel']);
$user->sex = $user->getData('sex');
$user['number']=StoreFinanceFlow::where('other_uid',$userId)->where(['status'=>0,'financial_pm'=>1,'type'=>1])->sum('number');
return $user->toArray();
}

View File

@ -212,7 +212,7 @@ class PayNotifyLogic extends BaseLogic
bcscale(2);
// $user->now_money = bcadd($user->now_money, $price, 2);//v.1
//更新等级
if ($price >= 1000) {
if ($price >= 0.01) {
$user->user_ship = 1; //v.1
}
$user->purchase_funds = bcadd($user->purchase_funds, $price, 2);

View File

@ -8,7 +8,7 @@ use app\store\controller\BaseAdminController;
use app\store\lists\user\UserLists;
use app\admin\logic\user\UserLogic;
use app\admin\validate\user\UserValidate;
use app\common\model\user\User;
class UserController extends BaseAdminController
{
@ -22,7 +22,7 @@ class UserController extends BaseAdminController
public function add()
{
$params = (new UserValidate())->post()->goCheck('storeAdd');
$result = UserLogic::StoreAdd($params);
UserLogic::StoreAdd($params);
if (UserLogic::hasError() ) {
return $this->fail(UserLogic::getError());
}
@ -37,4 +37,14 @@ class UserController extends BaseAdminController
return $this->success('', $detail);
}
public function user_ship(){
$user_ship=$this->request->post('user_ship',0);
$id=$this->request->post('id',0);
if($user_ship==1){
return $this->fail('充值会员不能前端设置');
}
User::where('id',$id)->update(['user_ship'=>$user_ship]);
return $this->success('设置成功');
}
}