酒店预订平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

70 line
1.9 KiB

  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: nizongfeng
  5. * Date: 2021/10/27
  6. * Time: 11:26
  7. */
  8. namespace app\admin\dao;
  9. use app\admin\command\Util;
  10. use app\admin\model\Admin;
  11. use app\admin\model\OrderHotel;
  12. use app\admin\model\OrderItem;
  13. use app\admin\model\OrderMain;
  14. use app\admin\model\OrderMemo;
  15. use think\Db;
  16. use think\Exception;
  17. class OrderMemoDao
  18. {
  19. /**
  20. * 添加日志
  21. * @param $param
  22. * @return array
  23. */
  24. public function save($param) {
  25. try{
  26. $data = [
  27. "order_id"=>$param["order_id"],
  28. "memo"=>$param["memo"],
  29. "create_id"=>empty($param['create_id'])?0:$param['create_id'],
  30. "create_name"=>""
  31. ];
  32. if (!empty($param['create_id'])) {
  33. $adminDao = new AdminDao();
  34. $admin = $adminDao->getInfoById($param['create_id']);
  35. if ($admin["flag"]) {
  36. $data["create_name"] = $admin["data"]["nickname"];
  37. }
  38. }
  39. $orderMemo = new OrderMemo();
  40. $id = $orderMemo->insertGetId($data);
  41. return Util::returnArrSu("", $id);
  42. }catch (Exception $e){
  43. return Util::returnArrEr("新增失败:".$e->getMessage());
  44. }
  45. }
  46. /**
  47. * 获取订单列表
  48. * @param $param
  49. * @return array
  50. */
  51. public function getListByWhere($param){
  52. try {
  53. $offset = ($param['pageNum'] - 1) * $param['pageSize'];
  54. $model = new OrderMemo();
  55. $count = $model->where(["order_id"=>$param['order_id']])->count();
  56. $list = $model->where(["order_id"=>$param['order_id']])->limit($offset,$param['pageSize'])->order("id","DESC")->select();
  57. return Util::returnArrSu("", ["total" => $count, "list" => $list->toArray()]);
  58. }catch (Exception $e){
  59. return Util::returnArrSu("", ["total" => 0, "list" => []]);
  60. }
  61. }
  62. }