|
|
@@ -19,19 +19,31 @@ class Order extends BaseModel
|
|
|
* @param $desc
|
|
|
*/
|
|
|
public function getList($page,$where = [],$pageCount = 20,$filed = '*',$desc = 'id desc'){
|
|
|
- $data = $this
|
|
|
- ->field(
|
|
|
- "o.*,p.store_name as pro_title,p.image as pro_img,m.mobile,m.avatar,
|
|
|
- (select count(*) from table_order_info where o_id = o.id) as order_count,
|
|
|
- (select count(*) from table_order_info where o_id = o.id and status = 2) as send_count,
|
|
|
- (SELECT title from table_express where id = o.express_id) as exp_name,
|
|
|
- (SELECT name from table_warehouse where id = o.warehouse_id) as ck_name"
|
|
|
- )
|
|
|
- ->alias("o")
|
|
|
- //->join('platform pf',"pf.id=o.platform_id")
|
|
|
- ->join('member m','m.uid=o.uid')
|
|
|
- ->leftJoin('product p',"p.id = o.pro_id")
|
|
|
- ->when(!empty($where),function ($query) use($where){
|
|
|
+ if($where['type'] == 1){
|
|
|
+ $model = $this
|
|
|
+ ->field(
|
|
|
+ "o.*,p.store_name as pro_title,p.image as pro_img,m.mobile,m.avatar,
|
|
|
+ (select count(*) from table_order_info where o_id = o.id) as order_count,
|
|
|
+ (select count(*) from table_order_info where o_id = o.id and status = 2) as send_count,
|
|
|
+ (SELECT title from table_express where id = o.express_id) as exp_name,
|
|
|
+ (SELECT name from table_warehouse where id = o.warehouse_id) as ck_name"
|
|
|
+ )
|
|
|
+ ->alias("o")
|
|
|
+ //->join('platform pf',"pf.id=o.platform_id")
|
|
|
+ ->leftJoin('member m','m.uid=o.uid')
|
|
|
+ ->leftJoin('product p',"p.id = o.pro_id")
|
|
|
+ ->where('o.type',1);
|
|
|
+ }else{
|
|
|
+ $model = $this
|
|
|
+ ->field("o.*,p.store_name as pro_title,a.image as pro_img,m.mobile,m.avatar,f.name,f.mobile,f.address,a.suk")
|
|
|
+ ->alias("o")
|
|
|
+ ->leftJoin('orderInfo f',"f.o_id=o.id")
|
|
|
+ ->leftJoin('member m','m.uid=o.uid')
|
|
|
+ ->leftJoin('product p',"p.id = o.pro_id")
|
|
|
+ ->leftJoin('product_attr_value a',"a.product_id = o.pro_id and a.unique = o.unique")
|
|
|
+ ->where('o.type',0);
|
|
|
+ }
|
|
|
+ $data = $model->when(!empty($where),function ($query) use($where){
|
|
|
//用户
|
|
|
if(!empty($where['uid'])) {
|
|
|
$query->where('o.uid',$where['uid']);
|