-1], [['dateStart', 'dateEnd'], 'trim'], [['fields'],'safe'] ]; } public function search() { if (!$this->validate()) { return [ 'code' => 1, 'msg' => $this->getErrorSummary(false)[0], ]; } $query = OrderRefund::find()->alias('or') ->leftJoin(['o' => Order::tableName()], 'o.id=or.order_id') ->leftJoin(['od' => OrderDetail::tableName()], 'od.id=or.order_detail_id') ->leftJoin(['g' => Goods::tableName()], 'g.id=od.goods_id') ->leftJoin(['u' => User::tableName()], 'u.id=or.user_id') ->where(['or.store_id' => $this->store_id, 'or.is_delete' => Order::IS_DELETE_FALSE, 'o.mch_id' => 0, 'o.is_show' => Order::IS_SHOW_TRUE]); if ($this->status == OrderRefund::STATUS_IN) { $query->andWhere(['or.status' => OrderRefund::STATUS_IN]); } if ($this->status == self::IS_HANDLE_STATUS) { $query->andWhere(['or.status' => OrderRefund::$is_handle_status]); } $commonOrderSearch = new CommonOrderSearch(); $query = $commonOrderSearch->search($query, $this); $query = $commonOrderSearch->keyword($query, $this->keywordType, $this->keyword); $query->orderBy('or.id DESC')->select('or.id order_refund_id,o.id order_id,o.order_no,o.name, o.mobile,o.address,o.pay_type,u.nickname,u.id user_id,u.platform,g.name goods_name,g.id goods_id,or.created_at, od.num,od.attr,od.total_price,or.type refund_type,or.status refund_status,or.desc refund_desc, or.pic_list refund_pic_list,or.refund_price,or.refuse_desc refund_refuse_desc,or.is_agree,or.is_user_send, or.user_send_express,or.user_send_express_no'); $pagination = pagination_make($query); $list = $pagination['list']; foreach ($list as $i => $item) { $list[$i]['created_at'] = date('Y-m-d H:i:s', $item['created_at']); $list[$i]['goods_pic'] = Goods::getGoodsPicStatic($item['goods_id'])->pic_url; $list[$i]['refund_pic_list'] = json_decode($item['refund_pic_list']); $list[$i]['attr'] = json_decode($item['attr']); } $address = RefundAddress::find()->where(['store_id' => $this->store_id, 'mch_id' => 0, 'is_delete' => 0])->all(); foreach ($address as &$v) { if (mb_strlen($v->address) > 20) { $v->address = mb_substr($v->address, 0, 20) . '···'; } } unset($v); return [ 'code' => 0, 'msg' => 'success', 'data' => [ 'data' => $list, 'address' => $address, 'pageNo' => $pagination['pageNo'], 'totalCount' => $pagination['totalCount'], ], ]; } }