作者 anyv

提现

... ... @@ -14,7 +14,17 @@ class WithdrawalController extends AdminBaseController{
public function withd_audit(){
if($this -> request -> isPost()){
$where['state'] = 0;
if(!empty($_POST['start_time']) && !empty($_POST['end_time'])){
$start_time = strtotime($_POST['start_time']);
$end_time = strtotime($_POST['end_time']);
$where['a.create_time'] = [['>=',$start_time],['<=',$end_time]];
}
if(!empty($_POST['keyword'])){
$where['b.phone'] = $_POST['keyword'];
}
$data = Db::name('money_expend') -> alias('a') -> field('a.*,b.phone') -> join('my_user b','a.uid=b.uid','LEFT') -> where($where) -> paginate(12);
$data_arr = $data -> toArray();
}else{
$data = Db::name('money_expend') -> alias('a') -> field('a.*,b.phone') -> join('my_user b','a.uid=b.uid','LEFT') -> where("state = 0") -> paginate(12);
$data_arr = $data -> toArray();
... ... @@ -46,10 +56,10 @@ class WithdrawalController extends AdminBaseController{
if(!empty($_POST['keyword'])){
$where['b.phone'] = $_POST['keyword'];
}
$data = Db::name('money_expend') -> alias('a') -> join('my_user b','a.uid=b.uid','LEFT') -> where($where) -> paginate(12);
$data = Db::name('money_expend') -> alias('a') -> field('a.*,b.phone') -> join('my_user b','a.uid=b.uid','LEFT') -> where($where) -> paginate(12);
$data_arr = $data -> toArray();
}else{
$data = Db::name('money_expend') -> alias('a') -> join('my_user b','a.uid=b.uid','LEFT') -> where("state = 1 or state = 2") -> paginate(12);
$data = Db::name('money_expend') -> alias('a') -> field('a.*,b.phone') -> join('my_user b','a.uid=b.uid','LEFT') -> where("state = 1 or state = 2") -> paginate(12);
$data_arr = $data -> toArray();
}
if(!empty($data_arr)){
... ... @@ -94,7 +104,40 @@ class WithdrawalController extends AdminBaseController{
}
/**
* 提现审核通过
*/
public function withd_through(){
$money_expend = Db::name('money_expend') -> where('id',$_POST['id']) -> find();
$third_party = Db::name('third_party') -> where('user_id',$money_expend['uid']) -> find();
$result = $this -> merchantPay($third_party['openid'],'',$money_expend['money'],'企业付款');
dump($result);die;
}
/**
* 提现
*/
public function merchantPay($openid,$user_name,$price,$desc){
$options = [
'app_id' => config('wechat_config.app_id'),
'secret' => config('wechat_config.secret'),
'payment' => config('wechat_config.payment'),
];
$app = new Application($options);
$merchantPay = $app->merchant_pay;
$merchantPayData = [
'partner_trade_no' => cmf_get_order_sn(), //随机字符串作为订单号,跟红包和支付一个概念。
'openid' => $openid, //收款人的openid
'check_name' => 'NO_CHECK', //文档中有三种校验实名的方法 NO_CHECK OPTION_CHECK FORCE_CHECK
're_user_name'=>$user_name, //OPTION_CHECK FORCE_CHECK 校验实名的时候必须提交
'amount' => $price*100, //单位为分
'desc' => $desc,
'spbill_create_ip' => $this->request->ip(0,true), //发起交易的IP地址
];
$result = $merchantPay->send($merchantPayData);
return $result;
}
... ...
... ... @@ -21,7 +21,7 @@
style="width: 140px;" autocomplete="off"> &nbsp;
关键字:
<input type="text" class="form-control" name="keyword" style="width: 200px;"
value="{$keyword|default=''}" placeholder="请输入微信昵称...">
value="{$keyword|default=''}" placeholder="请输入手机号...">
<input type="submit" class="btn btn-primary" value="搜索"/>
<a class="btn btn-danger" href="">清空</a>
</form>
... ... @@ -73,6 +73,23 @@
});
}
}
/**
*点击通过时
*/
function withd_through(id){
ccc = window.confirm('确定通过吗?');
if(ccc){
$.post("{:url('Withdrawal/withd_through')}",{id:id},function(data){
if(data){
$('.tr'+id).remove();
}else{
alert('通过失败');
}
});
}
}
</script>
</body>
</html>
\ No newline at end of file
... ...