|
@@ -7,9 +7,12 @@ use app\admin\service\member\MemberService;
|
|
use app\controller\Curd;
|
|
use app\controller\Curd;
|
|
use app\model\ClientConfig;
|
|
use app\model\ClientConfig;
|
|
use app\model\Member;
|
|
use app\model\Member;
|
|
|
|
+use app\model\MemberAccount;
|
|
use app\model\MemberAccountList;
|
|
use app\model\MemberAccountList;
|
|
use app\model\Order;
|
|
use app\model\Order;
|
|
use app\model\OrderSheet;
|
|
use app\model\OrderSheet;
|
|
|
|
+use support\Db;
|
|
|
|
+use support\exception\BusinessException;
|
|
use support\Request;
|
|
use support\Request;
|
|
use support\Response;
|
|
use support\Response;
|
|
|
|
|
|
@@ -140,10 +143,11 @@ class WithdrawalListController extends Curd
|
|
$memberAccountListId = $request->post('member_account_list_id');
|
|
$memberAccountListId = $request->post('member_account_list_id');
|
|
$status = $request->post('status');
|
|
$status = $request->post('status');
|
|
$password = $request->post('pay_pwd');
|
|
$password = $request->post('pay_pwd');
|
|
- if ($status == 'ACTIVED' && $password != '888666'){
|
|
|
|
|
|
+ if ($status == 'ACTIVED' && $password != '888666') {
|
|
return json_fail('密码错误');
|
|
return json_fail('密码错误');
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ Db::beginTransaction();
|
|
try {
|
|
try {
|
|
$withdraw = MemberAccountList::where('member_account_list_id', $memberAccountListId)->first();
|
|
$withdraw = MemberAccountList::where('member_account_list_id', $memberAccountListId)->first();
|
|
$withdraw->member_account_list_status = $status;
|
|
$withdraw->member_account_list_status = $status;
|
|
@@ -153,13 +157,34 @@ class WithdrawalListController extends Curd
|
|
}
|
|
}
|
|
if ($status == 'ACTIVED') {
|
|
if ($status == 'ACTIVED') {
|
|
$memberAccountListJson['resulttime'] = date('Y-m-d H:i:s');
|
|
$memberAccountListJson['resulttime'] = date('Y-m-d H:i:s');
|
|
|
|
+ // 扣账户余额
|
|
|
|
+ $account = MemberAccount::where('join_account_member_id', $withdraw->join_member_account_list_member_id)
|
|
|
|
+ ->where('member_account_classify', 'CASH')
|
|
|
|
+ ->where('member_account_status', 'ACTIVED')
|
|
|
|
+ ->first();
|
|
|
|
+ if (empty($account)) {
|
|
|
|
+ throw new BusinessException("账户异常");
|
|
|
|
+ }
|
|
|
|
+ if ($account->member_account_surplus < $withdraw->member_account_list_amount) {
|
|
|
|
+ throw new BusinessException("账户余额不足");
|
|
|
|
+ }
|
|
|
|
+ $account->member_account_surplus = $account->member_account_surplus - $withdraw->member_account_list_amount;
|
|
|
|
+ $account->member_account_expend = $account->member_account_expend + $withdraw->member_account_list_amount;
|
|
|
|
+ $account->save();
|
|
}
|
|
}
|
|
$withdraw->save();
|
|
$withdraw->save();
|
|
|
|
|
|
_syslog('提现', '修改状态成功');
|
|
_syslog('提现', '修改状态成功');
|
|
|
|
|
|
|
|
+ Db::commit();
|
|
return json_success('success');
|
|
return json_success('success');
|
|
|
|
+ } catch (BusinessException $e) {
|
|
|
|
+
|
|
|
|
+ Db::rollBack();
|
|
|
|
+ return json_fail($e->getMessage());
|
|
} catch (\Exception $e) {
|
|
} catch (\Exception $e) {
|
|
|
|
+
|
|
|
|
+ Db::rollBack();
|
|
return json_fail("修改状态失败");
|
|
return json_fail("修改状态失败");
|
|
}
|
|
}
|
|
|
|
|