Esempio n. 1
0
 /**
  * 是否接单
  */
 public function doneAction()
 {
     $iStatus = intval($this->getParam('status'));
     $iAutoID = intval($this->getParam('id'));
     $aAdMedia = Model_AdMedia::getDetail($iAutoID);
     if (empty($aAdMedia)) {
         return $this->showMsg('数据出错了', false);
     }
     if ($aAdMedia['iStatus'] != Model_AdMedia::STATUS_RECEIVE) {
         return $this->showMsg('你已经处理过了', false);
     }
     $aAd = Model_Ad::getDetail($aAdMedia['iAdID']);
     if ($aAd['iStatus'] != Model_Ad::STATUS_APPROVE_OK) {
         return $this->showMsg('该推广还没有审核通过', false);
     }
     $iStatus = $iStatus == 1 ? Model_AdMedia::STATUS_SUBMIT_PREVIEW : Model_AdMedia::STATUS_CANCEL;
     Model_AdMedia::begin();
     Model_AdMedia::updStatus($iAutoID, $iStatus);
     if (Model_AdMedia::STATUS_CANCEL == $iStatus) {
         Model_Finance::updMoney($aAdMedia['iAUserID'], array('iPayment' => Model_Finance::PAYMENT_IN, 'iSource' => Model_Finance::SOURCE_REFUSE_AD, 'iPayType' => Model_Finance::TYPE_NO, 'iMoney' => $aAdMedia['iMoney']));
     }
     Model_AdMedia::commit();
     if (Model_AdMedia::STATUS_SUBMIT_PREVIEW == $iStatus) {
         // 邮件通知
         $sTitle = Model_Kv::getValue('media_receive_order_ok_email_title');
         $sContent = Model_Kv::getValue('media_receive_order_ok_email_content');
         // 短信通知
         $iTempID = Util_Common::getConf(4, 'aSmsTempID');
         $aUser = Model_User::getDetail($aAdMedia['iAUserID']);
         $aMedia = Model_Media::getDetail($aAdMedia['iMediaID']);
         Util_Tools::sendMail($aUser['sEmail'], $sTitle, $sContent, array($aMedia['sMediaName']));
         Util_Sms::sendTemplateSms($aUser['sMobile'], array($aMedia['sMediaName']), $iTempID);
         // echo $sTitle, "\n", $sContent, "\n", $aUser['sEmail'], $aUser['sMobile'], $iTempID;
     } else {
     }
     return $this->showMsg('操作成功', true);
 }
Esempio n. 2
0
 /**
  * 投放完成(结算)
  * 
  * @return boolean
  */
 public function finishAction()
 {
     $iAutoID = intval($this->getParam('id'));
     $aAdMedia = Model_AdMedia::getDetail($iAutoID);
     if (empty($aAdMedia)) {
         return $this->showMsg('数据出错了', false);
     }
     if ($aAdMedia['iStatus'] != Model_AdMedia::STATUS_CONFIRM_EFFECT) {
         return $this->showMsg('你已经处理过了', false);
     }
     $aAd = Model_Ad::getDetail($aAdMedia['iAdID']);
     Model_AdMedia::begin();
     Model_AdMedia::updStatus($iAutoID, Model_AdMedia::STATUS_FINISHED);
     Model_Finance::updMoney($aAdMedia['iMUserID'], array('iPayment' => Model_Finance::PAYMENT_IN, 'iSource' => Model_Finance::SOURCE_AD_CASH_IN, 'iPayType' => Model_Finance::TYPE_NO, 'iMoney' => $aAdMedia['iMoney']));
     Model_AdMedia::commit();
     // 邮件通知
     $sTitle = Model_Kv::getValue('ad_approve_preview_email_title');
     $sContent = Model_Kv::getValue('ad_approve_preview_email_content');
     // 短信通知
     $iTempID = Util_Common::getConf(6, 'aSmsTempID');
     $aUser = Model_User::getDetail($aAdMedia['iMUserID']);
     $aMedia = Model_Media::getDetail($aAdMedia['iMediaID']);
     Util_Mail::send($aUser['sEmail'], $sTitle, $sContent, array($aMedia['sEmail']));
     Util_Sms::sendTemplateSms($aUser['sMobile'], array($aMedia['sEmail']), $iTempID);
     // echo $sTitle, "\n", $sContent, "\n", $aUser['sEmail'], $aUser['sMobile'], $iTempID;
     return $this->showMsg('操作成功', true);
 }