|
- <?php
- /**
- * Created by PhpStorm.
- * User: nizongfeng
- * Date: 2021/10/27
- * Time: 11:26
- */
-
- namespace app\admin\dao;
-
-
- use app\admin\command\Util;
- use app\admin\model\Admin;
- use app\admin\model\OrderHotel;
- use app\admin\model\OrderItem;
- use app\admin\model\OrderMain;
- use app\admin\model\OrderMemo;
- use think\Db;
- use think\Exception;
-
- class OrderMemoDao
- {
-
- /**
- * 添加日志
- * @param $param
- * @return array
- */
- public function save($param) {
- try{
- $data = [
- "order_id"=>$param["order_id"],
- "memo"=>$param["memo"],
- "create_id"=>empty($param['create_id'])?0:$param['create_id'],
- "create_name"=>""
- ];
- if (!empty($param['create_id'])) {
- $adminDao = new AdminDao();
- $admin = $adminDao->getInfoById($param['create_id']);
- if ($admin["flag"]) {
- $data["create_name"] = $admin["data"]["nickname"];
- }
- }
- $orderMemo = new OrderMemo();
- $id = $orderMemo->insertGetId($data);
- return Util::returnArrSu("", $id);
- }catch (Exception $e){
- return Util::returnArrEr("新增失败:".$e->getMessage());
- }
-
- }
-
- /**
- * 获取订单列表
- * @param $param
- * @return array
- */
- public function getListByWhere($param){
- try {
- $offset = ($param['pageNum'] - 1) * $param['pageSize'];
- $model = new OrderMemo();
- $count = $model->where(["order_id"=>$param['order_id']])->count();
- $list = $model->where(["order_id"=>$param['order_id']])->limit($offset,$param['pageSize'])->order("id","DESC")->select();
- return Util::returnArrSu("", ["total" => $count, "list" => $list->toArray()]);
- }catch (Exception $e){
- return Util::returnArrSu("", ["total" => 0, "list" => []]);
- }
- }
-
- }
|