1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- // +----------------------------------------------------------------------
- // | Niucloud-admin 企业快速开发的saas管理平台
- // +----------------------------------------------------------------------
- // | 官方网址:https://www.niucloud.com
- // +----------------------------------------------------------------------
- // | niucloud团队 版权所有 开源版本可自由商用
- // +----------------------------------------------------------------------
- // | Author: Niucloud Team
- // +----------------------------------------------------------------------
- namespace app\service\api\shop;
- use app\model\shop\ShopCashOut;
- use app\service\core\shop\CoreShopCashOutService;
- use core\base\BaseApiService;
- use core\exception\ApiException;
- use think\facade\Cache;
- /**
- * 店铺提现服务层
- */
- class ShopCashOutService extends BaseApiService
- {
- public function __construct()
- {
- parent::__construct();
- $this->model = new ShopCashOut();
- }
- /**
- * 店铺提现详情
- * @param int $id
- * @return array
- */
- public function getInfo(int $id)
- {
- $field = 'id,site_id,cash_out_no,transfer_type,transfer_realname,transfer_mobile,transfer_bank,transfer_account,transfer_fail_reason,transfer_time,apply_money,rate,service_money,money,audit_time,status,remark,create_time,refuse_reason, transfer_no, transfer_payee, transfer_payment_code';
- return $this->model->field($field)->where([ [ 'id', '=', $id ] ])->with(['siteInfo', 'transfer'])->append([ 'account_type_name', 'transfer_type_name', 'status_name', 'transfer_status_name' ])->findOrEmpty()->toArray();
- }
- /**
- * 提现转账(微信零钱)
- * @param int $id
- * @return void
- */
- public function transfer(int $id, array $data){
- $data['channel'] = $this->channel;
- $result = (new CoreShopCashOutService())->transfer($id, $data);
- return $result;
- }
- /**
- * 转账检测
- * @param string $code
- * @return bool|int
- */
- public function checkTransfer(string $code)
- {
- if (empty($code)) throw new ApiException('TRANSFER_CODE_EXPIRED');//转账二维码已过期
- $id = Cache::get($code);
- if (empty($id)) throw new ApiException('TRANSFER_CODE_EXPIRED');//转账二维码已过期
- return $id;
- }
- }
|