コード例 #1
1
ファイル: InquiryService.php プロジェクト: zwq/unpei
 public static function getinqlists($params)
 {
     $organID = Yii::app()->user->getOrganID();
     $where = ' where a.Status!=3 and a.DealerID like "%,' . $organID . ',%"';
     if ($params) {
         $where .= self::inqsql($params);
     }
     $sql = 'select a.InquiryID,a.InquirySn,a.CreateTime,a.Status,a.OrganID,a.State' . ' from `pap_inquiry` a' . $where;
     $sqlcount = 'select count(*) from `pap_inquiry`  a' . $where;
     $count = Yii::app()->papdb->createCommand($sqlcount)->queryScalar();
     $sql .= ' order by InquiryID desc ';
     $inqlists = new CSqlDataProvider($sql, array('db' => Yii::app()->papdb, 'totalItemCount' => $count, 'pagination' => array('pageSize' => 10)));
     $datas = $inqlists->getData();
     foreach ($datas as $k => $d) {
         $status = self::checkstatus(array('inqid' => $d['InquiryID'], 'status' => $d['Status']));
         $datas[$k]['sta'] = $status['status'];
         $datas[$k]['stamsg'] = $status['msg'];
         $datas[$k]['rowNO'] = $k + 1;
         if ($d['State'] == 1) {
             $datas[$k]['from'] = '客服代发';
         } else {
             $datas[$k]['from'] = '修理厂';
         }
         $datas[$k]['Info'] = "<a href='" . Yii::app()->createUrl('/pap/inquirylist/viewquo', array('inqid' => $d['InquiryID'])) . "' target='_blank'>询价单详情</a>";
     }
     $inqlists->setData($datas);
     return $inqlists;
 }
コード例 #2
0
ファイル: IntroduceController.php プロジェクト: zwq/unpei
 public function getdealer()
 {
     $sql = 'select jg.ID,jg.OrganName,TelPhone from `jpd_organ` jg,`jpd_user` ju';
     $where = ' where jg.Identity=2 and jg.IsBlack="0" and jg.IsFreeze="0" and jg.Status="1"';
     $where .= ' and jg.ID=ju.OrganID and ju.IsMain="1"';
     //显示山东汽配联盟
     $where .= ' and jg.UnionID=1';
     $sqlcount = 'select count(*)  from `jpd_organ` jg,`jpd_user` ju' . $where;
     $count = Yii::app()->jpdb->createCommand($sqlcount)->queryScalar();
     $sql .= $where . ' order by Sort asc';
     $dealer = new CSqlDataProvider($sql, array('db' => Yii::app()->jpdb, 'totalItemCount' => $count, 'pagination' => array('pageSize' => $count)));
     $datas = $dealer->getData();
     $list = array();
     foreach ($datas as $key => $val) {
         $a = array();
         $b = array();
         $list[$key]['OrganName'] = $val['OrganName'];
         $sql_brand = 'select a.BrandName from pap_brand as a,pap_dealer_brand as b where b.OrganID=' . $val['ID'] . ' and b.BrandID=a.ID';
         $brand = Yii::app()->papdb->createCommand($sql_brand)->queryAll();
         $brand_str = "";
         foreach ($brand as $k => $v) {
             if ($v['BrandName'] === null) {
                 continue;
             }
             $a[] = $v['BrandName'];
         }
         if ($a) {
             $brand_str = implode(',', $a);
             $list[$key]['brand'] = '<a title="' . $brand_str . '">' . $brand_str . '</a>';
         } else {
             $list[$key]['brand'] = '';
         }
         $vehicles = DealerVehicles::model()->findAll('OrganID=:organ', array(':organ' => $val['ID']));
         $str = "";
         foreach ($vehicles as $k => $v) {
             $car = $v['Make'];
             if ($v['Car']) {
                 $car .= ' ' . $v['Car'];
                 $car .= ' ' . '全年款';
             } else {
                 $car .= ' ' . '全车系';
             }
             $b[] = $car;
         }
         if ($b) {
             $str = implode(',', $b);
             $list[$key]['vehicles'] = '<a title="' . $str . '">' . $str . '</a>';
         } else {
             $list[$key]['vehicles'] = '数据更新中...';
         }
         if ($val['TelPhone']) {
             $phone = explode(',', $val['TelPhone']);
             $list[$key]['TelPhone'] = $phone[0] . '<br>' . $phone[1];
         } else {
             $list[$key]['TelPhone'] = '暂无';
         }
     }
     $dealer->setData($list);
     return $dealer;
 }
コード例 #3
0
ファイル: MycouponController.php プロジェクト: zwq/unpei
 public function actionIndex()
 {
     $select = "a.CouponSn,b.Title,a.Amount,a.CreateTime,(a.CreateTime+a.Valid*3600*24) as EndTime," . "(case when UNIX_TIMESTAMP()>(a.CreateTime+a.Valid*3600*24) then '<p style=color:red>已过期</p>' when a.IsUse=0 then '未使用'  else  '已使用' end)  as IsUse";
     $sql = "select  {$select}" . " from pap.pap_coupon_manage  as a " . " left join  pap.pap_promotion as b " . "on a.PromoID=b.ID " . " left join  jpd.jpd_organ as c " . "on a.OwnerID=c.ID where 1=1";
     $OrganID = intval(Yii::app()->user->getOrganID());
     $sql .= " and c.ID={$OrganID}";
     $ID = Yii::app()->request->getParam('ID');
     $IsUse = Yii::app()->request->getParam('IsUse');
     if ($ID && trim($ID) != null) {
         $ID = trim($ID);
         $sql .= " and a.CouponSn like  '%{$ID}%'";
     }
     if ($IsUse) {
         if ($IsUse == 1) {
             $sql .= " and   a.IsUse=0";
         } else {
             if ($IsUse == 2) {
                 $sql .= " and   a.IsUse=1";
             } else {
                 if ($IsUse == 3) {
                     $sql .= " and  UNIX_TIMESTAMP()>(a.CreateTime+a.Valid*3600*24)";
                 }
             }
         }
     }
     $count = Yii::app()->papdb->createCommand(str_replace($select, 'count(a.ID)', $sql))->queryScalar();
     $lists = new CSqlDataProvider($sql, array('totalItemcount' => $count, 'db' => Yii::app()->papdb, 'pagination' => array('pageSize' => 10)));
     $datas = $lists->getData();
     // var_dump($sql);die;
     $op[1] = array('ID' => 1, 'Name' => "未使用");
     $op[2] = array('ID' => 2, 'Name' => "已使用");
     $op[3] = array('ID' => 3, 'Name' => "已过期");
     //var_dump($sql);die;
     $this->render('index', array('lists' => $lists, 'datas' => $datas, 'op' => $op));
 }
コード例 #4
0
ファイル: ContactController.php プロジェクト: zwq/unpei
 public function actionIndex()
 {
     $this->pageTitle = Yii::app()->name . '-' . "客户管理";
     $page = Yii::app()->request->getParam('page') ? Yii::app()->request->getParam('page') : 1;
     $pageSize = 15;
     $sql = "select * from jpd_organ where Identity=3";
     if ($_GET) {
         $OrganName = Yii::app()->request->getParam('OrganName');
         if ($OrganName) {
             $sql .= " and OrganName like '%{$OrganName}%'";
         }
         $Phone = Yii::app()->request->getParam('Phone');
         if ($Phone) {
             $sql .= " and Phone like '%{$Phone}%'";
         }
     }
     $sql .= " order by ID desc";
     $count = Yii::app()->jpdb->createCommand(str_replace('*', 'count(*)', $sql))->queryScalar();
     $data = new CSqlDataProvider($sql, array('totalItemCount' => $count, 'db' => Yii::app()->jpdb, 'pagination' => array('pageSize' => $pageSize)));
     $datas = $data->getData();
     foreach ($datas as $k => $v) {
         $datas[$k]['rowNO'] = $k + 1 + ($page - 1) * $pageSize;
         //            $datas[$k]['OrganName']='<div title="'.$v['OrganName'].'">'.$v['OrganName'].'</div>';
     }
     $data->setData($datas);
     $this->render('index', array('dataProvider' => $data, 'OrganName' => $OrganName, 'Phone' => $Phone));
 }
