Beispiel #1
0
 public static function createorder($quoID, $schID, $payment, $address, $ordertype, $goodsids, $nums, $CouponSn)
 {
     $opration = array();
     //错误时执行操作
     $sql_findQuo = 'select * from pap_quotation where QuoID=' . $quoID;
     $Quoinfo = Yii::app()->papdb->createCommand($sql_findQuo)->queryRow();
     //获取方案对应的商品
     $sql_goods = 'select * from pap_quotation_goods where SchID=' . $schID . ' and GoodsID in(' . $goodsids . ') ';
     $goodsinfo = self::excutesql(array('sql' => $sql_goods, 'db' => 'pap'));
     //获取经销商最小价格
     $min_price = PapOrderMinTurnover::model()->find('OrganID=:OrganID', array(':OrganID' => $Quoinfo['DealerID']));
     $min_price = $min_price['MinTurnover'];
     //获取经销商信息
     $sql_dealer = 'select ID,OrganName from jpd_organ where ID=' . $Quoinfo['DealerID'];
     $dealerinfo = Yii::app()->jpdb->createCommand($sql_dealer)->queryRow();
     //获取修理厂信息
     $find_lsm_orgname = 'select OrganName from jpd_organ where ID=' . $Quoinfo['ServiceID'];
     $serviceinfo = Yii::app()->jpdb->createCommand($find_lsm_orgname)->queryRow();
     //调用商城生成订单方法
     $carts = array();
     $carts['SellerID'] = $Quoinfo['DealerID'];
     $carts['BuyerID'] = $Quoinfo['ServiceID'];
     $carts['SellerName'] = $dealerinfo['OrganName'];
     $carts['BuyerName'] = $serviceinfo['OrganName'];
     $carts['MinTurnover'] = $min_price ? $min_price : '0';
     //获取经销商订单折扣率--询报价订单
     $dis = 100;
     $discount = PapOrderDiscount::model()->find(array("condition" => " OrderType = 2"));
     if ($discount) {
         if ($payment == 1 && $discount['OrderAlipay']) {
             $dis = $discount['OrderAlipay'];
         } else {
             if ($payment == 2 && $discount['OrderLogis']) {
                 $dis = $discount['OrderLogis'];
             } else {
                 $dis = 100;
             }
         }
     } else {
         $dis = 100;
     }
     $carts['discount'] = $dis;
     $totalgoods;
     $nums = explode(',', $nums);
     foreach ($goodsinfo as $kk => $value) {
         $goodsbyid = DealergoodsService::getmongoversion($value['GoodsID'], $value['Version']);
         if ($goodsbyid) {
             $totalgoods[$kk] = array('BuyerID' => $Quoinfo['ServiceID'], 'BuyerName' => $serviceinfo['OrganName'], 'SellerID' => $dealerinfo['ID'], 'SellerName' => $dealerinfo['OrganName'], "GoodsID" => $value['GoodsID'], "GoodsNum" => $goodsbyid['GoodsInfo']['GoodsNO'], "GoodsOE" => is_array($goodsbyid['GoodsInfo']['oeno']) ? implode(',', $goodsbyid['GoodsInfo']['oeno']) : (is_string($goodsbyid['GoodsInfo']['oeno']) ? ['GoodsInfo']['oeno'] : ''), "GoodsName" => $goodsbyid['GoodsInfo']['Name'], "CpName" => $goodsbyid['GoodsInfo']['StandCode'] ? self::getCpName($goodsbyid['GoodsInfo']['StandCode']) : '', "Brand" => $goodsbyid['GoodsInfo']['Brand'], "Price" => $goodsbyid['GoodsInfo']['Price'], "ProPrice" => $value['Price'], "Quantity" => $nums[$kk], "ShipCost" => null, "CreateTime" => time(), "UpdateTime" => time(), "Version" => $goodsbyid['Version']);
         }
     }
     $carts['GoodsList'] = $totalgoods;
     if ($ordertype == 2) {
         //如果是由询价单生成的订单
         //获取询价单信息
         $sql = 'select * from pap_inquiry where InquiryID=' . $Quoinfo['InquiryID'];
         $Inquiryinfo = Yii::app()->papdb->createCommand($sql)->queryRow();
         if (!$Inquiryinfo) {
             return json_encode(array('success' => false, 'message' => '确认失败,该询价单不存在'));
         }
         if ($Inquiryinfo['Status'] == 2) {
             return json_encode(array('success' => false, 'message' => '确认失败,该询价单已确认'));
         }
         if ($Inquiryinfo['Status'] == 3) {
             return json_encode(array('success' => false, 'message' => '确认失败,该询价单已撤销'));
         }
         // 修改询价单状态
         $updateinquiry = PapInquiry::model()->updateByPK($Quoinfo['InquiryID'], array('Status' => 2));
         if ($updateinquiry != 1) {
             return json_encode(array('success' => false, 'message' => '确认询价单失败', 'msg' => 'check inquiry fail', 'QuoID' => $quoID, 'data' => '确认询价单失败'));
         } else {
             //成功时插入return的SQL
             $opration[1] = 'update pap_inquiry set Status=1 where InquiryID=' . $Quoinfo['InquiryID'];
         }
     }
     //修改方案状态
     $updateschem = InquiryorderService::changeschstatus(array('status' => 2, 'SchID' => $schID));
     if ($updateschem != 1) {
         self::returnint($opration);
         return json_encode(array('success' => false, 'message' => '确认方案失败', 'msg' => 'check scheme fail', 'QuoID' => $quoID, 'data' => '确认方案失败'));
     } else {
         $opration[2] = 'update pap_quotation_scheme set Status="1" where SchID=' . $schID;
     }
     // 修改报价单状态
     $discountdesc = QuotationService::getpriceratio($Quoinfo['DealerID'], $Quoinfo['ServiceID']);
     $updateQuo = PapQuotation::model()->updateByPK($quoID, array('Status' => '2', 'Discount' => $discountdesc['type'] . ',' . $discountdesc['discount']));
     if ($updateQuo != 1) {
         self::returnint($opration);
         return json_encode(array('success' => false, 'message' => '确认报价单失败', 'msg' => 'check quo scheme fail', 'QuoID' => $quoID, 'data' => '确认报价单方案失败'));
     } else {
         $opration[3] = 'update pap_quotation set Status=1 where QuoID=' . $quoID;
     }
     $adressinfo = self::getaddressbypk($address);
     $params = array('payment' => $payment, 'ship' => $adressinfo, 'ordertype' => $ordertype, 'cartsGoods' => array($carts));
     //根据优惠券编号查询优惠券金额
     if ($CouponSn) {
         $copinfo = BuyGoodsService::couponbysn(array('couponsn' => $CouponSn));
         if ($copinfo) {
             $params['coupon'] = $copinfo['Amount'];
             $params['couponsn'] = $copinfo['CouponSn'];
             $params['usecouponID'] = $copinfo['CouponID'];
         }
     }
     //self::returnint($opration);
     $orderID = BuyGoodsService::createorder($params);
     //        exit;
     $orderID = intval($orderID);
     //获取订单编号
     $sql_order = 'select OrderSN from pap_order where ID=' . $orderID;
     $res = Yii::app()->papdb->createCommand($sql_order)->queryRow();
     $order_sn = $res['OrderSN'];
     if (!$orderID) {
         self::returnint($opration);
         return json_encode(array('success' => false, 'message' => '生成订单失败', 'msg' => 'create order fail', 'QuoID' => $quoID, 'data' => '创建订单失败'));
     }
     //保存订单编号到询价单表
     if ($ordertype == 2) {
         PapInquiry::model()->updateByPK($Quoinfo['InquiryID'], array('OrderSn' => $order_sn));
     }
     //保存订单ID到报价单表
     PapQuotation::model()->updateByPK($quoID, array('OrderID' => $orderID));
     //更改报价单待确认状态为已处理
     $sql = 'update pap_remind_business set HandleStatus=2 where HandleID=' . $quoID . ' and OrganID=' . $Quoinfo['ServiceID'];
     Yii::app()->papdb->createCommand($sql)->execute();
     return json_encode(array('success' => true, 'message' => '生成订单成功,点击跳转', 'msg' => 'carate order success', 'QuoID' => $quoID, 'data' => '创建订单成功', 'orderID' => $orderID, 'ordersn' => $order_sn));
 }
