|
|
@@ -200,48 +200,48 @@ class UserExtract extends BaseController
|
|
200
|
200
|
*/
|
|
201
|
201
|
public function switchStatus($id)
|
|
202
|
202
|
{
|
|
203
|
|
- $data = $this->request->params(['status','fail_msg','mark']);
|
|
204
|
|
- if($data['status'] == '-1' && empty($data['fail_msg']))
|
|
|
203
|
+ $data = $this->request->params(['status', 'fail_msg', 'mark']);
|
|
|
204
|
+ if ($data['status'] == '-1' && empty($data['fail_msg']))
|
|
205
|
205
|
return app('json')->fail('请填写拒绝原因');
|
|
206
|
|
- if(!$this->repository->getWhereCount($id))
|
|
|
206
|
+ if (!$this->repository->getWhereCount($id))
|
|
207
|
207
|
return app('json')->fail('数据不存在或状态错误');
|
|
208
|
208
|
$data['admin_id'] = $this->request->adminId();
|
|
209
|
|
- $data['status_time'] = date('Y-m-d H:i:s',time());
|
|
210
|
|
- $extract_data=Db::name('user_extract')->where('extract_id',$id)->find();
|
|
211
|
|
- if($data['status']!='-1'){
|
|
212
|
|
-
|
|
213
|
|
- /** @var UserRepository $userRepository */
|
|
214
|
|
- $userRepository = app()->make(UserRepository::class);
|
|
215
|
|
- $userEntity = $userRepository->getUserEntityByUid($extract_data['uid']);
|
|
216
|
|
- if ($userEntity->getWithdrawalLimit() < $extract_data['extract_price']) {
|
|
217
|
|
- return app('json')->fail('提现额度不足');
|
|
218
|
|
- } else {
|
|
219
|
|
- try {
|
|
220
|
|
- /** @var UserWithdrawalLimitRecordRepository $userWithdrawalLimitRecordRepository */
|
|
221
|
|
- $userWithdrawalLimitRecordRepository = app()->make(UserWithdrawalLimitRecordRepository::class);
|
|
222
|
|
- // 添加扣减记录
|
|
223
|
|
- $userWithdrawalLimitRecordEntity = $userWithdrawalLimitRecordRepository->addUserWithdrawalLimitRecord(
|
|
224
|
|
- (int)$userEntity->getUid(),
|
|
225
|
|
- UserWithdrawalLimitRecordEnum::PM['EXPEND']['code'],
|
|
226
|
|
- (float)$extract_data['extract_price'],
|
|
227
|
|
- -1,
|
|
228
|
|
- '',
|
|
229
|
|
- '提现扣减提现额度'
|
|
230
|
|
- );
|
|
231
|
|
- // 结算扣减记录
|
|
232
|
|
- $userWithdrawalLimitRecordRepository->executeByIdList([$userWithdrawalLimitRecordEntity->getId()]);
|
|
233
|
|
- } catch (\Throwable $exception) {
|
|
234
|
|
- return app('json')->fail($exception->getMessage());
|
|
235
|
|
- }
|
|
236
|
|
- }
|
|
237
|
|
-
|
|
238
|
|
- if($extract_data['extract_type']==1){
|
|
239
|
|
- $res=$this->repository->WechatTransfers($id);
|
|
240
|
|
- if($res['code']==201){
|
|
|
209
|
+ $data['status_time'] = date('Y-m-d H:i:s', time());
|
|
|
210
|
+ $extract_data = Db::name('user_extract')->where('extract_id', $id)->find();
|
|
|
211
|
+ if ($data['status'] != '-1') {
|
|
|
212
|
+
|
|
|
213
|
+ // /** @var UserRepository $userRepository */
|
|
|
214
|
+ // $userRepository = app()->make(UserRepository::class);
|
|
|
215
|
+ // $userEntity = $userRepository->getUserEntityByUid($extract_data['uid']);
|
|
|
216
|
+ // if ($userEntity->getWithdrawalLimit() < $extract_data['extract_price']) {
|
|
|
217
|
+ // return app('json')->fail('提现额度不足');
|
|
|
218
|
+ // } else {
|
|
|
219
|
+ // try {
|
|
|
220
|
+ // /** @var UserWithdrawalLimitRecordRepository $userWithdrawalLimitRecordRepository */
|
|
|
221
|
+ // $userWithdrawalLimitRecordRepository = app()->make(UserWithdrawalLimitRecordRepository::class);
|
|
|
222
|
+ // // 添加扣减记录
|
|
|
223
|
+ // $userWithdrawalLimitRecordEntity = $userWithdrawalLimitRecordRepository->addUserWithdrawalLimitRecord(
|
|
|
224
|
+ // (int)$userEntity->getUid(),
|
|
|
225
|
+ // UserWithdrawalLimitRecordEnum::PM['EXPEND']['code'],
|
|
|
226
|
+ // (float)$extract_data['extract_price'],
|
|
|
227
|
+ // -1,
|
|
|
228
|
+ // '',
|
|
|
229
|
+ // '提现扣减提现额度'
|
|
|
230
|
+ // );
|
|
|
231
|
+ // // 结算扣减记录
|
|
|
232
|
+ // $userWithdrawalLimitRecordRepository->executeByIdList([$userWithdrawalLimitRecordEntity->getId()]);
|
|
|
233
|
+ // } catch (\Throwable $exception) {
|
|
|
234
|
+ // return app('json')->fail($exception->getMessage());
|
|
|
235
|
+ // }
|
|
|
236
|
+ // }
|
|
|
237
|
+
|
|
|
238
|
+ if ($extract_data['extract_type'] == 1) {
|
|
|
239
|
+ $res = $this->repository->WechatTransfers($id);
|
|
|
240
|
+ if ($res['code'] == 201) {
|
|
241
|
241
|
return app('json')->success('微信处理中,请稍后');
|
|
242
|
242
|
}
|
|
243
|
|
- }elseif ($extract_data['extract_type']==2){
|
|
244
|
|
- $res=$this->repository->AliTransfers($id);
|
|
|
243
|
+ } elseif ($extract_data['extract_type'] == 2) {
|
|
|
244
|
+ $res = $this->repository->AliTransfers($id);
|
|
245
|
245
|
}
|
|
246
|
246
|
// if($res['code']!=200 && $extract_data['types']==1){
|
|
247
|
247
|
// Db::name('user_rich')->where('uid',$extract_data['uid'])->inc('red', $extract_data['extract_price'])->update();
|
|
|
@@ -255,15 +255,15 @@ class UserExtract extends BaseController
|
|
255
|
255
|
// ]);
|
|
256
|
256
|
// return app('json')->fail(isset($res['msg'])?$res['msg']:'提现失败',$res);
|
|
257
|
257
|
// }
|
|
258
|
|
- }else{
|
|
259
|
|
- if($extract_data['withdrawal_type']==2) {
|
|
|
258
|
+ } else {
|
|
|
259
|
+ if ($extract_data['withdrawal_type'] == 2) {
|
|
260
|
260
|
Db::name('entropy_barter_bill')->where('order_no', $extract_data['order_sn'])->where('pm', 2)->update(['status' => 3, 'remarks' => '审核已拒绝']);
|
|
261
|
261
|
$eb_bill = Db::name('entropy_barter_bill')->where('order_no', $extract_data['order_sn'])->where('pm', 2)->find();
|
|
262
|
262
|
Db::name('entropy_barter_user_' . $extract_data['mer_id'])->where('eb_id', $eb_bill['to_id'])->inc('wallet', $extract_data['extract_price'])->update();
|
|
263
|
263
|
}
|
|
264
|
264
|
}
|
|
265
|
|
- $this->repository->switchStatus($id,$data);
|
|
266
|
|
- Db::name('user_extract')->where('extract_id',$id)->update($data);
|
|
|
265
|
+ $this->repository->switchStatus($id, $data);
|
|
|
266
|
+ Db::name('user_extract')->where('extract_id', $id)->update($data);
|
|
267
|
267
|
return app('json')->success('审核成功');
|
|
268
|
268
|
}
|
|
269
|
269
|
|