コード例 #5
0
ファイル: SenchaController.php プロジェクト: cntabana/inyungu
 public function actionIndex()
 {
     $sql = "SELECT cp.id as id,pr.productname as productname, m.umurenge,r.firstname, totalamount,dis.district,r.lastname, currentprice, quantity,mesure, creationdate,province,district,umudugudu,akagali,detail,telephone,image\n\t\t\t\t\tFROM igu_payment p, igu_voucher v, igu_credit c, igu_products pr, igu_client_product cp,igu_registration r,imirenge m,igu_district dis,igu_province pro\n\t\t\t\t\tWHERE c.id = v.idcredit\n\t\t\t\t\tAND v.vouchernumber = p.vouchernumber\n\t\t\t\t\tAND pr.id = cp.idproduct\n\t\t\t\t\tand r.id = cp.idclient\n\t\t\t\t\tand m.id = r.idumurenge\n\t\t\t\t\tand m.iddistrict = dis.id\n\t\t\t\t\tand r.id = p.idclient\n\t\t\t\t\tand pro.id = dis.idprovince\n\t\t\t\t\tand dis.id = r.iddistrict\n\t\t\t\t\tand SUBSTRING(now(),1,10)  <= DATE_ADD( datepaiement, INTERVAL days DAY ) and validity = 0 order by id desc";
     $count = "SELECT count(*)\n\t\t\t\t\tFROM igu_payment p, igu_voucher v, igu_credit c, igu_products pr, igu_client_product cp,igu_registration r,imirenge m,igu_district dis,igu_province pro\n\t\t\t\t\tWHERE c.id = v.idcredit\n\t\t\t\t\tAND v.vouchernumber = p.vouchernumber\n\t\t\t\t\tAND pr.id = cp.idproduct\n\t\t\t\t\tand r.id = cp.idclient\n\t\t\t\t\tand m.id = r.idumurenge\n\t\t\t\t\tand m.iddistrict = dis.id\n\t\t\t\t\tand r.id = p.idclient\n\t\t\t\t\tand pro.id = dis.idprovince\n\t\t\t\t\tand dis.id = r.iddistrict\n\t\t\t\t\tand SUBSTRING(now(),1,10)  <= DATE_ADD( datepaiement, INTERVAL days DAY ) and validity = 0";
     $record = Yii::app()->db->createCommand($count)->queryScalar();
     $dataProvider = new CSqlDataProvider($sql, array('totalItemCount' => $record, 'sort' => array('attributes' => array('productname' => array('asc' => 'igu_products.productname', 'desc' => 'igu_products.productname DESC'))), 'pagination' => array('pageSize' => 25)));
     $data = $dataProvider->getData();
     $this->renderPartial('index', array('data' => $data));
 }
コード例 #6
0
ファイル: LogisticsService.php プロジェクト: zwq/unpei
 public static function getlists($params)
 {
     $sql = 'select * from `jpd_logistics` ';
     $sqlcount = 'select count(*) from `jpd_logistics`  ';
     $count = Yii::app()->jpdb->createCommand($sqlcount)->queryScalar();
     $sql .= ' order by ID desc ';
     $lists = new CSqlDataProvider($sql, array('db' => Yii::app()->jpdb, 'totalItemCount' => $count, 'pagination' => array('pageSize' => 5)));
     $datas = $lists->getData();
     foreach ($datas as $k => $data) {
         $datas[$k]['area'] = self::getlogarea($data['ID']);
     }
     $lists->setData($datas);
     return $lists;
 }
コード例 #7
0
ファイル: SupportService.php プロジェクト: zwq/unpei
 public static function getServiceData($params)
 {
     $OrganID = Yii::app()->user->getOrganID();
     $sql = "SELECT jsp.RecordID, jsr.CreateTime, jsr.Mileage \n                FROM jpd_support_parts AS jsp, jpd_support_record AS jsr \n                WHERE jsp.RecordID = jsr.ID AND jsr.OrganID = '{$OrganID}' AND jsr.CarID = '{$params['CarID']}' AND jsr.Status = 0\n                GROUP BY jsp.RecordID ORDER BY jsr.CreateTime DESC";
     $countsql = "SELECT COUNT(*) FROM (" . $sql . ") as tab";
     //echo $sql;die;
     $count = Yii::app()->jpdb->createCommand($countsql)->queryScalar();
     $dataProvider = new CSqlDataProvider($sql, array('db' => Yii::app()->jpdb, 'totalItemCount' => $count, 'pagination' => array('pageSize' => 5)));
     $data = $dataProvider->getData();
     //var_dump($data);die;
     foreach ($data as $key => $val) {
         $data[$key]['partsinfo'] = self::getServiceDataByServiceID($val['RecordID']);
     }
     $dataProvider->setData($data);
     return $dataProvider;
 }
コード例 #8
0
ファイル: SelleraccountService.php プロジェクト: zwq/unpei
 public static function getReturn($params)
 {
     $select = "ID,ReturnNO,CreateTime,PayMethod,ServiceID,Price";
     $seaCon = self::getReturnCond($params, $select);
     $pageSize = $params['pageSize'] ? $params['pageSize'] : 20;
     // $page = $params['page'] ? $params['page'] : 1;
     $count = Yii::app()->papdb->createCommand(str_replace($select, 'count(ID)', $seaCon))->queryScalar();
     $data = new CSqlDataProvider($seaCon, array('totalItemCount' => $count, 'db' => Yii::app()->papdb, 'pagination' => array('pageSize' => $pageSize)));
     $datas = $data->getData();
     foreach ($datas as $k => $v) {
         //$datas[$k]['rowNO'] = $k + 1 + ($page - 1) * $pageSize;
         $datas[$k]['CreateTime'] = date('Y-m-d H:i:s', $v['CreateTime']);
         $datas[$k]['PayMethod'] = $v['PayMethod'] == 0 ? '支付宝担保' : '物流代收款';
         $datas[$k]['BuyerName'] = "<p class='eval_organ'>" . Organ::model()->findByPk($v['ServiceID'])->attributes['OrganName'] . "</p>";
     }
     $data->setData($datas);
     return $data;
 }
コード例 #9
0
 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionUpdate($id)
 {
     $model = $this->loadModel($id);
     $formModel = new UserAssignmentForm();
     $sql = "select * from AuthAssignment where userid = '{$id}'";
     $dataProvider = new CSqlDataProvider($sql);
     foreach ($dataProvider->getData() as $key => $data) {
         $formModel->role[] = $data['itemname'];
     }
     if (isset($_POST['User'])) {
         $oldname = $model->username;
         $model->attributes = $_POST['User'];
         if ($model->validate()) {
             if (isset($_FILES['User']['name']['image']) && is_uploaded_file($_FILES['User']['tmp_name']['image'])) {
                 $model->upload($_FILES['User']);
             }
             $model->save();
             if (isset($_POST['UserAssignmentForm'])) {
                 foreach ($_POST['UserAssignmentForm'] as $key => $value) {
                     if (is_array($value) && is_array($formModel->role)) {
                         $toRevoke = array_diff($formModel->role, $value);
                         foreach ($toRevoke as $revokeData) {
                             Yii::app()->authManager->revoke($revokeData, $id);
                         }
                     }
                     if (!empty($value)) {
                         foreach ($value as $data) {
                             $formModel->save($data, $id, $key);
                         }
                     }
                 }
             }
             UserLogs::createLog('update ' . get_class($model) . ' ' . 'id:' . $model->primaryKey . ' old name:' . $oldname . ', name:' . $model->username);
             Yii::app()->user->setFlash('success', 'Informasi User sudah dirubah.');
             $this->redirect(array('index'));
         }
     }
     $this->render('update', array('model' => $model, 'permissionModel' => $formModel));
 }
