|
@@ -3,6 +3,7 @@
|
|
|
namespace app\common\model;
|
|
|
|
|
|
use app\service\pay_user\PayUserWechat;
|
|
|
+use app\service\WechatTransferSvc;
|
|
|
use think\Model;
|
|
|
|
|
|
/**
|
|
@@ -21,6 +22,10 @@ class TakeCash extends Model
|
|
|
protected $append = [
|
|
|
|
|
|
];
|
|
|
+
|
|
|
+ protected $type=[
|
|
|
+ 'response'=>'json',
|
|
|
+ ];
|
|
|
|
|
|
const STATUS_APPLY=0;
|
|
|
const STATUS_PASS=1;
|
|
@@ -36,14 +41,20 @@ class TakeCash extends Model
|
|
|
public function audit($status){
|
|
|
empty(self::$statusList[$status]) && throw_user('状态有误');
|
|
|
$this['status']=$status;
|
|
|
+ if(!$this->save()){
|
|
|
+ throw_user('保存失败');
|
|
|
+ }
|
|
|
$user=$this->user;
|
|
|
if($status==self::STATUS_REJECT){
|
|
|
$user::money($this['amount'],$user['id'],MoneyLog::TYPE_TAKECASH_REJECT,'提现不通过');
|
|
|
}elseif ($status==self::STATUS_PASS){
|
|
|
- (new PayUserWechat())->payment($this['amount'],$user,MoneyLog::TYPE_TAKECASH,'提现',[],false);
|
|
|
- }
|
|
|
- if(!$this->save()){
|
|
|
- throw_user('保存失败');
|
|
|
+ //(new PayUserWechat())->payment($this['amount'],$user,MoneyLog::TYPE_TAKECASH,'提现',[],false);
|
|
|
+ $this['order_no']=session_create_id();
|
|
|
+ $this['detail_no']=session_create_id();
|
|
|
+ $pay=new WechatTransferSvc();
|
|
|
+ list($response)=$pay->transfer($user['openid'],$this['order_no'],$this['detail_no'],$this['amount']);
|
|
|
+ $this['response']=$response;
|
|
|
+ $this->save();
|
|
|
}
|
|
|
}
|
|
|
|