Beispiel #2
0
 public static function remindService($params)
 {
     $service = ' select OrganName,Phone from jpd_organ where ID=' . $params['OrganID'];
     $serviceres = Yii::app()->jpdb->createCommand($service)->queryRow();
     $scheme = 'SELECT SchID FROM `pap_quotation_scheme` where QuoID=' . $params['quoID'];
     $schemeres = Yii::app()->papdb->createCommand($scheme)->queryRow();
     //获取支付方式折扣率
     $discount = PapOrderDiscount::model()->find('OrderType=:OrderType', array(':OrderType' => 2));
     if ($discount) {
         if ($params['Payment'] == 1) {
             $factdiscount = $discount['OrderAlipay'] ? $discount['OrderAlipay'] : 100;
         } else {
             if ($params['Payment'] == 2) {
                 $factdiscount = $discount['OrderLogis'] ? $discount['OrderLogis'] : 100;
             }
         }
     } else {
         $factdiscount = 100;
     }
     $totalprices = self::Getsumprices($schemeres['SchID'], $factdiscount, trim($params['DealerID'], ','));
     $msg = '尊敬的' . $serviceres['OrganName'] . '客户,您的报价单方案已生成,总计' . $totalprices . '元。回复 ' . $params['checkSN'] . 'Y 确认、' . $params['checkSN'] . 'N 拒绝。详情:';
     $dealerinfo = QuotationService::getorganinfo(array('organID' => trim($params['DealerID'], ','), 'identity' => 2));
     //收货地址
     $addressql = ' select  ContactName,State,City,District,Address from jpd_receive_address where ID=' . $params['AddressID'];
     $address = Yii::app()->jpdb->createCommand($addressql)->queryRow();
     $address['site'] = Area::getaddress($address['State'], $address['City'], $address['District']) . $address['Address'];
     //获取报价单商品
     $goodssql = ' SELECT GoodsID,Num from pap_quotation_goods where SchID=' . $schemeres['SchID'];
     $goodses = Yii::app()->papdb->createCommand($goodssql)->queryAll();
     foreach ($goodses as $g) {
         $sql = ' select Name from pap_goods where ID=' . $g['GoodsID'];
         $gres = Yii::app()->papdb->createCommand($sql)->queryRow();
         $msg .= $gres['Name'] . ',' . $g['Num'] . '个;';
     }
     $msg .= '收货地址:' . $address['site'] . ';收货人:' . $address['ContactName'] . '。若有疑问请联系经销商:' . $dealerinfo['OrganName'] . ',电话:' . $dealerinfo['Phone'] . '。';
     $res = F::sendSMS(array('msg' => $msg, 'phone' => $serviceres['Phone']));
     if ($res['code'] == 0) {
         //发送成功,添加报价单短信确认数据
         $time = $_SERVER['REQUEST_TIME'];
         $insertsql = ' insert into pap_quotation_confirm (QuoID,DealerID,ServiceID,CreateTime) values(' . $params['quoID'] . $params['DealerID'] . $params['OrganID'] . ',' . $time . ')';
         $count = Yii::app()->papdb->createCommand($insertsql)->execute();
     }
     return $res;
 }