コード例 #10
0
ファイル: EvaluateService.php プロジェクト: zwq/unpei
 public static function getServiceEval($params)
 {
     $pageSize = $params['pageSize'] ? $params['pageSize'] : 3;
     $starttime = $params['starttime'];
     $endtime = $params['endtime'];
     $OrganID = $params['OrganID'] ? $params['OrganID'] : Yii::app()->user->getOrganID();
     $select = " GROUP_CONCAT(JudgeID) as JudgeID,GROUP_CONCAT(Score)as Score,CreateTime,Message,Recier,OrganID";
     $seaCon = "select {$select} from `pap_evaluation_organ` t";
     if ($params['type'] == 'dealer') {
         $seaCon .= " where t.OrganID = {$OrganID} and t.Identity=3";
     } else {
         $seaCon .= " where t.Recier = {$OrganID} and t.Identity=3";
     }
     //下单时间
     if ($starttime && $endtime) {
         $seaCon .= " and t.CreateTime > {$starttime} and t.CreateTime < {$endtime}+3600*24";
     } else {
         if ($starttime) {
             $seaCon .= " and t.CreateTime > {$starttime}";
         } else {
             if ($endtime) {
                 $seaCon .= " and t.CreateTime < {$endtime}+3600*24";
             }
         }
     }
     if (!empty($params['search_text'])) {
         $search_text = self::checkKey(urldecode($params['search_text']));
         $idstr = self::getOrgan($search_text);
         if ($params['type'] == 'dealer') {
             $seaCon .= " and t.Recier in {$idstr}";
         } else {
             $seaCon .= " and t.OrganID in {$idstr}";
         }
     }
     $count = Yii::app()->papdb->createCommand(str_replace($select, 'count(distinct OrderID)', $seaCon))->queryScalar();
     $seaCon .= " group by t.OrderID";
     $seaCon .= " order by t.CreateTime DESC";
     $data = new CSqlDataProvider($seaCon, array('totalItemCount' => $count, 'db' => Yii::app()->papdb, 'pagination' => array('pageSize' => $pageSize)));
     $judgeitem = self::getevainfo(3);
     $datas = $data->getData();
     foreach ($datas as $k => $v) {
         $items = explode(',', $v['JudgeID']);
         $score = explode(',', $v['Score']);
         $itemscore = array();
         foreach ($items as $m => $n) {
             $itemscore[$n] = $score[$m];
         }
         ksort($itemscore);
         $datas[$k]['evalItem'] = '';
         $datas[$k]['evalScore'] = '';
         foreach ($itemscore as $kk => $vv) {
             if ($judgeitem[$kk]) {
                 $datas[$k]['evalItem'] .= "<p style='padding-left:20px;text-align:right'>" . $judgeitem[$kk] . "</p>";
                 if ($vv == 1) {
                     $datas[$k]['evalScore'] .= '<p>好评</p>';
                 } else {
                     if ($vv == 0) {
                         $datas[$k]['evalScore'] .= '<p>中评</p>';
                     } else {
                         if ($vv == -1) {
                             $datas[$k]['evalScore'] .= '<p>差评</p>';
                         }
                     }
                 }
             }
         }
         $datas[$k]['evalItem'] .= "<p>&nbsp;<p>";
         $datas[$k]['evalScore'] .= "<p style='color:#888'>[" . date('Y-m-d H:i:s', $v['CreateTime']) . "]</p>";
         $datas[$k]['Message'] = "<p style='width:250px;word-break:break-all;padding-left:20px'>{$v['Message']}</p>";
     }
     $data->setData($datas);
     return array('data' => $data, 'count' => $count);
 }
コード例 #11
0
ファイル: SellerorderService.php プロジェクト: zwq/unpei
 public static function getSellOrderList($params)
 {
     $page = $params['page'] ? $params['page'] : 1;
     $pageSize = $params['pageSize'] ? $params['pageSize'] : 3;
     $seaCon = self::getOrderCond($params);
     $count = Yii::app()->papdb->createCommand(str_replace('t.*', 'count(*)', $seaCon))->queryScalar();
     $data = new CSqlDataProvider($seaCon, array('totalItemCount' => $count, 'db' => Yii::app()->papdb, 'pagination' => array('pageSize' => $pageSize)));
     $datas = $data->getData();
     $i = 0;
     $total = 0;
     foreach ($datas as $k => $v) {
         $datas[$k]['rowNO'] = $k + 1 + ($page - 1) * $pageSize;
         $datas[$k]['Info'] = "<a href='" . Yii::app()->createUrl('/pap/sellerorder/detail', array('ID' => $v['ID'])) . "'>订单详情</a>";
         if (!$v['BuyerName']) {
             $datas[$k]['BuyerName'] = Organ::model()->findByPk($v['BuyerID'], array('select' => 'OrganName'))->attributes['OrganName'];
         }
         $i++;
         $total += $v['RealPrice'];
     }
     // var_dump($datas);die;
     $data->setData($datas);
     return array('dataProvider' => $data, 'count' => $i, 'total' => $total);
 }
コード例 #12
0
ファイル: InfoController.php プロジェクト: mjrao/BugFree
 private function getGridShowContent($searchFieldConfig, $showFieldArr, $infoType, $productId, $filterColumn, $whereStr, $isAllBasicField = false)
 {
     $pageSize = CommonService::getPageSize();
     $viewColumnArr = SearchService::getViewColumnArr($searchFieldConfig, $showFieldArr, $infoType, $productId, $filterColumn);
     $totalNum = SqlService::getTotalFoundNum($infoType, $productId, $whereStr, $isAllBasicField);
     $sql = SqlService::getRawDataSql($searchFieldConfig, $infoType, $productId, $this->getSqlSelectFieldArr($infoType, $showFieldArr), $whereStr, $isAllBasicField);
     $dataProvider = new CSqlDataProvider($sql, array('totalItemCount' => $totalNum, 'sort' => array('defaultOrder' => array('id' => true), 'multiSort' => true, 'attributes' => array_merge($showFieldArr, array(Info::MARK))), 'pagination' => array('pageSize' => $pageSize)));
     $sortArr = $dataProvider->getSort()->getDirections();
     Yii::app()->user->setState($productId . '_' . $infoType . '_sortArr', $sortArr);
     $preNextSessionSql = SqlService::getPreNextSql($searchFieldConfig, $infoType, $productId, $whereStr, Yii::app()->user->getState($productId . '_' . $infoType . '_sortArr', $isAllBasicField));
     Yii::app()->user->setState($productId . '_' . $infoType . '_prenextsql', $preNextSessionSql);
     return array('viewColumnArr' => $viewColumnArr, 'dataProvider' => $dataProvider, 'totalNum' => $totalNum);
 }
コード例 #13
0
ファイル: MarketController.php プロジェクト: 00606/wechat
 public function actionGiftCodes($id)
 {
     $this->layout = '/layouts/memberList';
     $codeTable = sprintf(GiftModel::CREATE_CODE_TABLE_NAME, $this->wechatInfo->id);
     $whereSql = 'giftId=' . $id;
     //DELET
     $count = Yii::app()->db->createCommand('SELECT COUNT(*) FROM ' . $codeTable . ' where ' . $whereSql)->queryScalar();
     $sql = 'SELECT * FROM ' . $codeTable . ' where ' . $whereSql;
     $dataProvider = new CSqlDataProvider($sql, array('totalItemCount' => $count, 'sort' => array('attributes' => array('name')), 'pagination' => array('pageSize' => Page::SIZE)));
     $this->render('giftCode', array('data' => $dataProvider->getData(), 'pages' => $dataProvider->getPagination(), 'giftId' => $id));
 }
