sjtxapply.inc.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. global $_GPC, $_W;
  3. $storeid=$_COOKIE["storeid"];
  4. $cur_store = $this->getStoreById($storeid);
  5. $GLOBALS['frames'] = $this->getNaveMenu2($storeid);
  6. $sys=pdo_get('zhtc_system',array('uniacid'=>$_W['uniacid']),array('tx_type','tx_money'));
  7. $operation = !empty($_GPC['op']) ? $_GPC['op'] : 'display';
  8. $store=pdo_get('zhtc_store',array('id'=>$storeid,'uniacid'=>$_W['uniacid']),'wallet');
  9. //可提现金额
  10. $ktxcost= $store['wallet'];
  11. if(checksubmit('submit')){
  12. if(empty($_GPC['tx_cost'])){
  13. message('提现金额不能为空','','error');
  14. }
  15. if($sys['tx_money']> $ktxcost){
  16. message('未达到最低提现金额','','error');
  17. }
  18. if($_GPC['tx_cost']> $ktxcost){
  19. message('输入金额大于可提现金额','','error');
  20. }
  21. $data['name']=$_GPC['name'];//真实姓名
  22. $data['username']=$_GPC['username'];//账号
  23. $data['type']=$sys['tx_type'];
  24. $data['tx_cost']=$_GPC['tx_cost'];//提现金额
  25. $data['sj_cost']=$_GPC['sj_cost'];//实际到账金额
  26. $data['store_id']=$storeid;//商家id
  27. $data['method']=2;
  28. $data['time']=time();
  29. $data['state']=1;
  30. $data['uniacid']=$_W['uniacid'];
  31. $res=pdo_insert('zhtc_withdrawal',$data);
  32. $txsh_id=pdo_insertid();
  33. if($res){
  34. pdo_update('zhtc_store',array('wallet -='=>$_GPC['tx_cost']),array('id'=>$storeid));
  35. pdo_insert('zhtc_store_wallet',array('store_id'=>$storeid,'money'=>$_GPC['tx_cost'],'note'=>'提现申请','type'=>2,'time'=>date("Y-m-d H:i:s"),'tx_id'=>$txsh_id));
  36. message('添加成功',$this->createWebUrl2('sjtxlist',array()),'success');
  37. }else{
  38. message('添加失败','','error');
  39. }
  40. }
  41. include $this->template('web/sjtxapply');