當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Brand::brandSelectById方法代碼示例

本文整理匯總了PHP中Brand::brandSelectById方法的典型用法代碼示例。如果您正苦於以下問題:PHP Brand::brandSelectById方法的具體用法?PHP Brand::brandSelectById怎麽用?PHP Brand::brandSelectById使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Brand的用法示例。


在下文中一共展示了Brand::brandSelectById方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: actionsavelog

 /**
  * 保存日誌信息
  */
 public function actionsavelog()
 {
     $access_key = '';
     $secret_key = '';
     $log_string = '';
     $domain = '';
     $rand = md5(date("Y-m-d H:i:s"));
     if (Yii::app()->request->getParam('access_key')) {
         $access_key = Yii::app()->request->getParam('access_key');
     }
     if (Yii::app()->request->getParam('secret_key')) {
         $secret_key = Yii::app()->request->getParam('secret_key');
     }
     if (empty($access_key) || empty($secret_key)) {
         echo "驗證失敗";
         exit;
     }
     $brand_obj = Yii::app()->db->createCommand()->select('brandid,domain')->from('erp_qiniu_account')->where('access_key=:access_key and secret_key=:secret_key', array(':access_key' => $access_key, ':secret_key' => $secret_key))->queryRow();
     if (empty($brand_obj)) {
         echo '沒有對應的品牌數據';
         exit;
     }
     $domain = $brand_obj['domain'];
     $logurl = $domain . "log/op.log?" . $rand;
     $log_string = file_get_contents($logurl);
     $brand_id = $brand_obj['brandid'];
     //品牌ID號
     //獲取品牌 SKU 規則
     $brand_ret = Brand::brandSelectById($brand_id);
     if (count($brand_ret) == 0) {
         throw new Exception('');
     }
     $code_start = $brand_ret[0]['code_start'];
     $code_end = $brand_ret[0]['code_end'];
     if (empty($log_string)) {
         echo "log data fail";
         exit;
     }
     //		$command = Yii::app()->db->createCommand();
     //		$array = array ("orderlog" =>$log_string, "addtime" => date('Y-m-d H:i:s'), "orderid" => $brand_id);
     //		$command->insert('erp_orderlog', $array);
     //		exit();
     //		$log_string='ok|orderlist/z004X001/115230C211261/model/UQ15002441_B_100.jpg|2015-11-06 12:12:12
     //ok|orderlist/z004X001/115230C2112/115230C211261/model/UQ15002441_B_101.jpg|2015-11-06 12:12:12
     //fail|orderlist/z004X001/115250C0327/115250C032734/model/UQ15002441_B_102.jpg|2015-11-06 12:12:12
     //fail|orderlist/z004X002/115230E3211/115230E321115/product/UQ15002441_A0_101.jpg|2015-11-06 12:12:12
     //ok|orderlist/z004X003/115220A6205/115220A620517/product/UQ15002441_A2_101.jpg|2015-11-06 12:12:12
     //ok|poster/15ss/dscn001.jpg|2015-11-06 12:12:12
     //ok|poster/14ss/dscn002.jpg|2015-11-06 12:12:12';
     $log_array = explode("\n", $log_string);
     //按回車進行分隔,日誌數組
     $log_array = array_filter($log_array);
     $order_array = array();
     //訂單數組
     $brandnumber_array = array();
     //款號數組
     $order_name_array = array();
     //訂單名數組
     $poster_array = array();
     //海報數組
     foreach ($log_array as $value) {
         $string_array = explode(" | ", $value);
         //按"|"進行分隔,得到(狀態|路徑|時間)
         if (count($string_array) > 0) {
             $geshi_array = array();
             //格式數組
             $geshi_array['url'] = '';
             //路徑
             if ($string_array[0] == 'ok' || $string_array[0] == 'fail') {
                 $url_array = array();
                 //路徑數組
                 $geshi_array['status'] = $string_array[0];
                 //狀態
                 $geshi_array['date'] = $string_array[2];
                 //時間
                 if (!empty($string_array[1])) {
                     $geshi_array['url'] = $string_array[1];
                     //路徑
                     $url_array = explode("/", $string_array[1]);
                     //將url路徑分隔為數組
                     if (count($url_array) == 6) {
                         $order_array[$url_array[1]][] = $geshi_array;
                         $brandnumber_array[$url_array[3]][] = $geshi_array;
                         if (!in_array($url_array[1], $order_name_array)) {
                             $order_name_array[] = $url_array[1];
                             //訂單名數組
                         }
                     }
                     if (count($url_array) == 3) {
                         $poster_array[$url_array[1]][] = $geshi_array;
                         //海報數據數組
                     }
                 }
             }
         }
     }
     /***************海報****************開始**************/
//.........這裏部分代碼省略.........
開發者ID:bobwuyan,項目名稱:testproject,代碼行數:101,代碼來源:ERPController.php

示例2: setClothesDifferentAndRelated

 /**
  * 設置衣服的不同穿 不同色
  **/
 function setClothesDifferentAndRelated($brandid, $clothesid, $brandnumber)
 {
     try {
         $Different_data = self::beuDifferentSelectByClothesid2($clothesid);
         //根據衣服ID查找其不同穿法
         if (count($Different_data) > 0) {
             $arr = array();
             $id = 0;
             foreach ($Different_data as $key => $value) {
                 if ($key == 'id') {
                     $id = $value;
                 } else {
                     if (!empty($value) && $value != $clothesid) {
                         $arr[] = $value;
                     }
                 }
             }
             if (count($arr) < 2) {
                 //當其去除當前單品後,不同穿沒有其他單品 就將其關聯關係刪除
                 self::beuDifferentDeleteByid($id);
             } else {
                 $num = 1;
                 $ret_data_new = array();
                 for ($num = 1; $num <= 30; $num++) {
                     $ret_data_new['clothesid' . $num] = isset($arr[$num - 1]) ? $arr[$num - 1] : '';
                 }
                 beu_clothesdifferent::model()->updateAll($ret_data_new, 'id=:textx', array(':textx' => $id));
             }
         }
         /*$Related_data=self::beuRelatedSelectByClothesid2($clothesid);//根據衣服id查找不同顏色完整數據
         		if(count($Related_data)>0){
         			$arr = array ();
         			$id=0;
         			foreach ( $Related_data as $key => $value ) {
         				if($key == 'id'){
         					$id=$value;
         				}else if (! empty ( $value ) && $value!=$clothesid) {
         					$arr [] = $value;
         				}
         			}
         			if(count($arr)<2){//當其去除當前單品後,不同穿沒有其他單品 就將其關聯關係刪除
         				self::beuRelatedDeleteByid($id);
         			}else{
         				$num=1;
         				$ret_data_new=array();
         				for($num=1;$num<=30;$num++){
         					$ret_data_new['clothesid'.$num]=isset($arr[$num-1])?$arr[$num-1]:'';
         				}
         				beu_clothesrelated::model ()->updateAll ( $ret_data_new, 'id=:textx', array (':textx' => $id ) );
         			}
         		}*/
         if (!empty($brandnumber)) {
             //款號不為空的時候才自動綁定
             //查詢品牌的款號規則
             $brand_code = Brand::brandSelectById($brandid);
             if (empty($brand_code) || !isset($brand_code[0]['code_start']) || empty($brand_code[0]['code_start']) && empty($brand_code[0]['code_end'])) {
                 throw new Exception('查詢款號規則錯誤!');
             }
             //根據品牌的款號規則截取款號字符段
             $barcode_str = substr($brandnumber, $brand_code[0]['code_start'], $brand_code[0]['code_end'] - $brand_code[0]['code_start']);
             //查詢此品牌下的衣服
             $ret_clothes = self::getclothesBybrandandCode($brandid, $barcode_str, isset($brand_code[0]['code_start']) ? $brand_code[0]['code_start'] : 0, 2);
             if ($ret_clothes['status'] == 0) {
                 throw new Exception($ret_clothes['msg']);
             }
             $Different_arr = array();
             //不同穿數組
             $Related_arr = array();
             //不同色數組
             foreach ($ret_clothes['data'] as $value) {
                 if ($value['brandnumber'] == $brandnumber) {
                     //添加不同穿數據
                     $Different_arr[] = $value['id'];
                 }
                 //$Related_arr[$value['brandnumber']]=
             }
             if (count($Different_arr) > 1) {
                 self::clothesDifferentUpdataById($clothesid, implode(',', $Different_arr));
             }
         }
     } catch (Exception $e) {
     }
 }
開發者ID:bobwuyan,項目名稱:testproject,代碼行數:86,代碼來源:Clothes.php


注:本文中的Brand::brandSelectById方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。