コード例 #14
0
ファイル: SearchController.php プロジェクト: tymiles003/X2CRM
 /**
  * Rebuilds the search index.
  */
 public function actionBuildIndex()
 {
     $contact = new Contacts();
     $fieldData = $contact->getFields();
     // lookup searchable fields
     $fields = array();
     for ($i = 0; $i < count($fieldData); $i++) {
         if (in_array($fieldData[$i]->type, array('dropdown', 'text', 'varchar', 'assignment')) && !in_array($fieldData[$i]->fieldName, array('firstName', 'lastName', 'updatedBy', 'priority', 'id'))) {
             //,'phone','url','email','link',
             // || !$fields[$i]->searchable
             if ($fieldData[$i]->relevance == 'High') {
                 $relevance = 3;
             } elseif ($fieldData[$i]->relevance == 'Medium') {
                 $relevance = 2;
             } else {
                 $relevance = 1;
             }
             $fields[$fieldData[$i]->fieldName] = array('type' => $fieldData[$i]->type, 'linkType' => $fieldData[$i]->linkType, 'relevance' => $relevance);
         }
     }
     $t0 = microtime(true);
     $totalCount = Yii::app()->db->createCommand('SELECT count(*) from x2_contacts;')->queryScalar();
     $dataProvider = new CSqlDataProvider('SELECT ' . implode(',', array_merge(array_keys($fields), array('id', 'visibility'))) . ' FROM x2_contacts', array('totalItemCount' => $totalCount, 'sort' => array('defaultOrder' => 'id ASC'), 'pagination' => array('pageSize' => 500)));
     $dataProvider->getData();
     $pages = $dataProvider->pagination->getPageCount();
     echo $pages . ' pages.<br>';
     $searchTerms = array();
     // $fh = fopen('search.csv','w+');
     ob_end_flush();
     $keys = array();
     $tokenChars = " \n\r\t!\$%^&*()_+-=~[]{}\\|:;'\",.<>?/`‘’•–—“”";
     $noiseWords = array('a', 'about', 'after', 'all', 'also', 'an', 'and', 'another', 'any', 'are', 'arent', 'as', 'at', 'back', 'be', 'because', 'been', 'before', 'being', 'between', 'both', 'but', 'by', 'came', 'can', 'cant', 'come', 'contact', 'contacts', 'contacted', 'could', 'data', 'did', 'didnt', 'do', 'dont', 'does', 'doesnt', 'each', 'for', 'from', 'get', 'go', 'going', 'goes', 'got', 'has', 'hasnt', 'had', 'hadnt', 'he', 'hes', 'his', 'hed', 'have', 'havent', 'her', 'hers', 'here', 'heres', 'him', 'himself', 'how', 'i', 'if', 'in', 'into', 'is', 'it', 'its', 'like', 'make', 'made', 'makes', 'many', 'me', 'might', 'mightnt', 'more', 'most', 'much', 'must', 'mustnt', 'my', 'mine', 'never', 'no', 'now', 'not', 'of', 'on', 'only', 'onto', 'or', 'other', 'our', 'out', 'over', 'said', 'same', 'see', 'she', 'shes', 'should', 'shouldnt', 'since', 'some', 'still', 'such', 'take', 'than', 'that', 'the', 'their', 'them', 'then', 'there', 'theres', 'these', 'they', 'theyre', 'this', 'those', 'through', 'to', 'too', 'today', 'under', 'up', 'very', 'want', 'wants', 'wanted', 'was', 'wasnt', 'way', 'ways', 'we', 'well', 'were', 'what', 'whats', 'where', 'which', 'while', 'who', 'why', 'will', 'with', 'would', 'wont', 'you', 'your', 'youre');
     for ($i = 1; $i <= $pages; ++$i) {
         // for($i = 1; $i<=1; ++$i) {
         $links = array();
         $dataProvider->pagination->setCurrentPage($i);
         foreach ($dataProvider->getData($i > 1) as $record) {
             // var_dump($record);
             foreach ($fields as $fieldName => &$field) {
                 // $fieldName = $field['fieldName'];
                 if (!empty($record[$fieldName])) {
                     // break string into words, and eliminate any contractions so we can safely tokenize on ' characters
                     $token = strtok(preg_replace('/(?<=\\w)\'(?=\\w)/u', '', $record[$fieldName]), $tokenChars);
                     while ($token !== false) {
                         $token = strtolower($token);
                         if (strlen($token) <= 50 && !in_array($token, $noiseWords)) {
                             $links[] = array($token, 'Contacts', $record['id'], $field['relevance'], $record['assignedTo'], $record['visibility']);
                         }
                         $token = strtok($tokenChars);
                     }
                 }
             }
             unset($field);
         }
         $sql = 'INSERT INTO x2_search (keyword, modelType, modelId, relevance, assignedTo, visibility) VALUES ';
         for ($j = 0; $j < count($links); ++$j) {
             $sql .= '(?,?,?,?,?,?)';
             if ($j < count($links) - 1) {
                 $sql .= ',';
             }
         }
         // echo $sql;
         // var_dump($links);
         // die();
         $query = Yii::app()->db->createCommand($sql);
         for ($j = 0; $j < count($links); ++$j) {
             $query = $query->bindValues(array(6 * $j + 1 => $links[$j][0], 6 * $j + 2 => $links[$j][1], 6 * $j + 3 => $links[$j][2], 6 * $j + 4 => $links[$j][3], 6 * $j + 5 => $links[$j][4], 6 * $j + 6 => $links[$j][5]));
         }
         // die(var_dump($links));
         // echo $query->getText();
         $query->execute();
         // break;
         echo "Page {$i}...done<br>";
         flush();
     }
     // Yii::app()->db->createCommand();
     echo 'Time: ' . (microtime(true) - $t0) . '<br>';
 }
コード例 #15
0
ファイル: OrderreturnService.php プロジェクト: zwq/unpei
 public static function getauditreturn()
 {
     $organID = Yii::app()->user->getOrganID();
     $returnsql = "select * from pap_return_order where Status=1 and DealerID  =  '" . $organID . "'  ORDER BY CreateTime DESC";
     $data = new CSqlDataProvider($returnsql, array('db' => Yii::app()->papdb, 'pagination' => array('pageSize' => 10)));
     //pap/dealerreturn/audit/ID/134
     $datas = $data->getData();
     foreach ($datas as $k => $v) {
         $datas[$k]['rowNO'] = $k + 1;
         $datas[$k]['Info'] = "<a href='" . Yii::app()->createUrl('/pap/dealerreturn/audit', array('ID' => $v['ID'])) . "' target='_blank'>退货单详情</a>";
     }
     $data->setData($datas);
     return $data;
 }
コード例 #16
0
ファイル: Evento.php プロジェクト: cicb/tpc
 public function getValidacion($distribucionId, $eventoId, $funcion, $ZonasId, $SubzonaId)
 {
     $query = "SELECT Count(IdDistribucionPuerta) As Total\n                 FROM distribucionpuertalevel1\n                 WHERE IdDistribucionPuerta = '{$distribucionId}' AND EventoId = '{$eventoId}' AND FuncionesId = '{$funcion}'\n                 AND ZonasId = '{$ZonasId}' AND SubzonaId = '{$SubzonaId}'";
     $data = new CSqlDataProvider($query, array('pagination' => false));
     return $data->getData();
 }
