add-licheb-log
This commit is contained in:
@@ -16,6 +16,7 @@ class Orders extends HD_Controller
|
||||
$this->load->model('receiver/order/receiver_order_agents_model', 'order_agents_model');
|
||||
$this->load->model('receiver/order/receiver_order_deliverys_model', 'order_deliverys_model');
|
||||
$this->load->model('receiver/order/receiver_order_contracts_model', 'order_contracts_model');
|
||||
$this->load->model('receiver/order/receiver_order_oplogs_model','order_oplogs_model');
|
||||
$this->load->model('receiver/receiver_customers_model', 'customers_model');
|
||||
$this->load->model('auto/auto_series_model');
|
||||
$this->load->model('auto/auto_brand_model');
|
||||
@@ -283,8 +284,14 @@ class Orders extends HD_Controller
|
||||
$admin_name = $row_admin ? "{$row_biz['biz_name']} {$row_admin['uname']}" : "";
|
||||
$row['admin_name'] = $admin_name;
|
||||
}
|
||||
//日志
|
||||
$where = [
|
||||
'order_id' => $row['id']
|
||||
];
|
||||
$logs = $this->order_oplogs_model->select($where,'id desc',1,30,'uname,log,c_time');
|
||||
$info = $row;
|
||||
$this->data['info'] = $info;
|
||||
$this->data['logs'] = $logs;
|
||||
|
||||
$this->data['_title'] = '订单详情';
|
||||
return $this->show_view('receiver/orderv2/get/index', true);
|
||||
|
||||
@@ -289,26 +289,27 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
function upImg(field,obj) {
|
||||
var value;
|
||||
if(field=='ins_img' || field=='other_img'){
|
||||
value = $(obj).val();
|
||||
}else{
|
||||
value = $(obj).val();
|
||||
}
|
||||
$.post("/receiver/orderv2/orders/edit_imgs", {
|
||||
'id': <?=$info['id']?>,
|
||||
'filed': field,
|
||||
'value': value,
|
||||
}, function (data) {
|
||||
if (data.code) {
|
||||
layer.msg(data.msg, {time: 2000, icon: 1}, function () {
|
||||
$.form.reload();
|
||||
});
|
||||
} else {
|
||||
layer.msg(data.msg, {icon: 2});
|
||||
}
|
||||
}, 'json');
|
||||
</div>
|
||||
<script>
|
||||
function upImg(field,obj) {
|
||||
var value;
|
||||
if(field=='ins_img' || field=='other_img'){
|
||||
value = $(obj).val();
|
||||
}else{
|
||||
value = $(obj).val();
|
||||
}
|
||||
</script>
|
||||
$.post("/receiver/orderv2/orders/edit_imgs", {
|
||||
'id': <?=$info['id']?>,
|
||||
'filed': field,
|
||||
'value': value,
|
||||
}, function (data) {
|
||||
if (data.code) {
|
||||
layer.msg(data.msg, {time: 2000, icon: 1}, function () {
|
||||
$.form.reload();
|
||||
});
|
||||
} else {
|
||||
layer.msg(data.msg, {icon: 2});
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -301,6 +301,8 @@
|
||||
<? require_once "loaninfo.php" ?>
|
||||
<!--资料审核-->
|
||||
<? require_once "ckinfo.php" ?>
|
||||
<!--日志-->
|
||||
<? $this->load->view("receiver/orderv2/get/log"); ?>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
<?if($logs){?>
|
||||
<div class="am-panel am-panel-default">
|
||||
<div class="am-panel-hd">
|
||||
<span style="font-size: 20px">操作日志</span>
|
||||
<span style="float:right;margin-top:5px">
|
||||
</span>
|
||||
</div>
|
||||
<div class="am-panel-bd">
|
||||
<div class="am-tabs" data-am-tabs>
|
||||
<div class="am-tab-panel am-active">
|
||||
<table class="am-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="15%"><span>操作人员</span></th>
|
||||
<th width=""><span>内容</span></th>
|
||||
<th width="15%"><span>操作时间</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($logs as $key => $val) { ?>
|
||||
<tr>
|
||||
<td style="vertical-align:middle;word-wrap:break-word"><?= $val['uname'] ?></td>
|
||||
<td style="vertical-align:middle;word-wrap:break-word">
|
||||
<?=$val['log']?>
|
||||
</td>
|
||||
<td style="vertical-align:middle;word-wrap:break-word;"><?= date('Y-m-d H:i',$val['c_time']); ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?}?>
|
||||
@@ -19,6 +19,8 @@ class Business extends Wxapp{
|
||||
$this->load->model('auto/auto_cars_model');
|
||||
$this->load->model('auto/auto_business_model');
|
||||
$this->load->model("biz/biz_model");
|
||||
$this->load->model('receiver/order/receiver_orders_v2_model');
|
||||
$this->load->model('app/liche/app_liche_orders_model');
|
||||
$this->load->library('receiver/orders_v2_entity');
|
||||
}
|
||||
|
||||
@@ -28,6 +30,7 @@ class Business extends Wxapp{
|
||||
$v_id = $this->input_param('v_id');
|
||||
$color_id = $this->input_param('color_id');
|
||||
$main_type = $this->input_param('main_type');
|
||||
$oid = $this->input_param('oid');
|
||||
$biz = $this->biz_model->get(['id'=>$biz_id],'city_id');
|
||||
$city_id = $biz['city_id'];
|
||||
$where = [
|
||||
@@ -40,7 +43,16 @@ class Business extends Wxapp{
|
||||
$rows = $this->auto_business_model->select($where,'id desc',1,1);
|
||||
$row = $rows[0];
|
||||
if(!$row){
|
||||
throw new Exception('当前地区不支持销售该车型', API_CODE_FAIL);
|
||||
$order = $this->receiver_orders_v2_model->get(['id'=>$oid]);
|
||||
$info_json = json_decode($order['info_json'],true);
|
||||
$business_id = $info_json['business_id'];
|
||||
//存在已支付订单
|
||||
$if_pay = $this->app_liche_orders_model->count(['o_id'=>$oid,'status'=>1]);
|
||||
if($if_pay && $order && $s_id==$order['s_id'] && $v_id==$order['v_id']){
|
||||
$row = $this->auto_business_model->get(['id'=>$business_id]);
|
||||
}else{
|
||||
throw new Exception('当前地区不支持销售该车型', API_CODE_FAIL);
|
||||
}
|
||||
}
|
||||
$car['price_car'] = $row['price_car'];
|
||||
$car['price_floor'] = $row['price_floor'];
|
||||
|
||||
@@ -354,7 +354,7 @@ class CusorderV2 extends Wxapp{
|
||||
if($deposit<2000){
|
||||
throw new Exception('定金不得少于2000', ERR_PARAMS_ERROR);
|
||||
}
|
||||
$can_dis_money = $car_row['price_car'] - $car_row['price_floor']; //可优惠金额
|
||||
$can_dis_money = $business_row['price_car'] - $business_row['price_floor']; //可优惠金额
|
||||
if($can_dis_money>0){
|
||||
if($disc_money && $car_row['price_floor'] > $car_row['price_car']-$disc_money){
|
||||
throw new Exception('车辆售价不得低于车辆底价,请重新填写优惠信息', API_CODE_FAIL);
|
||||
@@ -438,7 +438,7 @@ class CusorderV2 extends Wxapp{
|
||||
$data['info_json'] = json_encode($info_json,JSON_UNESCAPED_UNICODE);
|
||||
$result = $this->orders_model->update($data,['id'=>$row['id']]);
|
||||
if($result){
|
||||
$this->orders_v2_entity->edit_order($data,$row);
|
||||
$this->orders_v2_entity->edit_order($data,$row,$this->session);
|
||||
//补充协商
|
||||
$sa && $this->order_datas_entity->up_data($row['id'],['sa'=>$sa]);
|
||||
throw new Exception('修改成功', API_CODE_SUCCESS);
|
||||
@@ -698,8 +698,9 @@ class CusorderV2 extends Wxapp{
|
||||
'品牌车型' => ['type'=> 'text','value'=>$title,'bg_color'=>''],
|
||||
'付款方式' => ['type'=> 'text','value'=>$val['payway']?'全款':'分期','bg_color'=>''],
|
||||
];
|
||||
$book_is_pay = $this->app_liche_orders_model->get(['o_id'=>$val['id'],'type'=>1]); //定金
|
||||
$int_is_pay = $this->app_liche_orders_model->get(['o_id'=>$val['id'],'type'=>4]); //意向金
|
||||
$book_is_pay = $this->app_liche_orders_model->get(['o_id'=>$val['id'],'type'=>1,'status>='=>0]); //定金
|
||||
$srv_is_pay = $this->app_liche_orders_model->get(['o_id'=>$val['id'],'type'=>2,'status>='=>0]); //服务费
|
||||
$int_is_pay = $this->app_liche_orders_model->get(['o_id'=>$val['id'],'type'=>4,'status>='=>0]); //意向金
|
||||
$p_row = $this->app_liche_orders_model->get(['o_id'=>$val['id'],'pid'=>0],'id'); //父订单
|
||||
$last_row = $this->app_liche_orders_model->get(['o_id'=>$val['id'],'pid'=>$p_row['id'],'type'=>3],'id'); //尾款订单
|
||||
//除去尾款已支付金额
|
||||
@@ -721,7 +722,11 @@ class CusorderV2 extends Wxapp{
|
||||
$last_is_pay_text = $is_pay_price >= $need_pay ? '已支付':'未支付';
|
||||
$last_text = $need_last_pay."($last_is_pay_text)";
|
||||
$other_data['尾款金额'] = ['type'=> 'text','value'=>$last_text,'bg_color'=>''];
|
||||
|
||||
if($srv_is_pay){
|
||||
$last_is_pay_text = $srv_is_pay['status'] ? '已支付':'未支付';
|
||||
$srv_text = intval($srv_is_pay['total_price'])."($last_is_pay_text)";
|
||||
$other_data['服务费'] = ['type'=> 'text','value'=>$srv_text,'bg_color'=>''];
|
||||
}
|
||||
if($int_is_pay['status'] || $book_is_pay['status'] || $this->app_liche_orders_model->count(['o_id'=>$val['id'],'type'=>6,'status'=>1])){
|
||||
if(!$val['payway']){
|
||||
$other_data['分期办理'] = ['type'=> 'text','value'=>$this->orders_status_entity->status_cn($val['id'],1),'bg_color'=>''];
|
||||
@@ -898,6 +903,24 @@ class CusorderV2 extends Wxapp{
|
||||
if($this->receiver_order_contracts_model->count(['o_id'=>$row['id'],'type in (0,1)'=>null])){
|
||||
$this->receiver_order_contracts_model->delete(['o_id'=>$row['id'],'type in (0,1)'=>null]);
|
||||
}
|
||||
$is_pay = $this->app_liche_orders_model->count(['o_id'=>$row['id'],'type!='=>4,'status'=>1]);
|
||||
if($is_pay){ //存在已支付订单并且修改信息 写日志
|
||||
$content = [];
|
||||
if($owner_name!=$row['owner_name']){
|
||||
$content[] = "车姓名由 {$row['owner_name']} 变更为 {$owner_name}";
|
||||
}
|
||||
if($owner_mobile!=$row['owner_mobile']){
|
||||
$content[] = "车手机号由 {$row['owner_mobile']} 变更为 {$owner_mobile}";
|
||||
}
|
||||
if($owner_cardid!=$info_json['c_owner_cardid']){
|
||||
$content[] = "车主身份证由 {$info_json['c_owner_cardid']} 变更为 {$owner_cardid}";
|
||||
}
|
||||
if($content){
|
||||
$log_content = implode("<br>",$content);
|
||||
$this->orders_entity->add_log($row['id'],$this->session['uid'],$this->session['uname'],$log_content);
|
||||
$this->orders_v2_entity->send_msg($row['sid'],$content[0]);
|
||||
}
|
||||
}
|
||||
throw new Exception('修改成功', API_CODE_SUCCESS);
|
||||
}else{
|
||||
throw new Exception('修改失败', ERR_PARAMS_ERROR);
|
||||
|
||||
@@ -219,12 +219,11 @@ class Qyrobot{
|
||||
$old_today_count && $today_count += $old_today_count;
|
||||
$old_month_count && $month_count += $old_month_count;
|
||||
|
||||
|
||||
$url = 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key='.$this->key;
|
||||
$this->ci->load->library('mycurl');
|
||||
if(!$type){
|
||||
$content = "🎉🎉🎉 **喜讯** 🎉🎉🎉 \n
|
||||
恭喜 <font color=\"warning\">{$biz_info}</font> 成交 <font color=\"warning\">{$car_info}</font> 一台。\n
|
||||
恭喜 <font color=\"warning\">{$biz_info}</font> 成交 <font color=\"warning\">{$car_info}({$order_row['owner_name']})</font> 一台。\n
|
||||
>本日累计成交: <font color=\"warning\">{$today_count}</font> 单
|
||||
>本月累计成交: <font color=\"warning\">{$month_count}</font> 单\n
|
||||
### 狸车加油,冲冲冲!💪🏻💪🏻💪🏻";
|
||||
|
||||
@@ -440,7 +440,7 @@ class Orders_v2_entity{
|
||||
* @param array() $new_data 修改后的数据
|
||||
* @param array() $row 修改前数据
|
||||
*/
|
||||
public function edit_order($new_data,$row){
|
||||
public function edit_order($new_data,$row,$user_info=[]){
|
||||
//更新购车订单车辆信息
|
||||
$up_data = [
|
||||
'brand_id' => $new_data['brand_id'],
|
||||
@@ -453,7 +453,7 @@ class Orders_v2_entity{
|
||||
//删除未支付订单
|
||||
$this->ci->app_liche_orders_model->delete(['o_id'=>$row['id'],'status'=>0,'pid!='=>0]);
|
||||
$userinfo = $this->ci->app_liche_users_model->get(['mobile'=>$row['mobile']],'id');
|
||||
if(!$this->ci->app_liche_orders_model->count(['o_id'=>$row['id'],'type'=>1,'status'=>1])){ //不存在订单订单
|
||||
if(!$this->ci->app_liche_orders_model->count(['o_id'=>$row['id'],'type'=>1,'status'=>1])){ //不存在定金订单
|
||||
$this->add_book_order($row['id'],$userinfo['id']);
|
||||
}
|
||||
$this->add_order($row['id'],$userinfo['id']);
|
||||
@@ -468,6 +468,32 @@ class Orders_v2_entity{
|
||||
if($need_del_con){
|
||||
$this->ci->receiver_order_contracts_model->delete(['o_id'=>$row['id'],'type in (0,1)'=>null]);
|
||||
}
|
||||
$is_pay = $this->ci->app_liche_orders_model->count(['o_id'=>$row['id'],'type!='=>4,'status'=>1]);
|
||||
if($is_pay &&
|
||||
($new_data['brand_id']!=$row['brand_id'] || $new_data['s_id']!=$row['s_id'] || $new_data['v_id']!=$row['v_id']) ||
|
||||
$new_data['cor_id']!=$row['cor_id'] || $new_data['incor_id'] != $row['incor_id']
|
||||
){ //存在已支付订单并且修改车型 写日志
|
||||
$where = [
|
||||
"lc_auto_series.id in ({$new_data['s_id']},{$row['s_id']})" => null
|
||||
];
|
||||
$brand = $this->ci->auto_series_model->select_brand($where);
|
||||
foreach ($brand as $key=>$value) {
|
||||
$brand[$value['id']] = $value;
|
||||
}
|
||||
$ids = [$new_data['v_id'],$row['v_id'],$new_data['cor_id'],$row['cor_id'],$new_data['incor_id'],$new_data['incor_id']];
|
||||
$ids_str = implode(',',$ids);
|
||||
$where = [
|
||||
"id in ({$ids_str})" => null
|
||||
];
|
||||
$attr = $this->ci->auto_attr_model->map('id','title',$where);
|
||||
$old_title = "{$brand[$row['s_id']]['b_name']}-{$brand[$row['s_id']]['name']}-{$attr[$row['v_id']]}-{$attr[$row['cor_id']]}";
|
||||
$new_title = "{$brand[$new_data['s_id']]['b_name']}-{$brand[$new_data['s_id']]['name']}-{$attr[$new_data['v_id']]}-{$attr[$new_data['cor_id']]}";
|
||||
$content = "车型由 {$old_title} 变更为 {$new_title}";
|
||||
$this->ci->load->library('receiver/orders_entity');
|
||||
$this->ci->orders_entity->add_log($row['id'],$user_info['uid'],$user_info['uname'],$content);
|
||||
//短信通知
|
||||
$this->send_msg($row['sid'],$content);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -687,4 +713,23 @@ class Orders_v2_entity{
|
||||
}
|
||||
return $img;
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单改变发送消息
|
||||
* @param $sid
|
||||
* @param $info
|
||||
* @return void
|
||||
*/
|
||||
public function send_msg($sid,$info){
|
||||
if(!$sid || !$info){
|
||||
return '';
|
||||
}
|
||||
$mobile = '18950000118';
|
||||
!is_product() && $mobile = '18350451617'; //测试
|
||||
/**
|
||||
* 模板内容
|
||||
* 叮~ 小爱同学,订单 ${sid} 信息发生变化:${info}变
|
||||
*/
|
||||
send_alisms(array('mobile' => $mobile, 'template' => 'SMS_241077742', 'param' => ['sid' => $sid,'info'=>$info]));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user