|
@@ -82,39 +82,36 @@ class Log extends Base
|
|
|
*/
|
|
|
public function msglist()
|
|
|
{
|
|
|
- $page = isset($this->post['page']) && $this->post['page'] !== "" ? intval($this->post['page']) : "1";
|
|
|
- $size = isset($this->post['size']) && $this->post['size'] !== "" ? intval($this->post['size']) : "10";
|
|
|
+ $param = $this->request->only(['token' => '', 'orderCode' => '', 'page' => 1, 'size' => 10, 'order_type' => '', 'is_read' => ''], 'post', 'trim');
|
|
|
+ $apply_id = GetUserInfo($param['token']);
|
|
|
+ if (empty($apply_id) || $apply_id['code'] != 0) return error_show(1002, "用户数据不存在");
|
|
|
|
|
|
- $token = isset($this->post['token']) ? trim($this->post['token']) : "";
|
|
|
- $apply_id = GetUserInfo($token);
|
|
|
- if (empty($apply_id) || $apply_id['code'] != 0) {
|
|
|
- return error_show(1002, "用户数据不存在");
|
|
|
- }
|
|
|
$rm = isset($apply_id["data"]['id']) ? $apply_id["data"]['id'] : 0;
|
|
|
- $condition=[["uid","=",$rm]];
|
|
|
- $orderCode = isset($this->post['orderCode'])&&$this->post['orderCode']!=''?trim($this->post['orderCode']):'';
|
|
|
- if($orderCode!=""){
|
|
|
- $condition[]=["orderCode","like","%$orderCode%"];
|
|
|
- }
|
|
|
- $order_type = isset($this->post['order_type'])&&$this->post['order_type']!=''?trim($this->post['order_type']):'';
|
|
|
- if($order_type!=""){
|
|
|
- $condition[]=["order_type","=",$order_type];
|
|
|
- }
|
|
|
- $is_read = isset($this->post['is_read'])&&$this->post['is_read']!==''?intval($this->post['is_read']):'';
|
|
|
- if($is_read!==""){
|
|
|
- $condition[]=["is_read","=",$is_read];
|
|
|
- }
|
|
|
- $count = Db::name("order_msg")->where($condition)->count();
|
|
|
- $total = ceil($count/$size);
|
|
|
- $page = $page >= $total ? $total : $page;
|
|
|
- $list =Db::name("order_msg")->where($condition)->page(intval($page),$size)->order("addtime desc")->select();
|
|
|
- $data=[];
|
|
|
- $type = \think\facade\Config::get("order");
|
|
|
- foreach ($list as $value){
|
|
|
- $value['order_type_cn']=$type["order_type"][$value['order_type']];
|
|
|
- $data[]=$value;
|
|
|
- }
|
|
|
- return app_show(0,"获取成功",['list'=>$data,"count"=>$count]);
|
|
|
+ $condition = [['om.uid', '=', $rm]];//自己看到自己的消息
|
|
|
+ if ($param['orderCode'] != "") $condition[] = ["om.orderCode", "like", "%{$param['orderCode']}%"];
|
|
|
+ if ($param['order_type'] != "") $condition[] = ["om.order_type", "=", $param['order_type']];
|
|
|
+ if ($param['is_read'] !== "") $condition[] = ["om.is_read", "=", $param['is_read']];
|
|
|
+
|
|
|
+ $count = Db::name("order_msg")
|
|
|
+ ->alias('om')
|
|
|
+ ->where($condition)
|
|
|
+ ->count();
|
|
|
+
|
|
|
+ $total = ceil($count / $param['size']);
|
|
|
+ $page = $param['page'] >= $total ? $total : $param['page'];
|
|
|
+
|
|
|
+ $list = Db::name("order_msg")
|
|
|
+ ->alias('om')
|
|
|
+ ->field('om.*,ap.order_name,p.process_name')
|
|
|
+ ->where($condition)
|
|
|
+ ->leftJoin('action_process ap', 'ap.order_type=om.order_type AND ap.order_process=om.order_status')
|
|
|
+ ->leftJoin('process p', 'p.id=ap.pid')
|
|
|
+ ->page(intval($page), intval($param['size']))
|
|
|
+ ->order("om.addtime desc")
|
|
|
+ ->select()
|
|
|
+ ->toArray();
|
|
|
+
|
|
|
+ return app_show(0, "获取成功", ['list' => $list, "count" => $count]);
|
|
|
}
|
|
|
|
|
|
/**
|