Beispiel #3
0
                <p class=" m-top5"></p>
            </ul>
        </div>
        <div style="*margin-top:50px">
            <p class="m-top20" style="margin: 10px 0 0 20px"><b>报价单信息</b></p>
            <ul class="xlcxx m-top">
                <li>报价单名称:<span><?php 
echo $quoinfo['Title'];
?>
</span></li>
                <li>报价单编号:<span><?php 
echo $quoinfo['QuoSn'];
?>
</span></li>
                <li>报价状态:<span><?php 
echo QuotationService::getstatus($quoinfo['Status']);
?>
</span></li>
                <li>创建时间:<span><?php 
echo date('Y-m-d H:i', $quoinfo['CreateTime']);
?>
</span></li>
                <div style="clear:both"></div>
                <p class=" m-top5"></p>
            </ul>
        </div>

    </div>
</div>
<!--报价单商品页-->
<?php 
Beispiel #4
0
 public function actionSaveedit()
 {
     $data = $_POST;
     $data['quoprices'] = $data['totalprices'];
     $data['shipprices'] = 0;
     if ($data['type'] == 1) {
         //报价单
         if ($data['quoid'] && $data['schid']) {
             //修改
             QuotationService::editscheme($data);
         } else {
             //新建
             QuotationService::newscheme($data);
         }
     } else {
         //询价单
         if ($data['schid']) {
             //修改
             InquiryService::editscheme($data);
         } else {
             //新建
             InquiryService::newscheme($data);
         }
     }
 }