コード例 #17
0
ファイル: ReportesController.php プロジェクト: cicb/tpc
 public function actionImpresionBoletosAjax2()
 {
     $this->perfil();
     ini_set('memory_limit', '-1');
     set_time_limit(0);
     if (!empty($_POST['formatoId'])) {
         $pv = $_POST['pv'];
         $EventoId = $_POST['EventoId'];
         $FuncionId = $_POST['FuncionId'];
         $todos = "";
         $ref = "";
         if ($_POST['tipo_impresion'] == "no_impresos") {
             $todos = "  ventaslevel1.VentasCon='' AND ";
         }
         if ($_POST['tipo_impresion'] == "referencia") {
             $ref = "  ventas.VentasNumRef IN(" . $_POST['refs'] . ") AND ";
         }
         $data = array();
         $query = "(SELECT  ventas.VentasId as id, \n                                    funciones.funcionesTexto as fnc, \n                                    lugares.LugaresLug,\n                                    filas.FilasAli,\n                                    zonas.ZonasAli,\n                                    subzona.SubzonaAcc,\n                                    evento.EventoDesBol,\n                                    evento.EventoNom,\n                                    evento.EventoImaBol,\n                                    foro.ForoNom,\n                                    ventaslevel1.EventoId,\n                                    ventaslevel1.FuncionesId,\n                                    ventaslevel1.ZonasId,\n                                    ventaslevel1.SubzonaId,\n                                    ventaslevel1.FilasId,\n                                    ventaslevel1.LugaresId,\n                                    ventaslevel1.VentasBolTip,\n                                    ventaslevel1.VentasCon,\n                                    ventaslevel1.VentasCarSer,\n                                    ventaslevel1.LugaresNumBol,\n                                    (ventaslevel1.VentasCosBol-ventaslevel1.VentasMonDes) as cosBol,\n                                    (ventaslevel1.VentasCosBol-ventaslevel1.VentasMonDes + ventaslevel1.VentasCarSer) as cosBolCargo,\n                                    ventas.UsuariosId,\n                                    ventas.VentasNumRef,\n                                    ventas.PuntosventaId,\n                                    ventas.VentasFecHor,\n                                    ventas.VentasNumTar,\n                                    ventas.VentasNomDerTar\n\t\t\t\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t\t\tlugares\n\t\t\t\t\t\t\t\t\tINNER JOIN funciones ON funciones.FuncionesId = lugares.FuncionesId AND funciones.EventoId = lugares.EventoId\n\t\t\t\t\t\t\t\t\tINNER JOIN ventaslevel1 ON (lugares.EventoId=ventaslevel1.EventoId)\n\t\t\t\t\t\t\t\t\tAND (lugares.FuncionesId=ventaslevel1.FuncionesId)\n\t\t\t\t\t\t\t\t\tAND (lugares.ZonasId=ventaslevel1.ZonasId)\n\t\t\t\t\t\t\t\t\tAND (lugares.SubzonaId=ventaslevel1.SubzonaId)\n\t\t\t\t\t\t\t\t\tAND (lugares.FilasId=ventaslevel1.FilasId)\n\t\t\t\t\t\t\t\t\tAND (lugares.LugaresId=ventaslevel1.LugaresId)\n                                    INNER JOIN evento ON evento.EventoId = ventaslevel1.EventoId\n                                    INNER JOIN foro ON foro.ForoId = evento.ForoId\n\t\t\t\t\t\t\t\t\tINNER JOIN filas ON (filas.EventoId=lugares.EventoId)\n\t\t\t\t\t\t\t\t\tAND (filas.FuncionesId=lugares.FuncionesId)\n\t\t\t\t\t\t\t\t\tAND (filas.ZonasId=lugares.ZonasId)\n\t\t\t\t\t\t\t\t\tAND (filas.SubzonaId=lugares.SubzonaId)\n\t\t\t\t\t\t\t\t\tAND (filas.FilasId=lugares.FilasId)\n\t\t\t\t\t\t\t\t\tINNER JOIN zonas ON (zonas.EventoId=filas.EventoId)\n\t\t\t\t\t\t\t\t\tAND (zonas.FuncionesId=filas.FuncionesId)\n\t\t\t\t\t\t\t\t\tAND (zonas.ZonasId=filas.ZonasId)\n\t\t\t\t\t\t\t\t\tINNER JOIN ventas ON (ventas.VentasId=ventaslevel1.VentasId)\n\t\t\t\t\t\t\t\t\tINNER JOIN subzona ON (subzona.EventoId=filas.EventoId)\n\t\t\t\t\t\t\t\t\tAND (subzona.FuncionesId=filas.FuncionesId)\n\t\t\t\t\t\t\t\t\tAND (subzona.ZonasId=filas.ZonasId)\n\t\t\t\t\t\t\t\t\tAND (subzona.SubzonaId=filas.SubzonaId)\n\t\t\t\t\t\t\t\t\tAND (zonas.EventoId=subzona.EventoId)\n\t\t\t\t\t\t\t\t\tAND (zonas.FuncionesId=subzona.FuncionesId)\n\t\t\t\t\t\t\t\t\tAND (zonas.ZonasId=subzona.ZonasId)\n\t\t\t\t\t\t\t\t\tWHERE\n                                    {$todos} \n                                    {$ref}\n                                    ventaslevel1.VentasSta not like '%CANCELADO%' AND \n\t\t\t\t\t\t\t\t\t(lugares.EventoId = {$EventoId} ) AND \n\t\t\t\t\t\t\t\t\t(lugares.FuncionesId = {$FuncionId} ) AND\n\t\t\t\t\t\t\t\t\t((ventas.PuntosventaId = '{$pv}')) AND \n\t\t\t\t\t\t\t\t\tNOT (ventas.VentasNumRef = ''))\n\t\t\t\t\t\t\t\t\tORDER BY  fnc ,ZonasAli,filasAli,LugaresLug;";
         $dataCodigo = new CSqlDataProvider($query, array('pagination' => false));
         $data = $dataCodigo->getData();
         $newdata = array();
         foreach ($data as $key => $boletoreimpresion) {
             $codigo = $this->verificaCodigos();
             if (empty($boletoreimpresion['LugaresNumBol'])) {
                 //$this->imprimeBoleto($codigo,$boletoreimpresion['id'],$boletoreimpresion['EventoId'],$boletoreimpresion['FuncionesId'],$boletoreimpresion['ZonasId'],$boletoreimpresion['SubzonaId'],$boletoreimpresion['FilasId'],$boletoreimpresion['LugaresId'],$boletoreimpresion['UsuariosId']);
                 $contra = $boletoreimpresion['EventoId'] . "." . $boletoreimpresion['FuncionesId'] . "." . $boletoreimpresion['ZonasId'] . "." . $boletoreimpresion['SubzonaId'];
                 $contra .= "." . $boletoreimpresion['FilasId'] . "." . $boletoreimpresion['LugaresId'] . "-" . date("m") . "." . date("d") . "-" . $boletoreimpresion['UsuariosId'];
                 $contra .= "R";
                 $ventaslevel1 = Ventaslevel1::model()->findByAttributes(array('VentasId' => $boletoreimpresion['id'], 'EventoId' => $boletoreimpresion['EventoId'], 'FuncionesId' => $boletoreimpresion['FuncionesId'], 'ZonasId' => $boletoreimpresion['ZonasId'], 'SubzonaId' => $boletoreimpresion['SubzonaId'], 'FilasId' => $boletoreimpresion['FilasId'], 'LugaresId' => $boletoreimpresion['LugaresId']));
                 $ventaslevel1->LugaresNumBol = $codigo;
                 $ventaslevel1->VentasCon = $contra;
                 $ventaslevel1->update();
                 $newdata[$key]['LugaresNumBol'] = $codigo;
                 $newdata[$key]['VentasCon'] = $contra;
                 $newdata[$key]['cosBolCargo'] = $boletoreimpresion['cosBolCargo'];
                 $newdata[$key]['FilasAli'] = $boletoreimpresion['FilasAli'];
                 $newdata[$key]['LugaresLug'] = $boletoreimpresion['LugaresLug'];
                 $newdata[$key]['ZonasAli'] = $boletoreimpresion['ZonasAli'];
                 $newdata[$key]['VentasNumRef'] = $boletoreimpresion['VentasNumRef'];
                 $newdata[$key]['EventoNom'] = $boletoreimpresion['EventoNom'];
                 $newdata[$key]['ForoNom'] = $boletoreimpresion['ForoNom'];
                 $newdata[$key]['SubzonaAcc'] = $boletoreimpresion['SubzonaAcc'];
                 $newdata[$key]['EventoDesBol'] = $boletoreimpresion['EventoDesBol'];
                 $newdata[$key]['fnc'] = $boletoreimpresion['fnc'];
                 $newdata[$key]['VentasBolTip'] = $boletoreimpresion['VentasBolTip'];
                 $newdata[$key]['cosBol'] = $boletoreimpresion['cosBol'];
                 $newdata[$key]['VentasCarSer'] = $boletoreimpresion['VentasCarSer'];
                 $newdata[$key]['EventoImaBol'] = $boletoreimpresion['EventoImaBol'];
                 $newdata[$key]['id'] = $boletoreimpresion['id'];
                 $newdata[$key]['PuntosventaId'] = $boletoreimpresion['PuntosventaId'];
                 $newdata[$key]['VentasFecHor'] = $boletoreimpresion['VentasFecHor'];
                 $newdata[$key]['VentasNumTar'] = $boletoreimpresion['VentasNumTar'];
                 $newdata[$key]['VentasNomDerTar'] = $boletoreimpresion['VentasNomDerTar'];
             } else {
                 //$this->reimprimeBoleto($codigo,$boletoreimpresion['id'],$boletoreimpresion['EventoId'],$boletoreimpresion['FuncionesId'],$boletoreimpresion['ZonasId'],$boletoreimpresion['SubzonaId'],$boletoreimpresion['FilasId'],$boletoreimpresion['LugaresId'],$boletoreimpresion['UsuariosId'],$boletoreimpresion['LugaresNumBol'],$boletoreimpresion['VentasBolTip'],$boletoreimpresion['cosBol']);
                 $reimpresiones = Reimpresiones::model()->count(array('condition' => "EventoId=" . $boletoreimpresion['EventoId'] . " AND FuncionesId=" . $boletoreimpresion['FuncionesId'] . " AND ZonasId=" . $boletoreimpresion['ZonasId'] . " AND SubzonaId=" . $boletoreimpresion['SubzonaId'] . " AND FilasId=" . $boletoreimpresion['FilasId'] . " AND LugaresId=" . $boletoreimpresion['LugaresId']));
                 $contra = $boletoreimpresion['EventoId'] . "." . $boletoreimpresion['FuncionesId'] . "." . $boletoreimpresion['ZonasId'] . "." . $boletoreimpresion['SubzonaId'];
                 $contra .= "." . $boletoreimpresion['FilasId'] . "." . $boletoreimpresion['LugaresId'] . "-" . date("m") . "." . date("d") . "-" . $boletoreimpresion['UsuariosId'];
                 $contra .= "PR{$reimpresiones}";
                 $ventaslevel1 = Ventaslevel1::model()->findByAttributes(array('VentasId' => $boletoreimpresion['id'], 'EventoId' => $boletoreimpresion['EventoId'], 'FuncionesId' => $boletoreimpresion['FuncionesId'], 'ZonasId' => $boletoreimpresion['ZonasId'], 'SubzonaId' => $boletoreimpresion['SubzonaId'], 'FilasId' => $boletoreimpresion['FilasId'], 'LugaresId' => $boletoreimpresion['LugaresId']));
                 $ventaslevel1->LugaresNumBol = $codigo;
                 $ventaslevel1->VentasCon = $contra;
                 $ventaslevel1->update();
                 $ultimo = Reimpresiones::model()->findAll(array('limit' => 1, 'order' => 't.ReimpresionesId DESC'));
                 $ultimo = $ultimo[0]->ReimpresionesId + 1;
                 $hoy = date("Y-m-d G:i:s");
                 $user_id = Yii::app()->user->id;
                 Yii::app()->db->createCommand("INSERT INTO reimpresiones VALUES({$ultimo}," . $boletoreimpresion['EventoId'] . "," . $boletoreimpresion['FuncionesId'] . "," . $boletoreimpresion['ZonasId'] . "," . $boletoreimpresion['SubzonaId'] . "," . $boletoreimpresion['FilasId'] . "," . $boletoreimpresion['LugaresId'] . ",'PANEL ADMINISTRATIVO','',{$user_id},'{$hoy}','" . $boletoreimpresion['LugaresNumBol'] . "')")->execute();
                 $ultimologreimp = Logreimp::model()->findAll(array('limit' => 1, 'order' => 't.LogReimpId DESC'));
                 $ultimologreimp = $ultimologreimp[0]->LogReimpId + 1;
                 Yii::app()->db->createCommand("INSERT INTO logreimp VALUES({$ultimologreimp},'{$hoy}','" . $boletoreimpresion['VentasBolTip'] . "'," . $boletoreimpresion['cosBol'] . ",'" . $boletoreimpresion['VentasBolTip'] . "',{$user_id},0," . $boletoreimpresion['EventoId'] . "," . $boletoreimpresion['FuncionesId'] . "," . $boletoreimpresion['ZonasId'] . "," . $boletoreimpresion['SubzonaId'] . "," . $boletoreimpresion['FilasId'] . "," . $boletoreimpresion['LugaresId'] . ")")->execute();
                 $newdata[$key]['LugaresNumBol'] = $codigo;
                 $newdata[$key]['VentasCon'] = $contra;
                 $newdata[$key]['cosBolCargo'] = $boletoreimpresion['cosBolCargo'];
                 $newdata[$key]['FilasAli'] = $boletoreimpresion['FilasAli'];
                 $newdata[$key]['LugaresLug'] = $boletoreimpresion['LugaresLug'];
                 $newdata[$key]['ZonasAli'] = $boletoreimpresion['ZonasAli'];
                 $newdata[$key]['VentasNumRef'] = $boletoreimpresion['VentasNumRef'];
                 $newdata[$key]['EventoNom'] = $boletoreimpresion['EventoNom'];
                 $newdata[$key]['ForoNom'] = $boletoreimpresion['ForoNom'];
                 $newdata[$key]['SubzonaAcc'] = $boletoreimpresion['SubzonaAcc'];
                 $newdata[$key]['EventoDesBol'] = $boletoreimpresion['EventoDesBol'];
                 $newdata[$key]['fnc'] = $boletoreimpresion['fnc'];
                 $newdata[$key]['VentasBolTip'] = $boletoreimpresion['VentasBolTip'];
                 $newdata[$key]['cosBol'] = $boletoreimpresion['cosBol'];
                 $newdata[$key]['VentasCarSer'] = $boletoreimpresion['VentasCarSer'];
                 $newdata[$key]['EventoImaBol'] = $boletoreimpresion['EventoImaBol'];
                 $newdata[$key]['id'] = $boletoreimpresion['id'];
                 $newdata[$key]['PuntosventaId'] = $boletoreimpresion['PuntosventaId'];
                 $newdata[$key]['VentasFecHor'] = $boletoreimpresion['VentasFecHor'];
                 $newdata[$key]['VentasNumTar'] = $boletoreimpresion['VentasNumTar'];
                 $newdata[$key]['VentasNomDerTar'] = $boletoreimpresion['VentasNomDerTar'];
             }
         }
         $formato = Formatosimpresionlevel1::model()->findAll(array('condition' => 'FormatoId=' . $_POST['formatoId']));
         $imagen = Evento::model()->findByAttributes(array('EventoId' => $_POST['EventoId']));
         //$data->getData();
         if ($imagen->EventoImaBol == "") {
             if (!file_exists($_SERVER["DOCUMENT_ROOT"] . '/' . Yii::app()->baseUrl . '/imagesbd/blanco.jpg')) {
                 copy('https://taquillacero.com/imagesbd/blanco.jpg', $_SERVER["DOCUMENT_ROOT"] . '/' . Yii::app()->baseUrl . '/imagesbd/blanco.jpg');
             }
         } else {
             if (!file_exists($_SERVER["DOCUMENT_ROOT"] . '/' . Yii::app()->baseUrl . '/imagesbd/' . $imagen->EventoImaBol)) {
                 copy('https://taquillacero.com/imagesbd/' . $imagen->EventoImaBol, $_SERVER["DOCUMENT_ROOT"] . '/' . Yii::app()->baseUrl . '/imagesbd/' . $imagen->EventoImaBol);
             }
         }
         $this->renderPartial('_impresionBoletosAjax', array('formato' => $formato, 'data' => $newdata, 'FormatoId' => $_POST['formatoId']));
     }
 }
