feat(user): 新增设置采购款和余额功能
- 在 UserController 中添加 setPurchaseFunds 和 setnowMoney 方法 - 在 UserLogic 中实现 PurchaseFunds 和 nowMoney 方法 - 更新 CapitalFlowLogic 以支持新的资金变动类型
This commit is contained in:
parent
36c1c45415
commit
e6e2cc78c3
@ -23,7 +23,7 @@ class UserController extends BaseAdminController
|
|||||||
return $this->dataLists(new UserLists());
|
return $this->dataLists(new UserLists());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notes 添加用户列表
|
* @notes 添加用户列表
|
||||||
* @return \think\response\Json
|
* @return \think\response\Json
|
||||||
* @author likeadmin
|
* @author likeadmin
|
||||||
@ -61,17 +61,17 @@ class UserController extends BaseAdminController
|
|||||||
{
|
{
|
||||||
// $params = (new UserValidate())->post()->goCheck('edit');
|
// $params = (new UserValidate())->post()->goCheck('edit');
|
||||||
$params = $this->request->post();
|
$params = $this->request->post();
|
||||||
$result = UserLogic::edit($params);
|
$result = UserLogic::edit($params);
|
||||||
if (true === $result) {
|
if (true === $result) {
|
||||||
return $this->success('编辑成功', [], 1, 1);
|
return $this->success('编辑成功', [], 1, 1);
|
||||||
}
|
}
|
||||||
return $this->fail(UserLogic::getError());
|
return $this->fail(UserLogic::getError());
|
||||||
}
|
}
|
||||||
|
|
||||||
//采购款明细、余额明细、礼品券明细、返还金明细
|
//采购款明细、余额明细、礼品券明细、返还金明细
|
||||||
public function fundList()
|
public function fundList()
|
||||||
{
|
{
|
||||||
(new UserValidate())->get()->goCheck('fund');
|
(new UserValidate())->get()->goCheck('fund');
|
||||||
$page_no = (int)$this->request->get('page_no', 1);
|
$page_no = (int)$this->request->get('page_no', 1);
|
||||||
$page_size = (int)$this->request->get('page_size', 15);
|
$page_size = (int)$this->request->get('page_size', 15);
|
||||||
$params = $this->request->get();
|
$params = $this->request->get();
|
||||||
@ -81,7 +81,6 @@ class UserController extends BaseAdminController
|
|||||||
$res['page_no'] = $params['page_no'];
|
$res['page_no'] = $params['page_no'];
|
||||||
$res['page_size'] = $params['page_size'];
|
$res['page_size'] = $params['page_size'];
|
||||||
return $this->success('ok', $res);
|
return $this->success('ok', $res);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -91,7 +90,6 @@ class UserController extends BaseAdminController
|
|||||||
public function userSing()
|
public function userSing()
|
||||||
{
|
{
|
||||||
return $this->dataLists(new UserSignLogLists());
|
return $this->dataLists(new UserSignLogLists());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -107,10 +105,24 @@ class UserController extends BaseAdminController
|
|||||||
$params['page_no'] = $page_no > 0 ? $page_no : 1;
|
$params['page_no'] = $page_no > 0 ? $page_no : 1;
|
||||||
$params['page_size'] = $page_size > 0 ? $page_size : 15;
|
$params['page_size'] = $page_size > 0 ? $page_size : 15;
|
||||||
$uid = $uid['id'];
|
$uid = $uid['id'];
|
||||||
$res = UserLogic::giftList($uid,$params);
|
$res = UserLogic::giftList($uid, $params);
|
||||||
$res['page_no'] = $params['page_no'];
|
$res['page_no'] = $params['page_no'];
|
||||||
$res['page_size'] = $params['page_size'];
|
$res['page_size'] = $params['page_size'];
|
||||||
return $this->success('ok', $res);
|
return $this->success('ok', $res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//设置采购款
|
||||||
|
public function setPurchaseFunds()
|
||||||
|
{
|
||||||
|
$params = $this->request->post();
|
||||||
|
$res = UserLogic::PurchaseFunds($params);
|
||||||
|
return $this->success( '设置成功',[],1,1);
|
||||||
|
}
|
||||||
|
//设置余额
|
||||||
|
public function setnowMoney()
|
||||||
|
{
|
||||||
|
$params = $this->request->post();
|
||||||
|
$res = UserLogic::nowMoney($params);
|
||||||
|
return $this->success( '设置成功',[],1,1);
|
||||||
|
}
|
||||||
}
|
}
|
@ -17,6 +17,7 @@ use app\common\enum\OrderEnum;
|
|||||||
use app\common\enum\user\UserTerminalEnum;
|
use app\common\enum\user\UserTerminalEnum;
|
||||||
use app\common\enum\YesNoEnum;
|
use app\common\enum\YesNoEnum;
|
||||||
use app\common\logic\BaseLogic;
|
use app\common\logic\BaseLogic;
|
||||||
|
use app\common\logic\CapitalFlowLogic;
|
||||||
use app\common\model\finance\CapitalFlow;
|
use app\common\model\finance\CapitalFlow;
|
||||||
use app\common\model\store_finance_flow\StoreFinanceFlow;
|
use app\common\model\store_finance_flow\StoreFinanceFlow;
|
||||||
use app\common\model\store_order\StoreOrder;
|
use app\common\model\store_order\StoreOrder;
|
||||||
@ -57,7 +58,7 @@ class UserLogic extends BaseLogic
|
|||||||
|
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
$res=User::create([
|
$res = User::create([
|
||||||
'avatar' => $avatar,
|
'avatar' => $avatar,
|
||||||
'real_name' => $params['real_name'],
|
'real_name' => $params['real_name'],
|
||||||
'nickname' => $params['nickname'],
|
'nickname' => $params['nickname'],
|
||||||
@ -78,21 +79,21 @@ class UserLogic extends BaseLogic
|
|||||||
|
|
||||||
public static function checkAddress(array $params)
|
public static function checkAddress(array $params)
|
||||||
{
|
{
|
||||||
$user_ship=$params['user_ship']??0;
|
$user_ship = $params['user_ship'] ?? 0;
|
||||||
if($user_ship==2){
|
if ($user_ship == 2) {
|
||||||
if(!isset($params['village'])){
|
if (!isset($params['village'])) {
|
||||||
throw new BusinessException('请设置村参数');
|
throw new BusinessException('请设置村参数');
|
||||||
}
|
}
|
||||||
$arr=User::where('user_ship',$user_ship)->alias('user')->join('user_address address','user.id=address.uid and village='.$params['village'])->find();
|
$arr = User::where('user_ship', $user_ship)->alias('user')->join('user_address address', 'user.id=address.uid and village=' . $params['village'])->find();
|
||||||
if ($arr) {
|
if ($arr) {
|
||||||
throw new BusinessException('该区域已有村长请重新选择');
|
throw new BusinessException('该区域已有村长请重新选择');
|
||||||
}
|
}
|
||||||
}elseif($user_ship==3){
|
} elseif ($user_ship == 3) {
|
||||||
if(!isset($params['brigade'])){
|
if (!isset($params['brigade'])) {
|
||||||
throw new BusinessException('请设置队参数');
|
throw new BusinessException('请设置队参数');
|
||||||
}
|
}
|
||||||
$arr=User::where('user_ship',$user_ship)->alias('user')->join('user_address address','user.id=address.uid and village='.$params['village'] .' and brigade='.$params['brigade'])->find();
|
$arr = User::where('user_ship', $user_ship)->alias('user')->join('user_address address', 'user.id=address.uid and village=' . $params['village'] . ' and brigade=' . $params['brigade'])->find();
|
||||||
if($arr){
|
if ($arr) {
|
||||||
throw new BusinessException('该区域已有队长请重新选择');
|
throw new BusinessException('该区域已有队长请重新选择');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -107,37 +108,37 @@ class UserLogic extends BaseLogic
|
|||||||
$avatar = !empty($params['avatar']) ? FileService::setFileUrl($params['avatar']) : $defaultAvatar;
|
$avatar = !empty($params['avatar']) ? FileService::setFileUrl($params['avatar']) : $defaultAvatar;
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
$data=[
|
$data = [
|
||||||
'avatar' => $avatar,
|
'avatar' => $avatar,
|
||||||
'real_name' => $params['real_name']??"",
|
'real_name' => $params['real_name'] ?? "",
|
||||||
'nickname' => '用户'.time(),
|
'nickname' => '用户' . time(),
|
||||||
'account' => $params['mobile'],
|
'account' => $params['mobile'],
|
||||||
'password' => $password,
|
'password' => $password,
|
||||||
'mobile' => $params['mobile'],
|
'mobile' => $params['mobile'],
|
||||||
'label_id' => $params['label_id']??0,
|
'label_id' => $params['label_id'] ?? 0,
|
||||||
'store_id' => $params['store_id']??0,
|
'store_id' => $params['store_id'] ?? 0,
|
||||||
];
|
];
|
||||||
if(isset($params['user_ship']) &&$params['user_ship']==4){
|
if (isset($params['user_ship']) && $params['user_ship'] == 4) {
|
||||||
$data['user_ship']=4;
|
$data['user_ship'] = 4;
|
||||||
}
|
}
|
||||||
$res=User::create($data);
|
$res = User::create($data);
|
||||||
UserCreateLog::create([
|
UserCreateLog::create([
|
||||||
'uid' => $res['id'],
|
'uid' => $res['id'],
|
||||||
'create_uid' => $params['create_uid']??0,
|
'create_uid' => $params['create_uid'] ?? 0,
|
||||||
'store_id' => $params['store_id']??0,
|
'store_id' => $params['store_id'] ?? 0,
|
||||||
'staff_id' => $params['staff_id']??0,
|
'staff_id' => $params['staff_id'] ?? 0,
|
||||||
'user_ship' => $data['user_ship']??0,
|
'user_ship' => $data['user_ship'] ?? 0,
|
||||||
]);
|
]);
|
||||||
UserAddress::create([
|
UserAddress::create([
|
||||||
'uid' => $res['id'],
|
'uid' => $res['id'],
|
||||||
'real_name' => $params['real_name']??"",
|
'real_name' => $params['real_name'] ?? "",
|
||||||
'mobile' => $params['mobile']??'',
|
'mobile' => $params['mobile'] ?? '',
|
||||||
'province' => $params['province']??'',
|
'province' => $params['province'] ?? '',
|
||||||
'city' => $params['city']??'',
|
'city' => $params['city'] ?? '',
|
||||||
'area' => $params['area']??'',
|
'area' => $params['area'] ?? '',
|
||||||
'street' => $params['street']??'',
|
'street' => $params['street'] ?? '',
|
||||||
'village' => $params['village']??'',
|
'village' => $params['village'] ?? '',
|
||||||
'brigade' => $params['brigade']??'',
|
'brigade' => $params['brigade'] ?? '',
|
||||||
'is_default' => 1,
|
'is_default' => 1,
|
||||||
]);
|
]);
|
||||||
Db::commit();
|
Db::commit();
|
||||||
@ -167,7 +168,7 @@ class UserLogic extends BaseLogic
|
|||||||
// 'mobile' => $params['mobile'] ?? '',
|
// 'mobile' => $params['mobile'] ?? '',
|
||||||
// 'sex' => $params['sex'] ?? 0,
|
// 'sex' => $params['sex'] ?? 0,
|
||||||
// 'is_disable' => $params['is_disable'] ?? 0,
|
// 'is_disable' => $params['is_disable'] ?? 0,
|
||||||
'label_id'=>$params['label_id']
|
'label_id' => $params['label_id']
|
||||||
]);
|
]);
|
||||||
|
|
||||||
Db::commit();
|
Db::commit();
|
||||||
@ -188,8 +189,21 @@ class UserLogic extends BaseLogic
|
|||||||
public static function detail(int $userId): array
|
public static function detail(int $userId): array
|
||||||
{
|
{
|
||||||
$field = [
|
$field = [
|
||||||
'id', 'account', 'nickname', 'avatar', 'real_name','integral','label_id','user_ship',
|
'id',
|
||||||
'sex', 'mobile', 'create_time', 'login_time', 'channel','now_money','purchase_funds'
|
'account',
|
||||||
|
'nickname',
|
||||||
|
'avatar',
|
||||||
|
'real_name',
|
||||||
|
'integral',
|
||||||
|
'label_id',
|
||||||
|
'user_ship',
|
||||||
|
'sex',
|
||||||
|
'mobile',
|
||||||
|
'create_time',
|
||||||
|
'login_time',
|
||||||
|
'channel',
|
||||||
|
'now_money',
|
||||||
|
'purchase_funds'
|
||||||
];
|
];
|
||||||
|
|
||||||
$user = User::where(['id' => $userId])->field($field)
|
$user = User::where(['id' => $userId])->field($field)
|
||||||
@ -197,8 +211,8 @@ class UserLogic extends BaseLogic
|
|||||||
|
|
||||||
$user['channel'] = UserTerminalEnum::getTermInalDesc($user['channel']);
|
$user['channel'] = UserTerminalEnum::getTermInalDesc($user['channel']);
|
||||||
$user->sex = $user->getData('sex');
|
$user->sex = $user->getData('sex');
|
||||||
$user['number']=StoreFinanceFlow::where('other_uid',$userId)->where(['status'=>0,'financial_pm'=>1,'type'=>1])->sum('number');
|
$user['number'] = StoreFinanceFlow::where('other_uid', $userId)->where(['status' => 0, 'financial_pm' => 1, 'type' => 1])->sum('number');
|
||||||
$user['user_ship_name']=$user->user_ship>0?UserShip::where('id',$user->user_ship)->value('title'):"一般用户";
|
$user['user_ship_name'] = $user->user_ship > 0 ? UserShip::where('id', $user->user_ship)->value('title') : "一般用户";
|
||||||
return $user->toArray();
|
return $user->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,66 +232,116 @@ class UserLogic extends BaseLogic
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新采购款
|
||||||
|
*/
|
||||||
|
public static function PurchaseFunds(array $params)
|
||||||
|
{
|
||||||
|
$find = User::where(['id' => $params['id']])->find();
|
||||||
|
Db::startTrans();
|
||||||
|
try {
|
||||||
|
$capitalFlowDao = new CapitalFlowLogic($find, 'user');
|
||||||
|
if ($params['type'] == 1) {
|
||||||
|
$capitalFlowDao->userIncome('system_purchase_add', 'system', 0, $params['purchase_funds'],'',1);
|
||||||
|
$find->purchase_funds = bcadd($params['purchase_funds'], $find['purchase_funds'], 2);
|
||||||
|
$find->save();
|
||||||
|
} else {
|
||||||
|
$capitalFlowDao->userExpense('system_purchase_dec', 'system', 0, $params['purchase_funds']);
|
||||||
|
$find->purchase_funds = bcsub($params['purchase_funds'], $find['purchase_funds'], 2);
|
||||||
|
$find->save();
|
||||||
|
}
|
||||||
|
Db::commit();
|
||||||
|
return true;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Db::rollback();
|
||||||
|
throw new BusinessException($e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 更新余额
|
||||||
|
*/
|
||||||
|
public static function nowMoney(array $params)
|
||||||
|
{
|
||||||
|
$find = User::where(['id' => $params['id']])->find();
|
||||||
|
Db::startTrans();
|
||||||
|
try {
|
||||||
|
$capitalFlowDao = new CapitalFlowLogic($find, 'user');
|
||||||
|
if ($params['type'] == 1) {
|
||||||
|
$capitalFlowDao->userIncome('system_balance_add', 'system', 0, $params['now_money'],);
|
||||||
|
$find->now_money = bcadd($params['now_money'], $find['now_money'], 2);
|
||||||
|
$find->save();
|
||||||
|
} else {
|
||||||
|
$capitalFlowDao->userExpense('system_balance_reduce', 'system', 0, $params['now_money']);
|
||||||
|
$find->now_money = bcsub($params['now_money'], $find['now_money'], 2);
|
||||||
|
$find->save();
|
||||||
|
}
|
||||||
|
Db::commit();
|
||||||
|
return true;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Db::rollback();
|
||||||
|
throw new BusinessException($e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
public static function dealDetails($params)
|
public static function dealDetails($params)
|
||||||
{
|
{
|
||||||
switch ($params['type']){
|
switch ($params['type']) {
|
||||||
case 1:
|
case 1:
|
||||||
//采购款明细
|
//采购款明细
|
||||||
$categories = ['user_balance_recharge', 'user_order_purchase_pay','system_purchase_add','user_balance_recharge_refund'];
|
$categories = ['user_balance_recharge', 'user_order_purchase_pay', 'system_purchase_add', 'user_balance_recharge_refund'];
|
||||||
$query = CapitalFlow::where('uid', $params['id'])
|
$query = CapitalFlow::where('uid', $params['id'])
|
||||||
->whereIn('category', $categories);
|
->whereIn('category', $categories);
|
||||||
$count = $query->count();
|
$count = $query->count();
|
||||||
$data = $query
|
$data = $query
|
||||||
->page($params['page_no'],$params['page_size'])
|
->page($params['page_no'], $params['page_size'])
|
||||||
->order('id','desc')
|
->order('id', 'desc')
|
||||||
->select()->toArray();
|
->select()->toArray();
|
||||||
foreach ($data as &$value){
|
foreach ($data as &$value) {
|
||||||
if($value['category'] == 'user_order_purchase_pay'){
|
if ($value['category'] == 'user_order_purchase_pay') {
|
||||||
$value['order_sn'] = StoreOrder::where('id',$value['link_id'])->value('order_id');
|
$value['order_sn'] = StoreOrder::where('id', $value['link_id'])->value('order_id');
|
||||||
}elseif($value['category'] == 'user_balance_recharge'){
|
} elseif ($value['category'] == 'user_balance_recharge') {
|
||||||
$value['order_sn'] = UserRecharge::where('id',$value['link_id'])->value('order_id');
|
$value['order_sn'] = UserRecharge::where('id', $value['link_id'])->value('order_id');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
//余额明细
|
//余额明细
|
||||||
$category = ['system_balance_add','user_order_balance_pay'];
|
$category = ['system_balance_add', 'user_order_balance_pay'];
|
||||||
$query = CapitalFlow::where('uid', $params['id'])
|
$query = CapitalFlow::where('uid', $params['id'])
|
||||||
->whereIn('category', $category);
|
->whereIn('category', $category);
|
||||||
$count = $query->count();
|
$count = $query->count();
|
||||||
$data = $query
|
$data = $query
|
||||||
->page($params['page_no'],$params['page_size'])
|
->page($params['page_no'], $params['page_size'])
|
||||||
->order('id','desc')
|
->order('id', 'desc')
|
||||||
->select()->toArray();
|
->select()->toArray();
|
||||||
foreach ($data as &$value){
|
foreach ($data as &$value) {
|
||||||
$value['order_sn'] = StoreOrder::where('id',$value['link_id'])->value('order_id');
|
$value['order_sn'] = StoreOrder::where('id', $value['link_id'])->value('order_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
//礼品券明细
|
//礼品券明细
|
||||||
$query = UserSign::where(['uid'=>$params['id']]);
|
$query = UserSign::where(['uid' => $params['id']]);
|
||||||
$count = $query->count();
|
$count = $query->count();
|
||||||
$data =$query
|
$data = $query
|
||||||
->page($params['page_no'],$params['page_size'])
|
->page($params['page_no'], $params['page_size'])
|
||||||
->order('id','desc')
|
->order('id', 'desc')
|
||||||
->select()->toArray();
|
->select()->toArray();
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
//返还金明细 -todo back
|
//返还金明细 -todo back
|
||||||
$query = VipFlow::with('store')->where(['user_id'=>$params['id']]);
|
$query = VipFlow::with('store')->where(['user_id' => $params['id']]);
|
||||||
$count = $query->count();
|
$count = $query->count();
|
||||||
$data = $query
|
$data = $query
|
||||||
->page($params['page_no'],$params['page_size'])
|
->page($params['page_no'], $params['page_size'])
|
||||||
->order('id','desc')
|
->order('id', 'desc')
|
||||||
->select()->toArray();
|
->select()->toArray();
|
||||||
foreach ($data as &$value){
|
foreach ($data as &$value) {
|
||||||
if($value['status'] == 0){
|
if ($value['status'] == 0) {
|
||||||
$value['title'] = "购买商品".$value['all']."元获得".$value['number']."元返还金";
|
$value['title'] = "购买商品" . $value['all'] . "元获得" . $value['number'] . "元返还金";
|
||||||
}else{
|
} else {
|
||||||
//退回到余额、微信、采购款
|
//退回到余额、微信、采购款
|
||||||
$back = self::dealTitleCate($value['pay_type']);
|
$back = self::dealTitleCate($value['pay_type']);
|
||||||
$value['title'] = "返还金解冻".$value['number']."元退回到".$back;
|
$value['title'] = "返还金解冻" . $value['number'] . "元退回到" . $back;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -289,27 +353,24 @@ class UserLogic extends BaseLogic
|
|||||||
'lists' => $data,
|
'lists' => $data,
|
||||||
'count' => $count
|
'count' => $count
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function giftList($uid,$params)
|
public static function giftList($uid, $params)
|
||||||
{
|
{
|
||||||
$query = StoreProductGift::with(['store','user','goodsName'])->where('uid',$uid);
|
$query = StoreProductGift::with(['store', 'user', 'goodsName'])->where('uid', $uid);
|
||||||
$count = $query->count();
|
$count = $query->count();
|
||||||
$list = $query->page($params['page_no'],$params['page_size'])
|
$list = $query->page($params['page_no'], $params['page_size'])
|
||||||
->order('id','desc')
|
->order('id', 'desc')
|
||||||
->select()->toArray();
|
->select()->toArray();
|
||||||
return [
|
return [
|
||||||
'lists' => $list,
|
'lists' => $list,
|
||||||
'count' => $count
|
'count' => $count
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function dealTitleCate($pay_type)
|
public static function dealTitleCate($pay_type)
|
||||||
{
|
{
|
||||||
switch ($pay_type){
|
switch ($pay_type) {
|
||||||
case 18:
|
case 18:
|
||||||
$title = "采购款";
|
$title = "采购款";
|
||||||
break;
|
break;
|
||||||
@ -317,17 +378,17 @@ class UserLogic extends BaseLogic
|
|||||||
$title = "现金";
|
$title = "现金";
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
$title ="余额";
|
$title = "余额";
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
case 9:
|
case 9:
|
||||||
$title ="微信";
|
$title = "微信";
|
||||||
break;
|
break;
|
||||||
case 13:
|
case 13:
|
||||||
$title ="支付宝";
|
$title = "支付宝";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$title ="默认";
|
$title = "默认";
|
||||||
}
|
}
|
||||||
return $title;
|
return $title;
|
||||||
}
|
}
|
||||||
|
@ -80,8 +80,8 @@ class CapitalFlowLogic extends BaseLogic
|
|||||||
$model->before_balance = bcadd($this->user['now_money'], $amount, 2);
|
$model->before_balance = bcadd($this->user['now_money'], $amount, 2);
|
||||||
$model->balance = $this->user['now_money'];
|
$model->balance = $this->user['now_money'];
|
||||||
} else {
|
} else {
|
||||||
$model->before_balance = $this->user['now_money'];
|
$model->before_balance = $this->user['purchase_funds'];
|
||||||
$model->balance = $this->user['now_money'];
|
$model->balance = bcsub($this->user['purchase_funds'], $amount, 2);
|
||||||
}
|
}
|
||||||
$model->create_time = date('Y-m-d H:i:s');
|
$model->create_time = date('Y-m-d H:i:s');
|
||||||
$model->type = 'out';
|
$model->type = 'out';
|
||||||
@ -176,6 +176,8 @@ class CapitalFlowLogic extends BaseLogic
|
|||||||
return "系统增加余额{$amount}元";
|
return "系统增加余额{$amount}元";
|
||||||
case 'system_purchase_add':
|
case 'system_purchase_add':
|
||||||
return "系统增加采购款{$amount}元";
|
return "系统增加采购款{$amount}元";
|
||||||
|
case 'system_purchase_dec':
|
||||||
|
return "系统减少采购款{$amount}元";
|
||||||
case 'system_balance_reduce':
|
case 'system_balance_reduce':
|
||||||
return "系统减少余额{$amount}元";
|
return "系统减少余额{$amount}元";
|
||||||
case 'user_balance_recharge_refund':
|
case 'user_balance_recharge_refund':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user