|
@@ -3,7 +3,7 @@ declare (strict_types = 1);
|
|
|
|
|
|
namespace app\admin\controller;
|
|
|
|
|
|
-use think\App;use think\facade\Validate;
|
|
|
+use app\admin\model\GoodChange;use think\App;use think\facade\Validate;
|
|
|
class Good extends Base
|
|
|
{
|
|
|
protected $model=null;
|
|
@@ -92,6 +92,8 @@ class Good extends Base
|
|
|
$temp['tax_diff']= $tax==$good->cgd_inv_tax?1:2;
|
|
|
$temp['cat_diff']= $temp['inv_cat_code']==$good->cgd_inv_cat_code?1:2;
|
|
|
}
|
|
|
+ $check = $this->checkChange($good,$temp);
|
|
|
+ if(!empty($check))GoodChange::create($check);
|
|
|
$examinfo=$good->exam_info;
|
|
|
$examinfo[]=['apply_name'=>$this->uname,'exam_status'=>$item['status'],"updatetime"=>date("Y-m-d H:i:s")];
|
|
|
$temp['exam_info'] = json_encode($examinfo,JSON_UNESCAPED_UNICODE);
|
|
@@ -134,4 +136,85 @@ class Good extends Base
|
|
|
'类目是否一致','税率是否一致','创建时间'];
|
|
|
excelExport("商品税率异常记录", $header, $list);
|
|
|
}
|
|
|
+ /**
|
|
|
+ * @param $good
|
|
|
+ * @param $check
|
|
|
+ * @return array
|
|
|
+ */
|
|
|
+ private function checkChange($good,$check){
|
|
|
+ $temp=[];
|
|
|
+ if($check['status']==1){
|
|
|
+ $before=[];
|
|
|
+ $after=[];
|
|
|
+ if($good->cgd_inv_cat_code!=""&&$check['cgd_inv_cat_code']!=$good->cgd_inv_cat_code){
|
|
|
+ $before['inv_cat_code'] = $good->cgd_inv_cat_code;
|
|
|
+ $after['inv_cat_code'] = $check['cgd_inv_cat_code'];
|
|
|
+ }
|
|
|
+ if($good->cgd_inv_cat_name!=''&&$check['cgd_inv_cat_name']!=$good->cgd_inv_cat_name){
|
|
|
+ $before['inv_cat_name'] = $good->cgd_inv_cat_name;
|
|
|
+ $after['inv_cat_name'] = $check['cgd_inv_cat_name'];
|
|
|
+ }
|
|
|
+ if($good->cgd_inv_good_name!=''&&$check['cgd_inv_good_name']!=$good->cgd_inv_good_name){
|
|
|
+ $before['inv_good_name'] = $good->cgd_inv_good_name;
|
|
|
+ $after['inv_good_name'] = $check['cgd_inv_good_name'];
|
|
|
+ }
|
|
|
+ if($good->cgd_inv_tax!=''){
|
|
|
+ $cgd_inv_tax = bcdiv(str_replace('%', '', $good->cgd_inv_tax), '100', 2);
|
|
|
+ if($check['cgd_inv_tax']!=$cgd_inv_tax){
|
|
|
+ $before['inv_tax'] = $cgd_inv_tax;
|
|
|
+ $after['inv_tax'] = $check['cgd_inv_tax'];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!empty($before))$temp['before'] = json_encode($before,JSON_UNESCAPED_UNICODE);
|
|
|
+ if(!empty($after))$temp['after'] = json_encode($after,JSON_UNESCAPED_UNICODE);
|
|
|
+ }
|
|
|
+
|
|
|
+ if($check['status']==2){
|
|
|
+ $before=[];
|
|
|
+ $after=[];
|
|
|
+ if($good->inv_cat_code!=''&&$check['inv_cat_code']!=$good->inv_cat_code){
|
|
|
+ $before['inv_cat_code'] = $good->inv_cat_code;
|
|
|
+ $after['inv_cat_code'] = $check['inv_cat_code'];
|
|
|
+ }
|
|
|
+ if($good->inv_cat_name!=''&&$check['inv_cat_name']!=$good->inv_cat_name){
|
|
|
+ $before['inv_cat_name'] = $good->inv_cat_name;
|
|
|
+ $after['inv_cat_name'] = $check['inv_cat_name'];
|
|
|
+ }
|
|
|
+ if($good->inv_good_name!=''&&$check['inv_good_name']!=$good->inv_good_name){
|
|
|
+ $before['inv_good_name'] = $good->inv_good_name;
|
|
|
+ $after['inv_good_name'] = $check['inv_good_name'];
|
|
|
+ }
|
|
|
+ if($good->inv_tax!=''){
|
|
|
+ $inv_tax = bcdiv(str_replace('%', '', $good->inv_tax), '100', 2);
|
|
|
+ if($check['inv_tax']!=$inv_tax){
|
|
|
+ $before['inv_tax'] = $inv_tax;
|
|
|
+ $after['inv_tax'] = $check['inv_tax'];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if($good->status==2&&$check['inv_tag']!=$good->inv_tag){
|
|
|
+ $before['inv_tag'] = $good->inv_tag;
|
|
|
+ $after['inv_tag'] = $check['inv_tag'];
|
|
|
+ }
|
|
|
+ if($good->status==2&&$check['is_discount']!=$good->is_discount){
|
|
|
+ $before['is_discount'] = $good->is_discount;
|
|
|
+ $after['is_discount'] = $check['is_discount'];
|
|
|
+ }
|
|
|
+ if($good->status==2&&$check['addTax']!=$good->addTax){
|
|
|
+ $before['addTax'] = $good->addTax;
|
|
|
+ $after['addTax'] = $check['addTax'];
|
|
|
+ }
|
|
|
+ if(!empty($before))$temp['before'] = json_encode($before,JSON_UNESCAPED_UNICODE);
|
|
|
+ if(!empty($after))$temp['after'] = json_encode($after,JSON_UNESCAPED_UNICODE);
|
|
|
+ }
|
|
|
+ if(!empty($temp)){
|
|
|
+ $temp['spuCode'] = $good->spuCode;
|
|
|
+ $temp['good_name'] = $good->good_name;
|
|
|
+ $temp['apply_id'] = $this->uid;
|
|
|
+ $temp['apply_name'] = $this->uname;
|
|
|
+ $temp['exam_status'] =$check['status'];
|
|
|
+ }
|
|
|
+ return $temp;
|
|
|
+ }
|
|
|
}
|