コード例 #18
0
ファイル: ExportService.php プロジェクト: mjrao/BugFree
 /**
  * check if show field is legal
  *
  * @author                                  youzhao.zxw<*****@*****.**>
  * @param   string      $infoType           bug,case or result
  * @param   array       $searchRowArr       search condition
  * @param   int         $productId          product id
  * @param   array       $showFieldArr       show field array
  * @param   array       $orderArr           order array
  * @param   string      $filterSql          filter sql
  * @param   int         $pageSize           page size
  * @param   int         $currentPageSize    current page size
  * @return  array                           export date result
  */
 public static function getExportData($infoType, $searchRowArr, $productId = null, $showFieldArr = null, $orderArr = null, $filterSql = null, $pageSize = null, $currentPage = null)
 {
     $resultInfo = array();
     if (!empty($productId)) {
         $accessIdArr = Yii::app()->user->getState('visit_product_id');
         if (!in_array($productId, $accessIdArr)) {
             $resultInfo['status'] = CommonService::$ApiResult['FAIL'];
             $resultInfo['detail'] = Yii::t('Product', 'No access right to this product');
             return $resultInfo;
         }
     }
     $searchFieldConfig = SearchService::getSearchableFields($infoType, $productId);
     $checkSearchRowResult = self::checkSearchRowField($searchFieldConfig, $searchRowArr);
     if ('' != $checkSearchRowResult) {
         $resultInfo['status'] = CommonService::$ApiResult['FAIL'];
         $resultInfo['detail'] = $checkSearchRowResult;
         return $resultInfo;
     }
     if (!empty($showFieldArr)) {
         $showFieldCheckResult = self::checkShowField($searchFieldConfig, $showFieldArr);
         if ('' != $showFieldCheckResult) {
             $resultInfo['status'] = CommonService::$ApiResult['FAIL'];
             $resultInfo['detail'] = $showFieldCheckResult;
             return $resultInfo;
         }
     }
     $getSqlResult = SqlService::baseGetGroupQueryStr($searchFieldConfig, $infoType, $searchRowArr);
     if (CommonService::$ApiResult['FAIL'] == $getSqlResult['status']) {
         $resultInfo = $getSqlResult;
         return $resultInfo;
     }
     $whereStr = $getSqlResult['detail'];
     if (!empty($filterSql)) {
         $whereStr .= ' and ' . $filterSql;
     }
     if (empty($showFieldArr)) {
         $showFieldArr = array_keys($searchFieldConfig);
         $showFieldArr = array_diff($showFieldArr, array(Info::MARK));
     }
     $allRelatedFieldArr = array();
     foreach ($searchRowArr as $searchRowTmp) {
         $allRelatedFieldArr[] = $searchRowTmp['field'];
     }
     $isAllBasicField = SearchService::isAllBasicField(SearchService::getBasicFieldArr($infoType), array_merge($showFieldArr, $allRelatedFieldArr));
     $sql = SqlService::getRawDataSql($searchFieldConfig, $infoType, $productId, $showFieldArr, $whereStr, $isAllBasicField);
     $totalNum = SqlService::getTotalFoundNum($infoType, $productId, $whereStr, $isAllBasicField);
     if (empty($pageSize)) {
         $pageSize = $totalNum;
     }
     if ($pageSize > 5000) {
         $resultInfo['status'] = CommonService::$ApiResult['FAIL'];
         $resultInfo['detail'] = 'items can not exceed 5000';
         return $resultInfo;
     }
     if (!isset($currentPage)) {
         $currentPage = 1;
     } else {
         if (0 == $currentPage) {
             $resultInfo['status'] = CommonService::$ApiResult['FAIL'];
             $resultInfo['detail'] = 'page should start from 1';
             return $resultInfo;
         }
         $maxPage = ceil($totalNum / $pageSize);
         if ($currentPage > $maxPage && 0 != $maxPage) {
             $resultInfo['status'] = CommonService::$ApiResult['FAIL'];
             $resultInfo['detail'] = 'current page [' . $currentPage . '] is greater than the max page [' . $maxPage . ']';
             return $resultInfo;
         }
     }
     if (empty($orderArr)) {
         $orderArr = array('{{bug_info_view}}.id' => true);
     }
     $dataProvider = new CSqlDataProvider($sql, array('totalItemCount' => $totalNum, 'sort' => array('defaultOrder' => $orderArr, 'attributes' => array_keys($searchFieldConfig)), 'pagination' => array('pageSize' => $pageSize, 'currentPage' => $currentPage - 1)));
     $rawData = $dataProvider->getData();
     $rawData = SqlService::handleRawData($rawData, $infoType, $searchFieldConfig, $showFieldArr, $productId);
     $rawData = self::getExportComment($infoType, $rawData, $productId);
     $resultInfo['status'] = CommonService::$ApiResult['SUCCESS'];
     $resultInfo['detail'] = $rawData;
     return $resultInfo;
 }
