diff --git a/frontend/controllers/CarController.php b/frontend/controllers/CarController.php index ade6612..0d63e23 100644 --- a/frontend/controllers/CarController.php +++ b/frontend/controllers/CarController.php @@ -1312,248 +1312,6 @@ class CarController extends BaseController ]); } - -// public function actionInfoRenewal() -// { -// $request = Yii::$app->request; -// $id = $request->get('id',0); -// $type = $request->get('type',0); -// $car_man = $request->get('car_man'); -// $phone = $request->get('phone'); -// $car_no = $request->get('car_no'); -// $page = $request->get('page',1); -// $sort_key = $request->get('sort_key','appointment_t.pdate'); -// $sort_value = $request->get('sort_value','ASC'); -// $next_index = $request->get('next_index',0); -// $back_params = $request->get('back_params'); -// $my_path = $this->my->group?$this->my->group->getPath():''; -// -// $car_info = CarT::findOne(['id'=>$id]); -// $order_info = $car_info->getOrders()->orderBy('id DESC')->one(); -// if(!$order_info) { -// $user_id = 0; -// if($car_info->location == 2) { -// $b_info = CarBT::findOne(['id'=>$car_info->id]); -// $user_id = $b_info->user_id; -// } -// if($car_info->location == 3) { -// $c_info = CarCT::findOne(['id'=>$car_info->id]); -// $user_id = $c_info->user_id; -// } -// if($car_info->location == 4) { -// $d_info = CarDT::findOne(['id'=>$car_info->id]); -// $user_id = $d_info->user_id; -// } -// $order_info = new OrderT(); -// $order_info->car_id = $car_info->id; -// $order_info->car_no = $car_info->car_no; -// $order_info->engine_no = $car_info->engine_no; -// $order_info->car_frame_no = $car_info->car_frame_no; -// $order_info->car_man = $car_info->car_man; -// $order_info->user_id = $user_id; -// $order_info->status_id = 1; -// $order_info->id_man = $car_info->car_man; -// $order_info->link_man = $car_info->car_man; -// $order_info->link_phone = $car_info->phone; -// $order_info->save(); -// } -// $insurer_type_items = InsurerTypeT::find()->all(); -// $insurer_company_items = InsurerCompanyT::find()->all(); -// $insurer_company2_items = InsurerCompany2T::find()->all(); -// $pay_type_items = PayTypeT::find()->all(); -// $car_use_items = CarUseT::find()->all(); -// $car_type_items = CarTypeT::find()->all(); -// $brand_items = BrandT::find()->all(); -// $series_items = SeriesT::find() -// ->where('brand_id='.intval($car_info->brand_id)) -// ->all(); -// $displacement_items = DisplacementT::find() -// ->where('series_id='.intval($car_info->series_id)) -// ->all(); -// $direction_items = DirectionT::find() -// ->all(); -// $range_items = RangeT::find() -// ->all(); -// $city_items = CityT::find() -// ->all(); -// $district_items = DistrictT::find() -// ->orderBy('order_id ASC') -// ->all(); -// $gift_items = GiftT::find() -// ->where('type_id=1') -// ->all(); -// $success_items = InvalidT::getTree(1); -// $failure_items = InvalidT::getTreeXubao(2); -// -// //下一辆 -// $next_id = 0; -// if($type == 1) { -// $query = AppointmentT::find() -// ->leftJoin('car_t','`car_t`.`id`=`appointment_t`.`car_id`') -// ->where('appointment_t.is_first=1 and car_t.location=4') -// ->andWhere('appointment_t.pdate<="'.date('Y-m-d').'"'); -// -// $user_ids = $this->getChildrenUserIDs(); -// $query = $query->andWhere(['in','appointment_t.user_id',$user_ids]); -// -// if($car_man != '') { -// $query = $query->andWhere('car_t.car_man like "'.$car_man.'"'); -// } -// if($phone != '') { -// $query = $query->andWhere('car_t.phone="'.$phone.'"'); -// } -// if($car_no != '') { -// $query = $query->andWhere('car_t.car_no like "'.$car_no.'"'); -// } -// if($sort_key != '') { -// $query = $query->orderBy($sort_key.' '.$sort_value); -// } -// $next_item = $query->offset($next_index)->one(); -// if($next_item) { -// $next_id = $next_item->car_id; -// } -// $next_index++; -// } -// if($type == 2) { -// $query = AppointmentT::find() -// ->leftJoin('car_t','`car_t`.`id`=`appointment_t`.`car_id`') -// ->where('appointment_t.is_first=0 and car_t.location=4') -// ->andWhere('appointment_t.pdate<="'.date('Y-m-d').'"'); -// -// $user_ids = $this->getChildrenUserIDs(); -// $query = $query->andWhere(['in','appointment_t.user_id',$user_ids]); -// -// if($car_man != '') { -// $query = $query->andWhere('car_t.car_man like "'.$car_man.'"'); -// } -// if($phone != '') { -// $query = $query->andWhere('car_t.phone="'.$phone.'"'); -// } -// if($car_no != '') { -// $query = $query->andWhere('car_t.car_no like "'.$car_no.'"'); -// } -// if($sort_key != '') { -// $query = $query->orderBy($sort_key.' '.$sort_value); -// } -// $next_item = $query->offset($next_index)->one(); -// if($next_item) { -// $next_id = $next_item->car_id; -// } -// $next_index++; -// } -// if($type == 3) { -// $query = AppointmentT::find() -// ->leftJoin('car_t','`car_t`.`id`=`appointment_t`.`car_id`') -// ->where('appointment_t.is_first=0 and car_t.location=4'); -// -// $user_ids = $this->getChildrenUserIDs(); -// $query = $query->andWhere(['in','appointment_t.user_id',$user_ids]); -// -// if($car_man != '') { -// $query = $query->andWhere('car_t.car_man like "'.$car_man.'"'); -// } -// if($phone != '') { -// $query = $query->andWhere('car_t.phone="'.$phone.'"'); -// } -// if($car_no != '') { -// $query = $query->andWhere('car_t.car_no like "'.$car_no.'"'); -// } -// if($sort_key != '') { -// $query = $query->orderBy($sort_key.' '.$sort_value); -// } -// $next_item = $query->offset($next_index)->one(); -// if($next_item) { -// $next_id = $next_item->car_id; -// } -// $next_index++; -// } -// if($type == 4) { -// $query = OrderT::find() -// ->where('status_id=1 and return_status_id>0') -// ->orderBy('submit_date DESC, id DESC'); -// $user_items = $this->my->getChildren(); -// $user_ids[] = $this->my->id; -// if($user_items) { -// foreach($user_items as $user_item) { -// $user_ids[] = $user_item->id; -// } -// } -// $query = $query->andWhere(['in','user_id',$user_ids]); -// if($car_man != '') { -// $query = $query->andWhere('car_man="'.$car_man.'"'); -// } -// if($phone != '') { -// $query = $query->andWhere('link_phone="'.$phone.'"'); -// } -// if($car_no != '') { -// $query = $query->andWhere('car_no="'.$car_no.'"'); -// } -// $next_item = $query->offset($next_index)->one(); -// if($next_item) { -// $next_id = $next_item->car_id; -// } -// $next_index++; -// } -// -//// $gift_type_items = GiftType2T::find()->all(); -// $gift_group_items = GiftGroupT::find() -// ->where('is_free=0') -// ->all(); -// $gift_free_group_items = GiftGroupT::find() -// ->where('is_free=1') -// ->all(); -// //获取礼品数据 -// $sel_gifts = array(); -// $tmp_items = OrderGiftT::find() -// ->where('order_id='.$order_info->id) -// ->all(); -// foreach($tmp_items as $item) { -// $sel_gifts[$item->group_id] = $item; -// } -// -// $list = MeetT::getAllData(1); -// -// $business_group = BusinessGroupT::find()->all(); -// -// return $this->render('info-renewal',[ -// 'type' => $type, -// 'car_info' => $car_info, -// 'insurer_type_items' => $insurer_type_items, -// 'order_info' => $order_info, -// 'insurer_company_items' => $insurer_company_items, -// 'insurer_company2_items' => $insurer_company2_items, -// 'pay_type_items' => $pay_type_items, -// 'car_use_items' => $car_use_items, -// 'car_type_items' => $car_type_items, -// 'brand_items' => $brand_items, -// 'series_items' => $series_items, -// 'displacement_items' => $displacement_items, -// 'direction_items' => $direction_items, -// 'range_items' => $range_items, -// 'city_items' => $city_items, -// 'district_items' => $district_items, -// 'gift_items' => $gift_items, -// 'success_items' => $success_items, -// 'failure_items' => $failure_items, -// 'next_id' => $next_id, -// 'list' => $list, -// 'next_index' => $next_index, -// 'car_man' => $car_man, -// 'car_no' => $car_no, -// 'phone' => $phone, -// 'page' => $page, -// 'sort_key' => $sort_key, -// 'sort_value' => $sort_value, -// 'back_params' => $back_params, -//// 'gift_type_items' => $gift_type_items, -// 'gift_group_items' => $gift_group_items, -// 'gift_free_group_items' => $gift_free_group_items, -// 'sel_gifts' => $sel_gifts, -// 'my_path' => $my_path, -// 'business_group' => $business_group, -// 'business_group_id' => $this->my->business_group_id, -// ]); -// } public function actionInfoRenewal() { $request = Yii::$app->request; @@ -2331,7 +2089,7 @@ class CarController extends BaseController //保单信息 $order_id = $request->post('id', 0); $email = $request->post('email'); - $company2_id = $request->post('company2_id'); + $company_id = $request->post('company_id'); $insurer1_begin_date = $request->post('insurer1_begin_date'); $insurer2_begin_date = $request->post('insurer2_begin_date'); $order_remark = $request->post('order_remark'); @@ -2417,7 +2175,7 @@ class CarController extends BaseController $order_info->link_man_type = $link_man_type; $order_info->link_man_number = $link_man_number; - $order_info->company2_id = $company2_id; + $order_info->company_id = $company_id; if($order_info->status_id != $status_id) { if($order_info->return_status_id > 0) { $order_info->status_id = $order_info->return_status_id; @@ -2537,6 +2295,7 @@ class CarController extends BaseController } //处理策略 + $gift_counts = []; OrderGiftT::deleteAll('order_id=' . $order_info->id . ' and status=0'); //礼品 foreach($gift_ids as $gift_str) { @@ -2558,6 +2317,15 @@ class CarController extends BaseController if (!$row->save()) { throw new \Exception(print_r($row->getErrors(), true)); } + if(!isset($gift_counts[$zhongjigift_item->id])) { + $gift_counts[$zhongjigift_item->id] = 1; + } else { + $gift_counts[$zhongjigift_item->id] += 1; + } + if($gift_counts[$zhongjigift_item->id] > $zhongjigift_item->n) { + $result['msg'] = '礼品数量超限,请重新选择'; + return $result; + } } } //礼券 @@ -2580,6 +2348,15 @@ class CarController extends BaseController if (!$row->save()) { throw new \Exception(print_r($row->getErrors(), true)); } + if(!isset($gift_counts[$zhongjigift_item->id])) { + $gift_counts[$zhongjigift_item->id] = 1; + } else { + $gift_counts[$zhongjigift_item->id] += 1; + } + if($gift_counts[$zhongjigift_item->id] > $zhongjigift_item->n) { + $result['msg'] = '礼券数量超限,请重新选择'; + return $result; + } } } diff --git a/frontend/controllers/InsurerController.php b/frontend/controllers/InsurerController.php index 16dcdc6..692a3ab 100644 --- a/frontend/controllers/InsurerController.php +++ b/frontend/controllers/InsurerController.php @@ -618,7 +618,7 @@ class InsurerController extends BaseController $data['rows'] = []; foreach($items as $item) { $row = $item->toArray(); - $row['company_name'] = $item->company2?$item->company2->name:''; + $row['company_name'] = $item->company?$item->company->name:''; $row['factory_model'] = $item->car?$item->car->factory_model:''; $row['user_name'] = $item->user?$item->user->getShowName():''; $row['status_name'] = $item->status->name; @@ -742,7 +742,7 @@ class InsurerController extends BaseController $total1_rate = $request->post('total1_rate','0.00'); $total2_rate = $request->post('total2_rate','0.00'); $pay_no = $request->post('pay_no',0); - $company_id = $request->post('company_id',0); + $company2_id = $request->post('company2_id',0); if($total1_rate == '') { $result['msg'] = '请输入商业跟单手续费!'; @@ -752,7 +752,7 @@ class InsurerController extends BaseController $result['msg'] = '请输入交强跟单手续费!'; return $result; } - if($company_id == 0) { + if($company2_id == 0) { $result['msg'] = '请选择保险公司!'; return $result; } @@ -772,7 +772,7 @@ class InsurerController extends BaseController $old_status_id = $order_info->status_id; $order_info->total1_rate = $total1_rate; $order_info->total2_rate = $total2_rate; - $order_info->company_id = $company_id; + $order_info->company2_id = $company2_id; $order_info->pay_no = $pay_no; $order_info->status_id = $status_id; @@ -1101,7 +1101,7 @@ class InsurerController extends BaseController $data['rows'] = []; foreach($items as $item) { $row = $item->toArray(); - $row['company_name'] = $item->company->name; + $row['company_name'] = $item->company2->name; $row['user_name'] = $item->user?$item->user->getShowName():''; $row['status_name'] = $item->status->name; $row['pay_type'] = ($item->shoufei_id?MyLib::zhifufs($item->shoufei_id).'-':'').' '.($item->payType?$item->payType->name:''); @@ -1340,6 +1340,7 @@ class InsurerController extends BaseController //更新保险日期 $car_info->insurer1_date = $order_info->insurer1_end_date; $car_info->insurer2_date = $order_info->insurer2_end_date; + $car_info->company = $order_info->company->name; //续保次数 $car_info->xubao_num=intval($car_info->xubao_num)+1; if(!$car_info->save()) { @@ -5022,7 +5023,7 @@ class InsurerController extends BaseController $result['msg'] = '正本还没有生成,不能确认礼品'; return $result; } - + $gift_counts = []; $tran = OrderT::getDb()->beginTransaction(); try { // OrderGiftT::deleteAll('order_id=' . $order_info->id . ' and gift_src is null'); @@ -5049,6 +5050,15 @@ class InsurerController extends BaseController throw new \Exception(print_r($row->getErrors(), true)); } $order_gift_id = $row->id; + if(!isset($gift_counts[$zhongjigift_item->id])) { + $gift_counts[$zhongjigift_item->id] = 1; + } else { + $gift_counts[$zhongjigift_item->id] += 1; + } + if($gift_counts[$zhongjigift_item->id] > $zhongjigift_item->n) { + $result['msg'] = '礼品数量超限,请重新选择'; + return $result; + } } //生成礼品图片 if($gift_item) { @@ -5077,6 +5087,15 @@ class InsurerController extends BaseController throw new \Exception(print_r($row->getErrors(), true)); } $order_gift_id = $row->id; + if(!isset($gift_counts[$zhongjigift_item->id])) { + $gift_counts[$zhongjigift_item->id] = 1; + } else { + $gift_counts[$zhongjigift_item->id] += 1; + } + if($gift_counts[$zhongjigift_item->id] > $zhongjigift_item->n) { + $result['msg'] = '礼券数量超限,请重新选择'; + return $result; + } } //生成礼券图片 if($gift_item) { diff --git a/frontend/controllers/PhoneCenterController.php b/frontend/controllers/PhoneCenterController.php index 4cd53b8..6392b5c 100644 --- a/frontend/controllers/PhoneCenterController.php +++ b/frontend/controllers/PhoneCenterController.php @@ -500,7 +500,6 @@ public function actionDownload(){ $result['msg'] = '删除成功'; } - $tran->commit(); } catch(\Exception $e) { $tran->rollBack(); diff --git a/frontend/controllers/SystemController.php b/frontend/controllers/SystemController.php index 4bda3eb..0219f3f 100644 --- a/frontend/controllers/SystemController.php +++ b/frontend/controllers/SystemController.php @@ -20,6 +20,8 @@ class SystemController extends \yii\web\Controller public $my = null; public $web = null; private $_STATE = 1; + public $enableCsrfValidation = false; + public $layout = 'blue-main'; public function init() { @@ -94,8 +96,11 @@ class SystemController extends \yii\web\Controller * @author liukangle * */ - public function actionIp(){ - + public function actionIp() { + return $this->render('ip'); + } + public function actionIpJson(){ + Yii::$app->response->format = Response::FORMAT_JSON; $request = Yii::$app->request; $name = $request->get('name'); $ips = SysIpT::find(); @@ -103,12 +108,16 @@ class SystemController extends \yii\web\Controller $ips = $ips->andWhere(['like','city_name',$name]); } $ips = $ips->andWhere('status ='.$this->_STATE); - $data = $ips->orderBy('id ASC')->all(); - - return $this->render('ip',[ - 'info' => $data, - 'name' => $name, - ]); + $items = $ips->orderBy('id ASC')->all(); + + $data = []; + $data['total'] = count($items); + $data['rows'] = []; + foreach($items as $item) { + $row = $item->toArray(); + $data['rows'][] = $row; + } + return $data; } /** @@ -181,7 +190,7 @@ class SystemController extends \yii\web\Controller * @author liukangle * */ - public function actionDel() + public function actionDelete() { Yii::$app->response->format = Response::FORMAT_JSON; $request = Yii::$app->request; diff --git a/frontend/views/car/info.php b/frontend/views/car/info.php index c054c81..bae840d 100644 --- a/frontend/views/car/info.php +++ b/frontend/views/car/info.php @@ -230,6 +230,17 @@ use \common\libs\MyLib; endBlock(); ?> diff --git a/frontend/views/phone-center/sub-index.php b/frontend/views/phone-center/sub-index.php index 4a3ed84..b6933f3 100644 --- a/frontend/views/phone-center/sub-index.php +++ b/frontend/views/phone-center/sub-index.php @@ -71,10 +71,16 @@ use \common\libs\MyLib; btn: ['删除','取消'], //按钮 shade: false //不显示遮罩 }, function(){ - $.post('/phone-center/sub-delete',{id:id},function(data) { - parent.layer.msg(data.msg); - refreshList(); - }, 'json'); + $.get('/phone/ax-unbind',{id:id},function(obj){ + if(obj.success){ + $.post('/phone-center/sub-delete',{id:id},function(data) { + parent.layer.msg(data.msg); + refreshList(); + }, 'json'); + } else { + parent.layer.msg(obj.msg); + } + },'json'); }, function(){ // }); diff --git a/frontend/views/system/edit.php b/frontend/views/system/edit.php index 52b0d90..8a2d425 100644 --- a/frontend/views/system/edit.php +++ b/frontend/views/system/edit.php @@ -1,48 +1,69 @@ - - - - - - - - - - - - - - - -
城市 - -
IP - -
- -    - -
- - - + +beginBlock('header_css'); ?> + +endBlock(); ?> + +
+
+
+
+
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+ +beginBlock('footer_js'); ?> +endBlock('footer_js'); ?> + diff --git a/frontend/views/system/ip.php b/frontend/views/system/ip.php index 99ca925..ead44ab 100644 --- a/frontend/views/system/ip.php +++ b/frontend/views/system/ip.php @@ -1,76 +1,98 @@ - - - - + + + - - - - - - -
- 名称: - - -
- - - - - - - - - $item){ - ?> - - - - - - - - - 没有查到数据 - -
序列号城市IP操作
city_name ?>ip ?> - [修改] - [删除] -
+ + $(function() { + search(); + }); + +endBlock(); ?> diff --git a/frontend/views/user/edit.php b/frontend/views/user/edit.php index d662f4a..3ee591a 100644 --- a/frontend/views/user/edit.php +++ b/frontend/views/user/edit.php @@ -171,7 +171,7 @@ use \common\libs\MyLib; '; - echo 'getPermissions()->where('id='.$permission->id)->count() > 0) echo ' checked '; echo '>'.$permission->name; @@ -185,7 +185,7 @@ use \common\libs\MyLib; echo ''; echo ''; echo '