Beispiel #5
0
 public function actionViewquo()
 {
     $params['inqid'] = Yii::app()->request->getParam('inqid');
     //获取询价单信息
     $inqres = InquiryService::getinqinfo($params['inqid']);
     //查询是否已经发送报价单
     $params['type'] = 1;
     $quoid = InquiryService::ifsendquo($params);
     if ($quoid) {
         //获取报价单方案
         $schparams['quoid'] = $quoid;
         $schparams['type'] = 4;
         $res = QuotationService::getschemelists($schparams);
     }
     $this->render('viewquo', array('inqres' => $inqres, 'schinfo' => $res['schinfo'], 'quoinfo' => $res['quoinfo']));
 }
Beispiel #6
0
 public function actionInquirydetail()
 {
     $inquiryid = Yii::app()->request->getParam('inquiryID');
     if (!$inquiryid) {
         throw new CHttpException('404');
     }
     //获取询价单信息
     $inquiryinfo = RPCClient::call('InquiryorderService_getinquirybyid', $inquiryid);
     if (!$inquiryinfo) {
         throw new CHttpException('404', '没有该询价单');
     }
     //获取发送经销商信息
     $dealerID = str_replace(',', '', $inquiryinfo['DealerID']);
     $sql_senddealer = 'select * from jpd_organ where ID=' . $dealerID;
     $delaer_info = InquiryorderService::excutesql(array('sql' => $sql_senddealer, 'db' => 'jpd'));
     //获取附件信息
     $inquiryimgs = RPCClient::call('InquiryorderService_getinquiryimgs', $inquiryid);
     //获取配件信息
     $sql = 'select * from pap_inquiry_category where InquiryID=' . $inquiryid;
     $categpry = InquiryorderService::excutesql(array('sql' => $sql, 'db' => 'pap'));
     if (!empty($categpry)) {
         $datacate = new CArrayDataProvider($categpry, array('pagination' => array('pageSize' => count($categpry))));
     } else {
         $datacate = '';
     }
     $prams = array('inquiryID' => $inquiryid, 'dealerids' => $inquiryinfo['DealerID']);
     $res;
     if ($inquiryinfo['Make']) {
         $paramas['Make'] = $inquiryinfo['Make'];
         $paramas['Car'] = $inquiryinfo['Car'];
         $paramas['Year'] = $inquiryinfo['Year'];
         $paramas['Model'] = $inquiryinfo['Model'];
         $res = InquiryService::getcarmodel($paramas);
     }
     //获取报价单信息
     $sql_findquo = 'select * from pap_quotation where InquiryID=' . $inquiryid . ' and IfSend="2"';
     $ars = InquiryorderService::excutesql(array('sql' => $sql_findquo, 'db' => 'pap'));
     $schinfo = '';
     $discount;
     if (!empty($ars)) {
         $schparams['quoid'] = $ars[0]['QuoID'];
         $schparams['type'] = 6;
         $schparams['sid'] = Yii::app()->user->getOrganID();
         $schinfo = QuotationService::getschemelists($schparams);
         //获取经销商最小交易额
         $miniprice = 0;
         $sql_findmini = 'select MinTurnover from pap_order_min_turnover where OrganID=' . $ars[0]['DealerID'];
         $lms_results = InquiryorderService::excutesql(array('sql' => $sql_findmini, 'db' => 'pap'));
         if ($lms_results && $lms_results[0]['MinTurnover']) {
             $miniprice = $lms_results[0]['MinTurnover'];
         }
         //获取经销商的折扣率
         $sql_finddiscount = 'select * from pap_order_discount where OrderType=2 ';
         $discount = InquiryorderService::excutesql(array('sql' => $sql_finddiscount, 'db' => 'pap'));
         if ($discount) {
             $discount[0]['OrderAlipay'] = $discount[0]['OrderAlipay'] ? $discount[0]['OrderAlipay'] . '%' : '';
             $discount[0]['OrderLogis'] = $discount[0]['OrderLogis'] ? $discount[0]['OrderLogis'] . '%' : '';
         }
     }
     //如果报价单已确认,查询订单ID
     $goodsdata;
     $sumtotal = 0;
     if (!empty($ars) && $ars[0]['OrderID']) {
         $sql_find_sum = 'select GoodsAmount from pap_order where ID=' . $ars[0]['OrderID'];
         $sum = Yii::app()->papdb->createCommand($sql_find_sum)->queryRow();
         $sumtotal = $sum['GoodsAmount'];
         $sql_find_goods = 'select * from pap_order_goods where OrderID=' . $ars[0]['OrderID'];
         $goodsinfo = Yii::app()->papdb->createCommand($sql_find_goods)->queryAll();
         $rearray = array();
         $partlevel = Yii::app()->getParams()->PartsLevel;
         $totals = 0;
         foreach ($goodsinfo as $key => $value) {
             //插入配件档次
             $pat_sql = 'select PartsLevel from pap_goods where ID=' . $value['GoodsID'];
             $final = Yii::app()->papdb->createCommand($pat_sql)->queryRow();
             $value['PL'] = $partlevel[$final['PartsLevel']];
             $value['GoodsOE'] = '<div style="width: 120px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;" title="' . $value['GoodsOE'] . '" >' . $value['GoodsOE'] . '</div>';
             //self::getmaxlength($value['GoodsOE'], 8, true);
             $value['rowNo'] = $key + 1;
             $value['GoodsName'] = '<div  href="javascript:void(0);" goodsid="' . $value['GoodsID'] . '"  orderid="' . $value['OrderID'] . '" version="' . $value['Version'] . '" class="quottion_goods_href" title="' . $value['GoodsName'] . '"  style="width: 100px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;cursor:pointer;">' . $value['GoodsName'] . '</div>';
             $value['GoodsNum'] = '<div   href="javascript:void(0);" goodsid="' . $value['GoodsID'] . '"  orderid="' . $value['OrderID'] . '" version="' . $value['Version'] . '" class="quottion_goods_href"  title="' . $value['GoodsNum'] . '" style="width: 80px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;cursor:pointer;">' . $value['GoodsNum'] . '</div>';
             $rearray[$key] = $value;
         }
         $goodsdata = new CArrayDataProvider($rearray, array('pagination' => array('pageSize' => count($rearray))));
     }
     //己方地址
     $address = RPCClient::call('InquiryorderService_getaddressid', Yii::app()->user->getOrganID());
     $addressprovider = RPCClient::call('InquiryorderService_dataproviderpage', $address);
     $model = new JpdReceiveAddress();
     $this->render('inquirydetail', array('inquiryinfo' => $inquiryinfo, 'res' => $res, 'imsgs' => $inquiryimgs, 'category' => $datacate ? $datacate : '', 'schinfo' => $schinfo ? $schinfo['schinfo'] : $schinfo, 'model' => $model, 'quoinfo' => $ars ? $ars[0] : $ars, 'address' => $addressprovider, 'discount' => $discount ? $discount[0] : $discount, 'mini' => $miniprice, 'goodsdata' => $goodsdata ? $goodsdata : '', 'sumtotal' => $sumtotal, 'dealer_info' => $delaer_info ? $delaer_info[0] : ''));
 }
