wugg 5 bulan lalu
induk
melakukan
5203dba999
2 mengubah file dengan 6 tambahan dan 3 penghapusan
  1. 2 1
      app/admin/controller/Export.php
  2. 4 2
      app/admin/controller/InvCat.php

+ 2 - 1
app/admin/controller/Export.php

@@ -222,10 +222,11 @@ class Export extends Base
     //资金认领导出
     public function orderPayExport()
     {
-        $param = $this->request->only(['start' => '', 'end' => '', 'name' => '', 'bank' => '', 'status' => '', 'tradNo' => '', 'company' => '', 'userd_lower' => '', 'used_upper' => ''], 'post', 'trim');
+        $param = $this->request->only(['start' => '', 'end' => '','create_start' => '', 'create_end' => '', 'name' => '', 'bank' => '', 'status' => '', 'tradNo' => '', 'company' => '', 'userd_lower' => '', 'used_upper' => ''], 'post', 'trim');
         $where = [['a.is_del', '=', 0],['b.is_del', '=', 0],['d.is_del', '=', 0],['d.is_del', '=', 0],["c.type","=",
         2],["c.status","in",[1,2]]];
         if (($param['start'] != '') && ($param['end'] != '')) $where[] = ['a.trade_time', 'between', [$param['start'] . ' 00:00:00', $param['end'] . ' 23:59:59']];
+        if (($param['create_start'] != '') && ($param['create_end'] != '')) $where[] = ['b.addtime', 'between', [$param['create_start'] . ' 00:00:00', $param['create_end'] . ' 23:59:59']];
         if ($param['name'] != '') $where[] = ['a.trade_out', 'like', '%' . $param['name'] . '%'];
         if ($param['bank'] != '') $where[] = ['a.trade_bank', 'like', '%' . $param['bank'] . '%'];
         if ($param['status'] != '') $where[] = ['a.status', '=', $param['status']];

+ 4 - 2
app/admin/controller/InvCat.php

@@ -187,6 +187,7 @@ class InvCat extends Base{
     {
 
         $list = $this->request->post('list/a', [], 'trim');
+        $isZx =$this->request->post('isZx/d', 0, 'trim');
 
         $val = Validate::rule([
             'spuCode|商品编号' => 'require|max:255',
@@ -203,7 +204,7 @@ class InvCat extends Base{
 
             $all_spuCode = Db::name('good')
                 ->whereIn('spuCode', array_column($list, 'spuCode'))
-                ->column('id', 'spuCode');
+                ->column('id,isZx', 'spuCode');
 
             $all_cat_code = Db::name('inv_cat')
                 ->whereIn('cat_code', array_column($list, 'cat_code'))
@@ -214,6 +215,7 @@ class InvCat extends Base{
                 if (!$val->check($value)) throw new Exception($val->getError());
 
                 if (!isset($all_spuCode[$value['spuCode']])) throw new Exception($value['spuCode'].'商品数据未找到');
+                if($isZx != $all_spuCode[$value['spuCode']]['isZx']) throw new Exception($value['spuCode'].'不是'. $isZx==1?"咨询商品":"非咨询商品");
                 if (!isset($all_cat_code[$value['cat_code']])) throw new Exception($value['cat_code'].'未找到对应的开票类目');
                 if (!in_array($value['tax'], $all_cat_code[$value['cat_code']]['tax'] != '' ? explode('、', $all_cat_code[$value['cat_code']]['tax']) : [])) throw new Exception($value['tax'].'未找到对应的开票类目税率');
                 $value['tax'] = str_replace('%', '', $value['tax']);
@@ -261,7 +263,7 @@ class InvCat extends Base{
                     'updatetime' => $date
                 ];
 
-                Db::name("good")->where('id', $all_spuCode[$value['spuCode']])->update($data);
+                Db::name("good")->where('id', $all_spuCode[$value['spuCode']]['id'])->update($data);
 
             }