本文整理汇总了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;
//海报数据数组
}
}
}
}
}
/***************海报****************开始**************/
//.........这里部分代码省略.........
示例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) {
}
}