コード例 #19
0
ファイル: UniondealerController.php プロジェクト: zwq/unpei
 public function actionIndex()
 {
     $type = Yii::app()->request->getParam('type');
     $state = Yii::app()->request->getParam('State');
     $city = Yii::app()->request->getParam('City');
     $homeajax = Yii::app()->request->getParam('homeajax');
     $pagesize = 12;
     if ($state === '') {
         $province = 'all';
     } elseif ($state === null) {
         $province = '370000';
     } else {
         $province = $state;
     }
     $brand = Yii::app()->request->getParam('brand');
     $type = $type === null ? 1 : $type;
     //1网格  2列表
     //获得联盟id
     $organID = Yii::app()->user->getOrganID();
     $unionid = MallService::getUnioninfo($organID);
     $unionid = $unionid ? $unionid : '-1';
     //联盟商品
     $dids = MallService::getUnionOrgan(array('UnionID' => $unionid, 'type' => 2));
     $where = ' where Identity=2 and IsBlack="0" and IsFreeze="0" and Status="1"';
     $where .= ' and ID in (' . $dids . ')';
     if ($homeajax == 1) {
         $province = 'all';
         $pagesize = 6;
     }
     if ($province !== 'all') {
         $where .= ' and Province=' . $province;
     }
     if ($city) {
         $where .= ' and City=' . $city;
     }
     if (!empty($brand)) {
         $ids = $this->getdealerbybrand($brand);
         $where .= ' and ID in' . $ids;
     }
     if ($homeajax == 1) {
         //工作台首页
         $sql = ' select ID,OrganName,Logo from jpd_organ' . $where;
     } else {
         $sql = ' select * from jpd_organ' . $where;
     }
     $sqlcount = ' select count(*) from jpd_organ' . $where;
     $count = Yii::app()->jpdb->createCommand($sqlcount)->queryScalar();
     $sql .= ' order by Sort ASC ';
     $dataProvider = new CSqlDataProvider($sql, array('db' => Yii::app()->jpdb, 'totalItemCount' => $count, 'pagination' => array('pageSize' => $pagesize)));
     $organ = $dataProvider->getData();
     if ($homeajax == 1) {
         echo json_encode($organ);
         die;
     }
     if ($organ) {
         foreach ($organ as $key => $val) {
             $a = array();
             $b = array();
             $organ[$key]['OrganName'] = '<a target="_black" href="' . Yii::app()->createUrl('servicer/servicedetail/detail', array('dealer' => $val['ID'])) . '">' . $val['OrganName'] . '</a>';
             $brand = PapBrand::model()->findAll('OrganID=:organ', array(':organ' => $val['ID']));
             $brand_str = "";
             foreach ($brand as $k => $v) {
                 if ($v['BrandName'] === null) {
                     continue;
                 }
                 $a[] = $v['BrandName'];
             }
             if ($a) {
                 $brand_str = implode(',', $a);
                 $organ[$key]['brand'] = '<a title="' . $brand_str . '">' . $brand_str . '</a>';
                 $organ[$key]['firstbrand'] = '<a title="' . $brand_str . '">' . $a[0] . '</a>';
             } else {
                 $organ[$key]['brand'] = '暂无';
                 $organ[$key]['firstbrand'] = '主营品牌:暂无';
             }
             $vehicles = DealerVehicles::model()->findAll('OrganID=:organ', array(':organ' => $val['ID']));
             $str = "";
             foreach ($vehicles as $k => $v) {
                 $car = $v['Make'];
                 if ($v['Car']) {
                     $car .= ' ' . $v['Car'];
                     if ($v['Year']) {
                         $car .= ' ' . $v['Year'];
                         if ($v['Model']) {
                             $car .= ' ' . $v['Model'];
                         } else {
                             $car .= ' ' . '全车型';
                         }
                     } else {
                         $car .= ' ' . '全年款';
                     }
                 } else {
                     $car .= ' ' . '全车系';
                 }
                 $b[] = $car;
             }
             if ($b) {
                 $str = implode('; ', $b);
                 //$organ[$key]['vehicles'] = '<a title="' . $str . '">' . $str . '</a>';
                 $organ[$key]['vehicles'] = $str;
             } else {
                 $organ[$key]['vehicles'] = '暂无';
             }
             $organ[$key]['TelPhone'] = $organ[$key]['TelPhone'] ? $organ[$key]['TelPhone'] : '暂无';
         }
     }
     $dataProvider->setData($organ);
     $branddata = $this->getBrand($dids);
     $get = $this->geturlparams($_GET);
     $get['type'] = $type;
     $pages = new CPagination($count);
     $pages->pageSize = $pagesize;
     $page = $pages->getCurrentPage() + 1;
     $totalpage = $pages->getPageCount();
     $start = 1 + ($page - 1) * $pagesize;
     $end = $page < $totalpage ? $start + $pagesize - 1 : $count;
     $footer = '<span class="zdyfooter">第 ' . $start . ' - ' . $end . ' 条, 共 ' . $count . ' 条.</span>';
     $this->render('index', array('dataProvider' => $dataProvider, 'brand' => $branddata, 'get' => $get, 'type' => $type, 'province' => $province, 'city' => $city, 'pages' => $pages, 'footer' => $footer));
 }
