Exemplo n.º 1
0
 public function actionBack()
 {
     if (!isset($_POST['callid']) || !$_POST['callid']) {
         $this->_exit($this->_error['20040'], '20040');
     }
     $cid = trim($_POST['callid']);
     $res = Callhistory::model()->getCallStatus($cid);
     if ($res >= 0) {
         $this->_exit($this->_error['20000'], '20000', $res, 'status');
     }
 }
Exemplo n.º 2
0
 /**
  * 财付通充值回调
  */
 public function actionNotify()
 {
     $data = array();
     $data['ver'] = Yii::app()->request->getParam('ver');
     $data['charset'] = Yii::app()->request->getParam('charset');
     $data['pay_result'] = Yii::app()->request->getParam('pay_result');
     $data['pay_info'] = Yii::app()->request->getParam('pay_info');
     $data['transaction_id'] = Yii::app()->request->getParam('transaction_id');
     $data['sp_billno'] = Yii::app()->request->getParam('sp_billno');
     $data['total_fee'] = Yii::app()->request->getParam('total_fee');
     $data['fee_type'] = Yii::app()->request->getParam('fee_type');
     $data['bargainor_id'] = Yii::app()->request->getParam('bargainor_id');
     $data['attach'] = Yii::app()->request->getParam('attach');
     $data['sign'] = Yii::app()->request->getParam('sign');
     $data['bank_type'] = Yii::app()->request->getParam('bank_type');
     $data['bank_billno'] = Yii::app()->request->getParam('bank_billno');
     $data['time_end'] = Yii::app()->request->getParam('time_end');
     $data['purchase_alias'] = Yii::app()->request->getParam('purchase_alias');
     $data['key'] = "ab124def05mgh7839cd33befg632cg04";
     $sign = PayOrder::model()->getSign($data);
     if ($sign != $data['sign']) {
         exit('fail');
     }
     if ($data['pay_result'] == "0") {
         $data['sp_billno'] = $data['sp_billno'] - 100000000000;
         $rows = PayOrder::model()->getOrder($data['sp_billno']);
         //获取金额和金币
         $uid = PayOrder::model()->getOrderUid($data['sp_billno']);
         //查询UID
         if ($rows['total_fee'] != $data['total_fee']) {
             PayOrder::model()->insertTenpayLog($uid, $data);
             //记录错误日志
             exit('fail');
         }
         $order = PayOrder::model()->updateOrder($data);
         //修改订单信息
         $coins = PayOrder::model()->addCoins($uid, $rows['total_coins']);
         //更新用户账户金币
         if ($coins) {
             Callhistory::model()->setCoinsHistory($uid, $rows['total_coins'], 12, 0);
             //更新推广员的收入
             TgPremote::model()->insertTgIncome($uid, $rows['total_coins']);
         }
         if ($order && $coins) {
             exit('success');
         }
     }
 }