Beispiel #7
0
 /**
  * 模糊循环匹配配件信息(配件查询会用到)
  */
 public static function getGoodsByPartsOENO($oe)
 {
     $sql = "select * from `pap_goods` where  IsSale = 1 and ISdelete = 1";
     if (!empty($oe) && is_array($oe)) {
         // OE号不为空,并且是数组
         $oearr = array_unique($oe);
         $oesql = 'select DISTINCT GoodsID from pap_goods_oe_relation where ';
         foreach ($oearr as $v) {
             $oesql .= 'OENO = "' . $v . '" or ';
         }
         $oesql = rtrim($oesql, 'or ');
     } elseif (!empty($oe) && !is_array($oe)) {
         // OE号不为空,并且不是数组
         $oesql = 'select DISTINCT GoodsID from pap_goods_oe_relation where OENO = "' . $oe . '"';
     }
     $oedatas = Yii::app()->papdb->createCommand($oesql)->queryAll();
     $ids = array();
     foreach ($oedatas as $v) {
         $ids[] = $v['GoodsID'];
     }
     $idstr = implode(',', $ids);
     if ($idstr) {
         $where .= ' and ID in (' . $idstr . ')';
     } else {
         $where .= ' and ID in (0)';
     }
     $sql .= $where . ' order by ID desc limit 3';
     $goodses = Yii::app()->papdb->createCommand($sql)->queryAll();
     $data = array();
     //判断当前登录角色(修理厂/经销商)
     $Identity = Yii::app()->user->getIdentity();
     if ($Identity == 'servicer') {
         $Identity = 3;
     } else {
         $Identity = 2;
     }
     $OrganID = Yii::app()->user->getOrganID();
     foreach ($goodses as $key => $goods) {
         $data[$key]['ImageUrl'] = self::getGoodsImage($goods['ID']);
         $data[$key]['ID'] = $goods['ID'];
         $data[$key]['OENO'] = QuotationService::getoebygoodsid($goods['ID']);
         $data[$key]['OrganID'] = $goods['OrganID'];
         $data[$key]['Name'] = $goods['Name'];
         $data[$key]['OrganName'] = self::getnamebyorganid($goods['OrganID']);
         $data[$key]['ListPrice'] = $goods['Price'];
         $data[$key]['Identity'] = $Identity;
         //当前登录用户觉角色
         //折扣率
         if ($Identity == 3) {
             //修理厂
             $discount = QuotationService::getpriceratio($goods['OrganID'], $OrganID);
             $data[$key]['PriceRatio'] = $discount['discount'] ? $discount['discount'] . '%' : "100%";
             $DisPrice = sprintf("%.2f", $goods['Price'] * $data[$key]['PriceRatio'] / 100);
             // 折扣价,小数点后面保留两位
             if ($goods['IsPro'] == 1) {
                 //促销商品
                 $ProPrice = empty($goods['ProPrice']) || $goods['ProPrice'] == 0 ? $DisPrice : $goods['ProPrice'];
                 // 促销价
                 $data[$key]['Price'] = $ProPrice < $DisPrice ? $ProPrice : $DisPrice;
             } else {
                 //非促销商品
                 $data[$key]['Price'] = $DisPrice;
                 //折扣价
             }
         } elseif ($Identity == 2) {
             //经销商
             $data[$key]['Price'] = $goods['Price'];
             //参考价
         }
     }
     return $data;
 }
