Esempio n. 1
0
 /**
  * 支付宝异步通知
  * @return [type] [description]
  */
 public function alipayNotify()
 {
     if (empty($_POST)) {
         $this->error('您查看的页面不存在');
     }
     $alipay = new Alipay();
     if (!$alipay->isAlipay($_POST)) {
         $this->error('请不要做违法行为!');
     }
     $alipay_no = I('post.trade_no');
     $order_id = I('post.out_trade_no');
     $status = I('post.trade_status');
     if ($status == 'TRADE_FINISHED' || $status == 'TRADE_SUCCESS') {
         /**
          * 生成账单
          */
         $pay_amount = $this->mod->where(array('order_id' => $order_id))->getField('order_amount');
         M('Seller')->where(array('seller_id' => $this->mid))->setInc('predeposit', $pay_amount);
         $predeposit = M('Seller')->where(array('seller_id' => $this->mid))->getField('predeposit');
         $bill_data['seller_id'] = $this->mid;
         $bill_data['bill_log'] = '充值金币,订单号:' . $order_id . '充值' . $pay_amount;
         $bill_data['amount'] = $pay_amount;
         $bill_data['balance'] = $predeposit;
         $bill_data['addtime'] = NOW_TIME;
         $bill_data['bill_type'] = 1;
         //充值
         M('SellerBill')->add($bill_data);
         $this->mod->where(array('order_id' => $order_id))->setField('order_state', 20);
         echo 'success';
     }
 }
Esempio n. 2
0
 /**
  * 支付宝异步通知
  * @return [type] [description]
  */
 public function alipayNotify()
 {
     if (empty($_POST)) {
         $this->error('您查看的页面不存在');
     }
     $alipay = new Alipay();
     if (!$alipay->isAlipay($_POST)) {
         $this->error('请不要做违法行为!');
     }
     $alipay_no = I('post.trade_no');
     $order_sn = I('post.out_trade_no');
     $status = I('post.trade_status');
     if ($status == 'TRADE_FINISHED' || $status == 'TRADE_SUCCESS') {
         if ($_POST['type'] == 'repair') {
             $this->mod = M('Repair');
             $where = array('rp_sn' => $order_sn);
             $order = $this->mod->where($where)->find();
             if ($order['rp_status'] == 3) {
                 $res = $this->mod->where($where)->setField('rp_status', 4);
                 //订单日志
                 $log_data['rp_id'] = $order['rp_id'];
                 $log_data['log_content'] = '会员已支付维修订单.';
                 $log_data['log_time'] = NOW_TIME;
                 $log_data['is_view'] = 1;
                 M('RepairLog')->add($log_data);
             }
             echo 'success';
         } else {
             $where = array('order_sn' => $order_sn);
             $order = $this->mod->where($where)->find();
             if ($order['order_state'] == 10) {
                 $res = $this->mod->where($where)->setField('order_state', 20);
                 //订单日志
                 $log_data['order_id'] = $order['order_id'];
                 $log_data['order_state'] = get_order_state_name(20);
                 $log_data['change_state'] = get_order_state_name(30);
                 $log_data['state_info'] = '会员已支付订单';
                 $log_data['log_time'] = NOW_TIME;
                 $log_data['operator'] = '会员';
                 M('OrderLog')->add($log_data);
             }
             echo 'success';
         }
     }
 }