コード例 #20
0
ファイル: QuotationService.php プロジェクト: zwq/unpei
 public static function getschemelists($params)
 {
     if ($params['quoid']) {
         $organID = Yii::app()->user->getOrganID();
         if ($params['type'] == 1) {
             $quosql = 'select * from pap_quotation where InquiryID=0 and (Status="1" or Status="3") and QuoID=' . $params['quoid'] . ' and DealerID=' . $organID;
         } elseif ($params['type'] == 2) {
             $quosql = 'select * from pap_quotation where InquiryID=0 and QuoID=' . $params['quoid'] . ' and DealerID=' . $organID;
         } elseif ($params['type'] == 3) {
             $quosql = 'select * from pap_quotation where InquiryID!=0 and (Status="1" or Status="3") and QuoID=' . $params['quoid'] . ' and DealerID=' . $organID;
         } elseif ($params['type'] == 4) {
             $quosql = 'select * from pap_quotation where InquiryID!=0 and QuoID=' . $params['quoid'] . ' and DealerID=' . $organID;
         } elseif ($params['type'] == 5) {
             $quosql = 'select * from pap_quotation where  QuoID=' . $params['quoid'] . ' and ServiceID=' . $params['sid'];
         } elseif ($params['type'] == 6) {
             $quosql = 'select * from pap_quotation where QuoID=' . $params['quoid'] . ' and ServiceID=' . $params['sid'];
         }
         $quoinfo = Yii::app()->papdb->createCommand($quosql)->queryRow();
         if (!$quoinfo) {
             Controller::redirect(Yii::app()->createUrl('pap/quotation/index'));
         }
         $schsql = 'select * from pap_quotation_scheme where QuoID=' . $params['quoid'];
         $schlists = Yii::app()->papdb->createCommand($schsql)->queryAll();
         $schinfo = array();
         foreach ($schlists as $key => $list) {
             $schinfo[$key] = $list;
             $quogoodssql = 'select ID as QuogoodsID,GoodsID,Num,Price,Version from pap_quotation_goods where SchID=' . $list['SchID'];
             $countsql = 'select count(*) from pap_quotation_goods where SchID=' . $list['SchID'];
             $total = Yii::app()->papdb->createCommand($countsql)->queryScalar();
             $goodslists = new CSqlDataProvider($quogoodssql, array('db' => Yii::app()->papdb, 'pagination' => array('pageSize' => $total)));
             $datas = $goodslists->getData();
             foreach ($datas as $k => $data) {
                 $goodsinfo = self::getgoodsinfobyid($data['GoodsID'], $data['Version'], $data['QuogoodsID']);
                 $datas[$k]['rowNo'] = '<span issell="' . $goodsinfo['IsPro'] . '" goodsid="' . $data['GoodsID'] . '">' . ($k + 1) . '<span>';
                 $datas[$k] = array_merge($goodsinfo, $datas[$k]);
                 $datas[$k]['totalprices'] = sprintf("%.2f", $data['Price'] * $data['Num']);
                 if (($params['type'] === 5 || $params['type'] === 6) && $quoinfo['Status'] === '1') {
                     $datas[$k]['selected'] = '<input type="checkbox" name="selectgoods" checked=true goodsid="' . $data['GoodsID'] . '" price="' . $data['Price'] . '">';
                     $htmlnum = '<a class="s" onclick="numsub(' . $data['GoodsID'] . ',this)" href="javascript:void(0)"></a>' . '<input class="input input5 width40 float_l" style="width:30px;margin-top:2px;height:20px;line-height:20px" type="text" name="num" onblur="numblur(' . $data['GoodsID'] . ',this);" onkeyup="numkeyup(' . $data['GoodsID'] . ',this)" value="' . $data['Num'] . '">' . '<a class="a" onclick="numadd(' . $data['GoodsID'] . ',this)" href="javascript:void(0)"></a>';
                     $datas[$k]['Num'] = $htmlnum;
                 }
             }
             $goodslists->setData($datas);
             $schinfo[$key]['goodsinfo'] = $goodslists;
         }
         return array('schinfo' => $schinfo, 'quoinfo' => $quoinfo);
     }
 }
コード例 #21
0
ファイル: ReserveService.php プロジェクト: zwq/unpei
 public static function getPurchaseData($params)
 {
     //var_dump($params);die;
     $OrganID = Yii::app()->user->getOrganID();
     $sql = "SELECT prp.ReserveID, prp.CreateTime, jsr.LicensePlate, prp.InOrder, jsr.ReserveNum\n\t\t    \tFROM pap_reserve_purchase as prp,jpd.jpd_service_reserve as jsr\n\t\t        WHERE prp.ReserveID = jsr.ID AND prp.OrganID = '{$OrganID}' ";
     if ($params['LicensePlate']) {
         $sql .= "AND LicensePlate LIKE '%{$params['LicensePlate']}%' ";
     }
     if ($params['CreateTime']) {
         $sql .= "AND prp.CreateTime = unix_timestamp('{$params['CreateTime']}') ";
     }
     if ($params['ReserveNum']) {
         $sql .= "AND jsr.ReserveNum = '{$params['ReserveNum']}' ";
     }
     if ($params['InOrder'] == 2) {
         $sql .= "AND InOrder = 0 ";
     } elseif ($params['InOrder'] == 3) {
         $sql .= "AND InOrder = 1 ";
     }
     $sql .= "group by prp.ReserveID, prp.InOrder, prp.CreateTime order by prp.ID desc";
     $countsql = "SELECT COUNT(*) FROM (" . $sql . ") as tab";
     //echo $sql;die;
     $count = Yii::app()->papdb->createCommand($countsql)->queryScalar();
     $dataProvider = new CSqlDataProvider($sql, array('db' => Yii::app()->papdb, 'totalItemCount' => $count, 'pagination' => array('pageSize' => 5)));
     $data = $dataProvider->getData();
     //var_dump($data);die;
     foreach ($data as $key => $val) {
         $arr = self::getPurchaseDataByReserveID($val['ReserveID'], $val['InOrder'], $val['CreateTime']);
         $data[$key]['goodsinfo'] = $arr['data'];
         $data[$key]['RealPrice'] = $arr['RealPrice'];
     }
     $dataProvider->setData($data);
     return $dataProvider;
 }
コード例 #22
0
ファイル: WheelController.php プロジェクト: 00606/wechat
 public function actionCodes($id)
 {
     $this->layout = '//layouts/memberList';
     $type = Yii::app()->request->getParam('type', Globals::CODE_TYPE_LEGAL);
     $codeTable = 'scratch_awards';
     $whereSql = 'scratchId=' . $id . ' and type=' . $type;
     $count = Yii::app()->db->createCommand('SELECT COUNT(*) FROM ' . $codeTable . ' where ' . $whereSql)->queryScalar();
     $sql = 'SELECT * FROM ' . $codeTable . ' where ' . $whereSql;
     $dataProvider = new CSqlDataProvider($sql, array('totalItemCount' => $count, 'sort' => array('attributes' => array('name')), 'pagination' => array('pageSize' => Page::SIZE)));
     $this->render('code', array('data' => $dataProvider->getData(), 'pages' => $dataProvider->getPagination(), 'scratchId' => $id, 'type' => $type));
 }
コード例 #23
0
ファイル: MallService.php プロジェクト: zwq/unpei
 public static function getGoodsDataold($params)
 {
     $sql = self::getGoodsSql($params);
     if ($params['SellerID'] && $params['IsSale'] == 0) {
         $sql["countSql"] = str_replace('dg.IsSale=1', 'dg.IsSale=0', $sql["countSql"]);
         $sql["sql"] = str_replace('dg.IsSale=1', 'dg.IsSale=0', $sql["sql"]);
     }
     $res = Yii::app()->papdb->createCommand($sql["countSql"])->queryAll();
     $count = $res[0]['count'];
     //        echo $sql["sql"];
     //        exit;
     $dataProvider = new CSqlDataProvider($sql["sql"], array('db' => Yii::app()->papdb, 'totalItemCount' => $count, 'pagination' => array('pageSize' => $params['rows'] ? $params['rows'] : 10)));
     $goods = $dataProvider->getData();
     foreach ($goods as $k => $v) {
         $image = self::getOneGoodsImage($v['ID']);
         if (!$image) {
             $goods[$k]['image'] = F::uploadUrl() . 'common/default-goods.png';
         } else {
             $goods[$k]['image'] = F::uploadUrl() . $image;
         }
         $MallImage = self::getOneGoodsImagethumb($v['ID']);
         if (!$MallImage) {
             $goods[$k]['MallImage'] = F::uploadUrl() . 'common/default-goods.png';
         } else {
             $goods[$k]['MallImage'] = F::uploadUrl() . self::getOneGoodsImagethumb($v['ID']);
         }
         //获取标准名称
         if ($v['StandCode']) {
             $goods[$k]['cpname'] = Gcategory::model()->find(array('select' => 'Name', 'condition' => "Code = '{$v['StandCode']}'"))->attributes['Name'];
         }
         //卖家信息
         $goods[$k]['dealername'] = Organ::model()->findByPk($v['OrganID'], array('select' => 'OrganName'))->attributes['OrganName'];
         if (!$params["resource"] || $params["resource"] != "mall") {
             //OE号
             $goods[$k]['OENOS'] = self::getOENOSByGoodsID($v['ID']);
             // 车型车系
             //$carmodel = explode('、', self::getVehicleByGoodsID($v['ID']));
             //$goods[$k]['vehicle'] = $carmodel[0];
             //$goods[$k]['vehicle'] = self::getOneVehicleByGoodsID($v['ID']);
         }
     }
     $dataProvider->setData($goods);
     return array('dataProvider' => $dataProvider, 'count' => $count);
 }