作者 wangzhi

222

... ... @@ -356,13 +356,15 @@ class Index extends Api
->join('logo b', 'b.id=a.logo_id')
->join('class_con d', 'd.id=a.class_con_id')
->join('classa c', 'c.id=a.class_id')
->field('a.id,a.avatar,d.class_con,a.name,c.class,b.logo,a.fengzhuang,a.con,a.stock,a.book_avatar,a.tidu1,a.price1,a.tidu2,a.price2,a.tidu3,a.price3,a.tidu4,a.price4,a.tidu5,a.price5')
->field('a.id')
->where($map1)
->where($map2)
->where($map3)
->where($map4)
->page($param['pages'], $param['rows'])
->select();
print_r($list);
die;
$count = \db('product')
->alias('a')
->join('logo b', 'b.id=a.logo_id')
... ...
... ... @@ -436,11 +436,11 @@ class Api
$gradient[$k]['price4'] = $v['price4'];
$gradient[$k]['tidu5'] = $v['tidu5'];
$gradient[$k]['price5'] = $v['price5'];
$num=count($gradient[$k]);
for($i=0;$i<$num/2;$i++){
$n=$i+1;
$info[$i]['tidu']= $gradient[$k]['tidu'.$n];
$info[$i]['price']= $gradient[$k]['price'.$n];
$num = count($gradient[$k]);
for ($i = 0; $i < $num / 2; $i++) {
$n = $i + 1;
$info[$i]['tidu'] = $gradient[$k]['tidu' . $n];
$info[$i]['price'] = $gradient[$k]['price' . $n];
}
}
foreach ($list as $k => $v) {
... ... @@ -493,11 +493,11 @@ class Api
$gradient[$k]['price4'] = $v['price4'];
$gradient[$k]['tidu5'] = $v['tidu5'];
$gradient[$k]['price5'] = $v['price5'];
$num=count($gradient[$k]);
for($i=0;$i<$num/2;$i++){
$n=$i+1;
$info[$i]['tidu']= $gradient[$k]['tidu'.$n];
$info[$i]['price']= $gradient[$k]['price'.$n];
$num = count($gradient[$k]);
for ($i = 0; $i < $num / 2; $i++) {
$n = $i + 1;
$info[$i]['tidu'] = $gradient[$k]['tidu' . $n];
$info[$i]['price'] = $gradient[$k]['price' . $n];
}
}
foreach ($list as $k => $v) {
... ... @@ -508,6 +508,42 @@ class Api
return $list;
}
// 商品信息
function product_arr($product_id)
{
$list = Db::name('product')
->alias('p')
->where(['p.id' => $product_id])
->join('class_con c', 'c.id=p.class_con_id')
->join('logo l', 'l.id=p.logo_id')
->field('p.avatar,p.name,c.class_con,l.logo')
->select();
$tidu_new = Db::name('product')->where(['id' => $product_id])->select();
foreach ($tidu_new as $k => $v) {
$gradient[$k]['tidu1'] = $v['tidu1'];
$gradient[$k]['price1'] = $v['price1'];
$gradient[$k]['tidu2'] = $v['tidu2'];
$gradient[$k]['price2'] = $v['price2'];
$gradient[$k]['tidu3'] = $v['tidu3'];
$gradient[$k]['price3'] = $v['price3'];
$gradient[$k]['tidu4'] = $v['tidu4'];
$gradient[$k]['price4'] = $v['price4'];
$gradient[$k]['tidu5'] = $v['tidu5'];
$gradient[$k]['price5'] = $v['price5'];
$num = count($gradient[$k]);
for ($i = 0; $i < $num / 2; $i++) {
$n = $i + 1;
$info[$i]['tidu'] = $gradient[$k]['tidu' . $n];
$info[$i]['price'] = $gradient[$k]['price' . $n];
}
}
foreach ($list as $k => $v) {
$list[$k]['avatar'] = cdnurl($v['avatar'], true);
$list[$k]['gradient'] = $info;
}
return $list;
}
//删除购物车
public function DeleteCar($shop_id)
... ...