diff --git a/application/admin/controller/OrderMain.php b/application/admin/controller/OrderMain.php
index d6f4c3b..1c9cdb8 100755
--- a/application/admin/controller/OrderMain.php
+++ b/application/admin/controller/OrderMain.php
@@ -2,6 +2,7 @@
namespace app\admin\controller;
+use app\admin\dao\FileDao;
use app\admin\dao\GroupDao;
use app\admin\dao\OrderMainDao;
use app\admin\dao\OrderMemoDao;
@@ -20,7 +21,7 @@ use think\Loader;
*/
class OrderMain extends Backend
{
- protected $noNeedRight = ['getOrderList',"save","delSubOrder","subOrderSave","getShowInfo","newAdd","insertOrderMain","addMemo","getMemoList","setHotFlag"];
+ protected $noNeedRight = ['getOrderList',"save","delSubOrder","subOrderSave","getShowInfo","newAdd","insertOrderMain","addMemo","getMemoList","setHotFlag","addFileInfo","getFileList"];
/**
* OrderMain模型对象
* @var \app\admin\model\OrderMain
@@ -168,4 +169,27 @@ class OrderMain extends Backend
$result = $model->setHotFlag($params["order_id"],$params["val"]);
return json($result);
}
+
+ /**
+ * 添加附件记录
+ * @return \think\response\Json
+ */
+ public function addFileInfo(){
+ $params=$this->request->post();
+ $params['create_id']=$this->auth->id;
+ $model = new FileDao();
+ $result = $model->addInfo($params["type"],$params["file"],$params['name'],$params['id'],$params['create_id']);
+ return json($result);
+ }
+
+ /**
+ * 获取附件列表
+ * @return \think\response\Json
+ */
+ public function getFileList(){
+ $params=$this->request->post();
+ $model = new FileDao();
+ $result = $model->getList($params["type"],$params['id']);
+ return json($result);
+ }
}
diff --git a/application/admin/dao/FileDao.php b/application/admin/dao/FileDao.php
new file mode 100644
index 0000000..95c7be2
--- /dev/null
+++ b/application/admin/dao/FileDao.php
@@ -0,0 +1,67 @@
+$type,
+ "file"=>$file,
+ "name"=>$name,
+ "obj_id"=>$id,
+ "create_id"=>$create_id
+ ];
+ if (!empty($create_id)) {
+ $adminDao = new AdminDao();
+ $admin = $adminDao->getInfoById($create_id);
+ if ($admin["flag"]) {
+ $data["create_name"] = $admin["data"]["nickname"];
+ }
+ }
+ $fileModel->insert($data);
+ return Util::returnArrSu("成功");
+ }catch (Exception $e){
+ return Util::returnArrEr("失败:".$e->getMessage());
+ }
+ }
+
+ /**
+ * 获取列表
+ * @param $type
+ * @param $file
+ * @param $id
+ * @return array
+ */
+ public function getList($type, $id){
+ try{
+ $fileModel = new File();
+ $where = [
+ "type"=>$type,
+ "obj_id"=>$id
+ ];
+ $list = $fileModel->where($where)->order("id","DESC")->select()->toArray();
+ return Util::returnArrSu("成功", $list);
+ }catch (Exception $e){
+ return Util::returnArrEr("失败:".$e->getMessage());
+ }
+ }
+}
\ No newline at end of file
diff --git a/application/admin/dao/ReceiptOrderDao.php b/application/admin/dao/ReceiptOrderDao.php
index ecf6b37..b0433d9 100644
--- a/application/admin/dao/ReceiptOrderDao.php
+++ b/application/admin/dao/ReceiptOrderDao.php
@@ -119,9 +119,9 @@ class ReceiptOrderDao
try {
$where = ["a.del_flag"=>0,"a.group_id"=>$param['group_id']];
- if (empty($param['order_id'])) {
+ if (!empty($param['order_id'])) {
$orderMainModel = new OrderMain();
- $orderMain = $orderMainModel->where(["id"=>$param['order_id']])->select()->find();
+ $orderMain = $orderMainModel->where(["id"=>$param['order_id']])->find();
if ($orderMain == null || empty($orderMain['receipt_order_id'])) {
$where["a.id"] = 0;
}else{
diff --git a/application/admin/model/File.php b/application/admin/model/File.php
new file mode 100644
index 0000000..50b5fab
--- /dev/null
+++ b/application/admin/model/File.php
@@ -0,0 +1,20 @@
+编辑
订单
删除
- 附件
+ 附件
@@ -294,6 +294,53 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ 提交
+
+
+
+
+
+
+
+
+ 下载
+
+
+
+
+
+