WithdrawCashService.php 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: tandunzhao
  5. * Date: 2017/12/2
  6. * Time: 下午3:34
  7. */
  8. namespace App\Modules\Finance\Services;
  9. use App\Modules\Channel\Services\ChannelService;
  10. use App\Modules\Finance\Models\FinancialPayMerchantBalance;
  11. use App\Modules\Finance\Models\FinancialStat;
  12. use App\Modules\Finance\Models\WithdrawCash;
  13. use App\Modules\Manage\Services\ManageService;
  14. use App\Modules\User\Services\UserService;
  15. use DB;
  16. class WithdrawCashService
  17. {
  18. /**
  19. * 自动提现
  20. * @param unknown_type $request
  21. */
  22. public static function auto_add_withdrawCash($distribution_channel_id, $amount, $remark)
  23. {
  24. $distribution_channel_name = '';
  25. if (!is_numeric($amount)) {
  26. return response()->error("PARAM_ERROR");
  27. }
  28. if ($amount < 100) {
  29. //TODO 渠道14,取消100 金额的判断 大于1一块钱就可以
  30. if ($distribution_channel_id == 14 || $distribution_channel_id = "14" || $distribution_channel_id = '14') {
  31. if ($amount < 1) {
  32. return response()->error("WITHDRAW_CASH_AMOUNT");
  33. }
  34. } else {
  35. return response()->error("WITHDRAW_CASH_AMOUNT");
  36. }
  37. }
  38. if ($amount >= (20 * 10000)) {
  39. //TODO 取消单笔提现额度限制
  40. //return response()->error("WITHDRAW_CASH_AMOUNT_MORE");
  41. }
  42. $financialStat = FinancialStatService::getFinancialStatSingle($distribution_channel_id);
  43. if (empty($financialStat) || $financialStat['enable_withdrawal_amount'] < $amount) {
  44. //可提现金额不够
  45. return response()->error("WITHDRAW_CASH_AMOUNT_INSUFFICIEN");
  46. }
  47. if (FinancialConfigService::isFrozenDistributionChannel($distribution_channel_id)) {
  48. //渠道被冻结
  49. return response()->error("WITHDRAW_CASH_AMOUNT_FROZEN");
  50. }
  51. //判断账户是否设置
  52. if (!CashAccountService::isCashAccountExits($distribution_channel_id)) {
  53. return response()->error("WITHDRAW_CASH_AMOUNT_ACCOUNT");
  54. }
  55. //判断今天是否已经提现
  56. if (WithdrawCashService::isWithdrawCashChannelToToday($distribution_channel_id)) {
  57. return response()->error("WITHDRAW_CASH_TODAY_USE");
  58. }
  59. $is_company = 0;
  60. $cashAccount = CashAccountService::getCashAccountSingle($distribution_channel_id);
  61. if (!empty($cashAccount)) {
  62. $is_company = $cashAccount['is_company'];
  63. }
  64. //一次提现不得超过一个公司主体最大充值金额
  65. /*$enable_by_company = FinancialPayMerchantBalanceService::getChannelEnableWithdraw($distribution_channel_id,$is_company);
  66. if(!$enable_by_company){
  67. return response()->error('WITHDRAW_CASH_AMOUNT_INSUFFICIEN');
  68. }
  69. $enable_amount = $enable_by_company->enable_withdrawal_amount;
  70. if($enable_amount<$amount){
  71. return ['code'=>101010,'msg'=>'本次最多可提现:'.$enable_amount];
  72. }*/
  73. $enable_by_companys = FinancialPayMerchantBalanceService::getChannelEnableWithdrawByCompanyId($distribution_channel_id);
  74. \Log::info('distribution_channel_id:' . $distribution_channel_id . 'amount:' . $amount);
  75. \Log::info('distribution_channel_id:' . $distribution_channel_id . 'enable:' . json_encode($enable_by_companys));
  76. DB::beginTransaction();
  77. try {
  78. foreach ($enable_by_companys as $enable_by_company) {
  79. $with_draw_amount = ($enable_by_company->enable_withdrawal_amount >= $amount) ? $amount : $enable_by_company->enable_withdrawal_amount;
  80. $pay_company_id = $enable_by_company->pay_merchant_company_id;
  81. WithdrawCashService::addWithdrawCash($distribution_channel_id, $with_draw_amount, $remark, $pay_company_id);
  82. $financialStatUp = FinancialStatService::updateFinancialStatByWithdraw($distribution_channel_id, $with_draw_amount);
  83. FinancialPayMerchantBalanceService::updateBalanceByWithdraw($with_draw_amount, $distribution_channel_id, $pay_company_id);
  84. $amount = $amount - $with_draw_amount;
  85. //部分通道公司只能对公打款
  86. if ($is_company == 0 && in_array($pay_company_id, explode(',', env('ZW_COMPANY_IDS')))) {
  87. DB::rollBack();
  88. return response()->error('NOT_ALLOWED_PRIVATE_ACCOUNT');
  89. }
  90. if ($amount <= 0) {
  91. break;
  92. }
  93. }
  94. } catch (\Exception $e) {
  95. DB::rollBack();
  96. \Log::error('withdraw error !' . ($e->getMessage()));
  97. return response()->error('WITHDRAW_CASHES_FAILED');
  98. }
  99. DB::commit();
  100. //修改可提现总额
  101. $enable_amount = $financialStatUp['enable_withdrawal_amount'];
  102. //修改提现中金额
  103. $withdraw_pending_amount = $financialStatUp['withdraw_pending_amount'];
  104. return response()->success(compact('enable_amount', 'withdraw_pending_amount'));
  105. }
  106. /**
  107. * 保存提现信息
  108. * @param $channelId 渠道ID
  109. * @param $amount 提现金额
  110. * @param $remark 备注
  111. * @return mixed
  112. */
  113. public static function addWithdrawCash($channelId, $amount, $remark, $pay_company_id)
  114. {
  115. $tallage = FinanceService::getWithdrawCashTallage($channelId, $amount);
  116. $is_company = 0;
  117. $channelName = ChannelService::getChannelNicknameById($channelId);
  118. $cashAccount = CashAccountService::getCashAccountSingle($channelId);
  119. if (!empty($cashAccount)) {
  120. $is_company = $cashAccount['is_company'];
  121. $dataWithdrawCash['account_bank'] = $cashAccount->account_bank;
  122. $dataWithdrawCash['bank_account'] = $cashAccount->card_number;
  123. $dataWithdrawCash['account_name'] = $cashAccount->account_name;
  124. }
  125. $dataWithdrawCash['distribution_channel_id'] = $channelId;
  126. $dataWithdrawCash['distribution_channel_name'] = $channelName;
  127. $dataWithdrawCash['amount'] = $amount;
  128. $dataWithdrawCash['tallage'] = $tallage;
  129. $dataWithdrawCash['status'] = self::getWithdrawCashStatusStr(0);
  130. $dataWithdrawCash['remark'] = $remark;
  131. $dataWithdrawCash['is_company'] = $is_company;
  132. $dataWithdrawCash['pay_merchant_company_id'] = $pay_company_id;
  133. $withdrawCash = WithdrawCash::create($dataWithdrawCash);
  134. return $withdrawCash;
  135. }
  136. /**
  137. * 更新提现信息状态
  138. * @param $id
  139. * @param $userId
  140. * @param $statusIn 状态 查看接口 WithdrawCashService::getWithdrawCashStatusList
  141. * @param $remark
  142. * @param string $serialNumber
  143. * @return mixed
  144. */
  145. public static function updateWithdrawCashStatus($id, $userId = '', $statusIn, $remark = '', $serialNumber = '')
  146. {
  147. //TODO 对于一个提现记录只有一条打款是没有Bug的。
  148. //TODO 一个提现记录对应多个支付通道打款,存在逻辑bug
  149. $withdrawCash = WithdrawCash::where('id', $id)->first();
  150. if (!empty($withdrawCash) && is_numeric($statusIn)) {
  151. if (WithdrawCashService::isWithdrawCashStatusPaymentIngStr($withdrawCash['status'])) {
  152. //当前状态是 打款中 可以修改状态
  153. } else {
  154. if (WithdrawCashService::isEditWithdrawCashStatus($id)) {
  155. return $withdrawCash;
  156. }
  157. }
  158. $userName = "";
  159. if ($userId) {
  160. $manage = ManageService::getById($userId);
  161. if (!empty($manage)) {
  162. $userName = $manage['nickname'];
  163. }
  164. }
  165. $statusStr = WithdrawCashService::getWithdrawCashStatusStr($statusIn);
  166. if (empty($statusStr)) {
  167. } else {
  168. if ($statusStr) {
  169. $withdrawCash['status'] = $statusStr;
  170. }
  171. }
  172. if (WithdrawCashService::isWithdrawCashStatusCodeSuccess($statusIn)) {
  173. //成功提现
  174. $financialStat = FinancialStat::getByDistributionChannel($withdrawCash['distribution_channel_id']);
  175. //修改累计提现金额
  176. $financialStat['accumulative_withdrawal_amount'] = (float)$financialStat['accumulative_withdrawal_amount'] + (float)$withdrawCash['amount'];
  177. //修改提现中金额
  178. $financialStat['withdraw_pending_amount'] = (float)$financialStat['withdraw_pending_amount'] - (float)$withdrawCash['amount'];
  179. $financialStat->save();
  180. //
  181. $financePayMerchantBalanceInfo = FinancialPayMerchantBalance::getOne($withdrawCash['distribution_channel_id'], $withdrawCash['pay_merchant_company_id']);
  182. \Log::info('financePayMerchantBalanceInfo:channel_id:' . $withdrawCash['distribution_channel_id'] . 'pay_merchant_company_id:' . $withdrawCash['pay_merchant_company_id'] . json_encode($financePayMerchantBalanceInfo));
  183. //修改累计提现金额
  184. $financePayMerchantBalanceInfo->accumulative_withdrawal_amount = (float)$financePayMerchantBalanceInfo->accumulative_withdrawal_amount + (float)$withdrawCash['amount'];
  185. //修改提现中金额
  186. $financePayMerchantBalanceInfo->withdraw_pending_amount = (float)$financePayMerchantBalanceInfo->withdraw_pending_amount - (float)$withdrawCash['amount'];
  187. $financePayMerchantBalanceInfo->save();
  188. }
  189. if ($userId) {
  190. $withdrawCash['check_user_id'] = $userId;
  191. }
  192. if ($userName) {
  193. $withdrawCash['check_user_name'] = $userName;
  194. }
  195. if ($remark) {
  196. $withdrawCash['remark'] = $remark;
  197. }
  198. if ($serialNumber) {
  199. if (strpos($withdrawCash['serial_number'], $serialNumber) !== false) {
  200. //包含
  201. } else {
  202. $serialNumber = $withdrawCash['serial_number'] . "," . $serialNumber;
  203. }
  204. $withdrawCash['serial_number'] = $serialNumber;
  205. }
  206. $withdrawCash->save();
  207. }
  208. return $withdrawCash;
  209. }
  210. /**
  211. * 获取一个提现信息
  212. * @param $id
  213. * @return mixed
  214. */
  215. public static function getWithdrawCash($id)
  216. {
  217. $withdrawCash = WithdrawCash::where('id', $id)->first();
  218. return $withdrawCash;
  219. }
  220. /**
  221. * 获取提现列表
  222. * @param string $channel_id 可不传
  223. * @param string $channel_name 可不传
  224. * @param string $start_date 可不传
  225. * @param string $end_date 可不传
  226. * @param string $statusIn 状态 查看接口 WithdrawCashService::getWithdrawCashStatusList 可不传
  227. * @param bool $is_all 可不传
  228. * @return mixed
  229. */
  230. public static function getList($channel_id = '', $channel_name = '', $start_date = '', $end_date = '', $statusIn = '', $is_all = false)
  231. {
  232. $status = false;
  233. if (is_numeric($statusIn)) {
  234. $status = self::getWithdrawCashStatusStrList($statusIn);
  235. }
  236. return WithdrawCash::getListByDistributionChannel($channel_id, $channel_name, $start_date, $end_date, $status, $is_all);
  237. }
  238. /**
  239. * 财务对账
  240. * @param $params[]
  241. * channel_id:渠道ID 可选
  242. * channel_name:渠道名称 可选
  243. * account_name: 打款人姓名
  244. * search_name: 搜索名称
  245. * start_date:开始时间 可选
  246. * end_date:结束时间 可选
  247. * is_frozen:冻结 0:正常状态; -1:冻结状态 可选
  248. * is_company: 0:私人; 1:公司
  249. * @param string $statusIn 状态 查看接口 WithdrawCashService::getWithdrawCashStatusList 可不传
  250. * @param $isAll
  251. * @return mixed
  252. */
  253. public static function getFinancialCounting($params = [], $statusIn = '', $isAll = '')
  254. {
  255. if (is_numeric($statusIn)) {
  256. $params['status'] = self::getWithdrawCashStatusStrList($statusIn);
  257. }
  258. return WithdrawCash::getFinancialCountingParam($params, $isAll);
  259. }
  260. /**
  261. * 财务审核
  262. * @param $params[]
  263. * channel_id:渠道ID 可选
  264. * channel_name:渠道名称 可选
  265. * account_name: 打款人姓名
  266. * search_name: 搜索名称 可选
  267. * start_date:开始时间 可选
  268. * end_date:结束时间 可选
  269. * is_frozen:冻结 0:正常状态; -1:冻结状态 可选
  270. * is_company: 0:私人; 1:公司
  271. * @param string $statusIn 状态 查看接口 WithdrawCashService::getWithdrawCashStatusList 可不传
  272. * @param $isAll
  273. * @return mixed
  274. */
  275. public static function getFinancialAudit($params = [], $statusIn = '', $isAll = false)
  276. {
  277. if (is_numeric($statusIn)) {
  278. $params['status'] = self::getWithdrawCashStatusStrList($statusIn);
  279. }
  280. return WithdrawCash::getFinancialAuditParam($params, $isAll);
  281. }
  282. /**
  283. * 判断当前渠道今天有没有提现
  284. * @param $channelId
  285. * @return bool true:今天已经提现
  286. */
  287. public static function isWithdrawCashChannelToToday($channelId)
  288. {
  289. $withdrawCash = WithdrawCash::getWithdrawCashLastRecord($channelId);
  290. if (empty($withdrawCash)) {
  291. return false;
  292. }
  293. $todayStart = strtotime(date('Y-m-d', time()) . ' 00:00:00');
  294. $createTime = strtotime($withdrawCash['created_at']);
  295. if ($createTime > $todayStart) {
  296. return true;
  297. }
  298. return false;
  299. }
  300. /**
  301. * 是否能修改提现状态
  302. * @param $withdrawCashId
  303. * @return bool true:不能修改
  304. */
  305. public static function isEditWithdrawCashStatus($withdrawCashId)
  306. {
  307. $withdrawCash = WithdrawCash::where('id', $withdrawCashId)->first();
  308. if (empty($withdrawCash)) {
  309. return false;
  310. }
  311. if (
  312. $withdrawCash['status'] == "打款中"
  313. || $withdrawCash['status'] == "自动打款中"
  314. || $withdrawCash['status'] == "人工打款中"
  315. || $withdrawCash['status'] == "打款成功"
  316. || $withdrawCash['status'] == "自动打款成功"
  317. || $withdrawCash['status'] == "人工打款成功"
  318. ) {
  319. return true;
  320. }
  321. return false;
  322. }
  323. /**
  324. * 判断当前提现记录是否 已打款 打款成功 状态
  325. * @param $withdrawCashId
  326. * @return bool true:已经打款 打款成功
  327. */
  328. public static function isWithdrawCashStatusSuccess($withdrawCashId)
  329. {
  330. $withdrawCash = WithdrawCash::where('id', $withdrawCashId)->first();
  331. if (empty($withdrawCash)) {
  332. return false;
  333. }
  334. if (
  335. $withdrawCash['status'] == "打款成功"
  336. || $withdrawCash['status'] == "自动打款成功"
  337. || $withdrawCash['status'] == "人工打款成功"
  338. ) {
  339. return true;
  340. }
  341. return false;
  342. }
  343. /**
  344. * 待打款状态
  345. * @param string $statusStr
  346. * @return bool
  347. */
  348. public static function isWithdrawCashStatusPaymentWaitStr($statusStr = '')
  349. {
  350. if (
  351. $statusStr == "待打款"
  352. || $statusStr == "自动待打款"
  353. || $statusStr == "人工待打款"
  354. ) {
  355. return true;
  356. }
  357. return false;
  358. }
  359. /**
  360. * 打款中状态
  361. * @param string $statusStr
  362. * @return bool
  363. */
  364. public static function isWithdrawCashStatusPaymentIngStr($statusStr = '')
  365. {
  366. if (
  367. $statusStr == "打款中"
  368. || $statusStr == "自动打款中"
  369. || $statusStr == "人工打款中"
  370. ) {
  371. return true;
  372. }
  373. return false;
  374. }
  375. /**
  376. * 成功打款Code
  377. * @param string $statusIn
  378. * @return bool
  379. */
  380. public static function isWithdrawCashStatusCodeSuccess($statusIn = '')
  381. {
  382. if ($statusIn == 30 || $statusIn == 31 || $statusIn == 32) {
  383. return true;
  384. }
  385. return false;
  386. }
  387. /**
  388. * 成功打款
  389. * @param string $statusStr
  390. * @return bool
  391. */
  392. public static function isWithdrawCashStatusStrSuccess($statusStr = '')
  393. {
  394. if (
  395. $statusStr == "打款成功"
  396. || $statusStr == "自动打款成功"
  397. || $statusStr == "人工打款成功"
  398. ) {
  399. return true;
  400. }
  401. return false;
  402. }
  403. /**
  404. * 获取成功和失败的状态
  405. * @return array
  406. */
  407. public static function getWithdrawCashStatusStrSuccessAndFailList()
  408. {
  409. $status = [];
  410. $status[] = "打款成功";
  411. $status[] = "自动打款成功";
  412. $status[] = "人工打款成功";
  413. $status[] = "打款失败";
  414. $status[] = "自动打款失败";
  415. $status[] = "人工打款失败";
  416. return $status;
  417. }
  418. /**
  419. * 获取 审核失败 打款成功 打款失败 状态
  420. * @return array
  421. */
  422. public static function getWithdrawCashStatusStrSuccessFailCheckedSuccessList()
  423. {
  424. $status = [];
  425. $status[] = "审核通过";
  426. $status[] = "审核不通过";
  427. $status[] = "待打款";
  428. $status[] = "自动待打款";
  429. $status[] = "人工待打款";
  430. $status[] = "打款中";
  431. $status[] = "自动打款中";
  432. $status[] = "人工打款中";
  433. $status[] = "打款成功";
  434. $status[] = "自动打款成功";
  435. $status[] = "人工打款成功";
  436. $status[] = "打款失败";
  437. $status[] = "自动打款失败";
  438. $status[] = "人工打款失败";
  439. return $status;
  440. }
  441. public static function getWithdrawCashStatusList($type)
  442. {
  443. if ($type == 10) {
  444. //channel
  445. $params = [
  446. ['code' => 0, 'name' => "待审核", 'show' => 1],
  447. // ['code' => 1 ,'name' => "审核中", 'show' => 0],
  448. // ['code' => 2 ,'name' => "审核通过", 'show' => 0],
  449. ['code' => 9, 'name' => "审核不通过", 'show' => 1],
  450. ['code' => 10, 'name' => "待打款", 'show' => 1],
  451. // ['code' => 11,'name' => "自动待打款", 'show' => 0],
  452. // ['code' => 13,'name' => "人工待打款", 'show' => 0],
  453. ['code' => 20, 'name' => "打款中", 'show' => 1],
  454. // ['code' => 21,'name' => "自动打款中", 'show' => 0],
  455. // ['code' => 22,'name' => "人工打款中", 'show' => 0],
  456. ['code' => 30, 'name' => "打款成功", 'show' => 1],
  457. // ['code' => 31,'name' => "自动打款成功", 'show' => 0],
  458. // ['code' => 32,'name' => "人工打款成功", 'show' => 0],
  459. ['code' => 40, 'name' => "打款失败", 'show' => 1],
  460. // ['code' => 41,'name' => "自动打款失败", 'show' => 0],
  461. // ['code' => 42,'name' => "人工打款失败", 'show' => 0],
  462. // ['code' => -1,'name' => "其他错误", 'show' => 0],
  463. ];
  464. return $params;
  465. }
  466. if ($type == 20) {
  467. //manage
  468. $params = [
  469. ['code' => 0, 'name' => "待审核", 'show' => 1],
  470. ['code' => 1, 'name' => "审核中", 'show' => 0],
  471. ['code' => 2, 'name' => "审核通过", 'show' => 0],
  472. ['code' => 9, 'name' => "审核不通过", 'show' => 1],
  473. ['code' => 10, 'name' => "待打款", 'show' => 1],
  474. ['code' => 11, 'name' => "自动待打款", 'show' => 0],
  475. ['code' => 13, 'name' => "人工待打款", 'show' => 0],
  476. ['code' => 20, 'name' => "打款中", 'show' => 1],
  477. ['code' => 21, 'name' => "自动打款中", 'show' => 0],
  478. ['code' => 22, 'name' => "人工打款中", 'show' => 0],
  479. ['code' => 30, 'name' => "打款成功", 'show' => 1],
  480. ['code' => 31, 'name' => "自动打款成功", 'show' => 0],
  481. ['code' => 32, 'name' => "人工打款成功", 'show' => 0],
  482. ['code' => 40, 'name' => "打款失败", 'show' => 1],
  483. ['code' => 41, 'name' => "自动打款失败", 'show' => 0],
  484. ['code' => 42, 'name' => "人工打款失败", 'show' => 0],
  485. ['code' => -1, 'name' => "其他错误", 'show' => 0],
  486. ];
  487. return $params;
  488. }
  489. }
  490. public static function getWithdrawCashStatusStr($statusIn = '')
  491. {
  492. $status = '';
  493. if (is_numeric($statusIn)) {
  494. if ($statusIn == 0) {
  495. $status = "待审核";
  496. } else if ($statusIn == 1) {
  497. $status = "审核中";
  498. } else if ($statusIn == 2) {
  499. $status = "审核通过";
  500. } else if ($statusIn == 9) {
  501. $status = "审核不通过";
  502. } else if ($statusIn == 10) {
  503. $status = "待打款";
  504. } else if ($statusIn == 11) {
  505. $status = "自动待打款";
  506. } else if ($statusIn == 12) {
  507. $status = "人工待打款";
  508. } else if ($statusIn == 20) {
  509. $status = "打款中";
  510. } else if ($statusIn == 21) {
  511. $status = "自动打款中";
  512. } else if ($statusIn == 22) {
  513. $status = "人工打款中";
  514. } else if ($statusIn == 30) {
  515. $status = "打款成功";
  516. } else if ($statusIn == 31) {
  517. $status = "自动打款成功";
  518. } else if ($statusIn == 32) {
  519. $status = "人工打款成功";
  520. } else if ($statusIn == 40) {
  521. $status = "打款失败";
  522. } else if ($statusIn == 41) {
  523. $status = "自动打款失败";
  524. } else if ($statusIn == 42) {
  525. $status = "人工打款失败";
  526. } else if ($statusIn == -1) {
  527. $status = "其他错误";
  528. } else {
  529. $status = "";
  530. }
  531. }
  532. return $status;
  533. }
  534. public static function getWithdrawCashStatusStrList($statusIn = '')
  535. {
  536. $status = '';
  537. if (is_numeric($statusIn)) {
  538. $status = [];
  539. if ($statusIn == 0) {
  540. $status[] = "待审核";
  541. } else if ($statusIn == 1) {
  542. $status[] = "审核中";
  543. } else if ($statusIn == 2) {
  544. $status[] = "审核通过";
  545. } else if ($statusIn == 9) {
  546. $status[] = "审核不通过";
  547. } else if ($statusIn == 10) {
  548. $status[] = "待打款";
  549. $status[] = "自动待打款";
  550. $status[] = "人工待打款";
  551. } else if ($statusIn == 11) {
  552. $status[] = "自动待打款";
  553. } else if ($statusIn == 12) {
  554. $status[] = "人工待打款";
  555. } else if ($statusIn == 20) {
  556. $status[] = "打款中";
  557. $status[] = "自动打款中";
  558. $status[] = "人工打款中";
  559. } else if ($statusIn == 21) {
  560. $status[] = "自动打款中";
  561. } else if ($statusIn == 22) {
  562. $status[] = "人工打款中";
  563. } else if ($statusIn == 30) {
  564. $status[] = "打款成功";
  565. $status[] = "自动打款成功";
  566. $status[] = "人工打款成功";
  567. } else if ($statusIn == 31) {
  568. $status[] = "自动打款成功";
  569. } else if ($statusIn == 32) {
  570. $status[] = "人工打款成功";
  571. } else if ($statusIn == 40) {
  572. $status[] = "打款失败";
  573. $status[] = "自动打款失败";
  574. $status[] = "人工打款失败";
  575. } else if ($statusIn == 41) {
  576. $status[] = "自动打款失败";
  577. } else if ($statusIn == 42) {
  578. $status[] = "人工打款失败";
  579. } else if ($statusIn == -1) {
  580. $status[] = "其他错误";
  581. } else {
  582. $status[] = "未知错误码";
  583. }
  584. }
  585. return $status;
  586. }
  587. public static function updateWithdrawCashType($id, $param)
  588. {
  589. return WithdrawCash::where('id', $id)->update($param);
  590. }
  591. }