Beispiel #8
0
            <?php 
if ($quoinfo) {
    ?>
                <p class="m-top20" style="clear:both"><b>报价单信息</b></p>
                <ul class="zdyul m-top">
                    <li>报价单名称:<span><?php 
    echo $quoinfo['Title'];
    ?>
</span></li>
                    <li>报价单编号:<span><?php 
    echo $quoinfo['QuoSn'];
    ?>
</span></li>
                    <li>报价状态:<span><?php 
    echo $quoinfo['IfSend'] == 1 ? '待发送' : QuotationService::getstatus($quoinfo['Status']);
    ?>
</span></li>
                    <li>创建时间:<span><?php 
    echo date('Y-m-d H:i', $quoinfo['CreateTime']);
    ?>
</span></li>
                    <div style="clear:both"></div>
                    <p class=" m-top5"></p>
                </ul>
            <?php 
}
?>
        </div>
    </div>
Beispiel #9
0
 public function actionAddapply()
 {
     if (Yii::app()->request->isPostRequest) {
         $time = $_SERVER['REQUEST_TIME'];
         $type = Yii::app()->request->getParam('type');
         if ($type == 1) {
             $model = new JpdApplyDealer();
             $types = '经销商';
         } else {
             $model = new JpdApplyService();
             $types = '修理厂';
         }
         $model->attributes = $_POST;
         $model->CreateTime = $time;
         $model->UpdateTime = $time;
         if ($type == 2) {
             $model->Province = Yii::app()->request->getParam('Province_s');
             $model->City = Yii::app()->request->getParam('City_s');
             $model->Area = Yii::app()->request->getParam('Area_s');
         }
         if ($model->save()) {
             echo json_encode(array('res' => 1));
             $subject = '由你配提醒您';
             $email = QuotationService::getsysparam('apply_remind_email');
             if (!$email) {
                 $email = Yii::app()->params->sendEmail['email'];
             } else {
                 $email = array_filter(explode(',', $email));
             }
             $message = '<p>有用户申请加入unipei系统,申请人信息如下:</p><table>
             <tr><td>身份:</td><td>' . $types . '</td></tr>
             <tr><td>机构名称:</td><td>' . $model->OrganName . '</td></tr>
             <tr><td>店铺人数:</td><td>' . $model->StaffNum . '</td></tr>';
             if ($type == 1) {
                 $message .= '<tr><td>主营品牌:</td><td>' . $model->Brand . '</td></tr>
                 <tr><td>主营车系:</td><td>' . $model->CarModel . '</td></tr>';
             } elseif ($type == 2) {
                 $message .= '<tr><td>技师人数:</td><td>' . $model->TechnicianNum . '</td></tr>
                            <tr><td>工位数:</td><td>' . $model->PositionNum . '</td></tr>';
             }
             $message .= '                   
             <tr><td>申请人姓名:</td><td>' . $model->Name . '</td></tr>
             <tr><td>手机:</td><td>' . $model->Phone . '</td></tr>
             <tr><td>固定电话:</td><td>' . $model->TelPhone . '</td></tr>
             <tr><td>联系邮箱:</td><td>' . $model->Email . '</td></tr>
             <tr><td>QQ:</td><td>' . $model->QQ . '</td></tr>
             <tr><td>机构所在省:</td><td>' . Area::getdatabyid($model->Province) . '</td></tr>
             <tr><td>机构所在市:</td><td>' . Area::getdatabyid($model->City) . '</td></tr>
             <tr><td>机构所在区:</td><td>' . Area::getdatabyid($model->Area) . '</td></tr>
             <tr><td>机构所在街道:</td><td>' . $model->Address . '</td></tr>
             <tr><td>申请时间:</td><td>' . date('Y-m-d H:i:s', $time) . '</td></tr>';
             $message .= '</table>';
             UserModule::sendMail($email, $subject, $message);
         } else {
             echo json_encode($model->errors);
         }
     }
 }