...
|
...
|
@@ -20,6 +20,7 @@ class GoodsdetailsController extends WeChatBaseController{ |
|
|
|
|
|
$goods_id = $this -> request -> param();
|
|
|
$data = Db::name('goods') -> alias('a') -> field("a.*,b.name") -> join('classification b','a.classify_id = b.id','LEFT') -> where('a.id',$goods_id['goods_id']) -> find();
|
|
|
$this -> assign('price',$data['price']);
|
|
|
$price = explode('.',$data['price']);
|
|
|
$pricing = explode('.',$data['pricing']);
|
|
|
$data['price0'] = $price[0];
|
...
|
...
|
@@ -69,6 +70,91 @@ class GoodsdetailsController extends WeChatBaseController{ |
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 立即支付判断
|
|
|
*/
|
|
|
public function goodsdetails_go_pay(){
|
|
|
|
|
|
$uid = cmf_get_current_user_id();
|
|
|
$goods_id = $_POST['id'];
|
|
|
$data[] = Db::name('goods') -> where('id',$goods_id) -> find();
|
|
|
$data[0]['book_num'] = 1;
|
|
|
|
|
|
foreach ($data as $key => $val){
|
|
|
if($data[0]['type'] == $data[$key]['type']){
|
|
|
}else{
|
|
|
$ret['type'] = 3;
|
|
|
return json_encode($ret);
|
|
|
}
|
|
|
}
|
|
|
if($data[0]['type'] == 1){
|
|
|
|
|
|
$indent['uid'] = $uid;
|
|
|
$indent['state'] = 4;
|
|
|
$indent['order_number'] = date('Ymd').substr(implode(NULL, array_map('ord', str_split(substr(uniqid(), 7, 13), 1))), 0, 8);
|
|
|
$indent['money'] = $_POST['myprice'];
|
|
|
$indent['create_time'] = time();
|
|
|
$indent['indent_type'] = 1;
|
|
|
$indent['logistic_name'] = 'YTO';
|
|
|
$book_num = 0;
|
|
|
foreach ($data as $key => $val){
|
|
|
$book_num += $val['book_num'];
|
|
|
}
|
|
|
$indent['book_num'] = $book_num;
|
|
|
$indet_id = Db::name('indent') -> insertGetId($indent);
|
|
|
foreach ($data as $key => $val){
|
|
|
$indent_goods['book_name'] = $val['book_name'];
|
|
|
$indent_goods['pricing'] = $val['pricing'];
|
|
|
$indent_goods['price'] = $val['price'];
|
|
|
$indent_goods['number'] = $val['book_num'];
|
|
|
$indent_goods['thumbnail'] = $val['show_img'];
|
|
|
$indent_goods['indent_id'] = $indet_id;
|
|
|
$indent_goods['commission'] = $val['money'];
|
|
|
$indent_goods['goods_id'] = $val['id'];
|
|
|
Db::name('indent_goods ') -> insert($indent_goods);
|
|
|
}
|
|
|
$ret['type'] = 1;
|
|
|
$ret['indet_id'] = $indet_id;
|
|
|
$res = json_encode($ret);
|
|
|
return $res;
|
|
|
}elseif ($data[0]['type'] == 2){
|
|
|
$indent['uid'] = $uid;
|
|
|
$indent['state'] = 4;
|
|
|
$indent['order_number'] = date('Ymd').substr(implode(NULL, array_map('ord', str_split(substr(uniqid(), 7, 13), 1))), 0, 8);
|
|
|
$indent['money'] = $_POST['myprice'];
|
|
|
$indent['indent_type'] = 2;
|
|
|
$indent['create_time'] = time();
|
|
|
$book_num = 0;
|
|
|
foreach ($data as $key => $val){
|
|
|
$book_num += $val['book_num'];
|
|
|
}
|
|
|
$indent['book_num'] = $book_num;
|
|
|
$indent['salesman_uid'] = $data[0]['uid'];
|
|
|
$indet_id = Db::name('indent') -> insertGetId($indent);
|
|
|
foreach ($data as $key => $val){
|
|
|
$indent_goods['book_name'] = $val['book_name'];
|
|
|
$indent_goods['pricing'] = $val['pricing'];
|
|
|
$indent_goods['price'] = $val['price'];
|
|
|
$indent_goods['number'] = $val['book_num'];
|
|
|
$indent_goods['thumbnail'] = $val['show_img'];
|
|
|
$indent_goods['indent_id'] = $indet_id;
|
|
|
$indent_goods['commission'] = $val['money'];
|
|
|
$indent_goods['goods_id'] = $val['id'];
|
|
|
Db::name('indent_goods ') -> insert($indent_goods);
|
|
|
}
|
|
|
$ret['type'] = 2;
|
|
|
$ret['indet_id'] = $indet_id;
|
|
|
$res = json_encode($ret);
|
|
|
return $res;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
...
|
...
|
|