添加:灵活用工插件及提现相关流程处理
This commit is contained in:
parent
14e1972f8f
commit
5945e96bf3
|
|
@ -216,6 +216,9 @@ class Withdraw extends BaseModel
|
|||
const MANUAL_TO_ALIPAY = 3;
|
||||
|
||||
|
||||
// 第三方打款
|
||||
const MANUAL_TO_THIRD_PARTY = 4;
|
||||
|
||||
/**
|
||||
* 审核通过的收入 ids 集合
|
||||
*
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@ use app\common\services\PayFactory;
|
|||
use Illuminate\Support\Facades\DB;
|
||||
use app\common\services\finance\BalanceNoticeService;
|
||||
use app\common\services\finance\MessageService;
|
||||
use Yunshop\UseStaff\models\ExternalApi;
|
||||
use Yunshop\UseStaff\models\UseStaff;
|
||||
|
||||
class PayedService
|
||||
{
|
||||
|
|
@ -668,6 +670,19 @@ class PayedService
|
|||
*/
|
||||
private function manualWithdrawPay()
|
||||
{
|
||||
if($this->withdrawModel->manual_type == 4){
|
||||
// 第三方代发(汇优财)
|
||||
$staff = UseStaff::getSingleInfo(['uid'=>$this->withdrawModel->member_id]);
|
||||
$info = [
|
||||
'uid' => $this->withdrawModel->member_id,
|
||||
'month' => date("Ym",strtotime($this->withdrawModel->created_at)),
|
||||
'member_id' => $staff['member_id'],
|
||||
'salary' => $this->withdrawModel->actual_amounts
|
||||
];
|
||||
$result = (new ExternalApi())->salaryModelOutOrder($info);
|
||||
if((int)$result['respCode'] === 2) return true;
|
||||
else throw new ShopException($result['respDesc']);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ use Yunshop\TeamDividend\models\TeamDividendAgencyModel;
|
|||
use Yunshop\TeamDividend\services\withdraw\IncomeWithdrawApply;
|
||||
use app\common\services\finance\Withdraw as WithdrawService;
|
||||
use Yunshop\ShopEsign\common\service\ContractService;
|
||||
|
||||
use Yunshop\UseStaff\models\UseStaff;
|
||||
|
||||
class IncomeWithdrawController extends ApiController
|
||||
{
|
||||
|
|
@ -866,6 +866,15 @@ class IncomeWithdrawController extends ApiController
|
|||
$incomeWithdrawMode['manual']['wechat'] = $yz_member->wechat;
|
||||
$incomeWithdrawMode['manual']['member_name'] = $member_bank->member_name;
|
||||
$incomeWithdrawMode['manual']['bank_card'] = $member_bank->bank_card;
|
||||
// 获取第三方代发账号信息
|
||||
if (app('plugins')->isEnabled('use-staff')) {
|
||||
$staff = UseStaff::uniacid()
|
||||
->where('uid',$member_id)
|
||||
->select(['id','name','card_num'])
|
||||
->first();
|
||||
$incomeWithdrawMode['manual']['use_staff_name'] = $staff->name ?? '';
|
||||
$incomeWithdrawMode['manual']['use_staff_card_num'] = $staff->card_num ? substr_replace($staff->card_num,'******',6,-4) : '';
|
||||
}
|
||||
}
|
||||
return $this->successJson('获取数据成功!', $incomeWithdrawMode);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,10 @@ class ManualTypeController extends ApiController
|
|||
$result['manual_type'] = 'alipay';
|
||||
$result['status'] = WithdrawManualService::getAlipayStatus();
|
||||
break;
|
||||
case 4:
|
||||
$result['manual_type'] = 'third_party';
|
||||
$result['status'] = WithdrawManualService::getThirdPartyStatus();
|
||||
break;
|
||||
default:
|
||||
$result['manual_type'] = 'bank';
|
||||
$result['status'] = WithdrawManualService::getBankStatus();
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ namespace app\frontend\modules\finance\services;
|
|||
|
||||
use app\frontend\models\MemberShopInfo;
|
||||
use app\frontend\modules\member\models\MemberBankCard;
|
||||
use Yunshop\UseStaff\models\UseStaff;
|
||||
|
||||
class WithdrawManualService
|
||||
{
|
||||
|
|
@ -27,6 +28,10 @@ class WithdrawManualService
|
|||
return $yzMember ? ($yzMember->alipayname && $yzMember->alipay) ? true : false : false;
|
||||
}
|
||||
|
||||
public static function getThirdPartyStatus(){
|
||||
$staff = UseStaff::select(['name','card_num','status'])->where('uid',\YunShop::app()->getMemberId())->first();
|
||||
return $staff && $staff->name && $staff->card_num && (int)$staff->status == 4;
|
||||
}
|
||||
|
||||
public static function getBankStatus()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -136,6 +136,9 @@ class PayWayValidatorService
|
|||
case Withdraw::MANUAL_TO_ALIPAY:
|
||||
$result = $this->alipayStatus();
|
||||
break;
|
||||
case Withdraw::MANUAL_TO_THIRD_PARTY:
|
||||
$result = $this->thirdPartyStatus();
|
||||
break;
|
||||
default:
|
||||
$result = $this->bankStatus();
|
||||
}
|
||||
|
|
@ -290,6 +293,14 @@ class PayWayValidatorService
|
|||
}
|
||||
|
||||
|
||||
protected function thirdPartyStatus()
|
||||
{
|
||||
if (!WithdrawManualService::getThirdPartyStatus()) {
|
||||
return '请先完善信息';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function getManualType()
|
||||
{
|
||||
$set = Setting::get('withdraw.income');
|
||||
|
|
|
|||
|
|
@ -3904,4 +3904,38 @@ if (!function_exists('getTimeStamp')) {
|
|||
}
|
||||
return [$startTime,$endTime];
|
||||
}
|
||||
}
|
||||
}
|
||||
// post请求
|
||||
if (!function_exists('curlPost')) {
|
||||
function curlPost($url, $post_data = array(), $timeout = 5, $header = "", $data_type = "") {
|
||||
$header = empty($header) ? '' : $header;
|
||||
//支持json数据数据提交
|
||||
if($data_type == 'json'){
|
||||
$post_string = json_encode($post_data);
|
||||
}elseif($data_type == 'array') {
|
||||
$post_string = $post_data;
|
||||
}elseif(is_array($post_data)){
|
||||
$post_string = http_build_query($post_data, '', '&');
|
||||
}
|
||||
|
||||
$ch = curl_init(); // 启动一个CURL会话
|
||||
curl_setopt($ch, CURLOPT_URL, $url); // 要访问的地址
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // 对认证证书来源的检查 // https请求 不验证证书和hosts
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); // 从证书中检查SSL加密算法是否存在
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); // 模拟用户使用的浏览器
|
||||
//curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); // 使用自动跳转
|
||||
//curl_setopt($curl, CURLOPT_AUTOREFERER, 1); // 自动设置Referer
|
||||
curl_setopt($ch, CURLOPT_POST, true); // 发送一个常规的Post请求
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_string); // Post提交的数据包
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); // 设置超时限制防止死循环
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
|
||||
//curl_setopt($curl, CURLOPT_HEADER, 0); // 显示返回的Header区域内容
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // 获取的信息以文件流的形式返回
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $header); //模拟的header头
|
||||
$result = curl_exec($ch);
|
||||
|
||||
|
||||
curl_close($ch);
|
||||
return json_decode($result,true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -522,6 +522,10 @@
|
|||
<input type='radio' name='withdraw[income][manual_type]' value='3' @if($set['manual_type'] == 3) checked @endif />
|
||||
支付宝
|
||||
</label>
|
||||
<label class='radio-inline'>
|
||||
<input type='radio' name='withdraw[income][manual_type]' value='4' @if($set['manual_type'] == 4) checked @endif />
|
||||
第三方代发(汇优财)
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue